mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Variable bookkeeping (phase 0.1).
This commit is contained in:
parent
b121523ac4
commit
109d948e1f
12 changed files with 257 additions and 5 deletions
|
@ -1,3 +1,18 @@
|
|||
2003-06-20 Mikhail Khodjaiants
|
||||
Variable bookkeeping (phase 0.1).
|
||||
The 'Enable' and 'Disable' actions added to the Variables view.
|
||||
* plugin.properties
|
||||
* plugin.xml
|
||||
* icons/full/obj16/vard_aggr.gif: new
|
||||
* icons/full/obj16/vard_pointer.gif: new
|
||||
* icons/full/obj16/vard_simple.gif: new
|
||||
* icons/full/clc16/disabled_co.gif: new
|
||||
* icons/full/clc16/enabled_co.gif: new
|
||||
* CDebugImages.java
|
||||
* CDTDebugModelPresentation.java
|
||||
* DisableVariablesActionDelegate.java: new
|
||||
* EnableVariablesActionDelegate.java: new
|
||||
|
||||
2003-06-13 Mikhail Khodjaiants
|
||||
Fix for PR 38788: Ctrl-X, Ctrl-C, Ctrl-V, Ctrl-A, Ctrl-Z and Ctrl-Y keys don't work
|
||||
in the address field of the Memory view.
|
||||
|
|
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/disabled_co.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/disabled_co.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 885 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/enabled_co.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/enabled_co.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 897 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/obj16/vard_aggr.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/obj16/vard_aggr.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 146 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/obj16/vard_pointer.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/obj16/vard_pointer.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 130 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/obj16/vard_simple.gif
Normal file
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/obj16/vard_simple.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 131 B |
|
@ -73,3 +73,9 @@ RestoreDefaultTypeAction.label=Restore Default Type
|
|||
RestoreDefaultTypeAction.tooltip=Restore Default Type Of Variable
|
||||
CastToArrayAction.label=Display As Array...
|
||||
CastToArrayAction.tooltip=Display Variable As Array
|
||||
|
||||
EnableVariablesAction.label=Enable
|
||||
EnableVariablesAction.tooltip=Enable Selected Variables
|
||||
|
||||
DisableVariablesAction.label=Disable
|
||||
DisableVariablesAction.tooltip=Disable Selected Variables
|
||||
|
|
|
@ -891,6 +891,36 @@
|
|||
</enablement>
|
||||
</action>
|
||||
</objectContribution>
|
||||
<viewerContribution
|
||||
targetID="org.eclipse.debug.ui.VariableView"
|
||||
id="org.eclipse.debug.ui.variablesView.popupMenu">
|
||||
<action
|
||||
label="%DisableVariablesAction.label"
|
||||
icon="icons/full/clcl16/disabled_co.gif"
|
||||
helpContextId="disable_variables_action_context"
|
||||
tooltip="%DisableVariablesAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate"
|
||||
menubarPath="variableGroup"
|
||||
enablesFor="2+"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate">
|
||||
<selection
|
||||
class="org.eclipse.cdt.debug.core.model.ICVariable">
|
||||
</selection>
|
||||
</action>
|
||||
<action
|
||||
label="%EnableVariablesAction.label"
|
||||
icon="icons/full/clcl16/enabled_co.gif"
|
||||
helpContextId="enable_variables_action_context"
|
||||
tooltip="%EnableVariablesAction.tooltip"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate"
|
||||
menubarPath="variableGroup"
|
||||
enablesFor="2+"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate">
|
||||
<selection
|
||||
class="org.eclipse.cdt.debug.core.model.ICVariable">
|
||||
</selection>
|
||||
</action>
|
||||
</viewerContribution>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.viewActions">
|
||||
|
|
|
@ -564,6 +564,8 @@ public class CDTDebugModelPresentation extends LabelProvider
|
|||
label.append( ' ' );
|
||||
}
|
||||
}
|
||||
if ( !((ICVariable)var).isEnabled() )
|
||||
label.append( "<disabled> " );
|
||||
label.append( var.getName() );
|
||||
IValue value = var.getValue();
|
||||
if ( value instanceof ICValue && value.getValueString() != null )
|
||||
|
@ -870,12 +872,16 @@ public class CDTDebugModelPresentation extends LabelProvider
|
|||
{
|
||||
if ( element instanceof ICVariable )
|
||||
{
|
||||
if ( !((ICVariable)element).isEditable() )
|
||||
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_VARIABLE_AGGREGATE );
|
||||
else if ( ((ICVariable)element).hasChildren() )
|
||||
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_VARIABLE_POINTER );
|
||||
ICType type = ((ICVariable)element).getType();
|
||||
if ( type != null && ( type.isArray() || type.isStructure() ) )
|
||||
return fDebugImageRegistry.get( ( ((ICVariable)element).isEnabled() ) ?
|
||||
CDebugImages.DESC_OBJS_VARIABLE_AGGREGATE : CDebugImages.DESC_OBJS_VARIABLE_AGGREGATE_DISABLED );
|
||||
else if ( type != null && type.isPointer() )
|
||||
return fDebugImageRegistry.get( ( ((ICVariable)element).isEnabled() ) ?
|
||||
CDebugImages.DESC_OBJS_VARIABLE_POINTER : CDebugImages.DESC_OBJS_VARIABLE_POINTER_DISABLED );
|
||||
else
|
||||
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_VARIABLE_SIMPLE );
|
||||
return fDebugImageRegistry.get( ( ((ICVariable)element).isEnabled() ) ?
|
||||
CDebugImages.DESC_OBJS_VARIABLE_SIMPLE : CDebugImages.DESC_OBJS_VARIABLE_SIMPLE_DISABLED );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -70,8 +70,11 @@ public class CDebugImages
|
|||
public static final String IMG_OBJS_WRITE_WATCHPOINT_ENABLED = NAME_PREFIX + "write_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_WRITE_WATCHPOINT_DISABLED = NAME_PREFIX + "write_obj_disabled.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_VARIABLE_SIMPLE = NAME_PREFIX + "var_simple.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_VARIABLE_SIMPLE_DISABLED = NAME_PREFIX + "vard_simple.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_VARIABLE_AGGREGATE = NAME_PREFIX + "var_aggr.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_VARIABLE_AGGREGATE_DISABLED = NAME_PREFIX + "vard_aggr.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_VARIABLE_POINTER = NAME_PREFIX + "var_pointer.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_VARIABLE_POINTER_DISABLED = NAME_PREFIX + "vard_pointer.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_VARIABLE_STRING = NAME_PREFIX + "var_string.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_REGISTER_GROUP = NAME_PREFIX + "registergroup_obj.gif"; //$NON-NLS-1$
|
||||
public static final String IMG_OBJS_REGISTER = NAME_PREFIX + "register_obj.gif"; //$NON-NLS-1$
|
||||
|
@ -127,8 +130,11 @@ public class CDebugImages
|
|||
public static final ImageDescriptor DESC_OBJS_WRITE_WATCHPOINT_ENABLED = createManaged( T_OBJ, IMG_OBJS_WRITE_WATCHPOINT_ENABLED );
|
||||
public static final ImageDescriptor DESC_OBJS_WRITE_WATCHPOINT_DISABLED = createManaged( T_OBJ, IMG_OBJS_WRITE_WATCHPOINT_DISABLED );
|
||||
public static final ImageDescriptor DESC_OBJS_VARIABLE_SIMPLE = createManaged( T_OBJ, IMG_OBJS_VARIABLE_SIMPLE );
|
||||
public static final ImageDescriptor DESC_OBJS_VARIABLE_SIMPLE_DISABLED = createManaged( T_OBJ, IMG_OBJS_VARIABLE_SIMPLE_DISABLED );
|
||||
public static final ImageDescriptor DESC_OBJS_VARIABLE_AGGREGATE = createManaged( T_OBJ, IMG_OBJS_VARIABLE_AGGREGATE );
|
||||
public static final ImageDescriptor DESC_OBJS_VARIABLE_AGGREGATE_DISABLED = createManaged( T_OBJ, IMG_OBJS_VARIABLE_AGGREGATE_DISABLED );
|
||||
public static final ImageDescriptor DESC_OBJS_VARIABLE_POINTER = createManaged( T_OBJ, IMG_OBJS_VARIABLE_POINTER );
|
||||
public static final ImageDescriptor DESC_OBJS_VARIABLE_POINTER_DISABLED = createManaged( T_OBJ, IMG_OBJS_VARIABLE_POINTER_DISABLED );
|
||||
public static final ImageDescriptor DESC_OBJS_VARIABLE_STRING = createManaged( T_OBJ, IMG_OBJS_VARIABLE_STRING );
|
||||
public static final ImageDescriptor DESC_OBJS_REGISTER_GROUP = createManaged( T_OBJ, IMG_OBJS_REGISTER_GROUP );
|
||||
public static final ImageDescriptor DESC_OBJS_REGISTER = createManaged( T_OBJ, IMG_OBJS_REGISTER );
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Jun 19, 2003
|
||||
*/
|
||||
public class DisableVariablesActionDelegate extends EnableVariablesActionDelegate
|
||||
{
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate#isEnableAction()
|
||||
*/
|
||||
protected boolean isEnableAction()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,166 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICVariable;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.core.runtime.MultiStatus;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IViewActionDelegate;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since Jun 19, 2003
|
||||
*/
|
||||
public class EnableVariablesActionDelegate implements IViewActionDelegate
|
||||
{
|
||||
private IViewPart fView;
|
||||
|
||||
private IAction fAction;
|
||||
|
||||
public EnableVariablesActionDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
protected IViewPart getView()
|
||||
{
|
||||
return fView;
|
||||
}
|
||||
|
||||
protected void setView( IViewPart view )
|
||||
{
|
||||
fView = view;
|
||||
}
|
||||
|
||||
protected IAction getAction()
|
||||
{
|
||||
return fAction;
|
||||
}
|
||||
|
||||
protected void setAction( IAction action )
|
||||
{
|
||||
fAction = action;
|
||||
}
|
||||
|
||||
/**
|
||||
* This action enables variables.
|
||||
*/
|
||||
protected boolean isEnableAction()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
|
||||
*/
|
||||
public void init( IViewPart view )
|
||||
{
|
||||
setView(view);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
||||
*/
|
||||
public void run( IAction action )
|
||||
{
|
||||
IStructuredSelection selection = getSelection();
|
||||
final int size = selection.size();
|
||||
if ( size == 0 )
|
||||
return;
|
||||
|
||||
final Iterator enum = selection.iterator();
|
||||
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, "Enable variable(s) failed.", null );
|
||||
Runnable runnable = new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
while( enum.hasNext() )
|
||||
{
|
||||
ICVariable var = (ICVariable)enum.next();
|
||||
try
|
||||
{
|
||||
if ( size > 1 )
|
||||
{
|
||||
if ( isEnableAction() )
|
||||
var.setEnabled( true );
|
||||
else
|
||||
var.setEnabled( false );
|
||||
}
|
||||
else
|
||||
var.setEnabled( !var.isEnabled() );
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
ms.merge( e.getStatus() );
|
||||
}
|
||||
}
|
||||
update();
|
||||
}
|
||||
};
|
||||
|
||||
final Display display = CDebugUIPlugin.getStandardDisplay();
|
||||
if ( display.isDisposed() )
|
||||
return;
|
||||
display.asyncExec( runnable );
|
||||
|
||||
if ( !ms.isOK() )
|
||||
{
|
||||
CDebugUIPlugin.errorDialog( "Exceptions occurred enabling the variable(s).", ms );
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
public void selectionChanged( IAction action, ISelection selection )
|
||||
{
|
||||
setAction( action );
|
||||
if ( !( selection instanceof IStructuredSelection ) )
|
||||
return;
|
||||
IStructuredSelection sel = (IStructuredSelection)selection;
|
||||
Object o = sel.getFirstElement();
|
||||
if ( !( o instanceof ICVariable ) )
|
||||
return;
|
||||
|
||||
Iterator enum = sel.iterator();
|
||||
boolean allEnabled = true;
|
||||
boolean allDisabled = true;
|
||||
while( enum.hasNext() )
|
||||
{
|
||||
ICVariable var = (ICVariable)enum.next();
|
||||
if ( !var.canEnableDisable() )
|
||||
continue;
|
||||
if ( var.isEnabled() )
|
||||
allDisabled = false;
|
||||
else
|
||||
allEnabled = false;
|
||||
}
|
||||
|
||||
if ( isEnableAction() )
|
||||
action.setEnabled( !allEnabled );
|
||||
else
|
||||
action.setEnabled( !allDisabled );
|
||||
}
|
||||
|
||||
private IStructuredSelection getSelection()
|
||||
{
|
||||
return (IStructuredSelection)getView().getViewSite().getSelectionProvider().getSelection();
|
||||
}
|
||||
|
||||
protected void update()
|
||||
{
|
||||
getView().getViewSite().getSelectionProvider().setSelection( getView().getViewSite().getSelectionProvider().getSelection() );
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue