Skip to main content
summaryrefslogtreecommitdiffstats
path: root/dsf
diff options
context:
space:
mode:
authorAnton Leherbauer2011-09-21 07:51:29 -0400
committerAnton Leherbauer2011-12-21 08:11:35 -0500
commitc7803d38e9dfeae5e842eaca263450268f12a3dc (patch)
treea8c10f066148a9843b9d8b60c55ea894bb5f7e3c /dsf
parent2dea3d4a339d49579b06d13399e66adb03556fd8 (diff)
downloadorg.eclipse.cdt-c7803d38e9dfeae5e842eaca263450268f12a3dc.tar.gz
org.eclipse.cdt-c7803d38e9dfeae5e842eaca263450268f12a3dc.tar.xz
org.eclipse.cdt-c7803d38e9dfeae5e842eaca263450268f12a3dc.zip
Bug 366942 - [disassembly] Extension point for contributing ruler columns
Diffstat (limited to 'dsf')
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/.settings/.api_filters8
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/plugin.properties7
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/plugin.xml55
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AddressRulerColumn.java68
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java209
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.java4
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.properties12
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java468
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/FunctionOffsetRulerColumn.java21
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java27
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java11
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferenceConstants.java6
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferencePage.java71
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyRulerColumn.java (renamed from dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyRulerColumn.java)66
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyViewer.java (renamed from dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyViewer.java)55
15 files changed, 665 insertions, 423 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/.settings/.api_filters b/dsf/org.eclipse.cdt.dsf.ui/.settings/.api_filters
index 6dfc9ce04a..d89b3e85b3 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/.settings/.api_filters
+++ b/dsf/org.eclipse.cdt.dsf.ui/.settings/.api_filters
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.cdt.dsf.ui" version="2">
+ <resource path="src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java" type="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyColumnSupport">
+ <filter comment="Bug 366942 - [disassembly] Extension point for contributing ruler columns" id="574619656">
+ <message_arguments>
+ <message_argument value="IColumnSupport"/>
+ <message_argument value="DisassemblyColumnSupport"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java" type="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart">
<filter id="571473929">
<message_arguments>
diff --git a/dsf/org.eclipse.cdt.dsf.ui/plugin.properties b/dsf/org.eclipse.cdt.dsf.ui/plugin.properties
index b88d2ccf30..fa604141f8 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/plugin.properties
+++ b/dsf/org.eclipse.cdt.dsf.ui/plugin.properties
@@ -66,4 +66,9 @@ debugUpdateModes.label = Debug Update Modes
# Pin & Clone
PinView.name = Pin to Debug Context
-OpenNewView.name = Open New View \ No newline at end of file
+OpenNewView.name = Open New View
+
+# Disassembly ruler columns
+disassemblyRulerColumn.addresses=Addresses
+disassemblyRulerColumn.functionOffsets=Function Offsets
+disassemblyRulerColumn.opcodes=Opcodes
diff --git a/dsf/org.eclipse.cdt.dsf.ui/plugin.xml b/dsf/org.eclipse.cdt.dsf.ui/plugin.xml
index 6fbd334683..95ad92131b 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/plugin.xml
+++ b/dsf/org.eclipse.cdt.dsf.ui/plugin.xml
@@ -789,6 +789,59 @@
name="%disassemblyView.name">
</editor>
</extension>
-
+ <extension
+ point="org.eclipse.cdt.debug.ui.disassemblyRulerColumns">
+ <column
+ class="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.AddressRulerColumn"
+ enabled="true"
+ global="false"
+ id="org.eclipse.cdt.dsf.ui.disassemblyColumn.address"
+ includeInMenu="true"
+ name="%disassemblyRulerColumn.addresses">
+ <placement
+ gravity="0.9">
+ </placement>
+ <targetClass
+ class="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart">
+ </targetClass>
+ </column>
+ <column
+ class="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.FunctionOffsetRulerColumn"
+ enabled="false"
+ global="true"
+ id="org.eclipse.cdt.dsf.ui.disassemblyColumn.functionOffsets"
+ includeInMenu="true"
+ name="%disassemblyRulerColumn.functionOffsets">
+ <placement
+ gravity="0.9">
+ <after
+ id="org.eclipse.cdt.dsf.ui.disassemblyColumn.address">
+ </after>
+ <after
+ id="org.eclipse.cdt.dsf.ui.disassemblyColumn.opcodes">
+ </after>
+ </placement>
+ <targetClass
+ class="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart">
+ </targetClass>
+ </column>
+ <column
+ class="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.OpcodeRulerColumn"
+ enabled="false"
+ global="true"
+ id="org.eclipse.cdt.dsf.ui.disassemblyColumn.opcodes"
+ includeInMenu="true"
+ name="%disassemblyRulerColumn.opcodes">
+ <placement
+ gravity="0.9">
+ <after
+ id="org.eclipse.cdt.dsf.ui.disassemblyColumn.address">
+ </after>
+ </placement>
+ <targetClass
+ class="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyPart">
+ </targetClass>
+ </column>
+ </extension>
</plugin>
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AddressRulerColumn.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AddressRulerColumn.java
index d5cfa50889..00dee41f8b 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AddressRulerColumn.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AddressRulerColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Wind River Systems and others.
+ * Copyright (c) 2007, 2011 Wind River Systems 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
@@ -15,6 +15,9 @@ import java.math.BigInteger;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.SourceFileInfo;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.preferences.DisassemblyPreferenceConstants;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyRulerColumn;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.source.IAnnotationHover;
import org.eclipse.jface.text.source.IAnnotationModel;
@@ -22,6 +25,7 @@ import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.jface.text.source.IVerticalRulerInfoExtension;
import org.eclipse.jface.text.source.IVerticalRulerListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
/**
@@ -29,6 +33,8 @@ import org.eclipse.swt.SWT;
*/
public class AddressRulerColumn extends DisassemblyRulerColumn implements IVerticalRulerInfo, IVerticalRulerInfoExtension, IAnnotationHover {
+ public static final String ID = "org.eclipse.cdt.dsf.ui.disassemblyColumn.address"; //$NON-NLS-1$
+
private int fRadix;
private boolean fShowRadixPrefix;
private String fRadixPrefix;
@@ -40,9 +46,11 @@ public class AddressRulerColumn extends DisassemblyRulerColumn implements IVerti
*/
public AddressRulerColumn() {
super(SWT.LEFT);
- setShowRadixPrefix(true);
+ IPreferenceStore prefs = getPreferenceStore();
+ setForeground(getColor(DisassemblyPreferenceConstants.ADDRESS_COLOR));
+ setRadix(prefs.getInt(DisassemblyPreferenceConstants.ADDRESS_RADIX));
+ setShowRadixPrefix(prefs.getBoolean(DisassemblyPreferenceConstants.SHOW_ADDRESS_RADIX));
setAddressSize(32);
- setRadix(16);
}
@Override
@@ -128,49 +136,35 @@ public class AddressRulerColumn extends DisassemblyRulerColumn implements IVerti
return buf.toString();
}
- /*
- * @see org.eclipse.jface.text.source.IVerticalRulerInfo#getLineOfLastMouseButtonActivity()
- */
+ @Override
public int getLineOfLastMouseButtonActivity() {
return getParentRuler().getLineOfLastMouseButtonActivity();
}
- /*
- * @see org.eclipse.jface.text.source.IVerticalRulerInfo#toDocumentLineNumber(int)
- */
+ @Override
public int toDocumentLineNumber(int y_coordinate) {
return getParentRuler().toDocumentLineNumber(y_coordinate);
}
- /*
- * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#getHover()
- */
+ @Override
public IAnnotationHover getHover() {
return this;
}
- /*
- * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#getModel()
- */
+ @Override
public IAnnotationModel getModel() {
return null;
}
- /*
- * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#addVerticalRulerListener(org.eclipse.jface.text.source.IVerticalRulerListener)
- */
+ @Override
public void addVerticalRulerListener(IVerticalRulerListener listener) {
}
- /*
- * @see org.eclipse.jface.text.source.IVerticalRulerInfoExtension#removeVerticalRulerListener(org.eclipse.jface.text.source.IVerticalRulerListener)
- */
+ @Override
public void removeVerticalRulerListener(IVerticalRulerListener listener) {
}
- /*
- * @see org.eclipse.jface.text.source.IAnnotationHover#getHoverInfo(org.eclipse.jface.text.source.ISourceViewer, int)
- */
+ @Override
public String getHoverInfo(ISourceViewer sourceViewer, int line) {
DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument();
BigInteger address = doc.getAddressOfLine(line);
@@ -181,4 +175,30 @@ public class AddressRulerColumn extends DisassemblyRulerColumn implements IVerti
return null;
}
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ String property = event.getProperty();
+ IPreferenceStore store = getPreferenceStore();
+ boolean needRedraw = false;
+ if (DisassemblyPreferenceConstants.ADDRESS_COLOR.equals(property)) {
+ setForeground(getColor(property));
+ needRedraw = true;
+ } else if (DisassemblyPreferenceConstants.ADDRESS_RADIX.equals(property)) {
+ setRadix(store.getInt(property));
+ updateNumberOfDigits();
+ computeIndentations();
+ layout(false);
+ needRedraw = true;
+ } else if (DisassemblyPreferenceConstants.SHOW_ADDRESS_RADIX.equals(property)) {
+ setShowRadixPrefix(store.getBoolean(property));
+ updateNumberOfDigits();
+ computeIndentations();
+ layout(false);
+ needRedraw = true;
+ }
+ if (needRedraw) {
+ redraw();
+ }
+ }
+
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java
new file mode 100644
index 0000000000..09f48dbba8
--- /dev/null
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * 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.cdt.dsf.debug.internal.ui.disassembly;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.cdt.debug.ui.disassembly.rulers.IColumnSupport;
+import org.eclipse.cdt.debug.ui.disassembly.rulers.IContributedRulerColumn;
+import org.eclipse.cdt.debug.ui.disassembly.rulers.RulerColumnDescriptor;
+import org.eclipse.cdt.debug.ui.disassembly.rulers.RulerColumnRegistry;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.text.source.CompositeRuler;
+import org.eclipse.jface.text.source.IVerticalRulerColumn;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.jface.util.SafeRunnable;
+
+/**
+ * Implements the ruler column support of for the given disassembly part.
+ * <p>
+ * This is currently only used to support vertical ruler columns.
+ * </p>
+ */
+class DisassemblyColumnSupport implements IColumnSupport {
+ private final DisassemblyPart fDisassembly;
+ private final RulerColumnRegistry fRegistry;
+ private final List<IContributedRulerColumn> fColumns;
+
+ /**
+ * Creates a new column support for the given disassembly part. Only the disassembly part itself should normally
+ * create such an instance.
+ *
+ * @param editor the disassembly part
+ * @param registry the contribution registry to refer to
+ */
+ public DisassemblyColumnSupport(DisassemblyPart disassembly, RulerColumnRegistry registry) {
+ Assert.isLegal(disassembly != null);
+ Assert.isLegal(registry != null);
+ fDisassembly= disassembly;
+ fRegistry= registry;
+ fColumns= new ArrayList<IContributedRulerColumn>();
+ }
+
+ /*
+ * @see org.eclipse.ui.texteditor.IColumnSupport#setColumnVisible(java.lang.String, boolean)
+ */
+ @Override
+ public final void setColumnVisible(RulerColumnDescriptor descriptor, boolean visible) {
+ Assert.isLegal(descriptor != null);
+
+ final CompositeRuler ruler= getRuler();
+ if (ruler == null)
+ return;
+
+ if (!isColumnSupported(descriptor))
+ visible= false;
+
+ if (isColumnVisible(descriptor)) {
+ if (!visible)
+ removeColumn(ruler, descriptor);
+ } else {
+ if (visible)
+ addColumn(ruler, descriptor);
+ }
+ }
+
+ private void addColumn(final CompositeRuler ruler, final RulerColumnDescriptor descriptor) {
+
+ final int idx= computeIndex(ruler, descriptor);
+
+ SafeRunnable runnable= new SafeRunnable() {
+ @Override
+ public void run() throws Exception {
+ IContributedRulerColumn column= descriptor.createColumn(fDisassembly);
+ fColumns.add(column);
+ initializeColumn(column);
+ ruler.addDecorator(idx, column);
+ }
+ };
+ SafeRunner.run(runnable);
+ }
+
+ /**
+ * Hook to let subclasses initialize a newly created column.
+ * <p>
+ * Subclasses may extend this method.</p>
+ *
+ * @param column the created column
+ */
+ protected void initializeColumn(IContributedRulerColumn column) {
+ }
+
+ private void removeColumn(final CompositeRuler ruler, final RulerColumnDescriptor descriptor) {
+ removeColumn(ruler, getVisibleColumn(ruler, descriptor));
+ }
+
+ private void removeColumn(final CompositeRuler ruler, final IContributedRulerColumn rulerColumn) {
+ if (rulerColumn != null) {
+ SafeRunnable runnable= new SafeRunnable() {
+ @Override
+ public void run() throws Exception {
+ if (ruler != null)
+ ruler.removeDecorator(rulerColumn);
+ rulerColumn.columnRemoved();
+ }
+ };
+ SafeRunner.run(runnable);
+ }
+ }
+
+ /**
+ * Returns the currently visible column matching <code>id</code>, <code>null</code> if
+ * none.
+ *
+ * @param ruler the composite ruler to scan
+ * @param descriptor the descriptor of the column of interest
+ * @return the matching column or <code>null</code>
+ */
+ private IContributedRulerColumn getVisibleColumn(CompositeRuler ruler, RulerColumnDescriptor descriptor) {
+ for (Iterator<?> it= ruler.getDecoratorIterator(); it.hasNext();) {
+ IVerticalRulerColumn column= (IVerticalRulerColumn)it.next();
+ if (column instanceof IContributedRulerColumn) {
+ IContributedRulerColumn rulerColumn= (IContributedRulerColumn)column;
+ RulerColumnDescriptor rcd= rulerColumn.getDescriptor();
+ if (descriptor.equals(rcd))
+ return rulerColumn;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Computes the insertion index for a column contribution into the currently visible columns.
+ *
+ * @param ruler the composite ruler into which to insert the column
+ * @param descriptor the descriptor to compute the index for
+ * @return the insertion index for a new column
+ */
+ private int computeIndex(CompositeRuler ruler, RulerColumnDescriptor descriptor) {
+ int index= 0;
+ List<?> all= fRegistry.getColumnDescriptors();
+ int newPos= all.indexOf(descriptor);
+ for (Iterator<?> it= ruler.getDecoratorIterator(); it.hasNext();) {
+ IVerticalRulerColumn column= (IVerticalRulerColumn) it.next();
+ if (column instanceof IContributedRulerColumn) {
+ RulerColumnDescriptor rcd= ((IContributedRulerColumn)column).getDescriptor();
+ if (rcd != null && all.indexOf(rcd) > newPos)
+ break;
+ }
+ index++;
+ }
+ return index;
+ }
+
+ @Override
+ public final boolean isColumnVisible(RulerColumnDescriptor descriptor) {
+ Assert.isLegal(descriptor != null);
+ CompositeRuler ruler= getRuler();
+ return ruler != null && getVisibleColumn(ruler, descriptor) != null;
+ }
+
+ @Override
+ public final boolean isColumnSupported(RulerColumnDescriptor descriptor) {
+ Assert.isLegal(descriptor != null);
+ if (getRuler() == null)
+ return false;
+
+ if (descriptor == null)
+ return false;
+
+ return descriptor.matchesPart(fDisassembly);
+ }
+
+ /**
+ * Returns the disassembly part's vertical ruler, if it is a {@link CompositeRuler}, <code>null</code>
+ * otherwise.
+ *
+ * @return the disassembly part's {@link CompositeRuler} or <code>null</code>
+ */
+ private CompositeRuler getRuler() {
+ Object ruler= fDisassembly.getAdapter(IVerticalRulerInfo.class);
+ if (ruler instanceof CompositeRuler)
+ return (CompositeRuler) ruler;
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Subclasses may extend this method.</p>
+ *
+ */
+ @Override
+ public void dispose() {
+ for (Iterator<IContributedRulerColumn> iter= new ArrayList<IContributedRulerColumn>(fColumns).iterator(); iter.hasNext();)
+ removeColumn(getRuler(), iter.next());
+ fColumns.clear();
+ }
+}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.java
index 43f06655e3..909f8e9f93 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.java
@@ -29,9 +29,6 @@ public final class DisassemblyMessages extends NLS {
return fgBundleForConstructedKeys;
}
- public static String Disassembly_action_ShowAddresses_label;
- public static String Disassembly_action_ShowFunctionOffsets_label;
- public static String Disassembly_action_ShowOpcode_label;
public static String Disassembly_action_ShowSource_label;
public static String Disassembly_action_ShowSymbols_label;
public static String Disassembly_action_GotoPC_label;
@@ -52,6 +49,7 @@ public final class DisassemblyMessages extends NLS {
public static String Disassembly_log_error_expression_eval;
public static String Disassembly_log_error_locateFile;
public static String Disassembly_log_error_readFile;
+ public static String DisassemblyPart_showRulerColumn_label;
public static String DisassemblyPreferencePage_addressFormatTooltip;
public static String DisassemblyPreferencePage_addressRadix;
public static String DisassemblyPreferencePage_showAddressRadix;
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.properties b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.properties
index 9ba33204d5..a4098d6aa1 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.properties
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.properties
@@ -11,9 +11,6 @@
# Patrick Chuong (Texas Instruments) - Bug fix (329682)
##########################################################################
-Disassembly_action_ShowAddresses_label=Show Addresses
-Disassembly_action_ShowFunctionOffsets_label=Show Function Offsets
-Disassembly_action_ShowOpcode_label=Show Opcodes
Disassembly_action_ShowSource_label=Show Source
Disassembly_action_ShowSymbols_label=Show Symbols
Disassembly_action_GotoPC_label=Go to Program Counter
@@ -44,9 +41,10 @@ Disassembly_log_error_expression_eval=Expression does not evaluate to an address
Disassembly_log_error_locateFile=Unable to locate file:\
Disassembly_log_error_readFile=Cannot read source file:\
+DisassemblyPart_showRulerColumn_label=Show {0}
DisassemblyPreferencePage_addressFormatTooltip=Use this format for the instruction address
DisassemblyPreferencePage_addressRadix=Address display format:
-DisassemblyPreferencePage_showAddressRadix=Force radix prefixes
+DisassemblyPreferencePage_showAddressRadix=Force radix prefix
DisassemblyPreferencePage_showSource=Show source
DisassemblyPreferencePage_showSourceTooltip=Show source code interleaved with instructions
DisassemblyPreferencePage_showSymbols=Show symbols
@@ -56,14 +54,8 @@ DisassemblyPreferencePage_error_negative_number=Address cannot be negative
DisassemblyPreferencePage_radix_octal=Octal
DisassemblyPreferencePage_radix_decimal=Decimal
DisassemblyPreferencePage_radix_hexadecimal=Hexadecimal
-DisassemblyPreferencePage_showFunctionOffsets=Show function offsets
-DisassemblyPreferencePage_showFunctionOffsetsTooltip=Show offsets of addresses in a function
-DisassemblyPreferencePage_showCodeBytes=Show instruction code bytes
-DisassemblyPreferencePage_showCodeBytesTooltip=Show the value of the address for the instruction code bytes
-DisassemblyPreferencePage_showAddress=Show instruction address
DisassemblyPreferencePage_OpcodeFormatTooltip=Use this format for the instruction value
DisassemblyPreferencePage_OpcodeFormat=Opcode display format:
-DisassemblyPreferencePage_showAddressTooltip=Show the address of each instruction
DisassemblyPreferencePage_showRadixTooltip=Show '0x' with hexadecimal addresses
DisassemblyIPAnnotation_primary=Debug Current Instruction Pointer
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
index b90e8e99e9..275588b02d 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
@@ -38,6 +38,12 @@ import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.LabelPosition;
+import org.eclipse.cdt.debug.internal.ui.preferences.StringSetSerializer;
+import org.eclipse.cdt.debug.ui.disassembly.rulers.IColumnSupport;
+import org.eclipse.cdt.debug.ui.disassembly.rulers.IContributedRulerColumn;
+import org.eclipse.cdt.debug.ui.disassembly.rulers.RulerColumnDescriptor;
+import org.eclipse.cdt.debug.ui.disassembly.rulers.RulerColumnPreferenceAdapter;
+import org.eclipse.cdt.debug.ui.disassembly.rulers.RulerColumnRegistry;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.AbstractDisassemblyAction;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.ActionGotoAddress;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.ActionGotoProgramCounter;
@@ -50,6 +56,8 @@ import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocume
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.SourceFileInfo;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.preferences.DisassemblyPreferenceConstants;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.presentation.DisassemblyIPAnnotation;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyRulerColumn;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyViewer;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.util.HSL;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
@@ -125,6 +133,7 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DragSource;
import org.eclipse.swt.dnd.DropTarget;
@@ -133,6 +142,7 @@ import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
@@ -171,6 +181,9 @@ import org.eclipse.ui.texteditor.IUpdate;
import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
+
+import com.ibm.icu.text.MessageFormat;
+
/**
* DisassemblyPart
*/
@@ -206,17 +219,19 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
public static final String KEY_BINDING_CONTEXT_DISASSEMBLY = "org.eclipse.cdt.dsf.debug.ui.disassembly.context"; //$NON-NLS-1$
+ /**
+ * A named preference that controls the visible ruler column contributions.
+ */
+ public static final String PREFERENCE_RULER_CONTRIBUTIONS= "rulerContributions"; //$NON-NLS-1$
+
protected DisassemblyViewer fViewer;
protected AbstractDisassemblyAction fActionGotoPC;
protected AbstractDisassemblyAction fActionGotoAddress;
protected AbstractDisassemblyAction fActionToggleSource;
- private AbstractDisassemblyAction fActionToggleFunctionColumn;
- private AbstractDisassemblyAction fActionToggleOpcodeColumn;
protected AbstractDisassemblyAction fActionToggleSymbols;
protected AbstractDisassemblyAction fActionRefreshView;
protected Action fActionOpenPreferences;
- private AbstractDisassemblyAction fActionToggleAddressColumn;
private AbstractDisassemblyAction fActionToggleBreakpointEnablement;
protected DisassemblyDocument fDocument;
@@ -244,10 +259,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
private TextViewerDragAdapter fDragSourceAdapter;
private DisassemblyDropAdapter fDropTargetAdapter;
- private FunctionOffsetRulerColumn fFunctionOffsetRulerColumn;
- private OpcodeRulerColumn fOpcodeRulerColumn;
- private AddressRulerColumn fAddressRulerColumn;
-
private BigInteger fStartAddress;
private BigInteger fEndAddress;
private int fAddressSize= 32;
@@ -272,8 +283,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
private List<Action> fSelectionActions = new ArrayList<Action>();
private List<AbstractDisassemblyAction> fStateDependentActions = new ArrayList<AbstractDisassemblyAction>();
private boolean fShowSource;
- private boolean fShowFunctionOffsets;
- private boolean fShowOpcodes;
private boolean fShowSymbols;
private Map<String, Object> fFile2Storage = new HashMap<String, Object>();
private boolean fShowDisassembly = true;
@@ -294,26 +303,34 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
protected IPartListener2 fPartListener =
new IPartListener2() {
+ @Override
public void partActivated(IWorkbenchPartReference partRef) {
}
+ @Override
public void partBroughtToTop(IWorkbenchPartReference partRef) {
}
+ @Override
public void partClosed(IWorkbenchPartReference partRef) {
}
+ @Override
public void partDeactivated(IWorkbenchPartReference partRef) {
}
+ @Override
public void partOpened(IWorkbenchPartReference partRef) {
}
+ @Override
public void partHidden(IWorkbenchPartReference partRef) {
if (partRef.getPart(false) == DisassemblyPart.this) {
setActive(false);
}
}
+ @Override
public void partVisible(IWorkbenchPartReference partRef) {
if (partRef.getPart(false) == DisassemblyPart.this) {
setActive(true);
}
}
+ @Override
public void partInputChanged(IWorkbenchPartReference partRef) {
}
};
@@ -338,6 +355,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
private IDebugContextListener fDebugContextListener;
+ private IColumnSupport fColumnSupport;
+
private final class SyncActiveDebugContextAction extends Action {
public SyncActiveDebugContextAction() {
setChecked(DisassemblyPart.this.isSyncWithActiveDebugContext());
@@ -380,54 +399,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
}
- private final class ActionToggleAddressColumn extends AbstractDisassemblyAction {
- ActionToggleAddressColumn () {
- super(DisassemblyPart.this);
- setText(DisassemblyMessages.Disassembly_action_ShowAddresses_label);
- }
- @Override
- public void run() {
- IPreferenceStore store = DsfUIPlugin.getDefault().getPreferenceStore();
- store.setValue(DisassemblyPreferenceConstants.SHOW_ADDRESS_RULER, !isAddressRulerVisible());
- }
- @Override
- public void update() {
- setChecked(isAddressRulerVisible());
- }
- }
-
- private final class ActionToggleFunctionColumn extends AbstractDisassemblyAction {
- ActionToggleFunctionColumn() {
- super(DisassemblyPart.this);
- setText(DisassemblyMessages.Disassembly_action_ShowFunctionOffsets_label);
- }
- @Override
- public void run() {
- IPreferenceStore store = DsfUIPlugin.getDefault().getPreferenceStore();
- store.setValue(DisassemblyPreferenceConstants.SHOW_FUNCTION_OFFSETS, !isFunctionOffsetsRulerVisible());
- }
- @Override
- public void update() {
- setChecked(isFunctionOffsetsRulerVisible());
- }
- }
-
- private final class ActionToggleOpcodeColumn extends AbstractDisassemblyAction {
- ActionToggleOpcodeColumn() {
- super(DisassemblyPart.this);
- setText(DisassemblyMessages.Disassembly_action_ShowOpcode_label);
- }
- @Override
- public void run() {
- IPreferenceStore store = DsfUIPlugin.getDefault().getPreferenceStore();
- store.setValue(DisassemblyPreferenceConstants.SHOW_CODE_BYTES, !isOpcodeRulerVisible());
- }
- @Override
- public void update() {
- setChecked(isOpcodeRulerVisible());
- }
- }
-
private final class ActionToggleBreakpointEnablement extends AbstractDisassemblyAction {
private IBreakpoint fBreakpoint;
public ActionToggleBreakpointEnablement() {
@@ -511,6 +482,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
*/
+ @Override
public void propertyChange(PropertyChangeEvent event) {
handlePreferenceStoreChanged(event);
}
@@ -537,8 +509,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
else
fEndAddress = new BigInteger(endAddressString, 16);
fShowSource = prefs.getBoolean(DisassemblyPreferenceConstants.SHOW_SOURCE);
- fShowFunctionOffsets = prefs.getBoolean(DisassemblyPreferenceConstants.SHOW_FUNCTION_OFFSETS);
- fShowOpcodes = prefs.getBoolean(DisassemblyPreferenceConstants.SHOW_CODE_BYTES);
fShowSymbols = prefs.getBoolean(DisassemblyPreferenceConstants.SHOW_SYMBOLS);
fUpdateBeforeFocus = !prefs.getBoolean(DisassemblyPreferenceConstants.AVOID_READ_BEFORE_PC);
fPCHistorySizeMax = prefs.getInt(DisassemblyPreferenceConstants.PC_HISTORY_SIZE);
@@ -571,13 +541,76 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
return fViewer != null ? fViewer.getTextWidget() : null;
} else if (IGotoMarker.class.equals(required)) {
return new IGotoMarker() {
+ @Override
public void gotoMarker(IMarker marker) {
DisassemblyPart.this.gotoMarker(marker);
}};
+ } else if (IColumnSupport.class.equals(required)) {
+ if (fColumnSupport == null)
+ fColumnSupport= createColumnSupport();
+ return fColumnSupport;
}
+
return super.getAdapter(required);
}
+ /**
+ * Adds "show" actions for all contributed rulers that support it.
+ *
+ * @param menu the ruler context menu
+ */
+ private void addRulerContributionActions(IMenuManager menu) {
+ // store directly in generic editor preferences
+ final IColumnSupport support= (IColumnSupport) getAdapter(IColumnSupport.class);
+ IPreferenceStore store= DsfUIPlugin.getDefault().getPreferenceStore();
+ final RulerColumnPreferenceAdapter adapter= new RulerColumnPreferenceAdapter(store, PREFERENCE_RULER_CONTRIBUTIONS);
+ List<RulerColumnDescriptor> descriptors= RulerColumnRegistry.getDefault().getColumnDescriptors();
+ for (final RulerColumnDescriptor descriptor : descriptors) {
+ if (!descriptor.isIncludedInMenu() || !support.isColumnSupported(descriptor))
+ continue;
+ final boolean isVisible= support.isColumnVisible(descriptor);
+ IAction action= new Action(MessageFormat.format(DisassemblyMessages.DisassemblyPart_showRulerColumn_label, new Object[] {descriptor.getName()}), IAction.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ if (descriptor.isGlobal())
+ // column state is modified via preference listener
+ adapter.setEnabled(descriptor, !isVisible);
+ else
+ // directly modify column for this editor instance
+ support.setColumnVisible(descriptor, !isVisible);
+ }
+ };
+ action.setChecked(isVisible);
+ action.setImageDescriptor(descriptor.getIcon());
+ menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, action);
+ }
+ }
+
+ /**
+ * Adds enabled ruler contributions to the vertical ruler.
+ *
+ * @param ruler the composite ruler to add contributions to
+ */
+ protected void updateContributedRulerColumns(CompositeRuler ruler) {
+ IColumnSupport support= (IColumnSupport)getAdapter(IColumnSupport.class);
+ if (support == null)
+ return;
+
+ RulerColumnPreferenceAdapter adapter= null;
+ if (fPreferenceStore != null)
+ adapter= new RulerColumnPreferenceAdapter(getPreferenceStore(), PREFERENCE_RULER_CONTRIBUTIONS);
+
+ RulerColumnRegistry registry= RulerColumnRegistry.getDefault();
+ List<RulerColumnDescriptor> descriptors= registry.getColumnDescriptors();
+ for (RulerColumnDescriptor descriptor : descriptors) {
+ support.setColumnVisible(descriptor, adapter == null || adapter.isEnabled(descriptor));
+ }
+ }
+
+ protected IColumnSupport createColumnSupport() {
+ return new DisassemblyColumnSupport(this, RulerColumnRegistry.getDefault());
+ }
+
private void setPreferenceStore(IPreferenceStore store) {
if (fPreferenceStore != null) {
fPreferenceStore.removePropertyChangeListener(fPropertyChangeListener);
@@ -610,28 +643,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (getFontPropertyPreferenceKey().equals(property)) {
initializeViewerFont(fViewer);
- } else if (property.equals(DisassemblyPreferenceConstants.SHOW_ADDRESS_RULER)) {
- fActionToggleAddressColumn.update();
- if (isAddressRulerVisible()) {
- showAddressRuler();
- } else {
- hideAddressRuler();
- }
- } else if (property.equals(DisassemblyPreferenceConstants.ADDRESS_RADIX)) {
- if (fAddressRulerColumn != null) {
- hideAddressRuler();
- showAddressRuler();
- }
- } else if (property.equals(DisassemblyPreferenceConstants.OPCODE_RADIX)) {
- if (isOpcodeRulerVisible()) {
- hideOpcodeRuler();
- showOpcodeRuler();
- }
- } else if (property.equals(DisassemblyPreferenceConstants.SHOW_ADDRESS_RADIX)) {
- if (fAddressRulerColumn != null) {
- hideAddressRuler();
- showAddressRuler();
- }
} else if (property.equals(DisassemblyPreferenceConstants.SHOW_SOURCE)) {
boolean showSource = store.getBoolean(property);
if (fShowSource == showSource) {
@@ -648,22 +659,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fShowSymbols = showSymbols;
fActionToggleSymbols.update();
refreshView(10);
- } else if (property.equals(DisassemblyPreferenceConstants.SHOW_FUNCTION_OFFSETS)) {
- fShowFunctionOffsets = store.getBoolean(property);
- fActionToggleFunctionColumn.update();
- if (isFunctionOffsetsRulerVisible()) {
- showFunctionOffsetsRuler();
- } else {
- hideFunctionOffsetsRuler();
- }
- } else if (property.equals(DisassemblyPreferenceConstants.SHOW_CODE_BYTES)) {
- fShowOpcodes = store.getBoolean(property);
- fActionToggleOpcodeColumn.update();
- if (isOpcodeRulerVisible()) {
- showOpcodeRuler();
- } else {
- hideOpcodeRuler();
- }
} else if (property.equals(DisassemblyPreferenceConstants.AVOID_READ_BEFORE_PC)) {
fUpdateBeforeFocus = !store.getBoolean(property);
updateVisibleArea();
@@ -676,7 +671,18 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
} else if (property.equals(DisassemblyPreferenceConstants.PC_HISTORY_SIZE)) {
fPCHistorySizeMax = store.getInt(property);
+ } else if (PREFERENCE_RULER_CONTRIBUTIONS.equals(property)) {
+ String[] difference= StringSetSerializer.getDifference((String) event.getOldValue(), (String) event.getNewValue());
+ IColumnSupport support= (IColumnSupport) getAdapter(IColumnSupport.class);
+ for (int i= 0; i < difference.length; i++) {
+ RulerColumnDescriptor desc= RulerColumnRegistry.getDefault().getColumnDescriptor(difference[i]);
+ if (desc != null && support.isColumnSupported(desc)) {
+ boolean newState= !support.isColumnVisible(desc);
+ support.setColumnVisible(desc, newState);
+ }
+ }
}
+
}
/**
@@ -691,7 +697,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
parent.setLayout(layout);
fVerticalRuler = createVerticalRuler();
int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION;
- fViewer = new DisassemblyViewer(this, parent, fVerticalRuler, getOverviewRuler(), true, styles);
+ fViewer = new DisassemblyViewer(parent, fVerticalRuler, getOverviewRuler(), true, styles);
SourceViewerConfiguration sourceViewerConfig = new DisassemblyViewerConfiguration(this);
fViewer.addTextPresentationListener(this);
fViewer.configure(sourceViewerConfig);
@@ -715,7 +721,21 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
hookContextMenu();
contributeToActionBars();
+ fViewer.getTextWidget().addVerifyKeyListener(new VerifyKeyListener() {
+ @Override
+ public void verifyKey(VerifyEvent event) {
+ switch (event.keyCode) {
+ case SWT.PAGE_UP:
+ case SWT.PAGE_DOWN:
+ case SWT.ARROW_UP:
+ case SWT.ARROW_DOWN:
+ event.doit = !keyScroll(event.keyCode);
+ }
+ }
+ });
+
fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
updateSelectionDependentActions();
}
@@ -726,14 +746,9 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fSourceColor = getSharedColors().getColor(new RGB(64, 0, 80));
fLabelColor = getSharedColors().getColor(new RGB(0, 0, 96));
- if (isAddressRulerVisible()) {
- showAddressRuler();
- }
- if (isFunctionOffsetsRulerVisible()) {
- showFunctionOffsetsRuler();
- }
- if (isOpcodeRulerVisible()) {
- showOpcodeRuler();
+ IVerticalRuler ruler= getVerticalRuler();
+ if (ruler instanceof CompositeRuler) {
+ updateContributedRulerColumns((CompositeRuler) ruler);
}
initDragAndDrop();
@@ -756,7 +771,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
super.setSite(site);
site.getPage().addPartListener(fPartListener);
fDebugContextListener = new IDebugContextListener() {
- public void debugContextChanged(DebugContextEvent event) {
+ @Override
+ public void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
updateDebugContext();
}
@@ -823,6 +839,10 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
fPropertyChangeListener = null;
}
+ if (fColumnSupport != null) {
+ fColumnSupport.dispose();
+ fColumnSupport= null;
+ }
fDocument.dispose();
fDocument = null;
@@ -1043,44 +1063,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
/**
- * Creates a new address ruler column that is appropriately initialized.
- *
- * @return the created line number column
- */
- protected IVerticalRulerColumn createAddressRulerColumn() {
- fAddressRulerColumn= new AddressRulerColumn();
- initializeRulerColumn(fAddressRulerColumn, DisassemblyPreferenceConstants.ADDRESS_COLOR);
- IPreferenceStore prefs = getPreferenceStore();
- fAddressRulerColumn.setRadix(prefs.getInt(DisassemblyPreferenceConstants.ADDRESS_RADIX));
- fAddressRulerColumn.setShowRadixPrefix(prefs.getBoolean(DisassemblyPreferenceConstants.SHOW_ADDRESS_RADIX));
- return fAddressRulerColumn;
- }
-
- /**
- * Creates a new ruler column that is appropriately initialized.
- *
- * @return the created line number column
- */
- protected IVerticalRulerColumn createFunctionOffsetsRulerColumn() {
- fFunctionOffsetRulerColumn= new FunctionOffsetRulerColumn();
-
- initializeRulerColumn(fFunctionOffsetRulerColumn, DisassemblyPreferenceConstants.FUNCTION_OFFSETS_COLOR);
-
- return fFunctionOffsetRulerColumn;
- }
-
- protected IVerticalRulerColumn createOpcodeRulerColumn() {
- fOpcodeRulerColumn= new OpcodeRulerColumn();
-
- initializeRulerColumn(fOpcodeRulerColumn, DisassemblyPreferenceConstants.CODE_BYTES_COLOR);
-
- IPreferenceStore prefs = getPreferenceStore();
- fOpcodeRulerColumn.setRadix(prefs.getInt(DisassemblyPreferenceConstants.OPCODE_RADIX));
-
- return fOpcodeRulerColumn;
- }
-
- /**
* Initializes the given address ruler column from the preference store.
*
* @param rulerColumn the ruler column to be initialized
@@ -1128,99 +1110,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
return ruler;
}
- private boolean isAddressRulerVisible() {
- return getPreferenceStore().getBoolean(DisassemblyPreferenceConstants.SHOW_ADDRESS_RULER);
- }
-
- /**
- * Shows the address ruler column.
- */
- private void showAddressRuler() {
- if (fAddressRulerColumn == null) {
- IVerticalRuler v= getVerticalRuler();
- if (v instanceof CompositeRuler) {
- CompositeRuler c= (CompositeRuler) v;
- c.addDecorator(1, createAddressRulerColumn());
- }
- }
- }
-
- /**
- * Hides the address ruler column.
- */
- private void hideAddressRuler() {
- if (fAddressRulerColumn != null) {
- IVerticalRuler v= getVerticalRuler();
- if (v instanceof CompositeRuler) {
- CompositeRuler c= (CompositeRuler) v;
- c.removeDecorator(fAddressRulerColumn);
- }
- fAddressRulerColumn = null;
- }
- }
-
- private boolean isFunctionOffsetsRulerVisible() {
- return fShowFunctionOffsets;
- }
-
- private boolean isOpcodeRulerVisible() {
- return fShowOpcodes;
- }
-
- /**
- * Shows the function offset ruler column.
- */
- private void showFunctionOffsetsRuler() {
- if (fFunctionOffsetRulerColumn == null) {
- IVerticalRuler v= getVerticalRuler();
- if (v instanceof CompositeRuler) {
- CompositeRuler c= (CompositeRuler) v;
- c.addDecorator(3, createFunctionOffsetsRulerColumn());
- }
- }
- }
-
- /**
- * Hides the function offset ruler column.
- */
- private void hideFunctionOffsetsRuler() {
- if (fFunctionOffsetRulerColumn != null) {
- IVerticalRuler v= getVerticalRuler();
- if (v instanceof CompositeRuler) {
- CompositeRuler c= (CompositeRuler) v;
- c.removeDecorator(fFunctionOffsetRulerColumn);
- }
- fFunctionOffsetRulerColumn = null;
- }
- }
-
- /**
- * Shows the opcode ruler column.
- */
- private void showOpcodeRuler() {
- if (fOpcodeRulerColumn == null) {
- IVerticalRuler v= getVerticalRuler();
- if (v instanceof CompositeRuler) {
- CompositeRuler c= (CompositeRuler) v;
- c.addDecorator(2, createOpcodeRulerColumn());
- }
- }
- }
-
- /**
- * Hides the opcode ruler column.
- */
- private void hideOpcodeRuler() {
- if (fOpcodeRulerColumn != null) {
- IVerticalRuler v= getVerticalRuler();
- if (v instanceof CompositeRuler) {
- CompositeRuler c= (CompositeRuler) v;
- c.removeDecorator(fOpcodeRulerColumn);
- }
- fOpcodeRulerColumn = null;
- }
- }
-
/**
* Returns the annotation access.
*
@@ -1246,6 +1135,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
MenuManager menuMgr = new MenuManager(id, id);
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
+ @Override
public void menuAboutToShow(IMenuManager manager) {
DisassemblyPart.this.fillContextMenu(manager);
}
@@ -1260,6 +1150,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
MenuManager menuMgr = new MenuManager(id, id);
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
+ @Override
public void menuAboutToShow(IMenuManager manager) {
DisassemblyPart.this.fillRulerContextMenu(manager);
}
@@ -1315,9 +1206,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
protected void fillRulerContextMenu(IMenuManager manager) {
fActionToggleBreakpointEnablement.update();
- fActionToggleAddressColumn.update();
- fActionToggleOpcodeColumn.update();
- fActionToggleFunctionColumn.update();
manager.add(new GroupMarker("group.top")); // ICommonMenuConstants.GROUP_TOP //$NON-NLS-1$
manager.add(new Separator("group.breakpoints")); //$NON-NLS-1$
@@ -1327,9 +1215,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
manager.add(new GroupMarker(ITextEditorActionConstants.GROUP_RESTORE));
manager.add(new Separator("add")); //$NON-NLS-1$
manager.add(new Separator(ITextEditorActionConstants.GROUP_RULERS));
- manager.add(fActionToggleAddressColumn);
- manager.add(fActionToggleOpcodeColumn);
- manager.add(fActionToggleFunctionColumn);
+ addRulerContributionActions(manager);
manager.add(new Separator(ITextEditorActionConstants.GROUP_REST));
for (Object listener : fRulerContextMenuListeners.getListeners())
@@ -1429,9 +1315,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
});
fActionToggleBreakpointEnablement = new ActionToggleBreakpointEnablement();
- fActionToggleAddressColumn = new ActionToggleAddressColumn();
- fActionToggleOpcodeColumn = new ActionToggleOpcodeColumn();
- fActionToggleFunctionColumn = new ActionToggleFunctionColumn();
fActionToggleSymbols = new ActionToggleSymbols();
fActionRefreshView = new ActionRefreshView();
fSyncAction = new SyncActiveDebugContextAction();
@@ -1457,6 +1340,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart#gotoProgramCounter()
*/
+ @Override
public final void gotoProgramCounter() {
if (fPCAddress != PC_RUNNING) {
fPCLastAddress = PC_UNKNOWN;
@@ -1467,6 +1351,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart#gotoAddress(java.math.BigInteger)
*/
+ @Override
public final void gotoAddress(IAddress address) {
if (address != null) {
gotoAddress(address.getValue());
@@ -1486,6 +1371,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#gotoAddress(java.math.BigInteger)
*/
+ @Override
public final void gotoAddress(BigInteger address) {
fFocusAddress = address;
if (fDebugSessionId == null) {
@@ -1517,6 +1403,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart#gotoSymbol(java.lang.String)
*/
+ @Override
public final void gotoSymbol(final String symbol) {
if (!fActive || fBackend == null || !fBackend.hasFrameContext()) {
return;
@@ -1563,12 +1450,14 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see org.eclipse.jface.text.IViewportListener#viewportChanged(int)
*/
+ @Override
public void viewportChanged(int verticalOffset) {
if (fDebugSessionId != null && fGotoAddressPending == PC_UNKNOWN && fScrollPos == null && !fUpdatePending && !fRefreshViewPending) {
fUpdatePending = true;
final int updateCount = fUpdateCount;
invokeLater(new Runnable() {
- public void run() {
+ @Override
+ public void run() {
if (updateCount == fUpdateCount) {
assert fUpdatePending;
if (fUpdatePending) {
@@ -1586,6 +1475,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
*
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#updateVisibleArea()
*/
+ @Override
public void updateVisibleArea() {
assert isGuiThread();
if (!fActive || fUpdatePending || fViewer == null || fDebugSessionId == null) {
@@ -1699,6 +1589,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#asyncExec(java.lang.Runnable)
*/
+ @Override
public void asyncExec(Runnable runnable) {
if (fViewer != null) {
fViewer.getControl().getDisplay().asyncExec(runnable);
@@ -1718,6 +1609,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
*
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#updateInvalidSource()
*/
+ @Override
public void updateInvalidSource() {
assert isGuiThread();
if (fViewer == null) {
@@ -1765,7 +1657,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
return;
}
startUpdate(new Runnable() {
- public void run() {
+ @Override
+ public void run() {
if (DEBUG) System.out.println("retrieveDisassembly "+file); //$NON-NLS-1$
fBackend.retrieveDisassembly(file, lines, fEndAddress, mixed, fShowSymbols, fShowDisassembly);
}
@@ -1783,6 +1676,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#retrieveDisassembly(java.math.BigInteger, java.math.BigInteger, int, boolean, boolean)
*/
+ @Override
public void retrieveDisassembly(final BigInteger startAddress, BigInteger endAddress, final int linesHint, boolean mixed, boolean ignoreFile) {
assert isGuiThread();
assert !fUpdatePending;
@@ -1811,6 +1705,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#insertError(java.math.BigInteger, java.lang.String)
*/
+ @Override
public void insertError(BigInteger address, String message) {
assert isGuiThread();
AddressRangePosition p = null;
@@ -1828,6 +1723,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#getAddressSize()
*/
+ @Override
public int getAddressSize() {
assert isGuiThread();
return fAddressSize;
@@ -1836,6 +1732,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#addressSizeChanged(int)
*/
+ @Override
public void addressSizeChanged(int addressSize) {
assert isGuiThread();
BigInteger oldEndAddress= fEndAddress;
@@ -1864,7 +1761,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
} else {
return;
}
- if (fAddressRulerColumn != null) {
+ AddressRulerColumn fAddressRulerColumn = (AddressRulerColumn) getRulerColumn(AddressRulerColumn.ID);
+ if (fAddressRulerColumn != null) {
fAddressRulerColumn.setAddressSize(addressSize);
if (fComposite != null) {
fComposite.layout(true);
@@ -1872,9 +1770,24 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
}
+ private IContributedRulerColumn getRulerColumn(String id) {
+ CompositeRuler compositeRuler = (CompositeRuler) getVerticalRuler();
+ for (Iterator<?> iter = compositeRuler.getDecoratorIterator(); iter.hasNext();) {
+ IVerticalRulerColumn column = (IVerticalRulerColumn) iter.next();
+ if (column instanceof IContributedRulerColumn) {
+ IContributedRulerColumn contributedColumn = (IContributedRulerColumn) column;
+ if (id.equals(contributedColumn.getDescriptor().getId())) {
+ return contributedColumn;
+ }
+ }
+ }
+ return null;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#getPositionOfAddress(java.math.BigInteger)
*/
+ @Override
public AddressRangePosition getPositionOfAddress(BigInteger address) {
assert isGuiThread();
if (address == null || address.compareTo(BigInteger.ZERO) < 0) {
@@ -1967,6 +1880,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
if (needUpdate && fViewer != null) {
startUpdate(new Runnable() {
+ @Override
public void run() {
debugContextChanged();
}
@@ -1980,7 +1894,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
final int updateCount = fUpdateCount;
final SafeRunnable safeUpdate = new SafeRunnable() {
- public void run() {
+ @Override
+ public void run() {
if (updateCount == fUpdateCount) {
update.run();
}
@@ -1992,7 +1907,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
};
if (fUpdatePending) {
invokeLater(new Runnable() {
- public void run() {
+ @Override
+ public void run() {
if (updateCount == fUpdateCount) {
SafeRunner.run(safeUpdate);
}
@@ -2057,6 +1973,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fRefreshViewPending = true;
final long refreshViewScheduled = System.currentTimeMillis() + delay;
final Runnable refresh = new Runnable() {
+ @Override
public void run() {
fRefreshViewPending = false;
long now = System.currentTimeMillis();
@@ -2087,6 +2004,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}};
if (delay > 0) {
invokeLater(delay, new Runnable() {
+ @Override
public void run() {
doScrollLocked(refresh);
}});
@@ -2230,6 +2148,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#gotoFrame(int)
*/
+ @Override
public void gotoFrame(int frame) {
assert isGuiThread();
fGotoAddressPending = PC_UNKNOWN;
@@ -2239,6 +2158,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#gotoFrameIfActive(int)
*/
+ @Override
public void gotoFrameIfActive(int frame) {
assert isGuiThread();
if (fActive) {
@@ -2252,6 +2172,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#gotoFrame(int, java.math.BigInteger)
*/
+ @Override
public void gotoFrame(int frame, BigInteger address) {
assert isGuiThread();
if (DEBUG) System.out.println("gotoFrame " + frame + " " + getAddressText(address)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -2332,6 +2253,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart#isActive()
*/
+ @Override
public final boolean isActive() {
return fActive;
}
@@ -2339,6 +2261,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart#isConnected()
*/
+ @Override
public final boolean isConnected() {
if (fDebugSessionId == null) {
return false;
@@ -2350,6 +2273,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart#isSuspended()
*/
+ @Override
public final boolean isSuspended() {
return isConnected() && fBackend.isSuspended();
}
@@ -2357,10 +2281,12 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart#getTextViewer()
*/
+ @Override
public final ISourceViewer getTextViewer() {
return fViewer;
}
+ @Override
public final boolean hasViewer() {
return fViewer != null;
}
@@ -2368,6 +2294,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart#addRulerContextMenuListener(org.eclipse.jface.action.IMenuListener)
*/
+ @Override
public final void addRulerContextMenuListener(IMenuListener listener) {
fRulerContextMenuListeners.add(listener);
}
@@ -2375,6 +2302,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart#removeRulerContextMenuListener(org.eclipse.jface.action.IMenuListener)
*/
+ @Override
public final void removeRulerContextMenuListener(IMenuListener listener) {
fRulerContextMenuListeners.remove(listener);
}
@@ -2476,6 +2404,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
* means target resumed
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#updatePC(java.math.BigInteger)
*/
+ @Override
public void updatePC(BigInteger pc) {
assert isGuiThread();
if (!fPendingPCUpdates.isEmpty()) {
@@ -2535,6 +2464,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (!fUpdatePending && !fDoPendingPosted) {
fDoPendingPosted = true;
invokeLater(new Runnable() {
+ @Override
public void run() {
doPending();
fDoPendingPosted = false;
@@ -2546,6 +2476,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#doPending()
*/
+ @Override
public void doPending() {
assert isGuiThread();
if (fViewer == null || fDocument == null) {
@@ -2581,6 +2512,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
* @param doit
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#doScrollLocked(java.lang.Runnable)
*/
+ @Override
public void doScrollLocked(final Runnable doit) {
assert isGuiThread();
if (fViewer == null || fDebugSessionId == null) {
@@ -2600,7 +2532,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (fUpdatePending) {
if (fRunnableQueue.size() == 1) {
Runnable doitlater = new Runnable() {
- public void run() {
+ @Override
+ public void run() {
if (updateCount == fUpdateCount) {
doScrollLocked(null);
}
@@ -2636,14 +2569,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#lockScroller()
*/
+ @Override
public void lockScroller() {
assert isGuiThread();
assert fScrollPos == null;
- if (isFunctionOffsetsRulerVisible()) {
- fRedrawControl = fViewer.getControl();
- } else {
- fRedrawControl = fViewer.getTextWidget();
- }
+ fRedrawControl = fViewer.getControl();
fRedrawControl.setRedraw(false);
try {
int topOffset = fViewer.getTopIndexStartOffset();
@@ -2680,6 +2610,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#unlockScroller()
*/
+ @Override
public void unlockScroller() {
assert isGuiThread();
try {
@@ -2732,7 +2663,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#insertSource(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition)
*/
- public void insertSource(AddressRangePosition _pos) {
+ @Override
+ public void insertSource(AddressRangePosition _pos) {
assert isGuiThread();
// IDisassemblyPartCallback does not have visibility to the
// SourcePosition type, which is DSF-specific, so it uses the base type
@@ -2838,6 +2770,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see org.eclipse.jface.text.ITextPresentationListener#applyTextPresentation(org.eclipse.jface.text.TextPresentation)
*/
+ @Override
@SuppressWarnings("unchecked")
public void applyTextPresentation(TextPresentation textPresentation) {
IRegion coverage = textPresentation.getExtent();
@@ -2934,9 +2867,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
}
+ @Override
public AddressRangePosition insertSource(AddressRangePosition pos, BigInteger address, final String file, int lineNumber) {
return insertSource(pos, address, file, lineNumber, lineNumber);
}
+ @Override
public AddressRangePosition insertSource(AddressRangePosition pos, BigInteger address, final String file, int firstLine, int lastLine) {
assert isGuiThread();
Object sourceElement = null;
@@ -3020,8 +2955,10 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#handleTargetSuspended()
*/
+ @Override
public void handleTargetSuspended() {
asyncExec(new Runnable() {
+ @Override
public void run() {
updatePC(PC_UNKNOWN);
firePropertyChange(PROP_SUSPENDED);
@@ -3032,8 +2969,10 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#handleTargetResumed()
*/
+ @Override
public void handleTargetResumed() {
asyncExec(new Runnable() {
+ @Override
public void run() {
updatePC(PC_RUNNING);
firePropertyChange(PROP_SUSPENDED);
@@ -3044,12 +2983,15 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#handleTargetEnded()
*/
+ @Override
public void handleTargetEnded() {
asyncExec(new Runnable() {
+ @Override
public void run() {
fDebugSessionId = null;
startUpdate(new Runnable() {
- public void run() {
+ @Override
+ public void run() {
debugContextChanged();
}
});
@@ -3060,6 +3002,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#setUpdatePending(boolean)
*/
+ @Override
public void setUpdatePending(boolean pending) {
fUpdatePending = pending;
}
@@ -3067,6 +3010,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#getUpdatePending()
*/
+ @Override
public boolean getUpdatePending() {
assert isGuiThread();
return fUpdatePending;
@@ -3075,6 +3019,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#setGotoAddressPending(java.math.BigInteger)
*/
+ @Override
public void setGotoAddressPending(BigInteger address) {
assert isGuiThread();
fGotoAddressPending = address;
@@ -3083,6 +3028,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#getGotoAddressPending()
*/
+ @Override
public BigInteger getGotoAddressPending() {
assert isGuiThread();
return fGotoAddressPending;
@@ -3091,6 +3037,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#getDocument()
*/
+ @Override
public IDisassemblyDocument getDocument() {
assert isGuiThread();
return fDocument;
@@ -3099,6 +3046,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#getStorageForFile(java.lang.String)
*/
+ @Override
public Object getStorageForFile(String file) {
assert isGuiThread();
return fFile2Storage.get(file);
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/FunctionOffsetRulerColumn.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/FunctionOffsetRulerColumn.java
index 119cfb845c..0c2fb8fddc 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/FunctionOffsetRulerColumn.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/FunctionOffsetRulerColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Wind River Systems and others.
+ * Copyright (c) 2007, 2011 Wind River Systems 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
@@ -13,13 +13,18 @@ package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyPosition;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.preferences.DisassemblyPreferenceConstants;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyRulerColumn;
import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.util.PropertyChangeEvent;
/**
* A vertical ruler column to display the function + offset of instructions.
*/
public class FunctionOffsetRulerColumn extends DisassemblyRulerColumn {
+ public static final String ID = "org.eclipse.cdt.dsf.ui.disassemblyColumn.functionOffset"; //$NON-NLS-1$
+
/** Maximum width of column (in characters) */
private static final int MAXWIDTH= 20;
@@ -28,6 +33,7 @@ public class FunctionOffsetRulerColumn extends DisassemblyRulerColumn {
*/
public FunctionOffsetRulerColumn() {
super();
+ setForeground(getColor(DisassemblyPreferenceConstants.FUNCTION_OFFSETS_COLOR));
}
/*
@@ -62,4 +68,17 @@ public class FunctionOffsetRulerColumn extends DisassemblyRulerColumn {
return Math.min(MAXWIDTH, doc.getMaxFunctionLength());
}
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ String property = event.getProperty();
+ boolean needRedraw = false;
+ if (DisassemblyPreferenceConstants.FUNCTION_OFFSETS_COLOR.equals(property)) {
+ setForeground(getColor(property));
+ needRedraw = true;
+ }
+ if (needRedraw) {
+ redraw();
+ }
+ }
+
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java
index 707d32205d..bfcf196172 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java
@@ -13,13 +13,19 @@ package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyPosition;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.preferences.DisassemblyPreferenceConstants;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyRulerColumn;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.util.PropertyChangeEvent;
/**
* A vertical ruler column to display the opcodes of instructions.
*/
public class OpcodeRulerColumn extends DisassemblyRulerColumn {
+ public static final String ID = "org.eclipse.cdt.dsf.ui.disassemblyColumn.opcode"; //$NON-NLS-1$
+
private int fRadix;
private String fRadixPrefix;
@@ -28,6 +34,8 @@ public class OpcodeRulerColumn extends DisassemblyRulerColumn {
*/
public OpcodeRulerColumn() {
super();
+ setForeground(getColor(DisassemblyPreferenceConstants.CODE_BYTES_COLOR));
+ setRadix(getPreferenceStore().getInt(DisassemblyPreferenceConstants.OPCODE_RADIX));
}
public void setRadix(int radix) {
@@ -91,4 +99,23 @@ public class OpcodeRulerColumn extends DisassemblyRulerColumn {
DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument();
return doc.getMaxOpcodeLength(fRadix);
}
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ String property = event.getProperty();
+ IPreferenceStore store = getPreferenceStore();
+ boolean needRedraw = false;
+ if (DisassemblyPreferenceConstants.CODE_BYTES_COLOR.equals(property)) {
+ setForeground(getColor(property));
+ needRedraw = true;
+ } else if (DisassemblyPreferenceConstants.OPCODE_RADIX.equals(property)) {
+ setRadix(store.getInt(property));
+ layout(false);
+ needRedraw = true;
+ }
+ if (needRedraw) {
+ redraw();
+ }
+ }
+
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java
index befaeac8ab..a23a5ac80e 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java
@@ -103,6 +103,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
setShowRadixPrefix(false);
fNumberOfInstructions = 0;
fMeanSizeOfInstructions = 4;
+ fMaxFunctionLength = 0;
}
/**
@@ -120,9 +121,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
fi.dispose();
}
fFileInfoMap.clear();
-
fInvalidAddressRanges.clear();
-
fInvalidSource.clear();
}
@@ -141,8 +140,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
return fInvalidAddressRanges.toArray(new AddressRangePosition[fInvalidAddressRanges.size()]);
}
- public void setMaxFunctionLength(int opcodeLength) {
- fMaxFunctionLength = opcodeLength;
+ public void setMaxFunctionLength(int functionLength) {
+ fMaxFunctionLength = functionLength;
}
public int getMaxFunctionLength() {
@@ -1019,6 +1018,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument#insertDisassemblyLine(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition, java.math.BigInteger, int, java.lang.String, java.lang.String, java.lang.String, int)
*/
+ @Override
public AddressRangePosition insertDisassemblyLine(AddressRangePosition pos, BigInteger address, int length, String functionOffset, String instruction, String file, int lineNr)
throws BadLocationException {
return insertDisassemblyLine(pos, address, length, functionOffset, null, instruction, file, lineNr);
@@ -1027,6 +1027,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument#insertDisassemblyLine(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition, java.math.BigInteger, int, java.lang.String, java.lang.String, java.lang.String, int)
*/
+ @Override
public AddressRangePosition insertDisassemblyLine(AddressRangePosition pos, BigInteger address, int length, String functionOffset, BigInteger opcode, String instruction, String file, int lineNr)
throws BadLocationException {
assert isGuiThread();
@@ -1194,6 +1195,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument#insertLabel(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition, java.math.BigInteger, java.lang.String, boolean)
*/
+ @Override
public AddressRangePosition insertLabel(AddressRangePosition pos, BigInteger address, String label, boolean showLabels)
throws BadLocationException {
assert isGuiThread();
@@ -1552,6 +1554,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
}
}
+ @Override
public void addInvalidAddressRange(AddressRangePosition pos) {
assert isGuiThread();
if (DEBUG) System.out.println("Adding to invalid range list: " + pos); //$NON-NLS-1$
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferenceConstants.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferenceConstants.java
index 381ad0c200..8af99458e5 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferenceConstants.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferenceConstants.java
@@ -32,11 +32,8 @@ public class DisassemblyPreferenceConstants {
public static final String ADDRESS_RADIX = "disassembly.addressRadix"; //$NON-NLS-1$
public static final String OPCODE_RADIX = "disassembly.opcodeRadix"; //$NON-NLS-1$
public static final String SHOW_ADDRESS_RADIX = "disassembly.showAddressRadix"; //$NON-NLS-1$
- public static final String SHOW_ADDRESS_RULER = "disassembly.showAddressRuler"; //$NON-NLS-1$
public static final String ADDRESS_COLOR = "disassembly.addressColor"; //$NON-NLS-1$
- public static final String SHOW_FUNCTION_OFFSETS = "disassembly.showFunctionOffsetRuler"; //$NON-NLS-1$
public static final String FUNCTION_OFFSETS_COLOR = "disassembly.functionOffsetsColor"; //$NON-NLS-1$
- public static final String SHOW_CODE_BYTES = "disassembly.showCodeBytesRuler"; //$NON-NLS-1$
public static final String CODE_BYTES_COLOR = "disassembly.codeBytesColor"; //$NON-NLS-1$
public static final String AVOID_READ_BEFORE_PC = "disassembly.avoidReadBeforePC"; //$NON-NLS-1$
public static final String TRACK_EXPRESSION = "disassembly.trackExpression"; //$NON-NLS-1$
@@ -58,13 +55,10 @@ public class DisassemblyPreferenceConstants {
store.setDefault(END_ADDRESS, "0x" + BigInteger.ONE.shiftLeft(64).toString(16)); //$NON-NLS-1$
store.setDefault(PC_HISTORY_SIZE, 4);
store.setDefault(SHOW_SOURCE, true);
- store.setDefault(SHOW_FUNCTION_OFFSETS, false);
- store.setDefault(SHOW_CODE_BYTES, false);
store.setDefault(SHOW_SYMBOLS, true);
store.setDefault(ADDRESS_RADIX, 16);
store.setDefault(OPCODE_RADIX, 16);
store.setDefault(SHOW_ADDRESS_RADIX, false);
- store.setDefault(SHOW_ADDRESS_RULER, true);
store.setDefault(AVOID_READ_BEFORE_PC, false);
PreferenceConverter.setDefault(store, ADDRESS_COLOR, new RGB(0, 96, 0));
PreferenceConverter.setDefault(store, FUNCTION_OFFSETS_COLOR, new RGB(96, 0, 0));
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferencePage.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferencePage.java
index 25cc9600e9..0fa58417d5 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferencePage.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferencePage.java
@@ -23,8 +23,6 @@ import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -46,6 +44,7 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
private List<Combo> fComboBoxes = new ArrayList<Combo>();
private ArrayList<Text> fNumberFields = new ArrayList<Text>();
private ModifyListener fNumberFieldListener = new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
numberFieldChanged((Text)e.widget);
}
@@ -93,38 +92,17 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
String label;
-// label = DisassemblyMessages.DisassemblyPreferencePage_startAddress; //$NON-NLS-1$
-// addTextField(composite, label, DisassemblyPreferenceConstants.START_ADDRESS, 20, 0, true);
-// label = DisassemblyMessages.DisassemblyPreferencePage_endAddress; //$NON-NLS-1$
-// addTextField(composite, label, DisassemblyPreferenceConstants.END_ADDRESS, 20, 0, true);
-
- label = DisassemblyMessages.DisassemblyPreferencePage_showAddress;
- final Button showAddressCB = addCheckBox(composite, label, DisassemblyPreferenceConstants.SHOW_ADDRESS_RULER, 0);
- showAddressCB.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- fAddressFormatCombo.setEnabled(showAddressCB.getSelection());
- }
- });
- showAddressCB.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_showAddressTooltip);
label = DisassemblyMessages.DisassemblyPreferencePage_addressRadix;
fAddressFormatCombo = addComboBox(composite, label, DisassemblyPreferenceConstants.ADDRESS_RADIX, fcRadixItems);
fAddressFormatCombo.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_addressFormatTooltip);
- label = DisassemblyMessages.DisassemblyPreferencePage_showCodeBytes;
- final Button showCodeBytes= addCheckBox(composite, label, DisassemblyPreferenceConstants.SHOW_CODE_BYTES, 0);
- showCodeBytes.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- fOpcodeFormatCombo.setEnabled(showCodeBytes.getSelection());
- }
- });
- showCodeBytes.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_showCodeBytesTooltip);
+ label = DisassemblyMessages.DisassemblyPreferencePage_showAddressRadix;
+ Button showRadixCB = addCheckBox(composite, label, DisassemblyPreferenceConstants.SHOW_ADDRESS_RADIX, 0);
+ showRadixCB.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_showRadixTooltip);
+
label = DisassemblyMessages.DisassemblyPreferencePage_OpcodeFormat;
fOpcodeFormatCombo = addComboBox(composite, label, DisassemblyPreferenceConstants.OPCODE_RADIX, fcRadixItems);
fOpcodeFormatCombo.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_OpcodeFormatTooltip);
-// label = DisassemblyMessages.DisassemblyPreferencePage_instructionRadix;
-// addComboBox(composite, label, DisassemblyPreferenceConstants.INSTRUCTION_RADIX, fcRadixItems);
label = DisassemblyMessages.DisassemblyPreferencePage_showSource;
Button showSourceCB = addCheckBox(composite, label, DisassemblyPreferenceConstants.SHOW_SOURCE, 0);
@@ -132,42 +110,6 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
label = DisassemblyMessages.DisassemblyPreferencePage_showSymbols;
Button showSymbolsCB = addCheckBox(composite, label, DisassemblyPreferenceConstants.SHOW_SYMBOLS, 0);
showSymbolsCB.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_showSymbolsTooltip);
-// label = DisassemblyMessages.DisassemblyPreferencePage_simplifiedMnemonics;
-// addCheckBox(composite, label, DisassemblyPreferenceConstants.SIMPLIFIED, 0);
- label = DisassemblyMessages.DisassemblyPreferencePage_showAddressRadix;
- Button showRadixCB = addCheckBox(composite, label, DisassemblyPreferenceConstants.SHOW_ADDRESS_RADIX, 0);
- showRadixCB.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_showRadixTooltip);
- label = DisassemblyMessages.DisassemblyPreferencePage_showFunctionOffsets;
- Button showFunctionOffsets = addCheckBox(composite, label, DisassemblyPreferenceConstants.SHOW_FUNCTION_OFFSETS, 0);
- showFunctionOffsets.setToolTipText(DisassemblyMessages.DisassemblyPreferencePage_showFunctionOffsetsTooltip);
-// label = DisassemblyMessages.DisassemblyPreferencePage_avoidReadBeforePC;
-// addCheckBox(composite, label, DisassemblyPreferenceConstants.AVOID_READ_BEFORE_PC, 0);
-
- // horizontal line
-// Label separator = new Label(composite, SWT.SEPARATOR|SWT.HORIZONTAL);
-// GridData data;
-// data = new GridData(GridData.FILL_HORIZONTAL);
-// data.horizontalSpan = layout.numColumns;
-// separator.setLayoutData(data);
-//
-// label = DisassemblyMessages.DisassemblyPreferencePage_useSourceOnlyMode;
-// addCheckBox(composite, label, DisassemblyPreferenceConstants.USE_SOURCE_ONLY_MODE, 0);
-//
-// // note
-// String noteTitle = DisassemblyMessages.DisassemblyPreferencePage_useSourceOnlyMode_noteTtitle;
-// String noteMessage = DisassemblyMessages.DisassemblyPreferencePage_useSourceOnlyMode_noteMessage;
-// Composite note = createNoteComposite(composite.getFont(), composite, noteTitle, noteMessage);
-// data = (GridData)note.getLayoutData();
-// if (data == null) {
-// data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
-// note.setLayoutData(data);
-// }
-// data.horizontalSpan = layout.numColumns;
-// Control msgControl = note.getChildren()[1];
-// data = new GridData(GridData.FILL_HORIZONTAL);
-// data.widthHint = convertWidthInCharsToPixels(65);
-// data.heightHint = convertHeightInCharsToPixels(3);
-// msgControl.setLayoutData(data);
Dialog.applyDialogFont(parent);
@@ -179,6 +121,7 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
+ @Override
public void init(IWorkbench workbench) {
}
@@ -200,7 +143,7 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
Label labelControl= new Label(parent, SWT.NONE);
labelControl.setText(label);
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalIndent = 16;
+ gd.horizontalIndent = 0;
gd.horizontalSpan = 2;
labelControl.setLayoutData(gd);
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyRulerColumn.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyRulerColumn.java
index f7017ef1a2..e3edb3db2b 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyRulerColumn.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyRulerColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation 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
@@ -10,11 +10,15 @@
* Anton Leherbauer (Wind River Systems)
*******************************************************************************/
-package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
+package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional;
import java.util.Arrays;
+import org.eclipse.cdt.debug.ui.disassembly.rulers.AbstractContributedRulerColumn;
+import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
@@ -26,7 +30,8 @@ import org.eclipse.jface.text.IViewportListener;
import org.eclipse.jface.text.TextEvent;
import org.eclipse.jface.text.source.CompositeRuler;
import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IVerticalRulerColumn;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
@@ -46,11 +51,13 @@ import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.editors.text.EditorsUI;
/**
* Vertical ruler column for use with disassembly parts.
@@ -58,7 +65,7 @@ import org.eclipse.swt.widgets.Display;
* Derived from {@link org.eclipse.jface.text.source.LineNumberRulerColumn}.
* </p>
*/
-public class DisassemblyRulerColumn implements IVerticalRulerColumn {
+public class DisassemblyRulerColumn extends AbstractContributedRulerColumn implements IPropertyChangeListener {
protected final static String DOTS = "......................................................................"; //$NON-NLS-1$
protected final static String SPACES = " "; //$NON-NLS-1$
@@ -70,6 +77,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
/*
* @see IViewportListener#viewportChanged(int)
*/
+ @Override
public void viewportChanged(int verticalPosition) {
if (verticalPosition != fScrollPos)
redraw();
@@ -78,6 +86,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
/*
* @see ITextListener#textChanged(TextEvent)
*/
+ @Override
public void textChanged(TextEvent event) {
if (updateNumberOfDigits()) {
@@ -97,6 +106,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
/*
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
*/
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
postRedraw();
}
@@ -119,6 +129,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
/*
* @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
*/
+ @Override
public void mouseUp(MouseEvent event) {
// see bug 45700
if (event.button == 1) {
@@ -131,6 +142,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
/*
* @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
*/
+ @Override
public void mouseDown(MouseEvent event) {
fParentRuler.setLocationOfLastMouseButtonActivity(event.x, event.y);
// see bug 45700
@@ -142,6 +154,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
/*
* @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
*/
+ @Override
public void mouseDoubleClick(MouseEvent event) {
fParentRuler.setLocationOfLastMouseButtonActivity(event.x, event.y);
stopSelecting();
@@ -151,6 +164,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
/*
* @see org.eclipse.swt.events.MouseMoveListener#mouseMove(org.eclipse.swt.events.MouseEvent)
*/
+ @Override
public void mouseMove(MouseEvent event) {
if (!autoScroll(event)) {
int newLine = fParentRuler.toDocumentLineNumber(event.y);
@@ -161,18 +175,21 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
/*
* @see org.eclipse.swt.events.MouseTrackListener#mouseEnter(org.eclipse.swt.events.MouseEvent)
*/
+ @Override
public void mouseEnter(MouseEvent event) {
}
/*
* @see org.eclipse.swt.events.MouseTrackListener#mouseExit(org.eclipse.swt.events.MouseEvent)
*/
+ @Override
public void mouseExit(MouseEvent event) {
}
/*
* @see org.eclipse.swt.events.MouseTrackListener#mouseHover(org.eclipse.swt.events.MouseEvent)
*/
+ @Override
public void mouseHover(MouseEvent event) {
}
@@ -283,6 +300,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
switch (direction) {
case SWT.UP:
timer = new Runnable() {
+ @Override
public void run() {
if (fAutoScrollDirection == SWT.UP) {
int top = getInclusiveTopIndex();
@@ -297,6 +315,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
break;
case SWT.DOWN:
timer = new Runnable() {
+ @Override
public void run() {
if (fAutoScrollDirection == SWT.DOWN) {
int top = getInclusiveTopIndex();
@@ -372,6 +391,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
* Redraw runnable
*/
private Runnable fRunnable = new Runnable() {
+ @Override
public void run() {
synchronized (fRunnableLock) {
fIsRunnablePosted = false;
@@ -402,6 +422,18 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
fPaintStyleBackground = paintStyle;
}
+ @Override
+ public void columnCreated() {
+ super.columnCreated();
+ getPreferenceStore().addPropertyChangeListener(this);
+ }
+
+ @Override
+ public void columnRemoved() {
+ getPreferenceStore().removePropertyChangeListener(this);
+ super.columnRemoved();
+ }
+
/**
* Sets the foreground color of this column.
*
@@ -446,9 +478,14 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
return fBackground;
}
+ public IPreferenceStore getPreferenceStore() {
+ return DsfUIPlugin.getDefault().getPreferenceStore();
+ }
+
/*
* @see IVerticalRulerColumn#getControl()
*/
+ @Override
public Control getControl() {
return fCanvas;
}
@@ -456,6 +493,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
/*
* @see IVerticalRuleColumnr#getWidth
*/
+ @Override
public int getWidth() {
return fIndentation[0];
}
@@ -556,6 +594,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
/*
* @see IVerticalRulerColumn#createControl(CompositeRuler, Composite)
*/
+ @Override
public Control createControl(CompositeRuler parentRuler, Composite parentControl) {
fParentRuler= parentRuler;
@@ -567,6 +606,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
fCanvas.setForeground(fForeground);
fCanvas.addPaintListener(new PaintListener() {
+ @Override
public void paintControl(PaintEvent event) {
if (fCachedTextViewer != null)
doubleBufferPaint(event.gc);
@@ -574,6 +614,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
});
fCanvas.addDisposeListener(new DisposeListener() {
+ @Override
public void widgetDisposed(DisposeEvent e) {
handleDispose();
fCachedTextViewer= null;
@@ -620,6 +661,14 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
}
}
+ protected Color getColor(String key) {
+ return EditorsUI.getSharedTextColors().getColor(PreferenceConverter.getColor(getPreferenceStore(), key));
+ }
+
+ protected Color getColor(RGB color) {
+ return EditorsUI.getSharedTextColors().getColor(color);
+ }
+
/**
* Double buffer drawing.
*
@@ -769,7 +818,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
* the line number for which the string is generated
* @return the string to be printed on the ruler column for <code>line</code>
*/
- String createDisplayString(int line) {
+ protected String createDisplayString(int line) {
return Integer.toString(line + 1);
}
@@ -941,6 +990,7 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
/*
* @see IVerticalRulerColumn#redraw()
*/
+ @Override
public void redraw() {
if (fRelayoutRequired) {
@@ -958,12 +1008,14 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
/*
* @see IVerticalRulerColumn#setModel(IAnnotationModel)
*/
+ @Override
public void setModel(IAnnotationModel model) {
}
/*
* @see IVerticalRulerColumn#setFont(Font)
*/
+ @Override
public void setFont(Font font) {
fFont= font;
if (fCanvas != null && !fCanvas.isDisposed()) {
@@ -982,4 +1034,8 @@ public class DisassemblyRulerColumn implements IVerticalRulerColumn {
return fParentRuler;
}
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ }
+
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyViewer.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyViewer.java
index 7d4a4e4300..b790a0339c 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyViewer.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyViewer.java
@@ -8,7 +8,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
+package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional;
import java.util.Iterator;
@@ -24,15 +24,12 @@ import org.eclipse.jface.text.source.IOverviewRuler;
import org.eclipse.jface.text.source.IVerticalRuler;
import org.eclipse.jface.text.source.IVerticalRulerColumn;
import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
@@ -43,15 +40,11 @@ import org.eclipse.swt.widgets.Composite;
public class DisassemblyViewer extends SourceViewer {
class ResizeListener implements ControlListener {
- /*
- * @see ControlListener#controlResized(ControlEvent)
- */
+ @Override
public void controlResized(ControlEvent e) {
updateViewportListeners(RESIZE);
}
- /*
- * @see ControlListener#controlMoved(ControlEvent)
- */
+ @Override
public void controlMoved(ControlEvent e) {
}
}
@@ -59,11 +52,6 @@ public class DisassemblyViewer extends SourceViewer {
private boolean fUserTriggeredScrolling;
private int fCachedLastTopPixel;
- // extra resize listener to workaround bug 171018
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=171018
- private ResizeListener fResizeListener;
- private DisassemblyPart fPart;
-
/**
* Create a new DisassemblyViewer.
* @param parent
@@ -72,9 +60,8 @@ public class DisassemblyViewer extends SourceViewer {
* @param showsAnnotationOverview
* @param styles
*/
- public DisassemblyViewer(DisassemblyPart part, Composite parent, IVerticalRuler ruler, IOverviewRuler overviewRuler, boolean showsAnnotationOverview, int styles) {
+ public DisassemblyViewer(Composite parent, IVerticalRuler ruler, IOverviewRuler overviewRuler, boolean showsAnnotationOverview, int styles) {
super(parent, ruler, overviewRuler, showsAnnotationOverview, styles);
- fPart = part;
// always readonly
setEditable(false);
}
@@ -86,30 +73,9 @@ public class DisassemblyViewer extends SourceViewer {
protected void createControl(Composite parent, int styles) {
super.createControl(parent, styles);
StyledText textWidget = getTextWidget();
+ // extra resize listener to workaround bug 171018
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=171018
- textWidget.addControlListener(fResizeListener= new ResizeListener());
- textWidget.addVerifyKeyListener(new VerifyKeyListener() {
- public void verifyKey(VerifyEvent event) {
- switch (event.keyCode) {
- case SWT.PAGE_UP:
- case SWT.PAGE_DOWN:
- case SWT.ARROW_UP:
- case SWT.ARROW_DOWN:
- event.doit = !fPart.keyScroll(event.keyCode);
- }
- }
- });
- }
-
- /*
- * @see org.eclipse.jface.text.source.SourceViewer#handleDispose()
- */
- @Override
- protected void handleDispose() {
- if (fResizeListener != null) {
- getTextWidget().removeControlListener(fResizeListener);
- }
- super.handleDispose();
+ textWidget.addControlListener(new ResizeListener());
}
/*
@@ -150,7 +116,7 @@ public class DisassemblyViewer extends SourceViewer {
* @throws BadLocationException
*/
public String getSelectedText() throws BadLocationException {
- StringBuffer text = new StringBuffer(200);
+ StringBuilder text = new StringBuilder(200);
String lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
DisassemblyDocument doc = (DisassemblyDocument)getDocument();
Point selection = getSelectedRange();
@@ -204,7 +170,7 @@ public class DisassemblyViewer extends SourceViewer {
* @return the prefix string with trailing blank or the empty string
*/
public String getLinePrefix(int line) {
- StringBuffer prefix = new StringBuffer(10);
+ StringBuilder prefix = new StringBuilder(10);
IVerticalRuler ruler = getVerticalRuler();
if (ruler instanceof CompositeRuler) {
for (Iterator<?> iter = ((CompositeRuler)ruler).getDecoratorIterator(); iter.hasNext();) {
@@ -280,10 +246,11 @@ public class DisassemblyViewer extends SourceViewer {
return -1;
}
- int getLastTopPixel() {
+ public int getLastTopPixel() {
return fCachedLastTopPixel;
}
- boolean isUserTriggeredScrolling() {
+
+ public boolean isUserTriggeredScrolling() {
return fUserTriggeredScrolling;
}

Back to the top