diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/show_paths.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/show_paths.gif new file mode 100644 index 00000000000..6c23051e9f0 Binary files /dev/null and b/debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/show_paths.gif differ diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/show_paths.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/show_paths.gif new file mode 100644 index 00000000000..e928437f1f4 Binary files /dev/null and b/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/show_paths.gif differ diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/show_parents.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/show_parents.gif new file mode 100644 index 00000000000..7cd61d03595 Binary files /dev/null and b/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/show_parents.gif differ diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/showpaths_obj.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/showpaths_obj.gif new file mode 100644 index 00000000000..6c23051e9f0 Binary files /dev/null and b/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/showpaths_obj.gif differ diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties index 3adaae42478..e104e10e311 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.properties +++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties @@ -28,5 +28,7 @@ BreakpointPropertiesAction.label=P&roperties... ManageWatchpointAction.label=Add C/C++ &Watchpoint... AddExpressionAction.label=Add C/C++ &Expression... RunToLineAction.label=Run To C/C++ &Line +ShowFullPathsAction.label=Show Full Paths +ShowFullPathsAction.tooltip=Show Full Paths CDebugActionGroup.name=C/C++ Debug diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index 77671e26a45..44a37fe6c9e 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -208,6 +208,20 @@ + + + + + + + + + + + + + + @@ -308,6 +340,36 @@ tooltip="%RestartAction.tooltip"> + + + + + + + + @@ -369,6 +431,9 @@ + + diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java index 93e3e0d0e50..c6fa1d529c5 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java @@ -73,7 +73,7 @@ public class CDTDebugModelPresentation extends LabelProvider * when rendering elements. * @see #setAttribute(String, Object) */ - public final static String DISPLAY_QUALIFIED_NAMES = "DISPLAY_QUALIFIED_NAMES"; //$NON-NLS-1$ + public final static String DISPLAY_FULL_PATHS = "DISPLAY_FULL_PATHS"; //$NON-NLS-1$ protected HashMap fAttributes = new HashMap(3); @@ -303,7 +303,7 @@ public class CDTDebugModelPresentation extends LabelProvider protected boolean isShowQualifiedNames() { - Boolean showQualified = (Boolean)fAttributes.get( DISPLAY_QUALIFIED_NAMES ); + Boolean showQualified = (Boolean)fAttributes.get( DISPLAY_FULL_PATHS ); showQualified = showQualified == null ? Boolean.FALSE : showQualified; return showQualified.booleanValue(); } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ShowFullPathsAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ShowFullPathsAction.java new file mode 100644 index 00000000000..8cfcdb1c81a --- /dev/null +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ShowFullPathsAction.java @@ -0,0 +1,63 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.internal.ui.actions; + +import org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation; +import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants; +import org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import org.eclipse.debug.ui.IDebugModelPresentation; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.swt.custom.BusyIndicator; + +/** + * + * Enter type comment. + * + * @since Oct 4, 2002 + */ +public class ShowFullPathsAction extends ToggleDelegateAction +{ + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.internal.ui.actions.ToggleDelegateAction#initActionId() + */ + protected void initActionId() + { + fId = CDebugUIPlugin.getUniqueIdentifier() + getView().getSite().getId() + ".ShowFullPathsAction"; //$NON-NLS-1$ + } + + protected void setAction( IAction action ) + { + super.setAction( action ); + action.setChecked( CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) ); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.internal.ui.actions.ToggleDelegateAction#valueChanged(boolean) + */ + protected void valueChanged( boolean on ) + { + if ( getViewer().getControl().isDisposed() ) + { + return; + } + ILabelProvider labelProvider = (ILabelProvider)getViewer().getLabelProvider(); + if ( labelProvider instanceof IDebugModelPresentation ) + { + IDebugModelPresentation debugLabelProvider = (IDebugModelPresentation)labelProvider; + debugLabelProvider.setAttribute( CDTDebugModelPresentation.DISPLAY_FULL_PATHS, ( on ? Boolean.TRUE : Boolean.FALSE ) ); + BusyIndicator.showWhile( getViewer().getControl().getDisplay(), + new Runnable() + { + public void run() + { + getViewer().refresh(); + } + } ); + } + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleDelegateAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleDelegateAction.java new file mode 100644 index 00000000000..0ca41718f81 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleDelegateAction.java @@ -0,0 +1,186 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.internal.ui.actions; + +import org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import org.eclipse.debug.ui.IDebugView; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IViewActionDelegate; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPart; + +/** + * + * A generic Toggle view action delegate, meant to be subclassed to provide + * a specific filter. + * + * @since Oct 4, 2002 + */ +public abstract class ToggleDelegateAction implements IViewActionDelegate, + IPropertyChangeListener, + IPartListener +{ + /** + * The viewer that this action works for + */ + private StructuredViewer fViewer; + + private IViewPart fView; + + protected String fId = ""; //$NON-NLS-1$ + + private IAction fAction; + private boolean fNeedsInitialization = true; + + protected void dispose() + { + if ( fView != null ) + { + fView.getViewSite().getPage().removePartListener( this ); + } + CDebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener( this ); + } + + /** + * @see IViewActionDelegate#init(IViewPart) + */ + public void init( IViewPart view ) + { + setView( view ); + initActionId(); + IDebugView adapter = (IDebugView)view.getAdapter( IDebugView.class ); + if ( adapter != null && adapter.getViewer() instanceof StructuredViewer ) + { + setViewer( (StructuredViewer)adapter.getViewer() ); + } + view.getViewSite().getPage().addPartListener( this ); + CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this ); + } + + protected abstract void initActionId(); + + /** + * @see IActionDelegate#run(IAction) + */ + public void run( IAction action ) + { + //do nothing.."run" will occur from the property change + //this allows for setting the checked state of the IAction + //to drive the execution of this delegate. + //see propertyChange(PropertyChangeEvent) + } + + protected abstract void valueChanged( boolean on ); + + protected String getActionId() + { + return fId; + } + + protected StructuredViewer getViewer() + { + return fViewer; + } + + protected void setViewer( StructuredViewer viewer ) + { + fViewer = viewer; + } + + /** + * @see IActionDelegate#selectionChanged(IAction, ISelection) + */ + public void selectionChanged( IAction action, ISelection selection ) + { + if ( fNeedsInitialization ) + { + setAction( action ); + action.setId( getActionId() ); + fNeedsInitialization = false; + } + } + + protected IAction getAction() + { + return fAction; + } + + protected void setAction( IAction action ) + { + fAction = action; + action.addPropertyChangeListener( this ); + } + + /** + * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent) + */ + public void propertyChange( PropertyChangeEvent event ) + { + if ( event.getProperty().equals( getActionId() ) ) + { + getAction().setChecked( CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( getActionId() ) ); + } + else if ( event.getProperty().equals( IAction.CHECKED ) ) + { + CDebugUIPlugin.getDefault().getPreferenceStore().setValue( getActionId(), getAction().isChecked() ); + valueChanged( getAction().isChecked() ); + } + } + + /** + * @see IPartListener#partActivated(IWorkbenchPart) + */ + public void partActivated( IWorkbenchPart part ) + { + } + + /** + * @see IPartListener#partBroughtToTop(IWorkbenchPart) + */ + public void partBroughtToTop( IWorkbenchPart part ) + { + } + + /** + * @see IPartListener#partClosed(IWorkbenchPart) + */ + public void partClosed( IWorkbenchPart part ) + { + if ( part.equals( getView() ) ) + { + dispose(); + } + } + + /** + * @see IPartListener#partDeactivated(IWorkbenchPart) + */ + public void partDeactivated( IWorkbenchPart part ) + { + } + + /** + * @see IPartListener#partOpened(IWorkbenchPart) + */ + public void partOpened( IWorkbenchPart part ) + { + } + + protected IViewPart getView() + { + return fView; + } + + protected void setView( IViewPart view ) + { + fView = view; + } +}