Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2012-09-18 01:32:25 -0400
committerPawel Piech2012-09-20 12:57:32 -0400
commit77adf5dd34d06c0d543f3fa82daa8f915289e196 (patch)
treec8efb1fb17793d51a406a38c699b3b85cea0cae3
parentd26abb2366cc155bcf08a49e5216feb73378a57b (diff)
downloadorg.eclipse.tcf-77adf5dd34d06c0d543f3fa82daa8f915289e196.tar.gz
org.eclipse.tcf-77adf5dd34d06c0d543f3fa82daa8f915289e196.tar.xz
org.eclipse.tcf-77adf5dd34d06c0d543f3fa82daa8f915289e196.zip
Bug 389767 - Neither expressions or registers follow the Background Debug Change Color Preference
Conflicts: plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/adapters/TCFLaunchLabelProvider.java plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeRegister.java plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeStackFrame.java
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/ColorCache.java37
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/adapters/TCFLaunchLabelProvider.java4
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java4
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java27
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeModule.java9
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeRegister.java18
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeStackFrame.java4
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFSnapshot.java6
8 files changed, 67 insertions, 42 deletions
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/ColorCache.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/ColorCache.java
new file mode 100644
index 000000000..d280b6476
--- /dev/null
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/ColorCache.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Xilinx, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.tcf.internal.debug.ui;
+
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.graphics.RGB;
+
+public class ColorCache {
+
+ public static final RGB
+ rgb_error = new RGB(192, 0, 0),
+ rgb_disabled = new RGB(127, 127, 127),
+ rgb_stalled = new RGB(128, 128, 128);
+
+ public static RGB rgb_highlight =
+ DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB();
+
+ private static final IPropertyChangeListener preferenceChangeListener = new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND)) {
+ rgb_highlight = DebugUITools.getPreferenceColor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND).getRGB();
+ }
+ }
+ };
+
+ static {
+ DebugUITools.getPreferenceStore().addPropertyChangeListener(preferenceChangeListener);
+ }
+}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/adapters/TCFLaunchLabelProvider.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/adapters/TCFLaunchLabelProvider.java
index 047bfc536..7162a6c6a 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/adapters/TCFLaunchLabelProvider.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/adapters/TCFLaunchLabelProvider.java
@@ -18,8 +18,8 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProv
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.RGB;
import org.eclipse.tcf.internal.debug.model.TCFLaunch;
+import org.eclipse.tcf.internal.debug.ui.ColorCache;
import org.eclipse.tcf.internal.debug.ui.ImageCache;
import org.eclipse.tcf.internal.debug.ui.model.TCFModel;
import org.eclipse.tcf.services.IProcesses;
@@ -49,7 +49,7 @@ class TCFLaunchLabelProvider implements IElementLabelProvider {
Throwable error = launch.getError();
if (error != null) {
status += ": " + TCFModel.getErrorMessage(error, false);
- result.setForeground(new RGB(255, 0, 0), 0);
+ result.setForeground(ColorCache.rgb_error, 0);
}
else if (launch.isExited()) {
status += ": All exited or detached";
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java
index 1052db733..19ac877d9 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExecContext.java
@@ -29,11 +29,11 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdat
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.RGB;
import org.eclipse.tcf.internal.debug.model.TCFContextState;
import org.eclipse.tcf.internal.debug.model.TCFFunctionRef;
import org.eclipse.tcf.internal.debug.model.TCFSourceRef;
import org.eclipse.tcf.internal.debug.model.TCFSymFileRef;
+import org.eclipse.tcf.internal.debug.ui.ColorCache;
import org.eclipse.tcf.internal.debug.ui.ImageCache;
import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.protocol.JSON;
@@ -1036,7 +1036,7 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
StringBuffer label = new StringBuffer();
Throwable error = run_context.getError();
if (error != null) {
- result.setForeground(new RGB(255, 0, 0), 0);
+ result.setForeground(ColorCache.rgb_error, 0);
label.append(id);
label.append(": ");
label.append(TCFModel.getErrorMessage(error, false));
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java
index 2ed2b26b9..993015987 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java
@@ -35,10 +35,10 @@ import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tcf.internal.debug.model.TCFContextState;
import org.eclipse.tcf.internal.debug.ui.Activator;
+import org.eclipse.tcf.internal.debug.ui.ColorCache;
import org.eclipse.tcf.internal.debug.ui.ImageCache;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IToken;
@@ -78,11 +78,6 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
private IExpressions.Value next_value;
private byte[] parent_value;
- private static final RGB
- rgb_error = new RGB(192, 0, 0),
- rgb_highlight = new RGB(255, 255, 128),
- rgb_disabled = new RGB(127, 127, 127);
-
private static int expr_cnt;
private class Expression {
@@ -1064,7 +1059,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
String[] cols = result.getColumnIds();
if (error != null) {
if (cols == null || cols.length <= 1) {
- result.setForeground(rgb_error, 0);
+ result.setForeground(ColorCache.rgb_error, 0);
result.setLabel(name + ": N/A", 0);
}
else {
@@ -1078,7 +1073,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
result.setLabel(type_name.getData(), i);
}
else {
- result.setForeground(rgb_error, i);
+ result.setForeground(ColorCache.rgb_error, i);
result.setLabel("N/A", i);
}
}
@@ -1109,10 +1104,10 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
}
next_value = value.getData();
if (isValueChanged(prev_value, next_value)) {
- result.setBackground(rgb_highlight, 0);
+ result.setBackground(ColorCache.rgb_highlight, 0);
if (cols != null) {
for (int i = 1; i < cols.length; i++) {
- result.setBackground(rgb_highlight, i);
+ result.setBackground(ColorCache.rgb_highlight, i);
}
}
}
@@ -1136,14 +1131,14 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
else {
String[] cols = result.getColumnIds();
if (cols == null || cols.length <= 1) {
- result.setForeground(rgb_disabled, 0);
+ result.setForeground(ColorCache.rgb_disabled, 0);
result.setLabel(script, 0);
}
else {
for (int i = 0; i < cols.length; i++) {
String c = cols[i];
if (c.equals(TCFColumnPresentationExpression.COL_NAME)) {
- result.setForeground(rgb_disabled, i);
+ result.setForeground(ColorCache.rgb_disabled, i);
result.setLabel(script, i);
}
}
@@ -1318,8 +1313,8 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
bf.append('\n');
}
else if (e != null) {
- bf.append("Cannot read pointed value: ", SWT.BOLD, null, rgb_error);
- bf.append(TCFModel.getErrorMessage(e, false), SWT.ITALIC, null, rgb_error);
+ bf.append("Cannot read pointed value: ", SWT.BOLD, null, ColorCache.rgb_error);
+ bf.append(TCFModel.getErrorMessage(string.getError(), false), SWT.ITALIC, null, ColorCache.rgb_error);
bf.append('\n');
}
}
@@ -1434,8 +1429,8 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
if (!expression.validate(done)) return false;
if (!value.validate(done)) return false;
int pos = bf.length();
- bf.append(expression.getError(), rgb_error);
- if (bf.length() == pos) bf.append(value.getError(), rgb_error);
+ bf.append(expression.getError(), ColorCache.rgb_error);
+ if (bf.length() == pos) bf.append(value.getError(), ColorCache.rgb_error);
if (bf.length() == pos) {
IExpressions.Value v = value.getData();
if (v != null) {
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeModule.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeModule.java
index 633e816b3..f7aeb6e24 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeModule.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeModule.java
@@ -16,9 +16,9 @@ import java.util.Map;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.RGB;
import org.eclipse.tcf.core.ErrorReport;
import org.eclipse.tcf.internal.debug.model.TCFSymFileRef;
+import org.eclipse.tcf.internal.debug.ui.ColorCache;
import org.eclipse.tcf.internal.debug.ui.ImageCache;
import org.eclipse.tcf.internal.debug.ui.model.TCFNodeExecContext.MemoryRegion;
import org.eclipse.tcf.protocol.JSON;
@@ -32,9 +32,6 @@ public class TCFNodeModule extends TCFNode implements IDetailsProvider {
private final TCFData<MemoryRegion> region;
- private static final RGB
- rgb_error = new RGB(192, 0, 0);
-
protected TCFNodeModule(final TCFNodeExecContext parent, String id, final int index) {
super(parent, id);
region = new TCFData<MemoryRegion>(channel) {
@@ -145,12 +142,12 @@ public class TCFNodeModule extends TCFNode implements IDetailsProvider {
Map<String,Object> map = (Map<String,Object>)sym_data.props.get("FileError");
if (map != null) {
String msg = TCFModel.getErrorMessage(new ErrorReport("", map), false);
- bf.append("Symbol file error: ", SWT.BOLD).append(msg, SWT.ITALIC, null, rgb_error).append('\n');
+ bf.append("Symbol file error: ", SWT.BOLD).append(msg, SWT.ITALIC, null, ColorCache.rgb_error).append('\n');
}
}
if (sym_data.error != null) bf.append("Symbol file error: ", SWT.BOLD).append(
TCFModel.getErrorMessage(sym_data.error, false),
- SWT.ITALIC, null, rgb_error).append('\n');
+ SWT.ITALIC, null, ColorCache.rgb_error).append('\n');
}
}
String section = r.getSectionName();
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeRegister.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeRegister.java
index 243229c05..5439ec16f 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeRegister.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeRegister.java
@@ -27,9 +27,9 @@ import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tcf.internal.debug.model.TCFContextState;
+import org.eclipse.tcf.internal.debug.ui.ColorCache;
import org.eclipse.tcf.internal.debug.ui.ImageCache;
import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.services.IRegisters;
@@ -48,10 +48,6 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchIn
private byte[] prev_value;
private byte[] next_value;
- private static final RGB
- rgb_error = new RGB(192, 0, 0),
- rgb_highlight = new RGB(255, 255, 128);
-
private int index;
TCFNodeRegister(TCFNode parent, final String id) {
@@ -208,8 +204,8 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchIn
if (!context.validate(done)) return false;
if (!value.validate(done)) return false;
int pos = bf.length();
- bf.append(context.getError(), rgb_error);
- if (bf.length() == pos) bf.append(value.getError(), rgb_error);
+ bf.append(context.getError(), ColorCache.rgb_error);
+ if (bf.length() == pos) bf.append(value.getError(), ColorCache.rgb_error);
if (bf.length() == pos) {
IRegisters.RegistersContext ctx = context.getData();
if (ctx != null) {
@@ -295,7 +291,7 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchIn
for (int i = 0; i < cols.length; i++) {
String c = cols[i];
if (ctx == null) {
- result.setForeground(rgb_error, i);
+ result.setForeground(ColorCache.rgb_error, i);
result.setLabel("N/A", i);
}
else if (c.equals(TCFColumnPresentationRegister.COL_NAME)) {
@@ -349,10 +345,10 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchIn
}
}
if (changed) {
- result.setBackground(rgb_highlight, 0);
+ result.setBackground(ColorCache.rgb_highlight, 0);
if (cols != null) {
for (int i = 1; i < cols.length; i++) {
- result.setBackground(rgb_highlight, i);
+ result.setBackground(ColorCache.rgb_highlight, i);
}
}
}
@@ -366,7 +362,7 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchIn
if (error == null) error = value.getError();
byte[] data = value.getData();
if (error != null || ctx == null) {
- result.setForeground(rgb_error, col);
+ result.setForeground(ColorCache.rgb_error, col);
result.setLabel("N/A", col);
}
else if (data != null) {
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeStackFrame.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeStackFrame.java
index 9f439f4f9..a8873009c 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeStackFrame.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeStackFrame.java
@@ -20,10 +20,10 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate;
import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.swt.graphics.RGB;
import org.eclipse.tcf.internal.debug.model.TCFContextState;
import org.eclipse.tcf.internal.debug.model.TCFFunctionRef;
import org.eclipse.tcf.internal.debug.model.TCFSourceRef;
+import org.eclipse.tcf.internal.debug.ui.ColorCache;
import org.eclipse.tcf.internal.debug.ui.ImageCache;
import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.protocol.JSON;
@@ -412,7 +412,7 @@ public class TCFNodeStackFrame extends TCFNode {
}
if (error != null) {
if (state == null || state.is_suspended) {
- result.setForeground(new RGB(255, 0, 0), 0);
+ result.setForeground(ColorCache.rgb_error, 0);
if (bf.length() > 0) bf.append(": ");
bf.append(TCFModel.getErrorMessage(error, false));
}
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFSnapshot.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFSnapshot.java
index 3737248e0..f1b11a490 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFSnapshot.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFSnapshot.java
@@ -25,6 +25,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.RGB;
+import org.eclipse.tcf.internal.debug.ui.ColorCache;
import org.eclipse.tcf.protocol.Protocol;
/**
@@ -38,7 +39,6 @@ class TCFSnapshot {
private final HashMap<TCFNode,PresentationData> cache = new HashMap<TCFNode,PresentationData>();
private final String[] columns;
- private final RGB rgb_stalled = new RGB(128, 128, 128);
private boolean ignore_bg_color = true;
@@ -277,7 +277,7 @@ class TCFSnapshot {
String[] ids_data = columns;
if (ids_update != ids_data && !Arrays.equals(ids_update, ids_data)) {
int n = ids_update == null ? 1 : ids_update.length;
- for (int i = 0; i < n; i++) update.setBackground(rgb_stalled, i);
+ for (int i = 0; i < n; i++) update.setBackground(ColorCache.rgb_stalled, i);
}
else {
if (data.label != null) {
@@ -297,7 +297,7 @@ class TCFSnapshot {
}
if (data.isStalled()) {
int n = ids_update == null ? 1 : ids_update.length;
- for (int i = 0; i < n; i++) update.setForeground(rgb_stalled, i);
+ for (int i = 0; i < n; i++) update.setForeground(ColorCache.rgb_stalled, i);
}
else {
if (data.fg_color != null) {

Back to the top