Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2011-11-03 01:03:21 +0000
committerEugene Tarassov2011-11-03 01:03:21 +0000
commit653fa126797e1cf7d56bf951345a8e6136457277 (patch)
treea84e09a4656ac07e534f98e513870c229c751a4b /plugins
parent56453870bd69191d7e09868b38effbec45fb316e (diff)
downloadorg.eclipse.tcf-653fa126797e1cf7d56bf951345a8e6136457277.tar.gz
org.eclipse.tcf-653fa126797e1cf7d56bf951345a8e6136457277.tar.xz
org.eclipse.tcf-653fa126797e1cf7d56bf951345a8e6136457277.zip
TCF Debugger: added font styles and colors in detail panes.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IDetailsProvider.java16
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/StyledStringBuffer.java110
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFDetailPane.java60
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java92
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeModule.java20
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java34
6 files changed, 247 insertions, 85 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IDetailsProvider.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IDetailsProvider.java
new file mode 100644
index 000000000..24104eb1d
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/IDetailsProvider.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.debug.ui.model;
+
+public interface IDetailsProvider {
+
+ boolean getDetailText(StyledStringBuffer buf, Runnable done);
+}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/StyledStringBuffer.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/StyledStringBuffer.java
new file mode 100644
index 000000000..7be54744f
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/StyledStringBuffer.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, 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
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.debug.ui.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.swt.graphics.RGB;
+
+class StyledStringBuffer {
+
+ private final StringBuffer bf = new StringBuffer();
+ private final ArrayList<Style> styles = new ArrayList<Style>();
+
+ static class Style {
+ int pos;
+ int len;
+ int font;
+ RGB bg;
+ RGB fg;
+ }
+
+ StyledStringBuffer append(int pos, int font, RGB bg, RGB fg) {
+ Style x = new Style();
+ x.pos = pos;
+ x.len = bf.length() - pos;
+ x.font = font;
+ x.bg = bg;
+ x.fg = fg;
+ styles.add(x);
+ return this;
+ }
+
+ StyledStringBuffer append(String s) {
+ bf.append(s);
+ return this;
+ }
+
+ StyledStringBuffer append(char ch) {
+ bf.append(ch);
+ return this;
+ }
+
+ StyledStringBuffer append(int i) {
+ bf.append(i);
+ return this;
+ }
+
+ StyledStringBuffer append(String s, int font) {
+ Style x = new Style();
+ x.pos = bf.length();
+ x.len = s.length();
+ x.font = font;
+ styles.add(x);
+ bf.append(s);
+ return this;
+ }
+
+ StyledStringBuffer append(String s, int font, RGB bg, RGB fg) {
+ Style x = new Style();
+ x.pos = bf.length();
+ x.len = s.length();
+ x.font = font;
+ x.bg = bg;
+ x.fg = fg;
+ styles.add(x);
+ bf.append(s);
+ return this;
+ }
+
+ StyledStringBuffer append(StyledStringBuffer s) {
+ int offs = bf.length();
+ for (Style y : s.styles) {
+ Style x = new Style();
+ x.pos = y.pos + offs;
+ x.len = y.len;
+ x.font = y.font;
+ x.bg = y.bg;
+ x.fg = y.fg;
+ styles.add(x);
+ }
+ bf.append(s.bf);
+ return this;
+ }
+
+ StringBuffer getStringBuffer() {
+ return bf;
+ }
+
+ Collection<Style> getStyle() {
+ return styles;
+ }
+
+ int length() {
+ return bf.length();
+ }
+
+ @Override
+ public String toString() {
+ return bf.toString();
+ }
+}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFDetailPane.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFDetailPane.java
index f81c43af6..114ac6907 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFDetailPane.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFDetailPane.java
@@ -11,13 +11,20 @@
package org.eclipse.tm.internal.tcf.debug.ui.model;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import org.eclipse.debug.ui.IDetailPane;
import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.ITextPresentationListener;
+import org.eclipse.jface.text.TextPresentation;
import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -41,12 +48,22 @@ public class TCFDetailPane implements IDetailPane {
@SuppressWarnings("unused")
private IWorkbenchPartSite part_site;
private final Document document = new Document();
+ private final ArrayList<StyleRange> style_ranges = new ArrayList<StyleRange>();
+ private final HashMap<RGB,Color> colors = new HashMap<RGB,Color>();
+
+ private final ITextPresentationListener presentation_listener = new ITextPresentationListener() {
+ public void applyTextPresentation(TextPresentation presentation) {
+ for (StyleRange r : style_ranges) presentation.addStyleRange(r);
+ }
+ };
public Control createControl(Composite parent) {
assert source_viewer == null;
source_viewer = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL);
+ source_viewer.configure(new SourceViewerConfiguration());
source_viewer.setDocument(document);
source_viewer.setEditable(false);
+ source_viewer.addTextPresentationListener(presentation_listener);
Control control = source_viewer.getControl();
GridData gd = new GridData(GridData.FILL_BOTH);
control.setLayoutData(gd);
@@ -69,41 +86,46 @@ public class TCFDetailPane implements IDetailPane {
Protocol.invokeLater(new Runnable() {
public void run() {
if (g != generation) return;
- final String s = getDetailText(nodes, this);
+ final StyledStringBuffer s = getDetailText(nodes, this);
if (s == null) return;
display.asyncExec(new Runnable() {
public void run() {
if (g != generation) return;
- document.set(s);
+ document.set(getStyleRanges(s));
}
});
}
});
}
- private String getDetailText(ArrayList<TCFNode> nodes, Runnable done) {
- StringBuffer bf = new StringBuffer();
+ private StyledStringBuffer getDetailText(ArrayList<TCFNode> nodes, Runnable done) {
+ StyledStringBuffer bf = new StyledStringBuffer();
for (TCFNode n : nodes) {
- if (n instanceof TCFNodeExpression) {
- String s = ((TCFNodeExpression)n).getDetailText(done);
- if (s == null) return null;
- bf.append(s);
- }
- else if (n instanceof TCFNodeRegister) {
- String s = ((TCFNodeRegister)n).getDetailText(done);
- if (s == null) return null;
- bf.append(s);
- }
- else if (n instanceof TCFNodeModule) {
- String s = ((TCFNodeModule)n).getDetailText(done);
- if (s == null) return null;
- bf.append(s);
+ if (n instanceof IDetailsProvider) {
+ if (!((IDetailsProvider)n).getDetailText(bf, done)) return null;
}
}
- return bf.toString();
+ return bf;
+ }
+
+ private String getStyleRanges(StyledStringBuffer s) {
+ style_ranges.clear();
+ for (StyledStringBuffer.Style x : s.getStyle()) {
+ style_ranges.add(new StyleRange(x.pos, x.len, getColor(x.fg), getColor(x.bg), x.font));
+ }
+ return s.toString();
+ }
+
+ private Color getColor(RGB rgb) {
+ if (rgb == null) return null;
+ Color c = colors.get(rgb);
+ if (c == null) colors.put(rgb, c = new Color(display, rgb));
+ return c;
}
public void dispose() {
+ for (Color c : colors.values()) c.dispose();
+ colors.clear();
if (source_viewer == null) return;
generation++;
if (source_viewer.getControl() != null) {
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java
index 1d45c6607..fe200332c 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExpression.java
@@ -29,6 +29,7 @@ import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tm.internal.tcf.debug.model.TCFContextState;
@@ -46,7 +47,7 @@ import org.eclipse.tm.tcf.services.ISymbols;
import org.eclipse.tm.tcf.util.TCFDataCache;
import org.eclipse.tm.tcf.util.TCFTask;
-public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastToType, IWatchInExpressions {
+public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastToType, IWatchInExpressions, IDetailsProvider {
// TODO: User commands: Add Global Variables, Remove Global Variables
// TODO: enable Change Value user command
@@ -70,6 +71,11 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
private IExpressions.Value prev_value;
private IExpressions.Value next_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 {
@@ -443,7 +449,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
});
return false;
}
- StringBuffer bf = new StringBuffer();
+ StyledStringBuffer bf = new StyledStringBuffer();
bf.append('{');
if (!appendCompositeValueText(bf, 1, base_type_data, buf, 0, size, mem.isBigEndian(), this)) return false;
bf.append('}');
@@ -969,7 +975,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
String[] cols = result.getColumnIds();
if (error != null) {
if (cols == null || cols.length <= 1) {
- result.setForeground(new RGB(255, 0, 0), 0);
+ result.setForeground(rgb_error, 0);
result.setLabel(name + ": N/A", 0);
}
else {
@@ -983,7 +989,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
result.setLabel(type_name.getData(), i);
}
else {
- result.setForeground(new RGB(255, 0, 0), i);
+ result.setForeground(rgb_error, i);
result.setLabel("N/A", i);
}
}
@@ -1014,11 +1020,10 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
}
next_value = value.getData();
if (isValueChanged(prev_value, next_value)) {
- RGB c = new RGB(255, 255, 0);
- result.setBackground(c, 0);
+ result.setBackground(rgb_highlight, 0);
if (cols != null) {
for (int i = 1; i < cols.length; i++) {
- result.setBackground(c, i);
+ result.setBackground(rgb_highlight, i);
}
}
}
@@ -1042,14 +1047,14 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
else {
String[] cols = result.getColumnIds();
if (cols == null || cols.length <= 1) {
- result.setForeground(new RGB(127, 127, 127), 0);
+ result.setForeground(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(new RGB(127, 127, 127), i);
+ result.setForeground(rgb_disabled, i);
result.setLabel(script, i);
}
}
@@ -1064,7 +1069,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
bf.append(TCFModel.getErrorMessage(error, true));
}
- private boolean appendArrayValueText(StringBuffer bf, int level, ISymbols.Symbol type,
+ private boolean appendArrayValueText(StyledStringBuffer bf, int level, ISymbols.Symbol type,
byte[] data, int offs, int size, boolean big_endian, Runnable done) {
assert offs + size <= data.length;
int length = type.getLength();
@@ -1085,7 +1090,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
return true;
}
- private boolean appendCompositeValueText(StringBuffer bf, int level, ISymbols.Symbol type,
+ private boolean appendCompositeValueText(StyledStringBuffer bf, int level, ISymbols.Symbol type,
byte[] data, int offs, int size, boolean big_endian, Runnable done) {
TCFDataCache<String[]> children_cache = model.getSymbolChildrenCache(type.getID());
if (children_cache == null) {
@@ -1118,7 +1123,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
continue;
}
else {
- StringBuffer bf1 = new StringBuffer();
+ StyledStringBuffer bf1 = new StyledStringBuffer();
if (!appendCompositeValueText(bf1, level, field_data, data,
offs + f_offs, f_size, big_endian, done)) return false;
if (bf1.length() > 0) {
@@ -1147,7 +1152,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
return false;
}
- private boolean appendValueText(StringBuffer bf, int level, String type_id,
+ private boolean appendValueText(StyledStringBuffer bf, int level, String type_id,
byte[] data, int offs, int size, boolean big_endian, Runnable done) {
if (data == null) return true;
ISymbols.Symbol type_data = null;
@@ -1165,19 +1170,19 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
assert size == data.length;
String s = getTypeName(type_class, size);
if (s == null) s = "not available";
- bf.append("Type: ");
+ bf.append("Type: ", SWT.BOLD);
bf.append(s);
bf.append('\n');
- bf.append("Size: ");
+ bf.append("Size: ", SWT.BOLD);
bf.append(size);
bf.append(size == 1 ? " byte\n" : " bytes\n");
if (size > 0) {
if (type_class == ISymbols.TypeClass.integer || type_class == ISymbols.TypeClass.real) {
- bf.append("Dec: ");
+ bf.append("Dec: ", SWT.BOLD);
bf.append(toNumberString(10, type_class, data, offs, size, big_endian));
bf.append("\n");
}
- bf.append("Hex: ");
+ bf.append("Hex: ", SWT.BOLD);
bf.append(toNumberString(16, type_class, data, offs, size, big_endian));
bf.append("\n");
}
@@ -1199,8 +1204,8 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
bf.append("\n");
}
else if (e != null) {
- bf.append("Cannot read pointed value: ");
- bf.append(TCFModel.getErrorMessage(e, true));
+ bf.append("Cannot read pointed value: ", SWT.BOLD, null, rgb_error);
+ bf.append(TCFModel.getErrorMessage(e, true), SWT.ITALIC, null, rgb_error);
}
}
if (type_data.getSize() > 0) {
@@ -1211,13 +1216,13 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
case cardinal:
case real:
if (level == 0) {
- bf.append("Dec: ");
+ bf.append("Dec: ", SWT.BOLD);
bf.append(toNumberString(10, type_class, data, offs, size, big_endian));
bf.append("\n");
- bf.append("Oct: ");
+ bf.append("Oct: ", SWT.BOLD);
bf.append(toNumberString(8, type_class, data, offs, size, big_endian));
bf.append("\n");
- bf.append("Hex: ");
+ bf.append("Hex: ", SWT.BOLD);
bf.append(toNumberString(16, type_class, data, offs, size, big_endian));
bf.append("\n");
}
@@ -1232,10 +1237,10 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
case pointer:
case function:
if (level == 0) {
- bf.append("Oct: ");
+ bf.append("Oct: ", SWT.BOLD);
bf.append(toNumberString(8, type_class, data, offs, size, big_endian));
bf.append("\n");
- bf.append("Hex: ");
+ bf.append("Hex: ", SWT.BOLD);
bf.append(toNumberString(16, type_class, data, offs, size, big_endian));
bf.append("\n");
}
@@ -1260,11 +1265,11 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
if (!type_name.validate(done)) return false;
String nm = type_name.getData();
if (nm != null) {
- bf.append("Type: ");
+ bf.append("Type: ", SWT.BOLD);
bf.append(nm);
bf.append("\n");
}
- bf.append("Size: ");
+ bf.append("Size: ", SWT.BOLD);
bf.append(type_data.getSize());
bf.append(type_data.getSize() == 1 ? " byte\n" : " bytes\n");
}
@@ -1316,46 +1321,53 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
return name;
}
- public String getDetailText(Runnable done) {
- if (!enabled) return "Disabled";
- if (!expression.validate(done)) return null;
- if (!value.validate(done)) return null;
- StringBuffer bf = new StringBuffer();
- appendErrorText(bf, expression.getError());
- if (bf.length() == 0) appendErrorText(bf, value.getError());
- if (bf.length() == 0) {
+ public boolean getDetailText(StyledStringBuffer bf, Runnable done) {
+ if (!enabled) {
+ bf.append("Disabled");
+ return true;
+ }
+ if (!expression.validate(done)) return false;
+ if (!value.validate(done)) return false;
+ int pos = bf.length();
+ appendErrorText(bf.getStringBuffer(), expression.getError());
+ if (bf.length() == pos) appendErrorText(bf.getStringBuffer(), value.getError());
+ if (bf.length() > pos) {
+ bf.append(pos, 0, null, rgb_error);
+ }
+ else {
IExpressions.Value v = value.getData();
if (v != null) {
byte[] data = v.getValue();
if (data != null) {
boolean big_endian = v.isBigEndian();
if (!appendValueText(bf, 0, v.getTypeID(),
- data, 0, data.length, big_endian, done)) return null;
+ data, 0, data.length, big_endian, done)) return false;
}
String reg_id = v.getRegisterID();
if (reg_id != null) {
String nm = getRegisterName(reg_id, done);
- if (nm == null) return null;
- bf.append("Register: ");
+ if (nm == null) return false;
+ bf.append("Register: ", SWT.BOLD);
bf.append(nm);
bf.append('\n');
}
Number addr = v.getAddress();
if (addr != null) {
BigInteger i = JSON.toBigInteger(addr);
- bf.append("Address: 0x");
+ bf.append("Address: ", SWT.BOLD);
+ bf.append("0x");
bf.append(i.toString(16));
bf.append('\n');
}
}
}
- return bf.toString();
+ return true;
}
public String getValueText(boolean add_error_text, Runnable done) {
if (!expression.validate(done)) return null;
if (!value.validate(done)) return null;
- StringBuffer bf = new StringBuffer();
+ StyledStringBuffer bf = new StyledStringBuffer();
IExpressions.Value v = value.getData();
if (v != null) {
byte[] data = v.getValue();
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeModule.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeModule.java
index a42a574a7..9db2e4f3a 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeModule.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeModule.java
@@ -13,6 +13,7 @@ package org.eclipse.tm.internal.tcf.debug.ui.model;
import java.math.BigInteger;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
+import org.eclipse.swt.SWT;
import org.eclipse.tm.internal.tcf.debug.ui.ImageCache;
import org.eclipse.tm.tcf.protocol.JSON;
import org.eclipse.tm.tcf.services.IMemoryMap;
@@ -20,7 +21,7 @@ import org.eclipse.tm.tcf.services.IMemoryMap;
/**
* A node representing a memory region (module).
*/
-public class TCFNodeModule extends TCFNode {
+public class TCFNodeModule extends TCFNode implements IDetailsProvider {
private final IMemoryMap.MemoryRegion region;
@@ -63,16 +64,15 @@ public class TCFNodeModule extends TCFNode {
return true;
}
- public String getDetailText(Runnable done) {
- StringBuilder detail = new StringBuilder();
- detail.append("File: ").append(region.getFileName()).append('\n');
- detail.append("Address: ").append(toHexString(region.getAddress())).append('\n');
- detail.append("Size: ").append(toHexString(region.getSize())).append('\n');
- detail.append("Flags: ").append(getFlagsLabel(region.getFlags())).append('\n');
- detail.append("Offset: ").append(toHexString(region.getOffset())).append('\n');
+ public boolean getDetailText(StyledStringBuffer bf, Runnable done) {
+ bf.append("File: ", SWT.BOLD).append(region.getFileName()).append('\n');
+ bf.append("Address: ", SWT.BOLD).append(toHexString(region.getAddress())).append('\n');
+ bf.append("Size: ", SWT.BOLD).append(toHexString(region.getSize())).append('\n');
+ bf.append("Flags: ", SWT.BOLD).append(getFlagsLabel(region.getFlags())).append('\n');
+ bf.append("Offset: ", SWT.BOLD).append(toHexString(region.getOffset())).append('\n');
String sectionName = region.getSectionName();
- detail.append("Section: ").append(sectionName != null ? sectionName : "<unknown>").append('\n');
- return detail.toString();
+ bf.append("Section: ", SWT.BOLD).append(sectionName != null ? sectionName : "<unknown>").append('\n');
+ return true;
}
private String toHexString(Number address) {
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java
index 7c5954c55..b49f9ecb2 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java
@@ -25,6 +25,7 @@ import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tm.internal.tcf.debug.model.TCFContextState;
@@ -35,7 +36,7 @@ import org.eclipse.tm.tcf.util.TCFDataCache;
import org.eclipse.tm.tcf.util.TCFTask;
-public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchInExpressions {
+public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchInExpressions, IDetailsProvider {
private final TCFChildrenRegisters children;
private final TCFData<IRegisters.RegistersContext> context;
@@ -47,8 +48,8 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchIn
private byte[] next_value;
private static final RGB
- rgb_error = new RGB(255, 0, 0),
- rgb_highlight = new RGB(255, 255, 0);
+ rgb_error = new RGB(192, 0, 0),
+ rgb_highlight = new RGB(255, 255, 128);
private int index;
@@ -204,15 +205,16 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchIn
bf.append(TCFModel.getErrorMessage(error, true));
}
- String getDetailText(Runnable done) {
- if (!context.validate(done)) return null;
- if (!value.validate(done)) return null;
- StringBuffer bf = new StringBuffer();
- appendErrorText(bf, context.getError());
- if (bf.length() == 0) {
- appendErrorText(bf, value.getError());
+ public boolean getDetailText(StyledStringBuffer bf, Runnable done) {
+ if (!context.validate(done)) return false;
+ if (!value.validate(done)) return false;
+ int pos = bf.length();
+ appendErrorText(bf.getStringBuffer(), context.getError());
+ if (bf.length() == 0) appendErrorText(bf.getStringBuffer(), value.getError());
+ if (bf.length() > pos) {
+ bf.append(pos, 0, null, rgb_error);
}
- if (bf.length() == 0) {
+ else {
IRegisters.RegistersContext ctx = context.getData();
if (ctx != null) {
if (ctx.getDescription() != null) {
@@ -243,21 +245,21 @@ public class TCFNodeRegister extends TCFNode implements IElementEditor, IWatchIn
}
byte[] v = value.getData();
if (v != null) {
- bf.append("Hex: ");
+ bf.append("Hex: ", SWT.BOLD);
bf.append(toNumberString(16));
bf.append(", ");
- bf.append("Dec: ");
+ bf.append("Dec: ", SWT.BOLD);
bf.append(toNumberString(10));
bf.append(", ");
- bf.append("Oct: ");
+ bf.append("Oct: ", SWT.BOLD);
bf.append(toNumberString(8));
bf.append('\n');
- bf.append("Bin: ");
+ bf.append("Bin: ", SWT.BOLD);
bf.append(toNumberString(2));
bf.append('\n');
}
}
- return bf.toString();
+ return true;
}
@Override

Back to the top