Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-07-19 08:52:49 -0400
committerAlexander Kurtakov2018-07-19 08:52:49 -0400
commit233a9f42db3dcb0a0eaebbe55a3c2574802b9805 (patch)
tree0787422f4289580540142302596cd67234e7e0d0 /org.eclipse.debug.ui/ui/org/eclipse/debug/ui
parent8c924456a516ce49087a542b155ee70c8d76ae38 (diff)
downloadeclipse.platform.debug-233a9f42db3dcb0a0eaebbe55a3c2574802b9805.tar.gz
eclipse.platform.debug-233a9f42db3dcb0a0eaebbe55a3c2574802b9805.tar.xz
eclipse.platform.debug-233a9f42db3dcb0a0eaebbe55a3c2574802b9805.zip
Bug 521038 - [refactoring] Replace anonymous Runnable classes by lambda
expression Changed some formatters to Eclipse so there is some formatting happening as the debug one is not clear where to get from and it's unrealistic to expect random contributors to do it. Change-Id: I731410854f9a4ac0c9fc18bcf3ad3dcf7d941c9a Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/ui')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java48
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java75
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/PrototypeTab.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java49
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java56
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java409
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java20
9 files changed, 300 insertions, 407 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java
index 7f051ad69..d9b95065e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -26,7 +26,6 @@ import org.eclipse.debug.internal.ui.actions.breakpoints.SkipAllBreakpointsActio
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
@@ -555,12 +554,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi
protected void createContextMenu(Control menuControl) {
MenuManager menuMgr= new MenuManager("#PopUp"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager mgr) {
- fillContextMenu(mgr);
- }
- });
+ menuMgr.addMenuListener(mgr -> fillContextMenu(mgr));
Menu menu= menuMgr.createContextMenu(menuControl);
menuControl.setMenu(menu);
@@ -623,30 +617,28 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi
// This is done in a runnable to be run after this view's pane
// is created
- Runnable r = new Runnable() {
- @Override
- public void run() {
- if (!isAvailable()) {
- return;
- }
- IContributionItem[] items = tbm.getItems();
- if (items != null) {
- for (int i = 0; i < items.length; i++) {
- if (items[i] instanceof ActionContributionItem) {
- IAction action = ((ActionContributionItem)items[i]).getAction();
- if (!SkipAllBreakpointsAction.ACTION_ID.equals(action.getId())) {
- if (action.getStyle() == IAction.AS_CHECK_BOX) {
- initActionState(action);
- if (action.isChecked()) {
- action.run();
- }
+ Runnable r = () -> {
+ if (!isAvailable()) {
+ return;
+ }
+ IContributionItem[] items = tbm.getItems();
+ if (items != null) {
+ for (int i = 0; i < items.length; i++) {
+ if (items[i] instanceof ActionContributionItem) {
+ IAction action = ((ActionContributionItem) items[i]).getAction();
+ if (!SkipAllBreakpointsAction.ACTION_ID.equals(action.getId())) {
+ if (action.getStyle() == IAction.AS_CHECK_BOX) {
+ initActionState(action);
+ if (action.isChecked()) {
+ action.run();
}
- }}
+ }
+ }
}
- setMemento(null);
}
- updateObjects();
+ setMemento(null);
}
+ updateObjects();
};
asyncExec(r);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
index 478bb34b5..1c54d48cd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
@@ -606,32 +606,27 @@ public class DebugUITools {
*/
public static int openLaunchConfigurationDialogOnGroup(final Shell shell, final IStructuredSelection selection, final String groupIdentifier, final IStatus status) {
final int[] result = new int[1];
- Runnable r = new Runnable() {
- /**
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- LaunchConfigurationsDialog dialog = (LaunchConfigurationsDialog) LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
- if (dialog != null) {
+ Runnable r = () -> {
+ LaunchConfigurationsDialog dialog = (LaunchConfigurationsDialog) LaunchConfigurationsDialog
+ .getCurrentlyVisibleLaunchConfigurationDialog();
+ if (dialog != null) {
+ dialog.setInitialSelection(selection);
+ dialog.doInitialTreeSelection();
+ if (status != null) {
+ dialog.handleStatus(status);
+ }
+ result[0] = Window.OK;
+ } else {
+ LaunchGroupExtension ext = DebugUIPlugin.getDefault().getLaunchConfigurationManager()
+ .getLaunchGroup(groupIdentifier);
+ if (ext != null) {
+ dialog = new LaunchConfigurationsDialog(shell, ext);
+ dialog.setOpenMode(LaunchConfigurationsDialog.LAUNCH_CONFIGURATION_DIALOG_OPEN_ON_SELECTION);
dialog.setInitialSelection(selection);
- dialog.doInitialTreeSelection();
- if (status != null) {
- dialog.handleStatus(status);
- }
- result[0] = Window.OK;
+ dialog.setInitialStatus(status);
+ result[0] = dialog.open();
} else {
- LaunchGroupExtension ext = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(groupIdentifier);
- if(ext != null) {
- dialog = new LaunchConfigurationsDialog(shell, ext);
- dialog.setOpenMode(LaunchConfigurationsDialog.LAUNCH_CONFIGURATION_DIALOG_OPEN_ON_SELECTION);
- dialog.setInitialSelection(selection);
- dialog.setInitialStatus(status);
- result[0] = dialog.open();
- }
- else {
- result[0] = Window.CANCEL;
- }
+ result[0] = Window.CANCEL;
}
}
};
@@ -982,24 +977,22 @@ public class DebugUITools {
private static Set<ILaunch> fgLaunchList = new LinkedHashSet<>();
- private static Runnable fgLaunchTerminate = new Runnable() {
- @Override
- public void run() {
- String launchConfigName = null;
- Set<ILaunch> launchList;
- try {
- synchronized (fgLaunchList) {
- launchList = new LinkedHashSet<>(fgLaunchList);
- fgLaunchList.clear();
- }
- for (ILaunch iLaunch : launchList) {
- launchConfigName = iLaunch.getLaunchConfiguration().getName();
- iLaunch.terminate();
- }
-
- } catch (DebugException e) {
- DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), NLS.bind(ActionMessages.TerminateAndLaunchFailure, launchConfigName), e));
+ private static Runnable fgLaunchTerminate = () -> {
+ String launchConfigName = null;
+ Set<ILaunch> launchList;
+ try {
+ synchronized (fgLaunchList) {
+ launchList = new LinkedHashSet<>(fgLaunchList);
+ fgLaunchList.clear();
}
+ for (ILaunch iLaunch : launchList) {
+ launchConfigName = iLaunch.getLaunchConfiguration().getName();
+ iLaunch.terminate();
+ }
+
+ } catch (DebugException e) {
+ DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(),
+ NLS.bind(ActionMessages.TerminateAndLaunchFailure, launchConfigName), e));
}
};
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/PrototypeTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/PrototypeTab.java
index 9d26b679a..a2a49338e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/PrototypeTab.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/PrototypeTab.java
@@ -444,15 +444,12 @@ public class PrototypeTab extends AbstractLaunchConfigurationTab {
* Set columns tree widths dynamically
*/
private void updateColumnsWidth() {
- getShell().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- Tree tree = fAttributesTreeViewer.getTree();
- if (tree != null && !tree.isDisposed()) {
- TreeColumn[] columns = tree.getColumns();
- for (TreeColumn treeColumn : columns) {
- treeColumn.pack();
- }
+ getShell().getDisplay().asyncExec(() -> {
+ Tree tree = fAttributesTreeViewer.getTree();
+ if (tree != null && !tree.isDisposed()) {
+ TreeColumn[] columns = tree.getColumns();
+ for (TreeColumn treeColumn : columns) {
+ treeColumn.pack();
}
}
});
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java
index 0df29da21..9e778812b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -159,17 +159,9 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
private void updateElements() {
final Display display = DebugUIPlugin.getStandardDisplay();
- BusyIndicator.showWhile(display, new Runnable() {
- @Override
- public void run() {
- final IStringVariable[] elements = VariablesPlugin.getDefault().getStringVariableManager().getVariables();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- setListElements(elements);
- }
- });
- }
+ BusyIndicator.showWhile(display, () -> {
+ final IStringVariable[] elements = VariablesPlugin.getDefault().getStringVariableManager().getVariables();
+ display.asyncExec(() -> setListElements(elements));
});
}
@@ -306,20 +298,14 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
*/
protected void editVariables() {
final Display display = DebugUIPlugin.getStandardDisplay();
- BusyIndicator.showWhile(display, new Runnable() {
- @Override
- public void run() {
- // show the preference page in a new dialog rather than using the utility method to re-use a
- // preference page, in case this dialog is being opened from a preference page
- if (showVariablesPage()) {
- final IStringVariable[] elements = VariablesPlugin.getDefault().getStringVariableManager().getVariables();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- setListElements(elements);
- }
- });
- }
+ BusyIndicator.showWhile(display, () -> {
+ // show the preference page in a new dialog rather than using the utility method
+ // to re-use a
+ // preference page, in case this dialog is being opened from a preference page
+ if (showVariablesPage()) {
+ final IStringVariable[] elements = VariablesPlugin.getDefault().getStringVariableManager()
+ .getVariables();
+ display.asyncExec(() -> setListElements(elements));
}
});
}
@@ -337,13 +323,10 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
manager.addToRoot(targetNode);
final PreferenceDialog dialog = new PreferenceDialog(DebugUIPlugin.getShell(), manager);
final boolean [] result = new boolean[] { false };
- BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), new Runnable() {
- @Override
- public void run() {
- dialog.create();
- dialog.setMessage(targetNode.getLabelText());
- result[0]= (dialog.open() == Window.OK);
- }
+ BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), () -> {
+ dialog.create();
+ dialog.setMessage(targetNode.getLabelText());
+ result[0] = (dialog.open() == Window.OK);
});
return result[0];
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineAction.java
index b8e18b8cf..2b71d373f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2017 IBM Corporation and others.
+ * Copyright (c) 2017, 2018 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
@@ -170,12 +170,7 @@ public class RunToLineAction extends Action implements IUpdate {
*/
@Override
public void update() {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- setEnabled(isTargetEnabled());
- }
- };
+ Runnable r = () -> setEnabled(isTargetEnabled());
DebugUIPlugin.getStandardDisplay().asyncExec(r);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
index 7f687386c..9f848a12e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -122,22 +122,20 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe
if (fAction == null) {
return;
}
- Runnable r = new Runnable() {
- @Override
- public void run() {
- boolean enabled = false;
- if (fPartTarget != null && fTargetElement != null) {
- IWorkbenchPartSite site = fActivePart.getSite();
- if (site != null) {
- ISelectionProvider selectionProvider = site.getSelectionProvider();
- if (selectionProvider != null) {
- ISelection selection = selectionProvider.getSelection();
- enabled = fTargetElement.isSuspended() && fPartTarget.canRunToLine(fActivePart, selection, fTargetElement);
- }
+ Runnable r = () -> {
+ boolean enabled = false;
+ if (fPartTarget != null && fTargetElement != null) {
+ IWorkbenchPartSite site = fActivePart.getSite();
+ if (site != null) {
+ ISelectionProvider selectionProvider = site.getSelectionProvider();
+ if (selectionProvider != null) {
+ ISelection selection = selectionProvider.getSelection();
+ enabled = fTargetElement.isSuspended()
+ && fPartTarget.canRunToLine(fActivePart, selection, fTargetElement);
}
}
- fAction.setEnabled(enabled);
}
+ fAction.setEnabled(enabled);
};
DebugUIPlugin.getStandardDisplay().asyncExec(r);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java
index 938b6ac52..978a1e10b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2016 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 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
@@ -25,7 +25,6 @@ import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
import org.eclipse.debug.internal.ui.views.memory.PropertyChangeNotifier;
import org.eclipse.debug.ui.DebugUITools;
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.util.IPropertyChangeListener;
@@ -118,11 +117,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
// disconnect from memory block when rendering is disposed
if (fMemoryBlock instanceof IMemoryBlockExtension)
{
- Runnable runnable = new Runnable(){
- @Override
- public void run() {
- ((IMemoryBlockExtension)fMemoryBlock).disconnect(AbstractMemoryRendering.this);
- }};
+ Runnable runnable = () -> ((IMemoryBlockExtension) fMemoryBlock).disconnect(AbstractMemoryRendering.this);
new ConnectionJob(runnable).schedule();
}
@@ -134,8 +129,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
fPopupMenuMgr = null;
}
- if (fPropertyListeners != null)
+ if (fPropertyListeners != null) {
fPropertyListeners = null;
+ }
}
/* (non-Javadoc)
@@ -143,8 +139,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
*/
@Override
public void activated() {
- if (fContainer.getMemoryRenderingSite().getSynchronizationService() != null)
+ if (fContainer.getMemoryRenderingSite().getSynchronizationService() != null) {
fContainer.getMemoryRenderingSite().getSynchronizationService().setSynchronizationProvider(this);
+ }
}
/* (non-Javadoc)
@@ -168,11 +165,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
if (fMemoryBlock instanceof IMemoryBlockExtension)
{
- Runnable runnable = new Runnable(){
- @Override
- public void run() {
- ((IMemoryBlockExtension)fMemoryBlock).connect(AbstractMemoryRendering.this);
- }};
+ Runnable runnable = () -> ((IMemoryBlockExtension) fMemoryBlock).connect(AbstractMemoryRendering.this);
new ConnectionJob(runnable).schedule();
}
}
@@ -185,11 +178,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
fVisible = false;
if (fMemoryBlock instanceof IMemoryBlockExtension)
{
- Runnable runnable = new Runnable(){
- @Override
- public void run() {
- ((IMemoryBlockExtension)fMemoryBlock).disconnect(AbstractMemoryRendering.this);
- }};
+ Runnable runnable = () -> ((IMemoryBlockExtension) fMemoryBlock).disconnect(AbstractMemoryRendering.this);
new ConnectionJob(runnable).schedule();
}
}
@@ -217,8 +206,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
@Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
- if (fPropertyListeners == null)
+ if (fPropertyListeners == null) {
fPropertyListeners = new ListenerList<>();
+ }
fPropertyListeners.add(listener);
}
@@ -229,8 +219,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
@Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
- if (fPropertyListeners == null)
+ if (fPropertyListeners == null) {
return;
+ }
fPropertyListeners.remove(listener);
}
@@ -250,8 +241,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
* @since 3.2
*/
protected Image decorateImage(Image image) {
- if (fLabelDecorator != null)
+ if (fLabelDecorator != null) {
return fLabelDecorator.decorateImage(image, this);
+ }
return image;
}
@@ -261,8 +253,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
@Override
public String getLabel()
{
- if (fMemoryBlock == null)
+ if (fMemoryBlock == null) {
return IInternalDebugCoreConstants.EMPTY_STRING;
+ }
StringBuffer label = new StringBuffer(IInternalDebugCoreConstants.EMPTY_STRING);
@@ -270,13 +263,16 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
{
String expression = ((IMemoryBlockExtension)fMemoryBlock).getExpression();
- if (expression == null)
+ if (expression == null) {
expression = IInternalDebugCoreConstants.EMPTY_STRING;
+ }
label.append(expression);
if (expression.startsWith("&")) //$NON-NLS-1$
+ {
label.insert(0, "&"); //$NON-NLS-1$
+ }
// show full address if the rendering is visible
// hide address if the rendering is invisible
@@ -321,8 +317,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
* @since 3.2
*/
protected String decorateLabel(String label) {
- if (fLabelDecorator != null)
+ if (fLabelDecorator != null) {
return fLabelDecorator.decorateText(label.toString(), this);
+ }
return label.toString();
}
@@ -356,11 +353,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
ISelectionProvider selProvider = site.getSite().getSelectionProvider();
- fMenuListener = new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }};
+ fMenuListener = manager -> manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
fPopupMenuMgr.addMenuListener(fMenuListener);
site.getSite().registerContextMenu(menuId, fPopupMenuMgr, selProvider);
@@ -388,8 +381,9 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements
*/
protected void firePropertyChangedEvent(PropertyChangeEvent event)
{
- if (fPropertyListeners == null)
+ if (fPropertyListeners == null) {
return;
+ }
for (IPropertyChangeListener iPropertyChangeListener : fPropertyListeners) {
PropertyChangeNotifier notifier = new PropertyChangeNotifier(iPropertyChangeListener, event);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
index adcaa5cd5..1b6910821 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2015 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 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
@@ -16,7 +16,6 @@ import java.math.BigInteger;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.core.model.IMemoryBlockExtension;
@@ -43,10 +42,8 @@ import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingConte
import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingLabelProvider;
import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingLabelProviderEx;
import org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingLine;
-
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
-
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -54,10 +51,8 @@ import org.eclipse.jface.action.Separator;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
-
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.TextViewer;
-
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CellEditor;
@@ -68,13 +63,10 @@ import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.custom.TableCursor;
import org.eclipse.swt.custom.TableEditor;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.KeyAdapter;
@@ -103,7 +95,6 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
-
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PropertyDialogAction;
@@ -867,12 +858,10 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
createPopupMenu(fTableViewer.getControl());
createPopupMenu(fTableCursor);
- fMenuListener = new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- fillContextMenu(manager);
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }};
+ fMenuListener = manager -> {
+ fillContextMenu(manager);
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ };
getPopupMenuManager().addMenuListener(fMenuListener);
// now the rendering is successfully created
@@ -1161,11 +1150,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
};
fTableCursor.addKeyListener(fCursorKeyAdapter);
- fCursorTraverseListener = new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent e) {
- handleCursorTraverseEvt(e);
- }};
+ fCursorTraverseListener = e -> handleCursorTraverseEvt(e);
fTableCursor.addTraverseListener(fCursorTraverseListener);
@@ -1178,17 +1163,15 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
// cursor may be disposed before disposed is called
// remove listeners whenever the cursor is disposed
- fTableCursor.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- if (fTableCursor == null) {
- return;
- }
- fTableCursor.removeTraverseListener(fCursorTraverseListener);
- fTableCursor.removeKeyListener(fCursorKeyAdapter);
- fTableCursor.removeMouseListener(fCursorMouseListener);
- fTableCursor.removeSelectionListener(fCursorSelectionListener);
- }});
+ fTableCursor.addDisposeListener(e -> {
+ if (fTableCursor == null) {
+ return;
+ }
+ fTableCursor.removeTraverseListener(fCursorTraverseListener);
+ fTableCursor.removeKeyListener(fCursorKeyAdapter);
+ fTableCursor.removeMouseListener(fCursorMouseListener);
+ fTableCursor.removeSelectionListener(fCursorSelectionListener);
+ });
fCursorSelectionListener = new SelectionAdapter() {
@Override
@@ -2830,12 +2813,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
return;
}
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- format(getBytesPerLine(), newColumnSize);
- }
- });
+ Display.getDefault().asyncExec(() -> format(getBytesPerLine(), newColumnSize));
}
/**
@@ -2856,12 +2834,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
final int columnSize = col;
final int rowSize = bytesPerLine;
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- format(rowSize, columnSize);
- }
- });
+ Display.getDefault().asyncExec(() -> format(rowSize, columnSize));
}
private void handleCursorMouseEvent(MouseEvent e){
@@ -3003,36 +2976,29 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
{
final FocusEvent e = event;
- Display.getDefault().syncExec(new Runnable() {
-
- @Override
- public void run()
+ Display.getDefault().syncExec(() -> {
+ try
{
- try
- {
- int row = findAddressIndex(fSelectedAddress);
- int col = fTableCursor.getColumn();
+ int row = findAddressIndex(fSelectedAddress);
+ int col = fTableCursor.getColumn();
- Text text = (Text)e.getSource();
- removeListeners(text);
+ Text text = (Text) e.getSource();
+ removeListeners(text);
- // get new value
- String newValue = text.getText();
+ // get new value
+ String newValue = text.getText();
- // modify memory at fRow and fCol
- modifyValue(row, col, newValue);
+ // modify memory at fRow and fCol
+ modifyValue(row, col, newValue);
- // show cursor after modification is completed
- setCursorAtAddress(fSelectedAddress);
- fTableCursor.moveAbove(text);
- fTableCursor.setVisible(false);
- fTableCursor.setVisible(true);
- }
- catch (NumberFormatException e1)
- {
- MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title,
+ // show cursor after modification is completed
+ setCursorAtAddress(fSelectedAddress);
+ fTableCursor.moveAbove(text);
+ fTableCursor.setVisible(false);
+ fTableCursor.setVisible(true);
+ } catch (NumberFormatException e1) {
+ MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title,
DebugUIMessages.MemoryViewCellModifier_data_is_invalid, null);
- }
}
});
}
@@ -3042,150 +3008,137 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
*/
private void handleKeyEventInEditor(KeyEvent event) {
final KeyEvent e = event;
- Display.getDefault().asyncExec(new Runnable()
- {
- @Override
- public void run()
- {
- Text text = (Text)e.getSource();
- int row = findAddressIndex(fSelectedAddress);
- int col = fTableCursor.getColumn();
+ Display.getDefault().asyncExec(() -> {
+ Text text = (Text) e.getSource();
+ int row = findAddressIndex(fSelectedAddress);
+ int col = fTableCursor.getColumn();
- try
+ try
+ {
+ switch (e.keyCode)
{
- switch (e.keyCode)
- {
- case SWT.ARROW_UP :
+ case SWT.ARROW_UP:
- // move text editor box up one row
- if (row-1 < 0) {
- return;
- }
+ // move text editor box up one row
+ if (row - 1 < 0) {
+ return;
+ }
- // modify value for current cell
- modifyValue(row, col, text.getText());
+ // modify value for current cell
+ modifyValue(row, col, text.getText());
- row--;
+ row--;
- // update cursor location and selection in table
- fTableCursor.setSelection(row, col);
- handleCursorMoved();
+ // update cursor location and selection in table
+ fTableCursor.setSelection(row, col);
+ handleCursorMoved();
- // remove listeners when focus is lost
- removeListeners(text);
- activateCellEditor(null);
- break;
- case SWT.ARROW_DOWN :
+ // remove listeners when focus is lost
+ removeListeners(text);
+ activateCellEditor(null);
+ break;
+ case SWT.ARROW_DOWN:
- // move text editor box down one row
+ // move text editor box down one row
- if (row+1 >= fTableViewer.getTable().getItemCount()) {
- return;
- }
+ if (row + 1 >= fTableViewer.getTable().getItemCount()) {
+ return;
+ }
+
+ // modify value for current cell
+ modifyValue(row, col, text.getText());
+
+ row++;
+
+ // update cursor location and selection in table
+ fTableCursor.setSelection(row, col);
+ handleCursorMoved();
+
+ // remove traverse listener when focus is lost
+ removeListeners(text);
+ activateCellEditor(null);
+ break;
+ case 0:
+
+ // if user has entered the max number of characters allowed in a cell, move to
+ // next cell
+ // Extra changes will be used as initial value for the next cell
+ int numCharsPerByte = getNumCharsPerByte();
+ if (numCharsPerByte > 0) {
+ if (text.getText().length() > getBytesPerColumn() * numCharsPerByte)
+ {
+ String newValue1 = text.getText();
+ text.setText(newValue1.substring(0, getBytesPerColumn() * numCharsPerByte));
- // modify value for current cell
modifyValue(row, col, text.getText());
- row++;
+ // if cursor is at the end of a line, move to next line
+ if (col >= getNumCol()) {
+ col = 1;
+ row++;
+ } else {
+ // move to next column
+ row++;
+ }
- // update cursor location and selection in table
+ // update cursor position and selected address
fTableCursor.setSelection(row, col);
handleCursorMoved();
- // remove traverse listener when focus is lost
removeListeners(text);
- activateCellEditor(null);
- break;
- case 0:
-
- // if user has entered the max number of characters allowed in a cell, move to next cell
- // Extra changes will be used as initial value for the next cell
- int numCharsPerByte = getNumCharsPerByte();
- if (numCharsPerByte > 0)
+
+ // activate text editor at next cell
+ activateCellEditor(newValue1.substring(getBytesPerColumn() * numCharsPerByte));
+ }
+ }
+ break;
+ case SWT.ESC:
+
+ // if user has pressed escape, do not commit the changes
+ // that's why "modifyValue" is not called
+ fTableCursor.setSelection(row, col);
+ handleCursorMoved();
+
+ removeListeners(text);
+
+ // cursor needs to have focus to remove focus from cell editor
+ fTableCursor.setFocus();
+ break;
+ default:
+ numCharsPerByte = getNumCharsPerByte();
+ if (numCharsPerByte > 0) {
+ if (text.getText().length() > getBytesPerColumn() * numCharsPerByte)
{
- if (text.getText().length() > getBytesPerColumn()*numCharsPerByte)
+ String newValue2 = text.getText();
+ text.setText(newValue2.substring(0, getBytesPerColumn() * numCharsPerByte));
+ modifyValue(row, col, text.getText());
+ // if cursor is at the end of a line, move to next line
+ if (col >= getNumCol()) {
+ col = 1;
+ row++;
+ } else
{
- String newValue = text.getText();
- text.setText(newValue.substring(0, getBytesPerColumn()*numCharsPerByte));
-
- modifyValue(row, col, text.getText());
-
- // if cursor is at the end of a line, move to next line
- if (col >= getNumCol())
- {
- col = 1;
- row++;
- }
- else
- {
- // move to next column
- row++;
- }
-
- // update cursor position and selected address
- fTableCursor.setSelection(row, col);
- handleCursorMoved();
-
- removeListeners(text);
-
- // activate text editor at next cell
- activateCellEditor(newValue.substring(getBytesPerColumn()*numCharsPerByte));
- }
+ col++;
}
- break;
- case SWT.ESC:
- // if user has pressed escape, do not commit the changes
- // that's why "modifyValue" is not called
fTableCursor.setSelection(row, col);
handleCursorMoved();
removeListeners(text);
- // cursor needs to have focus to remove focus from cell editor
- fTableCursor.setFocus();
- break;
- default :
- numCharsPerByte = getNumCharsPerByte();
- if (numCharsPerByte > 0)
- {
- if (text.getText().length()> getBytesPerColumn()* numCharsPerByte)
- {
- String newValue = text.getText();
- text.setText(newValue.substring(0,getBytesPerColumn()* numCharsPerByte));
- modifyValue(row, col, text.getText());
- // if cursor is at the end of a line, move to next line
- if (col >= getNumCol())
- {
- col = 1;
- row++;
- }
- else
- {
- col++;
- }
-
- fTableCursor.setSelection(row, col);
- handleCursorMoved();
-
- removeListeners(text);
-
- activateCellEditor(newValue.substring(getBytesPerColumn()*numCharsPerByte));
- }
+ activateCellEditor(newValue2.substring(getBytesPerColumn() * numCharsPerByte));
}
- break;
}
+ break;
}
- catch (NumberFormatException e1)
- {
- MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title,
+ } catch (NumberFormatException e1) {
+ MemoryViewUtil.openError(DebugUIMessages.MemoryViewCellModifier_failure_title,
DebugUIMessages.MemoryViewCellModifier_data_is_invalid, null);
- fTableCursor.setSelection(row, col);
- handleCursorMoved();
+ fTableCursor.setSelection(row, col);
+ handleCursorMoved();
- removeListeners(text);
- }
+ removeListeners(text);
}
});
}
@@ -3484,64 +3437,54 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
if (adapter == IMemoryBlockConnection.class) {
if (fConnection == null) {
- fConnection = new IMemoryBlockConnection() {
- @Override
- public void update() {
- try {
- fContentProvider.takeContentSnapshot();
- if (getMemoryBlock() instanceof IMemoryBlockExtension)
+ fConnection = () -> {
+ try {
+ fContentProvider.takeContentSnapshot();
+ if (getMemoryBlock() instanceof IMemoryBlockExtension) {
+ BigInteger address = ((IMemoryBlockExtension) getMemoryBlock()).getBigBaseAddress();
+ if (address.compareTo(fContentProvider.getContentBaseAddress()) != 0)
{
- BigInteger address = ((IMemoryBlockExtension)getMemoryBlock()).getBigBaseAddress();
- if (address.compareTo(fContentProvider.getContentBaseAddress()) != 0)
- {
- // get to new address
- setSelectedAddress(address);
- updateSyncSelectedAddress();
- fTopRowAddress = address;
- fContentInput.updateContentBaseAddress();
- fContentInput.setLoadAddress(address);
+ // get to new address
+ setSelectedAddress(address);
+ updateSyncSelectedAddress();
+ fTopRowAddress = address;
+ fContentInput.updateContentBaseAddress();
+ fContentInput.setLoadAddress(address);
+ }
+ fContentProvider.loadContentForExtendedMemoryBlock();
+ } else {
+ fContentProvider.loadContentForSimpleMemoryBlock();
+ }
+
+ // update UI asynchronously
+ Display display = DebugUIPlugin.getDefault().getWorkbench().getDisplay();
+ display.asyncExec(() -> {
+ updateLabels();
+
+ if (getMemoryBlock() instanceof IMemoryBlockExtension) {
+ int topIdx = findAddressIndex(fTopRowAddress);
+ if (topIdx != -1) {
+ setTopIndex(fTableViewer.getTable(), topIdx);
}
- fContentProvider.loadContentForExtendedMemoryBlock();
+ }
+
+ // cursor needs to be refreshed after reload
+ if (isAddressVisible(fSelectedAddress)) {
+ setCursorAtAddress(fSelectedAddress);
+ fTableCursor.setVisible(true);
+ fTableCursor.redraw();
} else {
- fContentProvider.loadContentForSimpleMemoryBlock();
+ fTableCursor.setVisible(false);
}
- // update UI asynchronously
- Display display = DebugUIPlugin.getDefault().getWorkbench().getDisplay();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- updateLabels();
-
- if (getMemoryBlock() instanceof IMemoryBlockExtension) {
- int topIdx = findAddressIndex(fTopRowAddress);
- if (topIdx != -1) {
- setTopIndex(fTableViewer.getTable(),topIdx);
- }
- }
-
- // cursor needs to be refreshed after reload
- if (isAddressVisible(fSelectedAddress))
- {
- setCursorAtAddress(fSelectedAddress);
- fTableCursor.setVisible(true);
- fTableCursor.redraw();
- }
- else
- {
- fTableCursor.setVisible(false);
- }
-
- if (!isDynamicLoad()) {
- updateSyncPageStartAddress();
- }
-
- updateSyncTopAddress();
- }
- });
- } catch (DebugException e) {
- displayError(e);
- }
+ if (!isDynamicLoad()) {
+ updateSyncPageStartAddress();
+ }
+
+ updateSyncTopAddress();
+ });
+ } catch (DebugException e) {
+ displayError(e);
}
};
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java
index aac8d0419..3911833e4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2018 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
@@ -242,15 +242,12 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE
protected void closeEditor()
{
final IEditorPart editor = this;
- DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- IWorkbenchWindow activeWorkbenchWindow = DebugUIPlugin.getActiveWorkbenchWindow();
- if (activeWorkbenchWindow != null) {
- IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
- if (activePage != null) {
- activePage.closeEditor(editor, false);
- }
+ DebugUIPlugin.getStandardDisplay().syncExec(() -> {
+ IWorkbenchWindow activeWorkbenchWindow = DebugUIPlugin.getActiveWorkbenchWindow();
+ if (activeWorkbenchWindow != null) {
+ IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
+ if (activePage != null) {
+ activePage.closeEditor(editor, false);
}
}
});
@@ -264,8 +261,9 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE
*/
@Override
public void dispose() {
- if (fLaunchesListener != null)
+ if (fLaunchesListener != null) {
DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(fLaunchesListener);
+ }
super.dispose();
}

Back to the top