Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2019-08-10 14:36:47 +0000
committerAlexander Kurtakov2019-08-12 11:11:40 +0000
commit1e42e5f0e1e6591b5b609db0b864affc746ed5bf (patch)
treeb640c6d31ef982f1428dcb1077d4ea8fba7fbce4 /memory/org.eclipse.cdt.debug.ui.memory.floatingpoint
parent51da3eb3a619c85b31c74d0a1bedacfa94f5db58 (diff)
downloadorg.eclipse.cdt-1e42e5f0e1e6591b5b609db0b864affc746ed5bf.tar.gz
org.eclipse.cdt-1e42e5f0e1e6591b5b609db0b864affc746ed5bf.tar.xz
org.eclipse.cdt-1e42e5f0e1e6591b5b609db0b864affc746ed5bf.zip
Convert new Runnable to lambda.
Change-Id: I8b827013a29802a3f3ae6400ddce8d8753eb6399 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'memory/org.eclipse.cdt.debug.ui.memory.floatingpoint')
-rw-r--r--memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/META-INF/MANIFEST.MF2
-rw-r--r--memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/FPRendering.java366
-rw-r--r--memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/FPRenderingPreferenceAction.java9
-rw-r--r--memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/Rendering.java318
4 files changed, 306 insertions, 389 deletions
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/META-INF/MANIFEST.MF b/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/META-INF/MANIFEST.MF
index 76046d0938b..6ec7f6d84e0 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/META-INF/MANIFEST.MF
+++ b/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.ui.memory.floatingpoint;singleton:=true
-Bundle-Version: 1.0.1.qualifier
+Bundle-Version: 1.0.100.qualifier
Bundle-Localization: plugin
Require-Bundle: org.eclipse.debug.core;bundle-version="3.7.100",
org.eclipse.debug.ui;bundle-version="3.8.1",
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/FPRendering.java b/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/FPRendering.java
index df0d0e86aca..dbb0c03dd71 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/FPRendering.java
+++ b/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/FPRendering.java
@@ -53,17 +53,13 @@ import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
import org.eclipse.debug.ui.memory.IResettableMemoryRendering;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.jface.window.Window;
@@ -121,49 +117,37 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
public FPRendering(String id) {
super(id);
- JFaceResources.getFontRegistry().addListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IInternalDebugUIConstants.FONT_NAME)) {
- FPRendering.this.fRendering
- .handleFontPreferenceChange(JFaceResources.getFont(IInternalDebugUIConstants.FONT_NAME));
- }
+ JFaceResources.getFontRegistry().addListener(event -> {
+ if (event.getProperty().equals(IInternalDebugUIConstants.FONT_NAME)) {
+ FPRendering.this.fRendering
+ .handleFontPreferenceChange(JFaceResources.getFont(IInternalDebugUIConstants.FONT_NAME));
}
});
- this.addPropertyChangeListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- IMemoryRendering sourceRendering = (IMemoryRendering) event.getSource();
- if (!sourceRendering.getMemoryBlock().equals(getMemoryBlock()))
- return;
+ this.addPropertyChangeListener(event -> {
+ IMemoryRendering sourceRendering = (IMemoryRendering) event.getSource();
+ if (!sourceRendering.getMemoryBlock().equals(getMemoryBlock()))
+ return;
- Object address = event.getNewValue();
+ Object address = event.getNewValue();
- if (event.getProperty().equals(AbstractTableRendering.PROPERTY_SELECTED_ADDRESS)
- && address instanceof BigInteger) {
- FPRendering.this.fRendering.ensureVisible((BigInteger) address);
- }
+ if (event.getProperty().equals(AbstractTableRendering.PROPERTY_SELECTED_ADDRESS)
+ && address instanceof BigInteger) {
+ FPRendering.this.fRendering.ensureVisible((BigInteger) address);
}
});
- FPRenderingPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- disposeColors();
- allocateColors();
- applyPreferences();
- }
+ FPRenderingPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(event -> {
+ disposeColors();
+ allocateColors();
+ applyPreferences();
});
- DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IDebugUIConstants.PREF_PADDED_STR)) {
- if (FPRendering.this.fRendering != null) {
- setRenderingPadding((String) event.getNewValue());
- FPRendering.this.fRendering.redrawPanes();
- }
+ DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(event -> {
+ if (event.getProperty().equals(IDebugUIConstants.PREF_PADDED_STR)) {
+ if (FPRendering.this.fRendering != null) {
+ setRenderingPadding((String) event.getNewValue());
+ FPRendering.this.fRendering.redrawPanes();
}
}
});
@@ -221,13 +205,10 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
* We use the UI dispatch thread to protect the proxy information. Even though I believe the
* dispose routine is always called in the UI dispatch thread. I am going to make sure.
*/
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (fModel != null) {
- fModel.removeModelChangedListener(FPRendering.this);
- fModel.dispose();
- }
+ Display.getDefault().asyncExec(() -> {
+ if (fModel != null) {
+ fModel.removeModelChangedListener(FPRendering.this);
+ fModel.dispose();
}
});
@@ -246,29 +227,26 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
*/
final IModelProxyFactory factory = (IModelProxyFactory) DebugPlugin.getAdapter(block, IModelProxyFactory.class);
if (factory != null) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
-
- /*
- * The asynchronous model assumes we have an asynchronous viewer that has an IPresentationContext
- * to represent it. The Platform memory subsystem provides a way to create one without a viewewr.
- */
- IMemoryRenderingSite site = container.getMemoryRenderingSite();
- MemoryViewPresentationContext context = new MemoryViewPresentationContext(site, container,
- FPRendering.this);
-
- /*
- * Get a new proxy and perform the initialization sequence so we are known the
- * the model provider.
- */
- fModel = factory.createModelProxy(block, context);
- if (fModel != null) {
- fModel.installed(null);
- fModel.addModelChangedListener(FPRendering.this);
- }
-
+ Display.getDefault().asyncExec(() -> {
+
+ /*
+ * The asynchronous model assumes we have an asynchronous viewer that has an IPresentationContext
+ * to represent it. The Platform memory subsystem provides a way to create one without a viewewr.
+ */
+ IMemoryRenderingSite site = container.getMemoryRenderingSite();
+ MemoryViewPresentationContext context = new MemoryViewPresentationContext(site, container,
+ FPRendering.this);
+
+ /*
+ * Get a new proxy and perform the initialization sequence so we are known the
+ * the model provider.
+ */
+ fModel = factory.createModelProxy(block, context);
+ if (fModel != null) {
+ fModel.installed(null);
+ fModel.addModelChangedListener(FPRendering.this);
}
+
});
}
@@ -605,12 +583,7 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
{
@Override
public void run() {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- FPRendering.this.fRendering.copyAddressToClipboard();
- }
- });
+ Display.getDefault().asyncExec(() -> FPRendering.this.fRendering.copyAddressToClipboard());
}
};
@@ -621,12 +594,8 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
{
@Override
public void run() {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- FPRendering.this.fRendering.gotoAddress(FPRendering.this.fRendering.fBaseAddress);
- }
- });
+ Display.getDefault().asyncExec(
+ () -> FPRendering.this.fRendering.gotoAddress(FPRendering.this.fRendering.fBaseAddress));
}
};
@@ -636,21 +605,18 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
{
@Override
public void run() {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- // For compatibility with DSF update modes (hopefully this will either be replaced
- // by an enhanced platform interface or the caching will move out of the data layer)
-
- try {
- Method m = fRendering.getMemoryBlock().getClass().getMethod("clearCache", new Class[0]); //$NON-NLS-1$
- if (m != null)
- m.invoke(fRendering.getMemoryBlock(), new Object[0]);
- } catch (Exception e) {
- }
-
- FPRendering.this.fRendering.refresh();
+ Display.getDefault().asyncExec(() -> {
+ // For compatibility with DSF update modes (hopefully this will either be replaced
+ // by an enhanced platform interface or the caching will move out of the data layer)
+
+ try {
+ Method m = fRendering.getMemoryBlock().getClass().getMethod("clearCache", new Class[0]); //$NON-NLS-1$
+ if (m != null)
+ m.invoke(fRendering.getMemoryBlock(), new Object[0]);
+ } catch (Exception e) {
}
+
+ FPRendering.this.fRendering.refresh();
});
}
};
@@ -826,24 +792,20 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
@Override
public void run() {
InputDialog inputDialog = new InputDialog(fRendering.getShell(), "Set Column Count", //$NON-NLS-1$
- "Please enter column count", "", new IInputValidator() //$NON-NLS-1$ //$NON-NLS-2$
- {
- @Override
- public String isValid(String input) {
- try {
- int index = Integer.parseInt(input);
-
- if (index <= 0)
- return "Please enter a positive integer"; //$NON-NLS-1$
-
- if (index > 200)
- return "Please enter a positive integer not greater than 200"; //$NON-NLS-1$
- } catch (NumberFormatException x) {
+ "Please enter column count", "", input -> {
+ try {
+ int index = Integer.parseInt(input);
+
+ if (index <= 0)
return "Please enter a positive integer"; //$NON-NLS-1$
- }
- return null;
+ if (index > 200)
+ return "Please enter a positive integer not greater than 200"; //$NON-NLS-1$
+ } catch (NumberFormatException x) {
+ return "Please enter a positive integer"; //$NON-NLS-1$
}
+
+ return null;
});
if (inputDialog.open() != Window.OK) {
@@ -927,104 +889,101 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
// Add the right-mouse-click (RMC) context menu items
- getPopupMenuManager().addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- manager.add(new Separator());
+ getPopupMenuManager().addMenuListener(manager -> {
+ manager.add(new Separator());
- MenuManager sub = new MenuManager(FPRenderingMessages.getString("FPRendering.PANES")); //$NON-NLS-1$
+ MenuManager sub = new MenuManager(FPRenderingMessages.getString("FPRendering.PANES")); //$NON-NLS-1$
- sub = new MenuManager(FPRenderingMessages.getString("FPRendering.ENDIAN")); //$NON-NLS-1$
- sub.add(actionDisplayBigEndian);
- sub.add(actionDisplayLittleEndian);
- manager.add(sub);
+ sub = new MenuManager(FPRenderingMessages.getString("FPRendering.ENDIAN")); //$NON-NLS-1$
+ sub.add(actionDisplayBigEndian);
+ sub.add(actionDisplayLittleEndian);
+ manager.add(sub);
- sub = new MenuManager(FPRenderingMessages.getString("FPRendering.NUMBER_TYPE")); //$NON-NLS-1$
- sub.add(actionFloatingPoint32);
- sub.add(actionFloatingPoint64);
- manager.add(sub);
+ sub = new MenuManager(FPRenderingMessages.getString("FPRendering.NUMBER_TYPE")); //$NON-NLS-1$
+ sub.add(actionFloatingPoint32);
+ sub.add(actionFloatingPoint64);
+ manager.add(sub);
- sub = new MenuManager(FPRenderingMessages.getString("FPRendering.PRECISION")); //$NON-NLS-1$
- sub.add(actionDisplay4Digits);
- sub.add(actionDisplay8Digits);
- sub.add(actionDisplay16Digits);
- manager.add(sub);
+ sub = new MenuManager(FPRenderingMessages.getString("FPRendering.PRECISION")); //$NON-NLS-1$
+ sub.add(actionDisplay4Digits);
+ sub.add(actionDisplay8Digits);
+ sub.add(actionDisplay16Digits);
+ manager.add(sub);
- // TODO: Add separator for FP group here: manager.add(new Separator());
+ // TODO: Add separator for FP group here: manager.add(new Separator());
- sub = new MenuManager(FPRenderingMessages.getString("FPRendering.COLUMN_COUNT")); //$NON-NLS-1$
- sub.add(displayColumnCountAuto);
+ sub = new MenuManager(FPRenderingMessages.getString("FPRendering.COLUMN_COUNT")); //$NON-NLS-1$
+ sub.add(displayColumnCountAuto);
- for (int index = 0; index < displayColumnCounts.length; index++)
- sub.add(displayColumnCounts[index]);
+ for (int index1 = 0; index1 < displayColumnCounts.length; index1++)
+ sub.add(displayColumnCounts[index1]);
- boolean currentCountIsCustom = fRendering.getColumnsSetting() != 0;
+ boolean currentCountIsCustom = fRendering.getColumnsSetting() != 0;
- for (int index = 0, j = 1; index < MAX_MENU_COLUMN_COUNT && currentCountIsCustom; index++, j *= 2)
- currentCountIsCustom = (j != fRendering.getColumnsSetting());
+ for (int index2 = 0, j = 1; index2 < MAX_MENU_COLUMN_COUNT && currentCountIsCustom; index2++, j *= 2)
+ currentCountIsCustom = (j != fRendering.getColumnsSetting());
- if (currentCountIsCustom)
- sub.add(displayColumnCountCustomValue);
+ if (currentCountIsCustom)
+ sub.add(displayColumnCountCustomValue);
- sub.add(displayColumnCountCustom);
- manager.add(sub);
+ sub.add(displayColumnCountCustom);
+ manager.add(sub);
- // Update modes
+ // Update modes
- int updateMode = getRMCvalue(IFPRConstants.UPDATEMODE_KEY);
+ int updateMode = getRMCvalue(IFPRConstants.UPDATEMODE_KEY);
- final Action updateAlwaysAction = new Action(FPRenderingMessages.getString("FPRendering.UPDATE_ALWAYS"), //$NON-NLS-1$
- IAction.AS_RADIO_BUTTON) {
- @Override
- public void run() {
- fRendering.setUpdateMode(Rendering.UPDATE_ALWAYS);
- setRMCvalue(IFPRConstants.UPDATEMODE_KEY, Rendering.UPDATE_ALWAYS);
- }
- };
- updateAlwaysAction.setChecked(updateMode == Rendering.UPDATE_ALWAYS);
+ final Action updateAlwaysAction = new Action(FPRenderingMessages.getString("FPRendering.UPDATE_ALWAYS"), //$NON-NLS-1$
+ IAction.AS_RADIO_BUTTON) {
+ @Override
+ public void run() {
+ fRendering.setUpdateMode(Rendering.UPDATE_ALWAYS);
+ setRMCvalue(IFPRConstants.UPDATEMODE_KEY, Rendering.UPDATE_ALWAYS);
+ }
+ };
+ updateAlwaysAction.setChecked(updateMode == Rendering.UPDATE_ALWAYS);
- final Action updateOnBreakpointAction = new Action(
- FPRenderingMessages.getString("FPRendering.UPDATE_ON_BREAKPOINT"), IAction.AS_RADIO_BUTTON) //$NON-NLS-1$
- {
- @Override
- public void run() {
- fRendering.setUpdateMode(Rendering.UPDATE_ON_BREAKPOINT);
- setRMCvalue(IFPRConstants.UPDATEMODE_KEY, Rendering.UPDATE_ON_BREAKPOINT);
- }
- };
- updateOnBreakpointAction.setChecked(updateMode == Rendering.UPDATE_ON_BREAKPOINT);
+ final Action updateOnBreakpointAction = new Action(
+ FPRenderingMessages.getString("FPRendering.UPDATE_ON_BREAKPOINT"), IAction.AS_RADIO_BUTTON) //$NON-NLS-1$
+ {
+ @Override
+ public void run() {
+ fRendering.setUpdateMode(Rendering.UPDATE_ON_BREAKPOINT);
+ setRMCvalue(IFPRConstants.UPDATEMODE_KEY, Rendering.UPDATE_ON_BREAKPOINT);
+ }
+ };
+ updateOnBreakpointAction.setChecked(updateMode == Rendering.UPDATE_ON_BREAKPOINT);
- final Action updateManualAction = new Action(FPRenderingMessages.getString("FPRendering.UPDATE_MANUAL"), //$NON-NLS-1$
- IAction.AS_RADIO_BUTTON) {
- @Override
- public void run() {
- fRendering.setUpdateMode(Rendering.UPDATE_MANUAL);
- setRMCvalue(IFPRConstants.UPDATEMODE_KEY, Rendering.UPDATE_MANUAL);
- }
- };
- updateManualAction.setChecked(updateMode == Rendering.UPDATE_MANUAL);
+ final Action updateManualAction = new Action(FPRenderingMessages.getString("FPRendering.UPDATE_MANUAL"), //$NON-NLS-1$
+ IAction.AS_RADIO_BUTTON) {
+ @Override
+ public void run() {
+ fRendering.setUpdateMode(Rendering.UPDATE_MANUAL);
+ setRMCvalue(IFPRConstants.UPDATEMODE_KEY, Rendering.UPDATE_MANUAL);
+ }
+ };
+ updateManualAction.setChecked(updateMode == Rendering.UPDATE_MANUAL);
- // Add menu
+ // Add menu
- sub = new MenuManager(FPRenderingMessages.getString("FPRendering.UPDATEMODE")); //$NON-NLS-1$
- sub.add(updateAlwaysAction);
- sub.add(updateOnBreakpointAction);
- sub.add(updateManualAction);
- manager.add(sub);
- manager.add(new Separator());
+ sub = new MenuManager(FPRenderingMessages.getString("FPRendering.UPDATEMODE")); //$NON-NLS-1$
+ sub.add(updateAlwaysAction);
+ sub.add(updateOnBreakpointAction);
+ sub.add(updateManualAction);
+ manager.add(sub);
+ manager.add(new Separator());
- BigInteger start = fRendering.getSelection().getStart();
- BigInteger end = fRendering.getSelection().getEnd();
- copyAction.setEnabled(start != null && end != null);
+ BigInteger start = fRendering.getSelection().getStart();
+ BigInteger end = fRendering.getSelection().getEnd();
+ copyAction.setEnabled(start != null && end != null);
- manager.add(copyAction);
- manager.add(copyAddressAction);
+ manager.add(copyAction);
+ manager.add(copyAddressAction);
- manager.add(gotoBaseAddressAction);
- manager.add(refreshAction);
- manager.add(new Separator());
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
+ manager.add(gotoBaseAddressAction);
+ manager.add(refreshAction);
+ manager.add(new Separator());
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
});
}
@@ -1097,12 +1056,7 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
@Override
public void goToAddress(final BigInteger address) throws DebugException {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- fRendering.gotoAddress(address);
- }
- });
+ Display.getDefault().asyncExec(() -> fRendering.gotoAddress(address));
}
protected void setTargetMemoryLittleEndian(boolean littleEndian) {
@@ -1145,27 +1099,19 @@ public class FPRendering extends AbstractMemoryRendering implements IRepositiona
if (adapter == IMemoryBlockConnection.class) {
if (fConnection == null) {
- fConnection = new IMemoryBlockConnection() {
- @Override
- public void update() {
- // update UI asynchronously
- Display display = FPRenderingPlugin.getDefault().getWorkbench().getDisplay();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- try {
- if (fBigBaseAddress != FPRendering.this.fRendering.getMemoryBlock()
- .getBigBaseAddress()) {
- fBigBaseAddress = FPRendering.this.fRendering.getMemoryBlock()
- .getBigBaseAddress();
- FPRendering.this.fRendering.gotoAddress(fBigBaseAddress);
- }
- FPRendering.this.fRendering.refresh();
- } catch (DebugException e) {
- }
+ fConnection = () -> {
+ // update UI asynchronously
+ Display display = FPRenderingPlugin.getDefault().getWorkbench().getDisplay();
+ display.asyncExec(() -> {
+ try {
+ if (fBigBaseAddress != FPRendering.this.fRendering.getMemoryBlock().getBigBaseAddress()) {
+ fBigBaseAddress = FPRendering.this.fRendering.getMemoryBlock().getBigBaseAddress();
+ FPRendering.this.fRendering.gotoAddress(fBigBaseAddress);
}
- });
- }
+ FPRendering.this.fRendering.refresh();
+ } catch (DebugException e) {
+ }
+ });
};
}
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/FPRenderingPreferenceAction.java b/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/FPRenderingPreferenceAction.java
index 4de3ee401a5..4cdf63dbc95 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/FPRenderingPreferenceAction.java
+++ b/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/FPRenderingPreferenceAction.java
@@ -36,12 +36,7 @@ public class FPRenderingPreferenceAction extends ActionDelegate implements IView
}
protected void showPreferencePage(String id, IPreferencePage page) {
- BusyIndicator.showWhile(FPRenderingPlugin.getStandardDisplay(), new Runnable() {
- @Override
- public void run() {
- PreferencesUtil.createPreferenceDialogOn(FPRenderingPlugin.getShell(), id, new String[] { id }, null)
- .open();
- }
- });
+ BusyIndicator.showWhile(FPRenderingPlugin.getStandardDisplay(), () -> PreferencesUtil
+ .createPreferenceDialogOn(FPRenderingPlugin.getShell(), id, new String[] { id }, null).open());
}
}
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/Rendering.java b/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/Rendering.java
index 7c6a72f7e78..90eec95d7f1 100644
--- a/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/Rendering.java
+++ b/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/Rendering.java
@@ -51,8 +51,6 @@ import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -238,12 +236,9 @@ public class Rendering extends Composite implements IDebugEventSetListener {
getHorizontalBar().addSelectionListener(createHorizontalBarSelectionListener());
getVerticalBar().addSelectionListener(createVerticalBarSelectinListener());
- this.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent pe) {
- pe.gc.setBackground(Rendering.this.getFPRendering().getColorBackground());
- pe.gc.fillRectangle(0, 0, Rendering.this.getBounds().width, Rendering.this.getBounds().height);
- }
+ this.addPaintListener(pe -> {
+ pe.gc.setBackground(Rendering.this.getFPRendering().getColorBackground());
+ pe.gc.fillRectangle(0, 0, Rendering.this.getBounds().width, Rendering.this.getBounds().height);
});
setLayout();
@@ -560,24 +555,16 @@ public class Rendering extends Composite implements IDebugEventSetListener {
protected void handleSuspend(boolean isBreakpointHit) {
if (getUpdateMode() == UPDATE_ALWAYS || (getUpdateMode() == UPDATE_ON_BREAKPOINT && isBreakpointHit)) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- archiveDeltas();
- refresh();
- }
+ Display.getDefault().asyncExec(() -> {
+ archiveDeltas();
+ refresh();
});
}
}
protected void handleChange() {
if (getUpdateMode() == UPDATE_ALWAYS) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- refresh();
- }
- });
+ Display.getDefault().asyncExec(() -> refresh());
}
}
@@ -859,205 +846,202 @@ public class Rendering extends Composite implements IDebugEventSetListener {
fCache.end = endAddress;
fCache.bytes = cachedBytesFinal;
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- // Generate deltas
-
- for (int historyIndex = 0; historyIndex < getHistoryDepth(); historyIndex++) {
- if (fHistoryCache[historyIndex] != null && fHistoryCache[historyIndex].isValid()) {
- BigInteger maxStart = startAddress.max(fHistoryCache[historyIndex].start);
- BigInteger minEnd = endAddress.min(fHistoryCache[historyIndex].end)
- .subtract(BigInteger.ONE);
-
- BigInteger overlapLength = minEnd.subtract(maxStart);
- if (overlapLength.compareTo(BigInteger.valueOf(0)) > 0) {
- // there is overlap
-
- int offsetIntoOld = maxStart.subtract(fHistoryCache[historyIndex].start).intValue();
- int offsetIntoNew = maxStart.subtract(startAddress).intValue();
-
- for (int i = overlapLength.intValue(); i >= 0; i--) {
- cachedBytesFinal[offsetIntoNew + i].setChanged(historyIndex,
- cachedBytesFinal[offsetIntoNew + i]
- .getValue() != fHistoryCache[historyIndex].bytes[offsetIntoOld
- + i].getValue());
- }
+ Display.getDefault().asyncExec(() -> {
+ // Generate deltas
- // There are several scenarios where the history cache must be updated from the data cache, so that when a
- // cell is edited the font color changes appropriately. The following code deals with the different cases.
+ for (int historyIndex = 0; historyIndex < getHistoryDepth(); historyIndex++) {
+ if (fHistoryCache[historyIndex] != null && fHistoryCache[historyIndex].isValid()) {
+ BigInteger maxStart = startAddress.max(fHistoryCache[historyIndex].start);
+ BigInteger minEnd = endAddress.min(fHistoryCache[historyIndex].end)
+ .subtract(BigInteger.ONE);
- if (historyIndex != 0)
- continue;
+ BigInteger overlapLength = minEnd.subtract(maxStart);
+ if (overlapLength.compareTo(BigInteger.valueOf(0)) > 0) {
+ // there is overlap
- int dataStart = fCache.start.intValue();
- int dataEnd = fCache.end.intValue();
- int dataLength = fCache.bytes.length;
+ int offsetIntoOld = maxStart.subtract(fHistoryCache[historyIndex].start).intValue();
+ int offsetIntoNew = maxStart.subtract(startAddress).intValue();
- int historyStart = fHistoryCache[0].start.intValue();
- int historyEnd = fHistoryCache[0].end.intValue();
- int historyLength = fHistoryCache[0].bytes.length;
+ for (int i = overlapLength.intValue(); i >= 0; i--) {
+ cachedBytesFinal[offsetIntoNew + i].setChanged(historyIndex,
+ cachedBytesFinal[offsetIntoNew + i]
+ .getValue() != fHistoryCache[historyIndex].bytes[offsetIntoOld + i]
+ .getValue());
+ }
- // Case 1: The data cache is smaller than the history cache; the data cache's
- // address range is fully covered by the history cache. Do nothing.
+ // There are several scenarios where the history cache must be updated from the data cache, so that when a
+ // cell is edited the font color changes appropriately. The following code deals with the different cases.
- if ((dataStart >= historyStart) && (dataEnd <= historyEnd))
- continue;
+ if (historyIndex != 0)
+ continue;
- // Case 2: The data and history cache's do not overlap at all
+ int dataStart = fCache.start.intValue();
+ int dataEnd = fCache.end.intValue();
+ int dataLength = fCache.bytes.length;
- if (((dataStart < historyStart) && (dataEnd < historyStart))
- || (dataStart > historyEnd)) {
- // Create a new history cache: Copy the data cache bytes to the history cache
+ int historyStart = fHistoryCache[0].start.intValue();
+ int historyEnd = fHistoryCache[0].end.intValue();
+ int historyLength = fHistoryCache[0].bytes.length;
- MemoryUnit newHistoryCache = new MemoryUnit();
+ // Case 1: The data cache is smaller than the history cache; the data cache's
+ // address range is fully covered by the history cache. Do nothing.
- newHistoryCache.start = fCache.start;
- newHistoryCache.end = fCache.end;
- int newHistoryCacheSize = fCache.bytes.length;
- newHistoryCache.bytes = new FPMemoryByte[newHistoryCacheSize];
+ if ((dataStart >= historyStart) && (dataEnd <= historyEnd))
+ continue;
- for (int index = 0; index < newHistoryCacheSize; index++)
- newHistoryCache.bytes[index] = new FPMemoryByte(
- fCache.bytes[index].getValue());
+ // Case 2: The data and history cache's do not overlap at all
- fHistoryCache[0] = newHistoryCache;
+ if (((dataStart < historyStart) && (dataEnd < historyStart))
+ || (dataStart > historyEnd)) {
+ // Create a new history cache: Copy the data cache bytes to the history cache
- continue;
- }
+ MemoryUnit newHistoryCache1 = new MemoryUnit();
- // Case 3: The data cache starts at a lower address than the history cache, but overlaps the history cache
+ newHistoryCache1.start = fCache.start;
+ newHistoryCache1.end = fCache.end;
+ int newHistoryCacheSize1 = fCache.bytes.length;
+ newHistoryCache1.bytes = new FPMemoryByte[newHistoryCacheSize1];
- if ((dataStart < historyStart)
- && ((dataEnd >= historyStart) && (dataEnd <= historyEnd))) {
- // Create a new history cache with the missing data from the main cache and append the old history to it.
+ for (int index1 = 0; index1 < newHistoryCacheSize1; index1++)
+ newHistoryCache1.bytes[index1] = new FPMemoryByte(
+ fCache.bytes[index1].getValue());
- int missingDataByteCount = historyStart - dataStart;
- int historyCacheSize = historyLength;
- int newHistoryCacheSize = missingDataByteCount + historyLength;
+ fHistoryCache[0] = newHistoryCache1;
- if (missingDataByteCount <= 0 && historyCacheSize <= 0)
- break;
+ continue;
+ }
- MemoryUnit newHistoryCache = new MemoryUnit();
+ // Case 3: The data cache starts at a lower address than the history cache, but overlaps the history cache
- newHistoryCache.start = fCache.start;
- newHistoryCache.end = fHistoryCache[0].end;
- newHistoryCache.bytes = new FPMemoryByte[newHistoryCacheSize];
+ if ((dataStart < historyStart)
+ && ((dataEnd >= historyStart) && (dataEnd <= historyEnd))) {
+ // Create a new history cache with the missing data from the main cache and append the old history to it.
- // Copy the missing bytes from the beginning of the main cache to the history cache.
+ int missingDataByteCount1 = historyStart - dataStart;
+ int historyCacheSize1 = historyLength;
+ int newHistoryCacheSize2 = missingDataByteCount1 + historyLength;
- for (int index = 0; index < missingDataByteCount; index++)
- newHistoryCache.bytes[index] = new FPMemoryByte(
- fCache.bytes[index].getValue());
+ if (missingDataByteCount1 <= 0 && historyCacheSize1 <= 0)
+ break;
- // Copy the remaining bytes from the old history cache to the new history cache
+ MemoryUnit newHistoryCache2 = new MemoryUnit();
- for (int index = 0; index < historyCacheSize; index++)
- newHistoryCache.bytes[index + missingDataByteCount] = new FPMemoryByte(
- fHistoryCache[0].bytes[index].getValue());
+ newHistoryCache2.start = fCache.start;
+ newHistoryCache2.end = fHistoryCache[0].end;
+ newHistoryCache2.bytes = new FPMemoryByte[newHistoryCacheSize2];
- fHistoryCache[0] = newHistoryCache;
+ // Copy the missing bytes from the beginning of the main cache to the history cache.
- continue;
- }
+ for (int index2 = 0; index2 < missingDataByteCount1; index2++)
+ newHistoryCache2.bytes[index2] = new FPMemoryByte(
+ fCache.bytes[index2].getValue());
- // Case 4: The data cache starts at a higher address than the history cache
+ // Copy the remaining bytes from the old history cache to the new history cache
- if (((dataStart >= historyStart) && (dataStart <= historyEnd))
- && (dataEnd > historyEnd)) {
- // Append the missing main cache bytes to the history cache.
+ for (int index3 = 0; index3 < historyCacheSize1; index3++)
+ newHistoryCache2.bytes[index3 + missingDataByteCount1] = new FPMemoryByte(
+ fHistoryCache[0].bytes[index3].getValue());
- int missingDataByteCount = dataEnd - historyEnd;
- int historyCacheSize = historyEnd - historyStart;
- int newHistoryCacheSize = missingDataByteCount + historyLength;
+ fHistoryCache[0] = newHistoryCache2;
- if (missingDataByteCount > 0 && historyCacheSize > 0) {
- MemoryUnit newHistoryCache = new MemoryUnit();
+ continue;
+ }
- newHistoryCache.start = fHistoryCache[0].start;
- newHistoryCache.end = fCache.end;
- newHistoryCache.bytes = new FPMemoryByte[newHistoryCacheSize];
+ // Case 4: The data cache starts at a higher address than the history cache
- // Copy the old history bytes to the new history cache
+ if (((dataStart >= historyStart) && (dataStart <= historyEnd))
+ && (dataEnd > historyEnd)) {
+ // Append the missing main cache bytes to the history cache.
- System.arraycopy(fHistoryCache[0].bytes, 0, newHistoryCache.bytes, 0,
- historyLength);
+ int missingDataByteCount2 = dataEnd - historyEnd;
+ int historyCacheSize2 = historyEnd - historyStart;
+ int newHistoryCacheSize3 = missingDataByteCount2 + historyLength;
- // Copy the bytes from the main cache that are not in the history cache to the end of the new history cache.
+ if (missingDataByteCount2 > 0 && historyCacheSize2 > 0) {
+ MemoryUnit newHistoryCache3 = new MemoryUnit();
- for (int index = 0; index < missingDataByteCount; index++) {
- int srcIndex = dataLength - missingDataByteCount + index;
- int dstIndex = historyLength + index;
- newHistoryCache.bytes[dstIndex] = new FPMemoryByte(
- fCache.bytes[srcIndex].getValue());
- }
+ newHistoryCache3.start = fHistoryCache[0].start;
+ newHistoryCache3.end = fCache.end;
+ newHistoryCache3.bytes = new FPMemoryByte[newHistoryCacheSize3];
- fHistoryCache[0] = newHistoryCache;
+ // Copy the old history bytes to the new history cache
- continue;
+ System.arraycopy(fHistoryCache[0].bytes, 0, newHistoryCache3.bytes, 0,
+ historyLength);
+
+ // Copy the bytes from the main cache that are not in the history cache to the end of the new history cache.
+
+ for (int index4 = 0; index4 < missingDataByteCount2; index4++) {
+ int srcIndex = dataLength - missingDataByteCount2 + index4;
+ int dstIndex = historyLength + index4;
+ newHistoryCache3.bytes[dstIndex] = new FPMemoryByte(
+ fCache.bytes[srcIndex].getValue());
}
+
+ fHistoryCache[0] = newHistoryCache3;
+
+ continue;
}
+ }
- // Case 5 - The data cache is greater than the history cache and fully covers it
+ // Case 5 - The data cache is greater than the history cache and fully covers it
- if (dataStart < historyStart && dataEnd > historyEnd) {
- int start = 0;
- int end = 0;
+ if (dataStart < historyStart && dataEnd > historyEnd) {
+ int start = 0;
+ int end = 0;
- // Create a new history cache to reflect the entire data cache
+ // Create a new history cache to reflect the entire data cache
- MemoryUnit newHistoryCache = new MemoryUnit();
+ MemoryUnit newHistoryCache4 = new MemoryUnit();
- newHistoryCache.start = fCache.start;
- newHistoryCache.end = fCache.end;
- int newHistoryCacheSize = fCache.bytes.length;
- newHistoryCache.bytes = new FPMemoryByte[newHistoryCacheSize];
+ newHistoryCache4.start = fCache.start;
+ newHistoryCache4.end = fCache.end;
+ int newHistoryCacheSize4 = fCache.bytes.length;
+ newHistoryCache4.bytes = new FPMemoryByte[newHistoryCacheSize4];
- int topByteCount = historyStart - dataStart;
- int bottomByteCount = dataEnd - historyEnd;
+ int topByteCount = historyStart - dataStart;
+ int bottomByteCount = dataEnd - historyEnd;
- // Copy the bytes from the beginning of the data cache to the new history cache
+ // Copy the bytes from the beginning of the data cache to the new history cache
- for (int index = 0; index < topByteCount; index++)
- newHistoryCache.bytes[index] = new FPMemoryByte(
- fCache.bytes[index].getValue());
+ for (int index5 = 0; index5 < topByteCount; index5++)
+ newHistoryCache4.bytes[index5] = new FPMemoryByte(
+ fCache.bytes[index5].getValue());
- // Copy the old history cache bytes to the new history cache
+ // Copy the old history cache bytes to the new history cache
- start = topByteCount;
- end = topByteCount + historyLength;
+ start = topByteCount;
+ end = topByteCount + historyLength;
- for (int index = start; index < end; index++)
- newHistoryCache.bytes[index] = new FPMemoryByte(
- fCache.bytes[index].getValue());
+ for (int index6 = start; index6 < end; index6++)
+ newHistoryCache4.bytes[index6] = new FPMemoryByte(
+ fCache.bytes[index6].getValue());
- // Copy the bytes from the end of the data cache to the new history cache
+ // Copy the bytes from the end of the data cache to the new history cache
- start = topByteCount + historyLength;
- end = topByteCount + historyLength + bottomByteCount;
+ start = topByteCount + historyLength;
+ end = topByteCount + historyLength + bottomByteCount;
- for (int index = start; index < end; index++)
- newHistoryCache.bytes[index] = new FPMemoryByte(
- fCache.bytes[index].getValue());
+ for (int index7 = start; index7 < end; index7++)
+ newHistoryCache4.bytes[index7] = new FPMemoryByte(
+ fCache.bytes[index7].getValue());
- fHistoryCache[0] = newHistoryCache;
+ fHistoryCache[0] = newHistoryCache4;
- continue;
- }
+ continue;
}
}
}
+ }
- // If the history does not exist, populate the history with the just populated
- // cache. This solves the use case of (1) connect to target; (2) edit memory
- // before the first suspend debug event; (3) paint differences in changed color.
+ // If the history does not exist, populate the history with the just populated
+ // cache. This solves the use case of (1) connect to target; (2) edit memory
+ // before the first suspend debug event; (3) paint differences in changed color.
- if (fHistoryCache[0] == null)
- fHistoryCache[0] = fCache.clone();
+ if (fHistoryCache[0] == null)
+ fHistoryCache[0] = fCache.clone();
- Rendering.this.redrawPanes();
- }
+ Rendering.this.redrawPanes();
});
} catch (Exception e) {
@@ -1728,12 +1712,9 @@ public class Rendering extends Composite implements IDebugEventSetListener {
fParent.setTargetMemoryLittleEndian(littleEndian);
fIsTargetLittleEndian = littleEndian;
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- fireSettingsChanged();
- layoutPanes();
- }
+ Display.getDefault().asyncExec(() -> {
+ fireSettingsChanged();
+ layoutPanes();
});
}
@@ -1747,12 +1728,7 @@ public class Rendering extends Composite implements IDebugEventSetListener {
fIsDisplayLittleEndian = isLittleEndian;
fireSettingsChanged();
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- layoutPanes();
- }
- });
+ Display.getDefault().asyncExec(() -> layoutPanes());
}
public int getCharsPerColumn() {

Back to the top