1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Implementation of 'Show Full Paths' action.

This commit is contained in:
Mikhail Khodjaiants 2002-10-04 20:23:28 +00:00
parent 707380391e
commit 114372c4fc
9 changed files with 318 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

View file

@ -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

View file

@ -208,6 +208,20 @@
</pluginState>
</enablement>
</action>
<action
label="%ShowFullPathsAction.label"
icon="icons/full/clcl16/show_paths.gif"
helpContextId="show_full_paths_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
menubarPath="renderGroup"
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
<enablement>
<pluginState
value="activated"
id="org.eclipse.cdt.debug.ui">
</pluginState>
</enablement>
</action>
</viewerContribution>
<viewerContribution
targetID="#CEditorRulerContext"
@ -289,6 +303,24 @@
id="org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesAction">
</action>
</objectContribution>
<viewerContribution
targetID="org.eclipse.debug.ui.BreakpointView"
id="org.eclipse.cdt.debug.ui.breakpointview.popupMenu">
<action
label="%ShowFullPathsAction.label"
icon="icons/full/clcl16/show_paths.gif"
helpContextId="show_full_paths_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
menubarPath="renderGroup"
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
<enablement>
<pluginState
value="activated"
id="org.eclipse.cdt.debug.ui">
</pluginState>
</enablement>
</action>
</viewerContribution>
</extension>
<extension
point="org.eclipse.ui.viewActions">
@ -308,6 +340,36 @@
tooltip="%RestartAction.tooltip">
</action>
</viewContribution>
<viewContribution
targetID="org.eclipse.debug.ui.DebugView"
id="org.eclipse.cdt.debug.ui.debugview.toolbar">
<action
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
toolbarPath="renderGroup"
hoverIcon="icons/full/clcl16/show_paths.gif"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
disabledIcon="icons/full/dlcl16/show_paths.gif"
icon="icons/full/elcl16/show_parents.gif"
helpContextId="show_full_paths_action_context"
label="%ShowFullPathsAction.label"
tooltip="%ShowFullPathsAction.tooltip">
</action>
</viewContribution>
<viewContribution
targetID="org.eclipse.debug.ui.BreakpointView"
id="org.eclipse.cdt.debug.ui.breakpointview.toolbar">
<action
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
toolbarPath="renderGroup"
hoverIcon="icons/full/clcl16/show_paths.gif"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
disabledIcon="icons/full/dlcl16/show_paths.gif"
icon="icons/full/elcl16/show_parents.gif"
helpContextId="show_full_paths_action_context"
label="%ShowFullPathsAction.label"
tooltip="%ShowFullPathsAction.tooltip">
</action>
</viewContribution>
</extension>
<extension
point="org.eclipse.ui.editorActions">
@ -369,6 +431,9 @@
<action
id="org.eclipse.cdt.debug.internal.ui.actions.RestartActionDelegate">
</action>
<action
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
</action>
</debugActionGroup>
</extension>

View file

@ -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();
}

View file

@ -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();
}
} );
}
}
}

View file

@ -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;
}
}