mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bugzillas
305260 305262
This commit is contained in:
parent
a2fd559aec
commit
7bd8acff99
5 changed files with 265 additions and 113 deletions
|
@ -64,7 +64,7 @@ public class ExpressionManagerVMNode extends AbstractVMNode
|
||||||
* VMC for a new expression object to be added. When user clicks on this node to
|
* VMC for a new expression object to be added. When user clicks on this node to
|
||||||
* edit it, he will create a new expression.
|
* edit it, he will create a new expression.
|
||||||
*/
|
*/
|
||||||
class NewExpressionVMC extends AbstractVMContext {
|
public class NewExpressionVMC extends AbstractVMContext {
|
||||||
public NewExpressionVMC() {
|
public NewExpressionVMC() {
|
||||||
super(ExpressionManagerVMNode.this);
|
super(ExpressionManagerVMNode.this);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,17 @@ public class ExpressionManagerVMNode extends AbstractVMNode
|
||||||
private IExpressionManager fManager = DebugPlugin.getDefault().getExpressionManager();
|
private IExpressionManager fManager = DebugPlugin.getDefault().getExpressionManager();
|
||||||
|
|
||||||
/** Cached reference to a cell modifier for editing expression strings of invalid expressions */
|
/** Cached reference to a cell modifier for editing expression strings of invalid expressions */
|
||||||
private WatchExpressionCellModifier fWatchExpressionCellModifier = new WatchExpressionCellModifier();
|
private ICellModifier fWatchExpressionCellModifier = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 2.1
|
||||||
|
*
|
||||||
|
* @return The cell modifier to be used when editing. If you need to provide
|
||||||
|
* a custom cell editor you would override this method.
|
||||||
|
*/
|
||||||
|
protected ICellModifier createCellModifier() {
|
||||||
|
return new WatchExpressionCellModifier();
|
||||||
|
}
|
||||||
|
|
||||||
public ExpressionManagerVMNode(ExpressionVMProvider provider) {
|
public ExpressionManagerVMNode(ExpressionVMProvider provider) {
|
||||||
super(provider);
|
super(provider);
|
||||||
|
@ -296,7 +306,10 @@ public class ExpressionManagerVMNode extends AbstractVMNode
|
||||||
return new TreePath(elementList.toArray());
|
return new TreePath(elementList.toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor#getCellEditor(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String, java.lang.Object, org.eclipse.swt.widgets.Composite)
|
||||||
|
*/
|
||||||
public CellEditor getCellEditor(IPresentationContext context, String columnId, Object element, Composite parent) {
|
public CellEditor getCellEditor(IPresentationContext context, String columnId, Object element, Composite parent) {
|
||||||
if (IDebugVMConstants.COLUMN_ID__EXPRESSION.equals(columnId)) {
|
if (IDebugVMConstants.COLUMN_ID__EXPRESSION.equals(columnId)) {
|
||||||
return new TextCellEditor(parent);
|
return new TextCellEditor(parent);
|
||||||
|
@ -304,7 +317,14 @@ public class ExpressionManagerVMNode extends AbstractVMNode
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor#getCellModifier(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object)
|
||||||
|
*/
|
||||||
public ICellModifier getCellModifier(IPresentationContext context, Object element) {
|
public ICellModifier getCellModifier(IPresentationContext context, Object element) {
|
||||||
|
if ( fWatchExpressionCellModifier == null ) {
|
||||||
|
fWatchExpressionCellModifier = createCellModifier();
|
||||||
|
}
|
||||||
return fWatchExpressionCellModifier;
|
return fWatchExpressionCellModifier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,7 +320,10 @@ public class SingleExpressionVMNode extends AbstractDMVMNode implements IElement
|
||||||
return new RootDMVMContext(getVMProvider().getRootVMNode(), dmc);
|
return new RootDMVMContext(getVMProvider().getRootVMNode(), dmc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setExpression(IExpressionDMContext dmc) {
|
/**
|
||||||
|
* @since 2.1
|
||||||
|
*/
|
||||||
|
public void setExpression(IExpressionDMContext dmc) {
|
||||||
String text = dmc.getExpression();
|
String text = dmc.getExpression();
|
||||||
fManager.setExpression(new SimpleExpression(text));
|
fManager.setExpression(new SimpleExpression(text));
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ import org.eclipse.debug.ui.DebugUITools;
|
||||||
import org.eclipse.debug.ui.IDebugModelPresentation;
|
import org.eclipse.debug.ui.IDebugModelPresentation;
|
||||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||||
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
|
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
|
||||||
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
import org.eclipse.jface.viewers.CellEditor;
|
import org.eclipse.jface.viewers.CellEditor;
|
||||||
import org.eclipse.jface.viewers.ICellModifier;
|
import org.eclipse.jface.viewers.ICellModifier;
|
||||||
|
@ -207,8 +208,58 @@ public class RegisterVMNode extends AbstractExpressionVMNode
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
private LabelBackground columnIdValueBackground;
|
||||||
|
private IPropertyChangeListener fPreferenceChangeListener;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
|
||||||
|
if ( fPreferenceChangeListener != null ) {
|
||||||
|
DebugUITools.getPreferenceStore().removePropertyChangeListener(fPreferenceChangeListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
protected IElementLabelProvider createLabelProvider() {
|
protected IElementLabelProvider createLabelProvider() {
|
||||||
|
/*
|
||||||
|
* Create background which is responsive to the preference color changes.
|
||||||
|
*/
|
||||||
|
columnIdValueBackground = new LabelBackground(
|
||||||
|
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB())
|
||||||
|
{
|
||||||
|
{
|
||||||
|
setPropertyNames(new String[] {
|
||||||
|
IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE,
|
||||||
|
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE,
|
||||||
|
IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT,
|
||||||
|
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
|
||||||
|
Boolean activeFormatChanged = (Boolean)properties.get(
|
||||||
|
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT);
|
||||||
|
Boolean activeChanged = (Boolean)properties.get(
|
||||||
|
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE);
|
||||||
|
return Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if ( fPreferenceChangeListener != null ) {
|
||||||
|
DebugUITools.getPreferenceStore().removePropertyChangeListener(fPreferenceChangeListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
fPreferenceChangeListener = new IPropertyChangeListener() {
|
||||||
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
|
if ( event.getProperty().equals(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND) ) {
|
||||||
|
columnIdValueBackground.setBackground(DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
DebugUITools.getPreferenceStore().addPropertyChangeListener(fPreferenceChangeListener);
|
||||||
|
|
||||||
PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
|
PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
|
||||||
|
|
||||||
// The name column consists of the register name.
|
// The name column consists of the register name.
|
||||||
|
@ -283,26 +334,7 @@ public class RegisterVMNode extends AbstractExpressionVMNode
|
||||||
return !status.isOK();
|
return !status.isOK();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new LabelBackground(
|
columnIdValueBackground,
|
||||||
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB())
|
|
||||||
{
|
|
||||||
{
|
|
||||||
setPropertyNames(new String[] {
|
|
||||||
IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE,
|
|
||||||
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE,
|
|
||||||
IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT,
|
|
||||||
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
|
|
||||||
Boolean activeFormatChanged = (Boolean)properties.get(
|
|
||||||
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT);
|
|
||||||
Boolean activeChanged = (Boolean)properties.get(
|
|
||||||
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE);
|
|
||||||
return Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new StaleDataLabelForeground(),
|
new StaleDataLabelForeground(),
|
||||||
new VariableLabelFont(),
|
new VariableLabelFont(),
|
||||||
}));
|
}));
|
||||||
|
@ -404,7 +436,6 @@ public class RegisterVMNode extends AbstractExpressionVMNode
|
||||||
return provider;
|
return provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "RegisterVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
return "RegisterVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
|
@ -88,6 +88,7 @@ import org.eclipse.debug.ui.DebugUITools;
|
||||||
import org.eclipse.debug.ui.IDebugModelPresentation;
|
import org.eclipse.debug.ui.IDebugModelPresentation;
|
||||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||||
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
|
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
|
||||||
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
import org.eclipse.jface.viewers.CellEditor;
|
import org.eclipse.jface.viewers.CellEditor;
|
||||||
import org.eclipse.jface.viewers.ICellModifier;
|
import org.eclipse.jface.viewers.ICellModifier;
|
||||||
|
@ -102,29 +103,29 @@ public class VariableVMNode extends AbstractExpressionVMNode
|
||||||
implements IElementEditor, IElementLabelProvider, IElementPropertiesProvider, IElementMementoProvider
|
implements IElementEditor, IElementLabelProvider, IElementPropertiesProvider, IElementMementoProvider
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
private static final String PROP_VARIABLE_TYPE_NAME = "variable_type_name"; //$NON-NLS-1$
|
public static final String PROP_VARIABLE_TYPE_NAME = "variable_type_name"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
private static final String PROP_VARIABLE_BASIC_TYPE = "variable_basic_type"; //$NON-NLS-1$
|
public static final String PROP_VARIABLE_BASIC_TYPE = "variable_basic_type"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
private static final String PROP_VARIABLE_ADDRESS = "variable_address"; //$NON-NLS-1$
|
public static final String PROP_VARIABLE_ADDRESS = "variable_address"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
private static final String PROP_VARIABLE_SHOW_TYPE_NAMES = "variable_show_type_names"; //$NON-NLS-1$
|
public static final String PROP_VARIABLE_SHOW_TYPE_NAMES = "variable_show_type_names"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
private static final String PROP_VARIABLE_ADDRESS_CHANGED = ICachingVMProvider.PROP_IS_CHANGED_PREFIX + PROP_VARIABLE_ADDRESS;
|
public static final String PROP_VARIABLE_ADDRESS_CHANGED = ICachingVMProvider.PROP_IS_CHANGED_PREFIX + PROP_VARIABLE_ADDRESS;
|
||||||
|
|
||||||
private final SyncVariableDataAccess fSyncVariableDataAccess;
|
private final SyncVariableDataAccess fSyncVariableDataAccess;
|
||||||
|
|
||||||
|
@ -213,48 +214,142 @@ public class VariableVMNode extends AbstractExpressionVMNode
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
private LabelBackground columnIdValueBackground;
|
||||||
|
private LabelBackground columnNoColumnsBackground;
|
||||||
|
private IPropertyChangeListener fPreferenceChangeListener;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.dsf.ui.viewmodel.datamodel.AbstractDMVMNode#dispose()
|
||||||
|
*
|
||||||
|
* We need to take over the dispose so we can get rid of the preference listener we created.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
|
||||||
|
if ( fPreferenceChangeListener != null ) {
|
||||||
|
DebugUITools.getPreferenceStore().removePropertyChangeListener(fPreferenceChangeListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create label image objects which are used in more than one column.
|
||||||
|
*
|
||||||
|
* @since 2.1
|
||||||
|
*
|
||||||
|
* Pointer image is used for variable and function pointers.
|
||||||
|
*/
|
||||||
|
public final static LabelImage POINTER_LABEL_IMAGE = new LabelImage(CDebugImages.DESC_OBJS_VARIABLE_POINTER) {
|
||||||
|
{ setPropertyNames(new String[] { PROP_VARIABLE_BASIC_TYPE }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
|
||||||
|
String type = (String)properties.get(PROP_VARIABLE_BASIC_TYPE);
|
||||||
|
return IExpressionDMData.BasicType.pointer.name().equals(type) ||
|
||||||
|
IExpressionDMData.BasicType.function.name().equals(type);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 2.1
|
||||||
|
*
|
||||||
|
* Aggregate image is used for array, struct, etc.
|
||||||
|
*/
|
||||||
|
public final static LabelImage AGGREGATE_LABEL_IMAGE = new LabelImage(CDebugImages.DESC_OBJS_VARIABLE_AGGREGATE) {
|
||||||
|
{ setPropertyNames(new String[] { PROP_VARIABLE_BASIC_TYPE }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
|
||||||
|
String type = (String)properties.get(PROP_VARIABLE_BASIC_TYPE);
|
||||||
|
return IExpressionDMData.BasicType.array.name().equals(type) ||
|
||||||
|
IExpressionDMData.BasicType.composite.name().equals(type);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 2.1
|
||||||
|
*
|
||||||
|
* Simple variable image is used for all other types, except when there is no type specified.
|
||||||
|
*/
|
||||||
|
public final static LabelImage SIMPLE_LABEL_IMAGE = new LabelImage(CDebugImages.DESC_OBJS_VARIABLE_SIMPLE) {
|
||||||
|
{ setPropertyNames(new String[] { PROP_VARIABLE_BASIC_TYPE }); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
|
||||||
|
String type = (String)properties.get(PROP_VARIABLE_BASIC_TYPE);
|
||||||
|
return type != null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
protected IElementLabelProvider createLabelProvider() {
|
protected IElementLabelProvider createLabelProvider() {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create the foreground/background colors which can be dynamically modified.
|
||||||
|
//
|
||||||
|
columnIdValueBackground = new LabelBackground(
|
||||||
|
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB())
|
||||||
|
{
|
||||||
|
{
|
||||||
|
setPropertyNames(new String[] {
|
||||||
|
FormattedValueVMUtil.getPropertyForFormatId(IFormattedValues.STRING_FORMAT),
|
||||||
|
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + FormattedValueVMUtil.getPropertyForFormatId(IFormattedValues.STRING_FORMAT),
|
||||||
|
IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE,
|
||||||
|
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE,
|
||||||
|
IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT,
|
||||||
|
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
|
||||||
|
Boolean activeFormatChanged = (Boolean)properties.get(
|
||||||
|
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT);
|
||||||
|
Boolean activeChanged = (Boolean)properties.get(
|
||||||
|
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE);
|
||||||
|
Boolean stringChanged = (Boolean)properties.get(
|
||||||
|
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + FormattedValueVMUtil.getPropertyForFormatId(IFormattedValues.STRING_FORMAT));
|
||||||
|
return Boolean.TRUE.equals(stringChanged) ||
|
||||||
|
( Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
columnNoColumnsBackground = new LabelBackground(DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB())
|
||||||
|
{
|
||||||
|
{
|
||||||
|
setPropertyNames(new String[] {
|
||||||
|
FormattedValueVMUtil.getPropertyForFormatId(IFormattedValues.STRING_FORMAT),
|
||||||
|
IDebugVMConstants.PROP_IS_STRING_FORMAT_VALUE_CHANGED,
|
||||||
|
IDebugVMConstants.PROP_IS_ACTIVE_FORMATTED_VALUE_CHANGED});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
|
||||||
|
Boolean stringChanged = (Boolean)properties.get(IDebugVMConstants.PROP_IS_STRING_FORMAT_VALUE_CHANGED);
|
||||||
|
Boolean activeChanged = (Boolean)properties.get(IDebugVMConstants.PROP_IS_ACTIVE_FORMATTED_VALUE_CHANGED);
|
||||||
|
return Boolean.TRUE.equals(stringChanged) || Boolean.TRUE.equals(activeChanged);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Get rid of the previous listener if it exists and then create a new one and sign it up.
|
||||||
|
if ( fPreferenceChangeListener != null ) {
|
||||||
|
DebugUITools.getPreferenceStore().removePropertyChangeListener(fPreferenceChangeListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
fPreferenceChangeListener = new IPropertyChangeListener() {
|
||||||
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
|
if ( event.getProperty().equals(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND) ) {
|
||||||
|
columnIdValueBackground.setBackground(DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB());
|
||||||
|
columnNoColumnsBackground.setBackground(DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
DebugUITools.getPreferenceStore().addPropertyChangeListener(fPreferenceChangeListener);
|
||||||
|
|
||||||
|
// Create the initial properties provider which can be built on.
|
||||||
PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
|
PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
|
||||||
|
|
||||||
//
|
|
||||||
// Create label image objects which are used in more than one column.
|
|
||||||
//
|
|
||||||
|
|
||||||
// Pointer image is used for variable and function pointers.
|
|
||||||
LabelImage pointerLabelImage = new LabelImage(CDebugImages.DESC_OBJS_VARIABLE_POINTER) {
|
|
||||||
{ setPropertyNames(new String[] { PROP_VARIABLE_BASIC_TYPE }); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
|
|
||||||
String type = (String)properties.get(PROP_VARIABLE_BASIC_TYPE);
|
|
||||||
return IExpressionDMData.BasicType.pointer.name().equals(type) ||
|
|
||||||
IExpressionDMData.BasicType.function.name().equals(type);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Aggregate image is used for array, struct, etc.
|
|
||||||
LabelImage aggregateLabelImage = new LabelImage(CDebugImages.DESC_OBJS_VARIABLE_AGGREGATE) {
|
|
||||||
{ setPropertyNames(new String[] { PROP_VARIABLE_BASIC_TYPE }); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
|
|
||||||
String type = (String)properties.get(PROP_VARIABLE_BASIC_TYPE);
|
|
||||||
return IExpressionDMData.BasicType.array.name().equals(type) ||
|
|
||||||
IExpressionDMData.BasicType.composite.name().equals(type);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Simple variable image is used for all other types, except when there is no type specified.
|
|
||||||
LabelImage simpleLabelImage = new LabelImage(CDebugImages.DESC_OBJS_VARIABLE_SIMPLE) {
|
|
||||||
{ setPropertyNames(new String[] { PROP_VARIABLE_BASIC_TYPE }); }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
|
|
||||||
String type = (String)properties.get(PROP_VARIABLE_BASIC_TYPE);
|
|
||||||
return type != null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// The name column consists of the expression name. The name column image depends on the variable type.
|
// The name column consists of the expression name. The name column image depends on the variable type.
|
||||||
provider.setColumnInfo(
|
provider.setColumnInfo(
|
||||||
IDebugVMConstants.COLUMN_ID__NAME,
|
IDebugVMConstants.COLUMN_ID__NAME,
|
||||||
|
@ -262,9 +357,9 @@ public class VariableVMNode extends AbstractExpressionVMNode
|
||||||
new LabelText(
|
new LabelText(
|
||||||
MessagesForVariablesVM.VariableVMNode_Name_column__text_format,
|
MessagesForVariablesVM.VariableVMNode_Name_column__text_format,
|
||||||
new String[] { PROP_NAME }),
|
new String[] { PROP_NAME }),
|
||||||
pointerLabelImage,
|
POINTER_LABEL_IMAGE,
|
||||||
aggregateLabelImage,
|
AGGREGATE_LABEL_IMAGE,
|
||||||
simpleLabelImage,
|
SIMPLE_LABEL_IMAGE,
|
||||||
new StaleDataLabelForeground(),
|
new StaleDataLabelForeground(),
|
||||||
new VariableLabelFont(),
|
new VariableLabelFont(),
|
||||||
}));
|
}));
|
||||||
|
@ -277,9 +372,9 @@ public class VariableVMNode extends AbstractExpressionVMNode
|
||||||
new LabelText(
|
new LabelText(
|
||||||
MessagesForVariablesVM.VariableVMNode_Expression_column__text_format,
|
MessagesForVariablesVM.VariableVMNode_Expression_column__text_format,
|
||||||
new String[] { PROP_ELEMENT_EXPRESSION }),
|
new String[] { PROP_ELEMENT_EXPRESSION }),
|
||||||
pointerLabelImage,
|
POINTER_LABEL_IMAGE,
|
||||||
aggregateLabelImage,
|
AGGREGATE_LABEL_IMAGE,
|
||||||
simpleLabelImage,
|
SIMPLE_LABEL_IMAGE,
|
||||||
new StaleDataLabelForeground(),
|
new StaleDataLabelForeground(),
|
||||||
new VariableLabelFont(),
|
new VariableLabelFont(),
|
||||||
}));
|
}));
|
||||||
|
@ -342,31 +437,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//
|
//
|
||||||
new LabelBackground(
|
columnIdValueBackground,
|
||||||
DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB())
|
|
||||||
{
|
|
||||||
{
|
|
||||||
setPropertyNames(new String[] {
|
|
||||||
FormattedValueVMUtil.getPropertyForFormatId(IFormattedValues.STRING_FORMAT),
|
|
||||||
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + FormattedValueVMUtil.getPropertyForFormatId(IFormattedValues.STRING_FORMAT),
|
|
||||||
IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE,
|
|
||||||
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE,
|
|
||||||
IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT,
|
|
||||||
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEnabled(IStatus status, java.util.Map<String,Object> properties) {
|
|
||||||
Boolean activeFormatChanged = (Boolean)properties.get(
|
|
||||||
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT);
|
|
||||||
Boolean activeChanged = (Boolean)properties.get(
|
|
||||||
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + IDebugVMConstants.PROP_FORMATTED_VALUE_ACTIVE_FORMAT_VALUE);
|
|
||||||
Boolean stringChanged = (Boolean)properties.get(
|
|
||||||
ICachingVMProvider.PROP_IS_CHANGED_PREFIX + FormattedValueVMUtil.getPropertyForFormatId(IFormattedValues.STRING_FORMAT));
|
|
||||||
return Boolean.TRUE.equals(stringChanged) ||
|
|
||||||
( Boolean.TRUE.equals(activeChanged) && !Boolean.TRUE.equals(activeFormatChanged));
|
|
||||||
};
|
|
||||||
},
|
|
||||||
new StaleDataLabelForeground(),
|
new StaleDataLabelForeground(),
|
||||||
new VariableLabelFont(),
|
new VariableLabelFont(),
|
||||||
}));
|
}));
|
||||||
|
@ -501,9 +572,9 @@ public class VariableVMNode extends AbstractExpressionVMNode
|
||||||
new ErrorLabelText(
|
new ErrorLabelText(
|
||||||
MessagesForVariablesVM.VariableVMNode_NoColumns_column__Error__text_format,
|
MessagesForVariablesVM.VariableVMNode_NoColumns_column__Error__text_format,
|
||||||
new String[] { PROP_NAME }),
|
new String[] { PROP_NAME }),
|
||||||
pointerLabelImage,
|
POINTER_LABEL_IMAGE,
|
||||||
aggregateLabelImage,
|
AGGREGATE_LABEL_IMAGE,
|
||||||
simpleLabelImage,
|
SIMPLE_LABEL_IMAGE,
|
||||||
new LabelForeground(new RGB(255, 0, 0)) // TODO: replace with preference error color
|
new LabelForeground(new RGB(255, 0, 0)) // TODO: replace with preference error color
|
||||||
{
|
{
|
||||||
{ setPropertyNames(new String[] { PROP_NAME }); }
|
{ setPropertyNames(new String[] { PROP_NAME }); }
|
||||||
|
@ -532,6 +603,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
|
||||||
return Boolean.TRUE.equals(stringChanged) || Boolean.TRUE.equals(activeChanged);
|
return Boolean.TRUE.equals(stringChanged) || Boolean.TRUE.equals(activeChanged);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
columnNoColumnsBackground,
|
||||||
new StaleDataLabelBackground(),
|
new StaleDataLabelBackground(),
|
||||||
new VariableLabelFont(),
|
new VariableLabelFont(),
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -76,10 +76,36 @@ public class LabelColumnInfo {
|
||||||
/**
|
/**
|
||||||
* Returns the list of configured label attributes for this column.
|
* Returns the list of configured label attributes for this column.
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
protected LabelAttribute[] setLabelAttributes(LabelAttribute attributes) {
|
protected void setLabelAttributes(LabelAttribute[] attributes) {
|
||||||
return fLabelAttributes;
|
fLabelAttributes = attributes;
|
||||||
|
|
||||||
|
List<String> names = new LinkedList<String>();
|
||||||
|
for (LabelAttribute attr : attributes) {
|
||||||
|
for (String name : attr.getPropertyNames()) {
|
||||||
|
names.add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fPropertyNames = names.toArray(new String[names.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inserts an attribute in front of all the other existing attributes.
|
||||||
|
*
|
||||||
|
* @since 2.1
|
||||||
|
*/
|
||||||
|
public void insertAttribute(LabelAttribute attribute) {
|
||||||
|
LabelAttribute[] newAttributeList = new LabelAttribute[fLabelAttributes.length+1];
|
||||||
|
|
||||||
|
for ( int idx = 0 ; idx < fLabelAttributes.length; idx ++ ) {
|
||||||
|
newAttributeList[ idx + 1 ] = fLabelAttributes[ idx ];
|
||||||
|
}
|
||||||
|
|
||||||
|
newAttributeList[ 0 ] = attribute;
|
||||||
|
|
||||||
|
setLabelAttributes( newAttributeList );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue