Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRandy Rohrbach2010-03-09 23:11:09 +0000
committerRandy Rohrbach2010-03-09 23:11:09 +0000
commit7bd8acff991ff80fb96705ae20b4fe14e37ba458 (patch)
treecf1b763a36e6d67d8f14eee4e53afe0c2cc2698f /dsf/org.eclipse.cdt.dsf.ui
parenta2fd559aecba188c4a60f3af87df9c25055e84a6 (diff)
downloadorg.eclipse.cdt-7bd8acff991ff80fb96705ae20b4fe14e37ba458.tar.gz
org.eclipse.cdt-7bd8acff991ff80fb96705ae20b4fe14e37ba458.tar.xz
org.eclipse.cdt-7bd8acff991ff80fb96705ae20b4fe14e37ba458.zip
Bugzillas
305260 305262
Diffstat (limited to 'dsf/org.eclipse.cdt.dsf.ui')
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionManagerVMNode.java28
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/SingleExpressionVMNode.java5
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/RegisterVMNode.java75
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java230
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/properties/LabelColumnInfo.java32
5 files changed, 261 insertions, 109 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionManagerVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionManagerVMNode.java
index f53b3360469..128d9b91a1c 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionManagerVMNode.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/ExpressionManagerVMNode.java
@@ -64,11 +64,11 @@ public class ExpressionManagerVMNode extends AbstractVMNode
* VMC for a new expression object to be added. When user clicks on this node to
* edit it, he will create a new expression.
*/
- class NewExpressionVMC extends AbstractVMContext {
+ public class NewExpressionVMC extends AbstractVMContext {
public NewExpressionVMC() {
super(ExpressionManagerVMNode.this);
}
-
+
@Override
@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
@@ -90,7 +90,17 @@ public class ExpressionManagerVMNode extends AbstractVMNode
private IExpressionManager fManager = DebugPlugin.getDefault().getExpressionManager();
/** 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) {
super(provider);
@@ -296,7 +306,10 @@ public class ExpressionManagerVMNode extends AbstractVMNode
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) {
if (IDebugVMConstants.COLUMN_ID__EXPRESSION.equals(columnId)) {
return new TextCellEditor(parent);
@@ -304,7 +317,14 @@ public class ExpressionManagerVMNode extends AbstractVMNode
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) {
+ if ( fWatchExpressionCellModifier == null ) {
+ fWatchExpressionCellModifier = createCellModifier();
+ }
return fWatchExpressionCellModifier;
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/SingleExpressionVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/SingleExpressionVMNode.java
index 46e8744698b..e715b1a94a5 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/SingleExpressionVMNode.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/expression/SingleExpressionVMNode.java
@@ -320,7 +320,10 @@ public class SingleExpressionVMNode extends AbstractDMVMNode implements IElement
return new RootDMVMContext(getVMProvider().getRootVMNode(), dmc);
}
- void setExpression(IExpressionDMContext dmc) {
+ /**
+ * @since 2.1
+ */
+ public void setExpression(IExpressionDMContext dmc) {
String text = dmc.getExpression();
fManager.setExpression(new SimpleExpression(text));
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/RegisterVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/RegisterVMNode.java
index a8096afde83..61aa8780be5 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/RegisterVMNode.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/RegisterVMNode.java
@@ -74,6 +74,7 @@ import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
+import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier;
@@ -207,8 +208,58 @@ public class RegisterVMNode extends AbstractExpressionVMNode
*
* @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() {
+ /*
+ * 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();
// The name column consists of the register name.
@@ -283,26 +334,7 @@ public class RegisterVMNode extends AbstractExpressionVMNode
return !status.isOK();
}
},
- 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);
- }
- },
+ columnIdValueBackground,
new StaleDataLabelForeground(),
new VariableLabelFont(),
}));
@@ -403,7 +435,6 @@ public class RegisterVMNode extends AbstractExpressionVMNode
return provider;
}
-
@Override
public String toString() {
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java
index 08d01336073..389ea2b8592 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java
@@ -88,6 +88,7 @@ import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
+import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier;
@@ -102,29 +103,29 @@ public class VariableVMNode extends AbstractExpressionVMNode
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;
@@ -213,48 +214,142 @@ public class VariableVMNode extends AbstractExpressionVMNode
*
* @since 2.0
*/
- protected IElementLabelProvider createLabelProvider() {
- PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
+ 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.
- //
-
- // 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 }); }
+ /**
+ * 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);
- };
+ @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 }); }
+ };
+
+ /**
+ * @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);
- };
+ @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 }); }
- // 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;
- };
+ @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() {
+
+ //
+ // 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();
+
// The name column consists of the expression name. The name column image depends on the variable type.
provider.setColumnInfo(
IDebugVMConstants.COLUMN_ID__NAME,
@@ -262,9 +357,9 @@ public class VariableVMNode extends AbstractExpressionVMNode
new LabelText(
MessagesForVariablesVM.VariableVMNode_Name_column__text_format,
new String[] { PROP_NAME }),
- pointerLabelImage,
- aggregateLabelImage,
- simpleLabelImage,
+ POINTER_LABEL_IMAGE,
+ AGGREGATE_LABEL_IMAGE,
+ SIMPLE_LABEL_IMAGE,
new StaleDataLabelForeground(),
new VariableLabelFont(),
}));
@@ -277,9 +372,9 @@ public class VariableVMNode extends AbstractExpressionVMNode
new LabelText(
MessagesForVariablesVM.VariableVMNode_Expression_column__text_format,
new String[] { PROP_ELEMENT_EXPRESSION }),
- pointerLabelImage,
- aggregateLabelImage,
- simpleLabelImage,
+ POINTER_LABEL_IMAGE,
+ AGGREGATE_LABEL_IMAGE,
+ SIMPLE_LABEL_IMAGE,
new StaleDataLabelForeground(),
new VariableLabelFont(),
}));
@@ -342,31 +437,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
}
},
//
- 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));
- };
- },
+ columnIdValueBackground,
new StaleDataLabelForeground(),
new VariableLabelFont(),
}));
@@ -501,9 +572,9 @@ public class VariableVMNode extends AbstractExpressionVMNode
new ErrorLabelText(
MessagesForVariablesVM.VariableVMNode_NoColumns_column__Error__text_format,
new String[] { PROP_NAME }),
- pointerLabelImage,
- aggregateLabelImage,
- simpleLabelImage,
+ POINTER_LABEL_IMAGE,
+ AGGREGATE_LABEL_IMAGE,
+ SIMPLE_LABEL_IMAGE,
new LabelForeground(new RGB(255, 0, 0)) // TODO: replace with preference error color
{
{ setPropertyNames(new String[] { PROP_NAME }); }
@@ -532,6 +603,7 @@ public class VariableVMNode extends AbstractExpressionVMNode
return Boolean.TRUE.equals(stringChanged) || Boolean.TRUE.equals(activeChanged);
};
},
+ columnNoColumnsBackground,
new StaleDataLabelBackground(),
new VariableLabelFont(),
}));
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/properties/LabelColumnInfo.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/properties/LabelColumnInfo.java
index 07fd4fe52ee..e1d056609d6 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/properties/LabelColumnInfo.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/properties/LabelColumnInfo.java
@@ -76,13 +76,39 @@ public class LabelColumnInfo {
/**
* Returns the list of configured label attributes for this column.
*
- * @since 2.0
+ * @since 2.1
*/
- protected LabelAttribute[] setLabelAttributes(LabelAttribute attributes) {
- return fLabelAttributes;
+ protected void setLabelAttributes(LabelAttribute[] attributes) {
+ 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 );
+ }
+
+ /**
* Updates the label parameters for this column based on the provided
* properties. The label information is written to the givne label
* update under the given column index.

Back to the top