mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 10:46:02 +02:00
Added the bookkeeping of registers and register groups.
This commit is contained in:
parent
1b2f0d5e9e
commit
69a0850c87
11 changed files with 198 additions and 59 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2004-10-08 Mikhail Khodjaiants
|
||||||
|
Added the bookkeeping of registers and register groups.
|
||||||
|
* ICVariable.java
|
||||||
|
* IEnableDisableTarget.java: new
|
||||||
|
* AbstractCVariable.java
|
||||||
|
* CRegister.java
|
||||||
|
* CRegisterGroup.java
|
||||||
|
|
||||||
2004-10-07 Mikhail Khodjaiants
|
2004-10-07 Mikhail Khodjaiants
|
||||||
Pass the current stack frame to the registers manager to provide the evaluation context.
|
Pass the current stack frame to the registers manager to provide the evaluation context.
|
||||||
* ICRegisterManager.java
|
* ICRegisterManager.java
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.debug.core.model.IVariable;
|
||||||
/**
|
/**
|
||||||
* C/C++ specific extension <code>IVariable</code>.
|
* C/C++ specific extension <code>IVariable</code>.
|
||||||
*/
|
*/
|
||||||
public interface ICVariable extends IVariable, ICDebugElement, IFormatSupport, ICastToArray, IValueModification {
|
public interface ICVariable extends IVariable, ICDebugElement, IFormatSupport, ICastToArray, IValueModification, IEnableDisableTarget {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type of this variable.
|
* Returns the type of this variable.
|
||||||
|
@ -27,28 +27,6 @@ public interface ICVariable extends IVariable, ICDebugElement, IFormatSupport, I
|
||||||
*/
|
*/
|
||||||
ICType getType() throws DebugException;
|
ICType getType() throws DebugException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether this variable is enabled.
|
|
||||||
*
|
|
||||||
* @return whether this variable is enabled
|
|
||||||
*/
|
|
||||||
boolean isEnabled();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the enabled state of this action.
|
|
||||||
*
|
|
||||||
* @param enabled <code>true</code> to enable, and <code>false</code> to disable
|
|
||||||
* @throws DebugException
|
|
||||||
*/
|
|
||||||
void setEnabled( boolean enabled ) throws DebugException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether this variable supports enable/disable operation.
|
|
||||||
*
|
|
||||||
* @return whether this variable supports enable/disable operation
|
|
||||||
*/
|
|
||||||
boolean canEnableDisable();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this variable is an argument.
|
* Returns whether this variable is an argument.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2004 QNX Software Systems and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
***********************************************************************/
|
||||||
|
package org.eclipse.cdt.debug.core.model;
|
||||||
|
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides support for enable/disable actions.
|
||||||
|
*/
|
||||||
|
public interface IEnableDisableTarget {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this object supports enable/disable operations.
|
||||||
|
*
|
||||||
|
* @return whether this object supports enable/disable operations
|
||||||
|
*/
|
||||||
|
boolean canEnableDisable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this object is enabled.
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if this obvject is enabled,
|
||||||
|
* or <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
boolean isEnabled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables/disables this object
|
||||||
|
*
|
||||||
|
* @param enabled enablement flag value
|
||||||
|
* @throws DebugException
|
||||||
|
*/
|
||||||
|
void setEnabled( boolean enabled ) throws DebugException;
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.debug.internal.core.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.model.ICStackFrame;
|
import org.eclipse.cdt.debug.core.model.ICStackFrame;
|
||||||
import org.eclipse.cdt.debug.core.model.ICVariable;
|
import org.eclipse.cdt.debug.core.model.ICVariable;
|
||||||
|
import org.eclipse.cdt.debug.core.model.IEnableDisableTarget;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,6 +53,15 @@ public abstract class AbstractCVariable extends CDebugElement implements ICVaria
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
|
||||||
|
*/
|
||||||
|
public Object getAdapter( Class adapter ) {
|
||||||
|
if ( IEnableDisableTarget.class.equals( adapter ) )
|
||||||
|
return this;
|
||||||
|
return super.getAdapter( adapter );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the text presentation of this variable as an expression.
|
* Returns the text presentation of this variable as an expression.
|
||||||
*
|
*
|
||||||
|
|
|
@ -46,11 +46,4 @@ public class CRegister extends CGlobalVariable implements IRegister {
|
||||||
public IRegisterGroup getRegisterGroup() throws DebugException {
|
public IRegisterGroup getRegisterGroup() throws DebugException {
|
||||||
return (IRegisterGroup)getParent();
|
return (IRegisterGroup)getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.debug.core.model.ICVariable#isEnabled()
|
|
||||||
*/
|
|
||||||
public boolean isEnabled() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -13,6 +13,8 @@ package org.eclipse.cdt.debug.internal.core.model;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject;
|
||||||
|
import org.eclipse.cdt.debug.core.model.IEnableDisableTarget;
|
||||||
|
import org.eclipse.debug.core.DebugEvent;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IRegister;
|
import org.eclipse.debug.core.model.IRegister;
|
||||||
import org.eclipse.debug.core.model.IRegisterGroup;
|
import org.eclipse.debug.core.model.IRegisterGroup;
|
||||||
|
@ -20,7 +22,7 @@ import org.eclipse.debug.core.model.IRegisterGroup;
|
||||||
/**
|
/**
|
||||||
* Represents a group of registers.
|
* Represents a group of registers.
|
||||||
*/
|
*/
|
||||||
public class CRegisterGroup extends CDebugElement implements IRegisterGroup {
|
public class CRegisterGroup extends CDebugElement implements IRegisterGroup, IEnableDisableTarget {
|
||||||
|
|
||||||
private String fName;
|
private String fName;
|
||||||
|
|
||||||
|
@ -28,6 +30,8 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup {
|
||||||
|
|
||||||
private IRegister[] fRegisters;
|
private IRegister[] fRegisters;
|
||||||
|
|
||||||
|
private boolean fIsEnabled = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for CRegisterGroup.
|
* Constructor for CRegisterGroup.
|
||||||
*/
|
*/
|
||||||
|
@ -57,6 +61,7 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup {
|
||||||
catch( DebugException e ) {
|
catch( DebugException e ) {
|
||||||
fRegisters[i] = new CRegister( this, fRegisterObjects[i], e.getMessage() );
|
fRegisters[i] = new CRegister( this, fRegisterObjects[i], e.getMessage() );
|
||||||
}
|
}
|
||||||
|
((CRegister)fRegisters[i]).setEnabled( isEnabled() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fRegisters;
|
return fRegisters;
|
||||||
|
@ -97,4 +102,46 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
|
||||||
|
*/
|
||||||
|
public Object getAdapter( Class adapter ) {
|
||||||
|
if ( IEnableDisableTarget.class.equals( adapter ) )
|
||||||
|
return this;
|
||||||
|
return super.getAdapter( adapter );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.model.IEnableDisableTarget#canEnableDisable()
|
||||||
|
*/
|
||||||
|
public boolean canEnableDisable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.model.IEnableDisableTarget#isEnabled()
|
||||||
|
*/
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return fIsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.model.IEnableDisableTarget#setEnabled(boolean)
|
||||||
|
*/
|
||||||
|
public void setEnabled( boolean enabled ) throws DebugException {
|
||||||
|
if ( fRegisters != null ) {
|
||||||
|
synchronized( fRegisters ) {
|
||||||
|
if ( fRegisters != null ) {
|
||||||
|
for ( int i = 0; i < fRegisters.length; ++i ) {
|
||||||
|
if ( fRegisters[i] instanceof CRegister ) {
|
||||||
|
((CRegister)fRegisters[i]).setEnabled( enabled );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fIsEnabled = enabled;
|
||||||
|
fireChangeEvent( DebugEvent.CONTENT );
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,3 +1,10 @@
|
||||||
|
2004-10-08 Mikhail Khodjaiants
|
||||||
|
Added the bookkeeping of registers and register groups.
|
||||||
|
* CDebugImages.java
|
||||||
|
* CDTDebugModelPresentation.java
|
||||||
|
* EnableVariablesActionDelegate.java
|
||||||
|
* plugin.xml
|
||||||
|
|
||||||
2004-10-07 Mikhail Khodjaiants
|
2004-10-07 Mikhail Khodjaiants
|
||||||
Added images of disabled registers and register groups.
|
Added images of disabled registers and register groups.
|
||||||
* icons/full/obj16/registerd_obj.gif: new
|
* icons/full/obj16/registerd_obj.gif: new
|
||||||
|
|
|
@ -751,6 +751,32 @@
|
||||||
id="org.eclipse.cdt.debug.ui"/>
|
id="org.eclipse.cdt.debug.ui"/>
|
||||||
</enablement>
|
</enablement>
|
||||||
</action>
|
</action>
|
||||||
|
<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>
|
</viewerContribution>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.eclipse.cdt.debug.core.model.ICValue;
|
||||||
import org.eclipse.cdt.debug.core.model.ICVariable;
|
import org.eclipse.cdt.debug.core.model.ICVariable;
|
||||||
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
|
||||||
import org.eclipse.cdt.debug.core.model.IDummyStackFrame;
|
import org.eclipse.cdt.debug.core.model.IDummyStackFrame;
|
||||||
|
import org.eclipse.cdt.debug.core.model.IEnableDisableTarget;
|
||||||
import org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor;
|
import org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor;
|
||||||
import org.eclipse.cdt.debug.internal.ui.editors.EditorInputDelegate;
|
import org.eclipse.cdt.debug.internal.ui.editors.EditorInputDelegate;
|
||||||
import org.eclipse.cdt.debug.internal.ui.editors.FileNotFoundElement;
|
import org.eclipse.cdt.debug.internal.ui.editors.FileNotFoundElement;
|
||||||
|
@ -50,6 +51,7 @@ import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IStorage;
|
import org.eclipse.core.resources.IStorage;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
@ -285,6 +287,15 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
|
||||||
if ( element instanceof ICDebugElementStatus && !((ICDebugElementStatus)element).isOK() ) {
|
if ( element instanceof ICDebugElementStatus && !((ICDebugElementStatus)element).isOK() ) {
|
||||||
baseText.append( getFormattedString( " <{0}>", ((ICDebugElementStatus)element).getMessage() ) ); //$NON-NLS-1$
|
baseText.append( getFormattedString( " <{0}>", ((ICDebugElementStatus)element).getMessage() ) ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
if ( element instanceof IAdaptable ) {
|
||||||
|
IEnableDisableTarget target = (IEnableDisableTarget)((IAdaptable)element).getAdapter( IEnableDisableTarget.class );
|
||||||
|
if ( target != null ) {
|
||||||
|
if ( !target.isEnabled() ) {
|
||||||
|
baseText.append( ' ' );
|
||||||
|
baseText.append( CDebugUIMessages.getString( "CDTDebugModelPresentation.25" ) ); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return baseText.toString();
|
return baseText.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,12 +501,14 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
|
||||||
result.insert( 0, typeName + ' ' );
|
result.insert( 0, typeName + ' ' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( expression.isEnabled() ) {
|
||||||
String valueString = DebugUIPlugin.getModelPresentation().getText( value );
|
String valueString = DebugUIPlugin.getModelPresentation().getText( value );
|
||||||
if ( valueString.length() > 0 ) {
|
if ( valueString.length() > 0 ) {
|
||||||
result.append( " = " ).append( valueString ); //$NON-NLS-1$
|
result.append( " = " ).append( valueString ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ( !expression.isEnabled() ) {
|
if ( !expression.isEnabled() ) {
|
||||||
result.append( ' ' );
|
result.append( ' ' );
|
||||||
result.append( CDebugUIMessages.getString( "CDTDebugModelPresentation.22" ) ); //$NON-NLS-1$
|
result.append( CDebugUIMessages.getString( "CDTDebugModelPresentation.22" ) ); //$NON-NLS-1$
|
||||||
|
@ -523,15 +536,13 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
|
||||||
if ( name != null )
|
if ( name != null )
|
||||||
label.append( name.trim() );
|
label.append( name.trim() );
|
||||||
IValue value = var.getValue();
|
IValue value = var.getValue();
|
||||||
|
if ( value != null ) {
|
||||||
String valueString = DebugUIPlugin.getModelPresentation().getText( value );
|
String valueString = DebugUIPlugin.getModelPresentation().getText( value );
|
||||||
if ( !isEmpty( valueString ) ) {
|
if ( !isEmpty( valueString ) ) {
|
||||||
label.append( " = " ); //$NON-NLS-1$
|
label.append( " = " ); //$NON-NLS-1$
|
||||||
label.append( valueString );
|
label.append( valueString );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !((ICVariable)var).isEnabled() ) {
|
|
||||||
label.append( ' ' );
|
|
||||||
label.append( CDebugUIMessages.getString( "CDTDebugModelPresentation.25" ) ); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
return label.toString();
|
return label.toString();
|
||||||
}
|
}
|
||||||
|
@ -804,11 +815,14 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Image getRegisterGroupImage( IRegisterGroup element ) {
|
protected Image getRegisterGroupImage( IRegisterGroup element ) {
|
||||||
|
IEnableDisableTarget target = (IEnableDisableTarget)element.getAdapter( IEnableDisableTarget.class );
|
||||||
|
if ( target != null && !target.isEnabled() )
|
||||||
|
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER_GROUP_DISABLED );
|
||||||
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER_GROUP );
|
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER_GROUP );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Image getRegisterImage( IRegister element ) {
|
protected Image getRegisterImage( IRegister element ) {
|
||||||
return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER );
|
return ( ( element instanceof ICVariable && ((ICVariable)element).isEnabled() ) ) ? fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER ) : fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER_DISABLED );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Image getExpressionImage( IExpression element ) {
|
protected Image getExpressionImage( IExpression element ) {
|
||||||
|
@ -825,6 +839,8 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
|
||||||
private String getVariableTypeName( ICType type ) {
|
private String getVariableTypeName( ICType type ) {
|
||||||
StringBuffer result = new StringBuffer();
|
StringBuffer result = new StringBuffer();
|
||||||
String typeName = type.getName();
|
String typeName = type.getName();
|
||||||
|
if ( typeName != null )
|
||||||
|
typeName = typeName.trim();
|
||||||
if ( type.isArray() && typeName != null ) {
|
if ( type.isArray() && typeName != null ) {
|
||||||
int index = typeName.indexOf( '[' );
|
int index = typeName.indexOf( '[' );
|
||||||
if ( index != -1 )
|
if ( index != -1 )
|
||||||
|
|
|
@ -88,7 +88,9 @@ public class CDebugImages
|
||||||
public static final String IMG_OBJS_VARIABLE_POINTER_DISABLED = NAME_PREFIX + "vard_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_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_GROUP = NAME_PREFIX + "registergroup_obj.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_OBJS_REGISTER_GROUP_DISABLED = NAME_PREFIX + "registergroupd_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_REGISTER = NAME_PREFIX + "register_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_REGISTER = NAME_PREFIX + "register_obj.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_OBJS_REGISTER_DISABLED = NAME_PREFIX + "registerd_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_DISASSEMBLY = NAME_PREFIX + "disassembly_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_DISASSEMBLY = NAME_PREFIX + "disassembly_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_PROJECT = NAME_PREFIX + "project_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_PROJECT = NAME_PREFIX + "project_obj.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_OBJS_CLOSED_PROJECT = NAME_PREFIX + "cproject_obj.gif"; //$NON-NLS-1$
|
public static final String IMG_OBJS_CLOSED_PROJECT = NAME_PREFIX + "cproject_obj.gif"; //$NON-NLS-1$
|
||||||
|
@ -160,7 +162,9 @@ public class CDebugImages
|
||||||
public static final ImageDescriptor DESC_OBJS_VARIABLE_POINTER_DISABLED = createManaged( T_OBJ, IMG_OBJS_VARIABLE_POINTER_DISABLED );
|
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_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_GROUP = createManaged( T_OBJ, IMG_OBJS_REGISTER_GROUP );
|
||||||
|
public static final ImageDescriptor DESC_OBJS_REGISTER_GROUP_DISABLED = createManaged( T_OBJ, IMG_OBJS_REGISTER_GROUP_DISABLED );
|
||||||
public static final ImageDescriptor DESC_OBJS_REGISTER = createManaged( T_OBJ, IMG_OBJS_REGISTER );
|
public static final ImageDescriptor DESC_OBJS_REGISTER = createManaged( T_OBJ, IMG_OBJS_REGISTER );
|
||||||
|
public static final ImageDescriptor DESC_OBJS_REGISTER_DISABLED = createManaged( T_OBJ, IMG_OBJS_REGISTER_DISABLED );
|
||||||
public static final ImageDescriptor DESC_OBJS_DISASSEMBLY = createManaged( T_OBJ, IMG_OBJS_DISASSEMBLY );
|
public static final ImageDescriptor DESC_OBJS_DISASSEMBLY = createManaged( T_OBJ, IMG_OBJS_DISASSEMBLY );
|
||||||
public static final ImageDescriptor DESC_OBJS_PROJECT = createManaged( T_OBJ, IMG_OBJS_PROJECT );
|
public static final ImageDescriptor DESC_OBJS_PROJECT = createManaged( T_OBJ, IMG_OBJS_PROJECT );
|
||||||
public static final ImageDescriptor DESC_OBJS_CLOSED_PROJECT = createManaged( T_OBJ, IMG_OBJS_CLOSED_PROJECT );
|
public static final ImageDescriptor DESC_OBJS_CLOSED_PROJECT = createManaged( T_OBJ, IMG_OBJS_CLOSED_PROJECT );
|
||||||
|
|
|
@ -11,8 +11,9 @@
|
||||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import org.eclipse.cdt.debug.core.model.ICVariable;
|
import org.eclipse.cdt.debug.core.model.IEnableDisableTarget;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.MultiStatus;
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
|
@ -83,21 +84,20 @@ public class EnableVariablesActionDelegate implements IViewActionDelegate {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
while( enum.hasNext() ) {
|
while( enum.hasNext() ) {
|
||||||
ICVariable var = (ICVariable)enum.next();
|
IEnableDisableTarget target = getEnableDisableTarget( enum.next() );
|
||||||
|
if ( target != null ) {
|
||||||
try {
|
try {
|
||||||
if ( size > 1 ) {
|
if ( size > 1 ) {
|
||||||
if ( isEnableAction() )
|
target.setEnabled( isEnableAction() );
|
||||||
var.setEnabled( true );
|
|
||||||
else
|
|
||||||
var.setEnabled( false );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
var.setEnabled( !var.isEnabled() );
|
target.setEnabled( !target.isEnabled() );
|
||||||
}
|
}
|
||||||
catch( DebugException e ) {
|
catch( DebugException e ) {
|
||||||
ms.merge( e.getStatus() );
|
ms.merge( e.getStatus() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -117,16 +117,16 @@ public class EnableVariablesActionDelegate implements IViewActionDelegate {
|
||||||
return;
|
return;
|
||||||
IStructuredSelection sel = (IStructuredSelection)selection;
|
IStructuredSelection sel = (IStructuredSelection)selection;
|
||||||
Object o = sel.getFirstElement();
|
Object o = sel.getFirstElement();
|
||||||
if ( !(o instanceof ICVariable) )
|
if ( getEnableDisableTarget( o ) == null )
|
||||||
return;
|
return;
|
||||||
Iterator enum = sel.iterator();
|
Iterator enum = sel.iterator();
|
||||||
boolean allEnabled = true;
|
boolean allEnabled = true;
|
||||||
boolean allDisabled = true;
|
boolean allDisabled = true;
|
||||||
while( enum.hasNext() ) {
|
while( enum.hasNext() ) {
|
||||||
ICVariable var = (ICVariable)enum.next();
|
IEnableDisableTarget target = getEnableDisableTarget( enum.next() );
|
||||||
if ( !var.canEnableDisable() )
|
if ( target != null && !target.canEnableDisable() )
|
||||||
continue;
|
continue;
|
||||||
if ( var.isEnabled() )
|
if ( target.isEnabled() )
|
||||||
allDisabled = false;
|
allDisabled = false;
|
||||||
else
|
else
|
||||||
allEnabled = false;
|
allEnabled = false;
|
||||||
|
@ -144,4 +144,12 @@ public class EnableVariablesActionDelegate implements IViewActionDelegate {
|
||||||
protected void update() {
|
protected void update() {
|
||||||
getView().getViewSite().getSelectionProvider().setSelection( getView().getViewSite().getSelectionProvider().getSelection() );
|
getView().getViewSite().getSelectionProvider().setSelection( getView().getViewSite().getSelectionProvider().getSelection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IEnableDisableTarget getEnableDisableTarget( Object obj ) {
|
||||||
|
IEnableDisableTarget target = null;
|
||||||
|
if ( obj instanceof IAdaptable ) {
|
||||||
|
target = (IEnableDisableTarget)((IAdaptable)obj).getAdapter( IEnableDisableTarget.class );
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue