Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Pazderski2019-05-18 22:03:52 +0000
committerPaul Pazderski2019-06-14 12:39:45 +0000
commit4e5b4450176cf71c5f3620377ec4d7ef39392c0c (patch)
tree2f248a44fd5072a873c92f9fc18f748b3aad39c0 /org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui
parenta27187cb1a408caaadf5eca6909bbe03a8b297a4 (diff)
downloadeclipse.platform.debug-4e5b4450176cf71c5f3620377ec4d7ef39392c0c.tar.gz
eclipse.platform.debug-4e5b4450176cf71c5f3620377ec4d7ef39392c0c.tar.xz
eclipse.platform.debug-4e5b4450176cf71c5f3620377ec4d7ef39392c0c.zip
Bug 547304 - [cleanup] Fix wrong space/tab indentationI20190616-1800I20190615-1800I20190614-1800
This change fixes space or mixed tab/space indentations in all Java files. This also includes two or three space indentations and even fix most stray single spaces in indentations. The change includes only whitespace formatting and no code changes. Change-Id: I95f385f1587b72776aee5d955b66e82539dedc3c
Diffstat (limited to 'org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui')
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlCellModifier.java6
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java104
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java24
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java2
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java48
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java34
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java304
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDABreakpointAdapter.java148
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAEditorAdapterFactory.java6
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java176
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTargetFactory.java76
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistProcessor.java98
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistant.java30
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditor.java28
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java86
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDASourceViewerConfiguration.java30
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/TextHover.java94
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/WordFinder.java16
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDALaunchShortcut.java64
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/presentation/PDAModelPresentation.java106
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/AbstractDataStackViewHandler.java64
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CanPushTester.java32
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/DataStackView.java56
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PopHandler.java54
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PushHandler.java18
25 files changed, 852 insertions, 852 deletions
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlCellModifier.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlCellModifier.java
index e50d90bf9..664ab17ca 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlCellModifier.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/ControlCellModifier.java
@@ -49,15 +49,15 @@ public class ControlCellModifier implements ICellModifier {
@Override
public void modify(Object element, String property, Object value) {
Object oldValue = getValue(element, property);
- if (!value.equals(oldValue)) {
- if (SequencerColumnPresentation.COL_VALUE.equals(property)) {
+ if (!value.equals(oldValue)) {
+ if (SequencerColumnPresentation.COL_VALUE.equals(property)) {
if (element instanceof SequencerControl) {
if (value instanceof String) {
SequencerControl control = (SequencerControl) element;
control.setValue((String) value);
}
}
- }
+ }
}
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java
index be482366d..66d18e20a 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java
@@ -47,10 +47,10 @@ public class DebugUIPlugin extends AbstractUIPlugin {
private final static String ICONS_PATH = "icons/full/";//$NON-NLS-1$
private final static String PATH_OBJECT = ICONS_PATH + "obj16/"; //Model object icons //$NON-NLS-1$
- private final static String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/"; //Enabled local toolbar icons //$NON-NLS-1$
- private final static String PATH_DLOCALTOOL = ICONS_PATH + "dlcl16/"; //Disabled local toolbar icons //$NON-NLS-1$
+ private final static String PATH_ELOCALTOOL = ICONS_PATH + "elcl16/"; //Enabled local toolbar icons //$NON-NLS-1$
+ private final static String PATH_DLOCALTOOL = ICONS_PATH + "dlcl16/"; //Disabled local toolbar icons //$NON-NLS-1$
- /**
+ /**
* The id of the plugin
*
* @since 1.4.200
@@ -62,31 +62,31 @@ public class DebugUIPlugin extends AbstractUIPlugin {
public final static String IMG_ELCL_POP = "IMG_ELCL_POP"; //$NON-NLS-1$
public final static String IMG_DLCL_POP = "IMG_DLCL_POP"; //$NON-NLS-1$
- /**
- * Toolbar action to push onto data stack
- */
+ /**
+ * Toolbar action to push onto data stack
+ */
public final static String IMG_ELCL_PUSH = "IMG_ELCL_PUSH"; //$NON-NLS-1$
public final static String IMG_DLCL_PUSH = "IMG_DLCL_PUSH"; //$NON-NLS-1$
- /**
- * PDA program image
- */
+ /**
+ * PDA program image
+ */
public final static String IMG_OBJ_PDA = "IMB_OBJ_PDA"; //$NON-NLS-1$
- /**
- * MIDI file image
- */
+ /**
+ * MIDI file image
+ */
public final static String IMG_OBJ_MIDI = "IMB_OBJ_MIDI"; //$NON-NLS-1$
- /**
- * Keyword color
- */
- public final static RGB KEYWORD = new RGB(0,0,255);
- public final static RGB LABEL = new RGB(128, 128, 0);
+ /**
+ * Keyword color
+ */
+ public final static RGB KEYWORD = new RGB(0,0,255);
+ public final static RGB LABEL = new RGB(128, 128, 0);
- /**
- * Managed colors
- */
+ /**
+ * Managed colors
+ */
private final Map<RGB, Color> fColors = new HashMap<>();
/**
@@ -118,10 +118,10 @@ public class DebugUIPlugin extends AbstractUIPlugin {
plugin = null;
resourceBundle = null;
Iterator<Entry<RGB, Color>> colors = fColors.entrySet().iterator();
- while (colors.hasNext()) {
- Entry<RGB, Color> entry = colors.next();
- entry.getValue().dispose();
- }
+ while (colors.hasNext()) {
+ Entry<RGB, Color> entry = colors.next();
+ entry.getValue().dispose();
+ }
}
/**
@@ -169,17 +169,17 @@ public class DebugUIPlugin extends AbstractUIPlugin {
declareImage(IMG_DLCL_PUSH, PATH_DLOCALTOOL + "push.gif"); //$NON-NLS-1$
}
- /**
- * Declares a workbench image given the path of the image file (relative to
- * the workbench plug-in). This is a helper method that creates the image
- * descriptor and passes it to the main <code>declareImage</code> method.
- *
- * @param symbolicName the symbolic name of the image
- * @param path the path of the image file relative to the base of the workbench
- * plug-ins install directory
- * <code>false</code> if this is not a shared image
- */
- private void declareImage(String key, String path) {
+ /**
+ * Declares a workbench image given the path of the image file (relative to
+ * the workbench plug-in). This is a helper method that creates the image
+ * descriptor and passes it to the main <code>declareImage</code> method.
+ *
+ * @param symbolicName the symbolic name of the image
+ * @param path the path of the image file relative to the base of the workbench
+ * plug-ins install directory
+ * <code>false</code> if this is not a shared image
+ */
+ private void declareImage(String key, String path) {
ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
Bundle bundle = Platform.getBundle(PLUGIN_ID);
URL url = null;
@@ -189,23 +189,23 @@ public class DebugUIPlugin extends AbstractUIPlugin {
desc = ImageDescriptor.createFromURL(url);
}
}
- getImageRegistry().put(key, desc);
- }
-
- /**
- * Returns the color described by the given RGB.
- *
- * @param rgb
- * @return color
- */
- public Color getColor(RGB rgb) {
- Color color = fColors.get(rgb);
- if (color == null) {
- color= new Color(Display.getCurrent(), rgb);
- fColors.put(rgb, color);
- }
- return color;
- }
+ getImageRegistry().put(key, desc);
+ }
+
+ /**
+ * Returns the color described by the given RGB.
+ *
+ * @param rgb
+ * @return color
+ */
+ public Color getColor(RGB rgb) {
+ Color color = fColors.get(rgb);
+ if (color == null) {
+ color= new Color(Display.getCurrent(), rgb);
+ fColors.put(rgb, color);
+ }
+ return color;
+ }
/**
* Returns the active workbench window
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java
index 4698fa1b7..25a5ebb20 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java
@@ -26,22 +26,22 @@ import org.eclipse.debug.examples.core.pda.model.PDADebugTarget;
*/
public class CommandAdapterFactory implements IAdapterFactory {
- private static IRestartHandler fgRestartHandler = new PDARestartDebugCommand();
+ private static IRestartHandler fgRestartHandler = new PDARestartDebugCommand();
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
- if (IRestartHandler.class.equals(adapterType)) {
- if (adaptableObject instanceof PDADebugTarget) {
- return (T) fgRestartHandler;
- }
- }
- return null;
- }
+ if (IRestartHandler.class.equals(adapterType)) {
+ if (adaptableObject instanceof PDADebugTarget) {
+ return (T) fgRestartHandler;
+ }
+ }
+ return null;
+ }
- @Override
+ @Override
public Class<?>[] getAdapterList() {
- return new Class[]{IRestartHandler.class};
- }
+ return new Class[]{IRestartHandler.class};
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java
index 2a13dce63..6c4b8fcc3 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java
@@ -26,7 +26,7 @@ import org.eclipse.debug.ui.IDebugUIConstants;
public class PDADebugTargetContentProvider extends ElementContentProvider {
- @Override
+ @Override
protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
PDAThread thread = ((PDADebugTarget) element).getThread(0);
if (thread != null) {
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java
index 1a7ef09ba..86ac85ca9 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java
@@ -27,34 +27,34 @@ import org.eclipse.debug.examples.core.pda.model.PDADebugTarget;
*/
public class PDARestartDebugCommand extends AbstractDebugCommand implements IRestartHandler {
- @Override
+ @Override
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
- for (int i = 0; i < targets.length; i++) {
- ((PDADebugTarget)targets[i]).restart();
- monitor.worked(1);
- }
- }
+ for (int i = 0; i < targets.length; i++) {
+ ((PDADebugTarget)targets[i]).restart();
+ monitor.worked(1);
+ }
+ }
- @Override
+ @Override
protected Object getTarget(Object element) {
- IDebugTarget target = (IDebugTarget)getAdapter(element, IDebugTarget.class);
- if (target instanceof PDADebugTarget) {
- return target;
- }
- return null;
- }
+ IDebugTarget target = (IDebugTarget)getAdapter(element, IDebugTarget.class);
+ if (target instanceof PDADebugTarget) {
+ return target;
+ }
+ return null;
+ }
- @Override
+ @Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
- throws CoreException
- {
- for (int i = 0; i < targets.length; i++) {
- if (((PDADebugTarget)targets[i]).isTerminated()) {
- return false;
- }
- monitor.worked(1);
- }
- return true;
- }
+ throws CoreException
+ {
+ for (int i = 0; i < targets.length; i++) {
+ if (((PDADebugTarget)targets[i]).isTerminated()) {
+ return false;
+ }
+ monitor.worked(1);
+ }
+ return true;
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java
index 1e38468de..99d6a2f7c 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java
@@ -46,12 +46,12 @@ public class PDAThreadEventHandler extends DebugEventHandler {
@Override
protected void handleSuspend(DebugEvent event) {
- IThread thread = (IThread) event.getSource();
- int extras = IModelDelta.STATE;
- if (event.getDetail() == DebugEvent.BREAKPOINT | event.getDetail() == DebugEvent.CLIENT_REQUEST) {
- extras = IModelDelta.EXPAND;
- }
- fireDeltaUpdatingTopFrame(thread, IModelDelta.NO_CHANGE | extras);
+ IThread thread = (IThread) event.getSource();
+ int extras = IModelDelta.STATE;
+ if (event.getDetail() == DebugEvent.BREAKPOINT | event.getDetail() == DebugEvent.CLIENT_REQUEST) {
+ extras = IModelDelta.EXPAND;
+ }
+ fireDeltaUpdatingTopFrame(thread, IModelDelta.NO_CHANGE | extras);
}
private boolean isEqual(Object o1, Object o2) {
@@ -135,23 +135,23 @@ public class PDAThreadEventHandler extends DebugEventHandler {
ModelDelta delta = buildRootDelta();
ModelDelta node = addTarget(delta, thread);
synchronized (this) {
- IStackFrame prev = fPrev;
- IStackFrame frame = null;
+ IStackFrame prev = fPrev;
+ IStackFrame frame = null;
try {
frame = thread.getTopStackFrame();
} catch (DebugException e) {
}
- if (isEqual(frame, prev)) {
- node.setFlags(flags);
- } else {
+ if (isEqual(frame, prev)) {
+ node.setFlags(flags);
+ } else {
node.setFlags(flags | IModelDelta.CONTENT);
- }
- if (frame != null) {
- node.addNode(frame, 0, IModelDelta.STATE | IModelDelta.SELECT, 0);
- }
- fPrev = frame;
+ }
+ if (frame != null) {
+ node.addNode(frame, 0, IModelDelta.STATE | IModelDelta.SELECT, 0);
+ }
+ fPrev = frame;
}
- fireDelta(delta);
+ fireDelta(delta);
}
@Override
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java
index 7a7b246a3..3e002de85 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java
@@ -65,69 +65,69 @@ import org.eclipse.ui.texteditor.IUpdate;
*/
public class PDAVirtualFindAction extends Action implements IUpdate {
- private final TreeModelViewer fClientViewer;
+ private final TreeModelViewer fClientViewer;
protected class VirtualViewerListener implements IViewerUpdateListener, ILabelUpdateListener {
- private boolean fViewerUpdatesComplete = false;
- private boolean fLabelUpdatesComplete = false;
- private IProgressMonitor fProgressMonitor;
- private int fRemainingUpdatesCount = 0;
+ private boolean fViewerUpdatesComplete = false;
+ private boolean fLabelUpdatesComplete = false;
+ private IProgressMonitor fProgressMonitor;
+ private int fRemainingUpdatesCount = 0;
- @Override
+ @Override
public void labelUpdateStarted(ILabelUpdate update) {}
- @Override
+ @Override
public void labelUpdateComplete(ILabelUpdate update) {
- incrementProgress(1);
- }
- @Override
+ incrementProgress(1);
+ }
+ @Override
public void labelUpdatesBegin() {
- fLabelUpdatesComplete = false;
- }
- @Override
+ fLabelUpdatesComplete = false;
+ }
+ @Override
public void labelUpdatesComplete() {
- fLabelUpdatesComplete = true;
- completeProgress();
- }
+ fLabelUpdatesComplete = true;
+ completeProgress();
+ }
- @Override
+ @Override
public void updateStarted(IViewerUpdate update) {}
- @Override
+ @Override
public void updateComplete(IViewerUpdate update) {
- if (update instanceof IChildrenUpdate) {
- incrementProgress(((IChildrenUpdate)update).getLength());
- }
- }
- @Override
+ if (update instanceof IChildrenUpdate) {
+ incrementProgress(((IChildrenUpdate)update).getLength());
+ }
+ }
+ @Override
public void viewerUpdatesBegin() {
- fViewerUpdatesComplete = false;
- }
- @Override
+ fViewerUpdatesComplete = false;
+ }
+ @Override
public void viewerUpdatesComplete() {
- fViewerUpdatesComplete = true;
- completeProgress();
- }
-
- private void completeProgress() {
- IProgressMonitor pm;
- synchronized (this) {
- pm = fProgressMonitor;
- }
- if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
- pm.done();
- }
- }
-
- private void incrementProgress(int count) {
- IProgressMonitor pm;
- synchronized (this) {
- pm = fProgressMonitor;
- fRemainingUpdatesCount -= count;
- }
- if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
- pm.worked(count);
- }
- }
+ fViewerUpdatesComplete = true;
+ completeProgress();
+ }
+
+ private void completeProgress() {
+ IProgressMonitor pm;
+ synchronized (this) {
+ pm = fProgressMonitor;
+ }
+ if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
+ pm.done();
+ }
+ }
+
+ private void incrementProgress(int count) {
+ IProgressMonitor pm;
+ synchronized (this) {
+ pm = fProgressMonitor;
+ fRemainingUpdatesCount -= count;
+ }
+ if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
+ pm.worked(count);
+ }
+ }
}
@@ -136,21 +136,21 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
private final Map<VirtualItem, String> fTextCache = new HashMap<>();
public FindLabelProvider(VirtualTreeModelViewer viewer, List<VirtualItem> items) {
- fVirtualViewer = viewer;
- for (int i = 0; i < items.size(); i++) {
- VirtualItem item = items.get(i);
- fTextCache.put(item, fVirtualViewer.getText(item, 0));
- }
+ fVirtualViewer = viewer;
+ for (int i = 0; i < items.size(); i++) {
+ VirtualItem item = items.get(i);
+ fTextCache.put(item, fVirtualViewer.getText(item, 0));
+ }
}
@Override
public Image getImage(Object element) {
- return fVirtualViewer.getImage((VirtualItem) element, 0);
+ return fVirtualViewer.getImage((VirtualItem) element, 0);
}
@Override
public String getText(Object element) {
- return fTextCache.get(element);
+ return fTextCache.get(element);
}
}
@@ -159,64 +159,64 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
setId(DebugUIPlugin.getUniqueIdentifier() + ".FindElementAction"); //$NON-NLS-1$
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.FIND_ELEMENT_ACTION);
setActionDefinitionId(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
- fClientViewer = (TreeModelViewer)((IDebugView)context.getPart()).getViewer();
+ fClientViewer = (TreeModelViewer)((IDebugView)context.getPart()).getViewer();
}
protected VirtualTreeModelViewer initVirtualViewer(TreeModelViewer clientViewer, VirtualViewerListener listener) {
- Object input = clientViewer.getInput();
- ModelDelta stateDelta = new ModelDelta(input, IModelDelta.NO_CHANGE);
- clientViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND);
- listener.fRemainingUpdatesCount = calcUpdatesCount(stateDelta);
- VirtualTreeModelViewer fVirtualViewer = new VirtualTreeModelViewer(
- clientViewer.getDisplay(),
- SWT.NONE,
- makeVirtualPresentationContext(clientViewer.getPresentationContext()));
- fVirtualViewer.addViewerUpdateListener(listener);
- fVirtualViewer.addLabelUpdateListener(listener);
- fVirtualViewer.setInput(input);
- if (fVirtualViewer.canToggleColumns()) {
- fVirtualViewer.setShowColumns(clientViewer.isShowColumns());
- }
- fVirtualViewer.updateViewer(stateDelta);
- return fVirtualViewer;
+ Object input = clientViewer.getInput();
+ ModelDelta stateDelta = new ModelDelta(input, IModelDelta.NO_CHANGE);
+ clientViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND);
+ listener.fRemainingUpdatesCount = calcUpdatesCount(stateDelta);
+ VirtualTreeModelViewer fVirtualViewer = new VirtualTreeModelViewer(
+ clientViewer.getDisplay(),
+ SWT.NONE,
+ makeVirtualPresentationContext(clientViewer.getPresentationContext()));
+ fVirtualViewer.addViewerUpdateListener(listener);
+ fVirtualViewer.addLabelUpdateListener(listener);
+ fVirtualViewer.setInput(input);
+ if (fVirtualViewer.canToggleColumns()) {
+ fVirtualViewer.setShowColumns(clientViewer.isShowColumns());
+ }
+ fVirtualViewer.updateViewer(stateDelta);
+ return fVirtualViewer;
}
protected IPresentationContext makeVirtualPresentationContext(final IPresentationContext clientViewerContext) {
- return new PresentationContext(clientViewerContext.getId()) {
+ return new PresentationContext(clientViewerContext.getId()) {
- {
- String[] clientProperties = clientViewerContext.getProperties();
- for (int i = 0; i < clientProperties.length; i++) {
- setProperty(clientProperties[i], clientViewerContext.getProperty(clientProperties[i]));
- }
+ {
+ String[] clientProperties = clientViewerContext.getProperties();
+ for (int i = 0; i < clientProperties.length; i++) {
+ setProperty(clientProperties[i], clientViewerContext.getProperty(clientProperties[i]));
+ }
- }
+ }
- @Override
+ @Override
public String[] getColumns() {
- String[] clientColumns = super.getColumns();
-
- if (clientColumns == null || clientColumns.length == 0) {
- // No columns are used.
- return null;
- }
-
- // Try to find the name column.
- for (int i = 0; i < clientColumns.length; i++) {
- if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(clientColumns[i])) {
- return new String[] { IDebugUIConstants.COLUMN_ID_VARIABLE_NAME };
- }
- }
-
- return new String[] { clientColumns[0] };
- }
- };
+ String[] clientColumns = super.getColumns();
+
+ if (clientColumns == null || clientColumns.length == 0) {
+ // No columns are used.
+ return null;
+ }
+
+ // Try to find the name column.
+ for (int i = 0; i < clientColumns.length; i++) {
+ if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(clientColumns[i])) {
+ return new String[] { IDebugUIConstants.COLUMN_ID_VARIABLE_NAME };
+ }
+ }
+
+ return new String[] { clientColumns[0] };
+ }
+ };
}
@Override
public void run() {
- final VirtualViewerListener listener = new VirtualViewerListener();
- VirtualTreeModelViewer virtualViewer = initVirtualViewer(fClientViewer, listener);
+ final VirtualViewerListener listener = new VirtualViewerListener();
+ VirtualTreeModelViewer virtualViewer = initVirtualViewer(fClientViewer, listener);
ProgressMonitorDialog dialog = new TimeTriggeredProgressMonitorDialog(fClientViewer.getControl().getShell(), 500);
final IProgressMonitor monitor = dialog.getProgressMonitor();
@@ -224,23 +224,23 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
try {
dialog.run(
- true, true,
- new IRunnableWithProgress() {
- @Override
+ true, true,
+ new IRunnableWithProgress() {
+ @Override
public void run(final IProgressMonitor m) throws InvocationTargetException, InterruptedException {
- synchronized(listener) {
- listener.fProgressMonitor = m;
- listener.fProgressMonitor.beginTask(DebugUIPlugin.removeAccelerators(getText()), listener.fRemainingUpdatesCount);
- }
-
- while ((!listener.fLabelUpdatesComplete || !listener.fViewerUpdatesComplete) && !listener.fProgressMonitor.isCanceled()) {
- Thread.sleep(1);
- }
- synchronized(listener) {
- listener.fProgressMonitor = null;
- }
- }
- });
+ synchronized(listener) {
+ listener.fProgressMonitor = m;
+ listener.fProgressMonitor.beginTask(DebugUIPlugin.removeAccelerators(getText()), listener.fRemainingUpdatesCount);
+ }
+
+ while ((!listener.fLabelUpdatesComplete || !listener.fViewerUpdatesComplete) && !listener.fProgressMonitor.isCanceled()) {
+ Thread.sleep(1);
+ }
+ synchronized(listener) {
+ listener.fProgressMonitor = null;
+ }
+ }
+ });
} catch (InvocationTargetException e) {
DebugUIPlugin.log(e);
return;
@@ -255,30 +255,30 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
FindLabelProvider labelProvider = new FindLabelProvider(virtualViewer, list);
VirtualItem result = performFind(list, labelProvider);
if (result != null) {
- setSelectionToClient(virtualViewer, labelProvider, result);
+ setSelectionToClient(virtualViewer, labelProvider, result);
}
}
- virtualViewer.removeLabelUpdateListener(listener);
- virtualViewer.removeViewerUpdateListener(listener);
- virtualViewer.dispose();
+ virtualViewer.removeLabelUpdateListener(listener);
+ virtualViewer.removeViewerUpdateListener(listener);
+ virtualViewer.dispose();
}
private int calcUpdatesCount(IModelDelta stateDelta) {
- final int[] count = new int[] {0};
- stateDelta.accept( new IModelDeltaVisitor() {
- @Override
+ final int[] count = new int[] {0};
+ stateDelta.accept( new IModelDeltaVisitor() {
+ @Override
public boolean visit(IModelDelta delta, int depth) {
- if ((delta.getFlags() & IModelDelta.EXPAND) != 0) {
- count[0] += delta.getChildCount();
- return true;
- }
- return false;
- }
- });
-
- // Double it to account for separate element and label update ticks.
- return count[0] * 2;
+ if ((delta.getFlags() & IModelDelta.EXPAND) != 0) {
+ count[0] += delta.getChildCount();
+ return true;
+ }
+ return false;
+ }
+ });
+
+ // Double it to account for separate element and label update ticks.
+ return count[0] * 2;
}
private void collectAllChildren(VirtualItem element, List<VirtualItem> collect) {
@@ -295,42 +295,42 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
protected VirtualItem performFind(List<VirtualItem> items, FindLabelProvider labelProvider) {
FindElementDialog dialog = new FindElementDialog(
- fClientViewer.getControl().getShell(),
- labelProvider,
- items.toArray());
+ fClientViewer.getControl().getShell(),
+ labelProvider,
+ items.toArray());
dialog.setTitle("PDA Variables View Find"); //$NON-NLS-1$
dialog.setMessage("&Specify an element to select (? = any character, * = any String):"); //$NON-NLS-1$
if (dialog.open() == Window.OK) {
Object[] elements = dialog.getResult();
if (elements.length == 1) {
- return (VirtualItem)elements[0];
+ return (VirtualItem)elements[0];
}
}
return null;
}
protected void setSelectionToClient(VirtualTreeModelViewer virtualViewer, ILabelProvider labelProvider, VirtualItem findItem) {
- virtualViewer.getTree().setSelection(new VirtualItem[] { findItem } );
- ModelDelta stateDelta = new ModelDelta(virtualViewer.getInput(), IModelDelta.NO_CHANGE);
- virtualViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.SELECT);
- fClientViewer.updateViewer(stateDelta);
-
- ISelection selection = fClientViewer.getSelection();
- if (!selection.isEmpty() &&
- selection instanceof IStructuredSelection &&
- ((IStructuredSelection)selection).getFirstElement().equals(findItem.getData()) ) {
- } else {
- DebugUIPlugin.errorDialog(
- fClientViewer.getControl().getShell(),
+ virtualViewer.getTree().setSelection(new VirtualItem[] { findItem } );
+ ModelDelta stateDelta = new ModelDelta(virtualViewer.getInput(), IModelDelta.NO_CHANGE);
+ virtualViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.SELECT);
+ fClientViewer.updateViewer(stateDelta);
+
+ ISelection selection = fClientViewer.getSelection();
+ if (!selection.isEmpty() &&
+ selection instanceof IStructuredSelection &&
+ ((IStructuredSelection)selection).getFirstElement().equals(findItem.getData()) ) {
+ } else {
+ DebugUIPlugin.errorDialog(
+ fClientViewer.getControl().getShell(),
"Error", //$NON-NLS-1$
"Could not select item:" + labelProvider.getText(findItem), //$NON-NLS-1$
new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Element no longer in viewer.")); //$NON-NLS-1$
- }
+ }
}
@Override
public void update() {
- setEnabled( fClientViewer.getInput() != null && fClientViewer.getChildCount(TreePath.EMPTY) > 0 );
+ setEnabled( fClientViewer.getInput() != null && fClientViewer.getChildCount(TreePath.EMPTY) > 0 );
}
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDABreakpointAdapter.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDABreakpointAdapter.java
index fc617622e..3cdfcf5fb 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDABreakpointAdapter.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDABreakpointAdapter.java
@@ -100,15 +100,15 @@ public class PDABreakpointAdapter implements IToggleBreakpointsTargetExtension {
@Override
public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
- String[] variableAndFunctionName = getVariableAndFunctionName(part, selection);
- if (variableAndFunctionName != null && part instanceof ITextEditor && selection instanceof ITextSelection) {
- ITextEditor editorPart = (ITextEditor)part;
- int lineNumber = ((ITextSelection)selection).getStartLine();
- IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
- String var = variableAndFunctionName[0];
- String fcn = variableAndFunctionName[1];
- toggleWatchpoint(resource, lineNumber, fcn, var, true, true);
- }
+ String[] variableAndFunctionName = getVariableAndFunctionName(part, selection);
+ if (variableAndFunctionName != null && part instanceof ITextEditor && selection instanceof ITextSelection) {
+ ITextEditor editorPart = (ITextEditor)part;
+ int lineNumber = ((ITextSelection)selection).getStartLine();
+ IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
+ String var = variableAndFunctionName[0];
+ String fcn = variableAndFunctionName[1];
+ toggleWatchpoint(resource, lineNumber, fcn, var, true, true);
+ }
}
@Override
@@ -117,25 +117,25 @@ public class PDABreakpointAdapter implements IToggleBreakpointsTargetExtension {
}
protected void toggleWatchpoint(IResource resource, int lineNumber, String fcn, String var, boolean access,
- boolean modification) throws CoreException
+ boolean modification) throws CoreException
{
- // look for existing watchpoint to delete
- IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(DebugCorePlugin.ID_PDA_DEBUG_MODEL);
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- if (breakpoint instanceof PDAWatchpoint && resource.equals(breakpoint.getMarker().getResource())) {
- PDAWatchpoint watchpoint = (PDAWatchpoint)breakpoint;
- String otherVar = watchpoint.getVariableName();
- String otherFcn = watchpoint.getFunctionName();
- if (otherVar.equals(var) && otherFcn.equals(fcn)) {
- breakpoint.delete();
- return;
- }
- }
- }
- // create watchpoint
- PDAWatchpoint watchpoint = new PDAWatchpoint(resource, lineNumber + 1, fcn, var, access, modification);
- DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(watchpoint);
+ // look for existing watchpoint to delete
+ IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(DebugCorePlugin.ID_PDA_DEBUG_MODEL);
+ for (int i = 0; i < breakpoints.length; i++) {
+ IBreakpoint breakpoint = breakpoints[i];
+ if (breakpoint instanceof PDAWatchpoint && resource.equals(breakpoint.getMarker().getResource())) {
+ PDAWatchpoint watchpoint = (PDAWatchpoint)breakpoint;
+ String otherVar = watchpoint.getVariableName();
+ String otherFcn = watchpoint.getFunctionName();
+ if (otherVar.equals(var) && otherFcn.equals(fcn)) {
+ breakpoint.delete();
+ return;
+ }
+ }
+ }
+ // create watchpoint
+ PDAWatchpoint watchpoint = new PDAWatchpoint(resource, lineNumber + 1, fcn, var, access, modification);
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(watchpoint);
}
/**
@@ -147,27 +147,27 @@ public class PDABreakpointAdapter implements IToggleBreakpointsTargetExtension {
* The array has two elements, the first is the variable name, the second is the function name.
*/
protected String[] getVariableAndFunctionName(IWorkbenchPart part, ISelection selection) {
- ITextEditor editor = getEditor(part);
- if (editor != null && selection instanceof ITextSelection) {
- ITextSelection textSelection = (ITextSelection) selection;
- IDocumentProvider documentProvider = editor.getDocumentProvider();
- try {
- documentProvider.connect(this);
- IDocument document = documentProvider.getDocument(editor.getEditorInput());
- IRegion region = document.getLineInformationOfOffset(textSelection.getOffset());
- String string = document.get(region.getOffset(), region.getLength()).trim();
+ ITextEditor editor = getEditor(part);
+ if (editor != null && selection instanceof ITextSelection) {
+ ITextSelection textSelection = (ITextSelection) selection;
+ IDocumentProvider documentProvider = editor.getDocumentProvider();
+ try {
+ documentProvider.connect(this);
+ IDocument document = documentProvider.getDocument(editor.getEditorInput());
+ IRegion region = document.getLineInformationOfOffset(textSelection.getOffset());
+ String string = document.get(region.getOffset(), region.getLength()).trim();
if (string.startsWith("var ")) { //$NON-NLS-1$
- String varName = string.substring(4).trim();
- String fcnName = getFunctionName(document, varName, document.getLineOfOffset(textSelection.getOffset()));
- return new String[] {varName, fcnName};
- }
- } catch (CoreException e) {
- } catch (BadLocationException e) {
- } finally {
- documentProvider.disconnect(this);
- }
- }
- return null;
+ String varName = string.substring(4).trim();
+ String fcnName = getFunctionName(document, varName, document.getLineOfOffset(textSelection.getOffset()));
+ return new String[] {varName, fcnName};
+ }
+ } catch (CoreException e) {
+ } catch (BadLocationException e) {
+ } finally {
+ documentProvider.disconnect(this);
+ }
+ }
+ return null;
}
/**
@@ -180,39 +180,39 @@ public class PDABreakpointAdapter implements IToggleBreakpointsTargetExtension {
* @return name of function defining the variable
*/
private String getFunctionName(IDocument document, String varName, int line) {
- // This is a simple guess at the function name - look for the labels preceeding
- // the variable definition, and then see if there are any 'calls' to that
- // label. If none, assumet the variable is in the "_main_" function
- String source = document.get();
- int lineIndex = line - 1;
- while (lineIndex >= 0) {
- try {
- IRegion information = document.getLineInformation(lineIndex);
- String lineText = document.get(information.getOffset(), information.getLength());
+ // This is a simple guess at the function name - look for the labels preceeding
+ // the variable definition, and then see if there are any 'calls' to that
+ // label. If none, assumet the variable is in the "_main_" function
+ String source = document.get();
+ int lineIndex = line - 1;
+ while (lineIndex >= 0) {
+ try {
+ IRegion information = document.getLineInformation(lineIndex);
+ String lineText = document.get(information.getOffset(), information.getLength());
if (lineText.startsWith(":")) { //$NON-NLS-1$
- String label = lineText.substring(1);
+ String label = lineText.substring(1);
if (source.contains("call " + label)) { //$NON-NLS-1$
- return label;
- }
- }
- lineIndex--;
- } catch (BadLocationException e) {
- }
- }
+ return label;
+ }
+ }
+ lineIndex--;
+ } catch (BadLocationException e) {
+ }
+ }
return "_main_"; //$NON-NLS-1$
}
- @Override
+ @Override
public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
- if (canToggleWatchpoints(part, selection)) {
- toggleWatchpoints(part, selection);
- } else {
- toggleLineBreakpoints(part, selection);
- }
- }
+ if (canToggleWatchpoints(part, selection)) {
+ toggleWatchpoints(part, selection);
+ } else {
+ toggleLineBreakpoints(part, selection);
+ }
+ }
- @Override
+ @Override
public boolean canToggleBreakpoints(IWorkbenchPart part, ISelection selection) {
- return canToggleLineBreakpoints(part, selection) || canToggleWatchpoints(part, selection);
- }
+ return canToggleLineBreakpoints(part, selection) || canToggleWatchpoints(part, selection);
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAEditorAdapterFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAEditorAdapterFactory.java
index 438afa76c..277747887 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAEditorAdapterFactory.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAEditorAdapterFactory.java
@@ -35,15 +35,15 @@ public class PDAEditorAdapterFactory implements IAdapterFactory {
if (resource != null) {
String extension = resource.getFileExtension();
if (extension != null && extension.equals("pda")) { //$NON-NLS-1$
- if (adapterType.equals(IToggleBreakpointsTarget.class)) {
+ if (adapterType.equals(IToggleBreakpointsTarget.class)) {
return (T) new PDABreakpointAdapter();
- }
+ }
//#ifdef ex7
//# // TODO: Exercise 7 - create run to line adapter
//#else
if (adapterType.equals(IRunToLineTarget.class)) {
return (T) new PDARunToLineAdapter();
- }
+ }
//#endif
}
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java
index 1aef74728..0fe58af12 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java
@@ -42,121 +42,121 @@ import org.eclipse.ui.texteditor.ITextEditor;
*/
public class PDAToggleWatchpointsTarget extends PDABreakpointAdapter {
- final private boolean fAccessModeEnabled;
- final private boolean fModificationModeEnabled;
+ final private boolean fAccessModeEnabled;
+ final private boolean fModificationModeEnabled;
- PDAToggleWatchpointsTarget(boolean access, boolean modification) {
- fAccessModeEnabled = access;
- fModificationModeEnabled = modification;
- }
+ PDAToggleWatchpointsTarget(boolean access, boolean modification) {
+ fAccessModeEnabled = access;
+ fModificationModeEnabled = modification;
+ }
- @Override
+ @Override
public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
- if (super.canToggleWatchpoints(part, selection)) {
- return true;
- } else {
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- return ss.getFirstElement() instanceof PDAVariable;
- }
- }
- return false;
- }
+ if (super.canToggleWatchpoints(part, selection)) {
+ return true;
+ } else {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection)selection;
+ return ss.getFirstElement() instanceof PDAVariable;
+ }
+ }
+ return false;
+ }
@Override
public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
- String[] variableAndFunctionName = getVariableAndFunctionName(part, selection);
-
- if (variableAndFunctionName != null && part instanceof ITextEditor && selection instanceof ITextSelection) {
- // Selection inside text editor. Create a watchpoint based on
- // current source line.
- ITextEditor editorPart = (ITextEditor)part;
- int lineNumber = ((ITextSelection)selection).getStartLine();
- IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
- String var = variableAndFunctionName[0];
- String fcn = variableAndFunctionName[1];
- toggleWatchpoint(resource, lineNumber, fcn, var, fAccessModeEnabled, fModificationModeEnabled);
- } else if (selection instanceof IStructuredSelection &&
- ((IStructuredSelection)selection).getFirstElement() instanceof PDAVariable )
- {
- // Selection is inside a variables view. Create a watchpoint
- // using information from the variable. Retrieving information
- // from the model requires performing source lookup which should be
- // done on a background thread.
- final PDAVariable var = (PDAVariable)((IStructuredSelection)selection).getFirstElement();
- final PDAStackFrame frame = var.getStackFrame();
- final Shell shell = part.getSite().getShell();
+ String[] variableAndFunctionName = getVariableAndFunctionName(part, selection);
+
+ if (variableAndFunctionName != null && part instanceof ITextEditor && selection instanceof ITextSelection) {
+ // Selection inside text editor. Create a watchpoint based on
+ // current source line.
+ ITextEditor editorPart = (ITextEditor)part;
+ int lineNumber = ((ITextSelection)selection).getStartLine();
+ IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
+ String var = variableAndFunctionName[0];
+ String fcn = variableAndFunctionName[1];
+ toggleWatchpoint(resource, lineNumber, fcn, var, fAccessModeEnabled, fModificationModeEnabled);
+ } else if (selection instanceof IStructuredSelection &&
+ ((IStructuredSelection)selection).getFirstElement() instanceof PDAVariable )
+ {
+ // Selection is inside a variables view. Create a watchpoint
+ // using information from the variable. Retrieving information
+ // from the model requires performing source lookup which should be
+ // done on a background thread.
+ final PDAVariable var = (PDAVariable)((IStructuredSelection)selection).getFirstElement();
+ final PDAStackFrame frame = var.getStackFrame();
+ final Shell shell = part.getSite().getShell();
new Job("Toggle PDA Watchpoint") { //$NON-NLS-1$
- { setSystem(true); }
+ { setSystem(true); }
- @Override
+ @Override
protected IStatus run(IProgressMonitor monitor) {
- try {
- IFile file = getResource(var.getStackFrame());
- String varName = var.getName();
- int line = findLine(file, varName);
- toggleWatchpoint(file, line, frame.getName(), varName,
- fAccessModeEnabled, fModificationModeEnabled);
- } catch (final CoreException e) {
- // Need to switch back to the UI thread to show the error
- // dialog.
+ try {
+ IFile file = getResource(var.getStackFrame());
+ String varName = var.getName();
+ int line = findLine(file, varName);
+ toggleWatchpoint(file, line, frame.getName(), varName,
+ fAccessModeEnabled, fModificationModeEnabled);
+ } catch (final CoreException e) {
+ // Need to switch back to the UI thread to show the error
+ // dialog.
new WorkbenchJob(shell.getDisplay(), "Toggle PDA Watchpoint") { //$NON-NLS-1$
- { setSystem(true); }
+ { setSystem(true); }
- @Override
+ @Override
public IStatus runInUIThread(IProgressMonitor submonitor) {
ErrorDialog.openError(shell, "Failed to create PDA watchpoint", "Failed to create PDA watchpoint.\n", e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$
- return Status.OK_STATUS;
- }
- }.schedule();
- }
- return Status.OK_STATUS;
- }
- }.schedule();
- }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
}
private IFile getResource(PDAStackFrame frame) {
- ISourceLocator locator = frame.getLaunch().getSourceLocator();
- Object sourceElement = locator.getSourceElement(frame);
- if (sourceElement instanceof IFile) {
- return (IFile)sourceElement;
- }
- return null;
+ ISourceLocator locator = frame.getLaunch().getSourceLocator();
+ Object sourceElement = locator.getSourceElement(frame);
+ if (sourceElement instanceof IFile) {
+ return (IFile)sourceElement;
+ }
+ return null;
}
private int findLine(IFile file, String var) throws CoreException {
- int lineNum = 0;
+ int lineNum = 0;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents()))) {
- while(true) {
- String line = reader.readLine().trim();
+ while(true) {
+ String line = reader.readLine().trim();
if (line.startsWith("var")) { //$NON-NLS-1$
String varName = line.substring("var".length()).trim(); //$NON-NLS-1$
- if (varName.equals(var)) {
- break;
- }
- }
- lineNum++;
- }
- } catch (IOException e) {
- // end of file reached and line wasn't found
- return -1;
+ if (varName.equals(var)) {
+ break;
+ }
+ }
+ lineNum++;
+ }
+ } catch (IOException e) {
+ // end of file reached and line wasn't found
+ return -1;
}
return lineNum;
}
- @Override
+ @Override
public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
- if (canToggleWatchpoints(part, selection)) {
- toggleWatchpoints(part, selection);
- } else {
- toggleLineBreakpoints(part, selection);
- }
- }
-
- @Override
+ if (canToggleWatchpoints(part, selection)) {
+ toggleWatchpoints(part, selection);
+ } else {
+ toggleLineBreakpoints(part, selection);
+ }
+ }
+
+ @Override
public boolean canToggleBreakpoints(IWorkbenchPart part, ISelection selection) {
- return canToggleLineBreakpoints(part, selection) || canToggleWatchpoints(part, selection);
- }
+ return canToggleLineBreakpoints(part, selection) || canToggleWatchpoints(part, selection);
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTargetFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTargetFactory.java
index c04f19c8c..3c363792a 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTargetFactory.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTargetFactory.java
@@ -39,55 +39,55 @@ public class PDAToggleWatchpointsTargetFactory implements IToggleBreakpointsTarg
private final Map<String, IToggleBreakpointsTarget> fToggleWatchpointTargets = new HashMap<>(3);
- static {
- TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_BOTH);
- TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_ACCESS);
- TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_MODIFICATION);
- }
+ static {
+ TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_BOTH);
+ TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_ACCESS);
+ TOGGLE_WATCHPOINTS_TARGETS.add(TOGGLE_WATCHPOINT_TARGET_MODIFICATION);
+ }
- @Override
+ @Override
public IToggleBreakpointsTarget createToggleTarget(String targetID) {
- IToggleBreakpointsTarget target = fToggleWatchpointTargets.get(targetID);
- if (target == null) {
- if (TOGGLE_WATCHPOINT_TARGET_BOTH.equals(targetID)) {
- target = new PDAToggleWatchpointsTarget(true, true);
- } else if (TOGGLE_WATCHPOINT_TARGET_ACCESS.equals(targetID)) {
- target = new PDAToggleWatchpointsTarget(true, false);
- } else if (TOGGLE_WATCHPOINT_TARGET_MODIFICATION.equals(targetID)) {
- target = new PDAToggleWatchpointsTarget(false, true);
- } else {
- return null;
- }
- fToggleWatchpointTargets.put(targetID, target);
- }
- return target;
- }
+ IToggleBreakpointsTarget target = fToggleWatchpointTargets.get(targetID);
+ if (target == null) {
+ if (TOGGLE_WATCHPOINT_TARGET_BOTH.equals(targetID)) {
+ target = new PDAToggleWatchpointsTarget(true, true);
+ } else if (TOGGLE_WATCHPOINT_TARGET_ACCESS.equals(targetID)) {
+ target = new PDAToggleWatchpointsTarget(true, false);
+ } else if (TOGGLE_WATCHPOINT_TARGET_MODIFICATION.equals(targetID)) {
+ target = new PDAToggleWatchpointsTarget(false, true);
+ } else {
+ return null;
+ }
+ fToggleWatchpointTargets.put(targetID, target);
+ }
+ return target;
+ }
- @Override
+ @Override
public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
- return TOGGLE_WATCHPOINT_TARGET_BOTH;
- }
+ return TOGGLE_WATCHPOINT_TARGET_BOTH;
+ }
- @Override
+ @Override
public Set<String> getToggleTargets(IWorkbenchPart part, ISelection selection) {
- return TOGGLE_WATCHPOINTS_TARGETS;
- }
+ return TOGGLE_WATCHPOINTS_TARGETS;
+ }
- @Override
+ @Override
public String getToggleTargetName(String targetID) {
- if (TOGGLE_WATCHPOINT_TARGET_BOTH.equals(targetID)) {
+ if (TOGGLE_WATCHPOINT_TARGET_BOTH.equals(targetID)) {
return "Watchpoints (Read/Write)"; //$NON-NLS-1$
- } else if (TOGGLE_WATCHPOINT_TARGET_ACCESS.equals(targetID)) {
+ } else if (TOGGLE_WATCHPOINT_TARGET_ACCESS.equals(targetID)) {
return "Watchpoints (Read)"; //$NON-NLS-1$
- } else if (TOGGLE_WATCHPOINT_TARGET_MODIFICATION.equals(targetID)) {
+ } else if (TOGGLE_WATCHPOINT_TARGET_MODIFICATION.equals(targetID)) {
return "Watchpoints (Write)"; //$NON-NLS-1$
- } else {
- return null;
- }
- }
+ } else {
+ return null;
+ }
+ }
- @Override
+ @Override
public String getToggleTargetDescription(String targetID) {
- return getToggleTargetName(targetID);
- }
+ return getToggleTargetName(targetID);
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistProcessor.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistProcessor.java
index c7b698bc9..85ea65334 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistProcessor.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistProcessor.java
@@ -28,68 +28,68 @@ import org.eclipse.jface.text.contentassist.IContextInformationValidator;
public class PDAContentAssistProcessor implements IContentAssistProcessor {
- @Override
+ @Override
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
- int index = offset - 1;
- StringBuilder prefix = new StringBuilder();
- IDocument document = viewer.getDocument();
- while (index > 0) {
- try {
- char prev = document.getChar(index);
- if (Character.isWhitespace(prev)) {
- break;
- }
- prefix.insert(0, prev);
- index--;
- } catch (BadLocationException e) {
- }
- }
+ int index = offset - 1;
+ StringBuilder prefix = new StringBuilder();
+ IDocument document = viewer.getDocument();
+ while (index > 0) {
+ try {
+ char prev = document.getChar(index);
+ if (Character.isWhitespace(prev)) {
+ break;
+ }
+ prefix.insert(0, prev);
+ index--;
+ } catch (BadLocationException e) {
+ }
+ }
List<CompletionProposal> proposals = new ArrayList<>();
- String[] keywords = PDAScanner.fgKeywords;
- if (prefix.length() > 0) {
- String word = prefix.toString();
- for (int i = 0; i < keywords.length; i++) {
- String keyword = keywords[i];
- if (keyword.startsWith(word) && word.length() < keyword.length()) {
+ String[] keywords = PDAScanner.fgKeywords;
+ if (prefix.length() > 0) {
+ String word = prefix.toString();
+ for (int i = 0; i < keywords.length; i++) {
+ String keyword = keywords[i];
+ if (keyword.startsWith(word) && word.length() < keyword.length()) {
proposals.add(new CompletionProposal(keyword + " ", index + 1, offset - (index + 1), keyword.length() + 1)); //$NON-NLS-1$
- }
- }
- } else {
- // propose all keywords
- for (int i = 0; i < keywords.length; i++) {
- String keyword = keywords[i];
+ }
+ }
+ } else {
+ // propose all keywords
+ for (int i = 0; i < keywords.length; i++) {
+ String keyword = keywords[i];
proposals.add(new CompletionProposal(keyword + " ", offset, 0, keyword.length() + 1)); //$NON-NLS-1$
- }
- }
- if (!proposals.isEmpty()) {
- return proposals.toArray(new ICompletionProposal[proposals.size()]);
- }
- return null;
- }
+ }
+ }
+ if (!proposals.isEmpty()) {
+ return proposals.toArray(new ICompletionProposal[proposals.size()]);
+ }
+ return null;
+ }
- @Override
+ @Override
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public char[] getCompletionProposalAutoActivationCharacters() {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public String getErrorMessage() {
- return null;
- }
+ return null;
+ }
- @Override
+ @Override
public IContextInformationValidator getContextInformationValidator() {
- return null;
- }
+ return null;
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistant.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistant.java
index 396b362bd..67b543bdd 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistant.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAContentAssistant.java
@@ -23,24 +23,24 @@ import org.eclipse.swt.widgets.Shell;
public class PDAContentAssistant extends ContentAssistant {
- public PDAContentAssistant() {
- super();
+ public PDAContentAssistant() {
+ super();
- PDAContentAssistProcessor processor= new PDAContentAssistProcessor();
- setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
+ PDAContentAssistProcessor processor= new PDAContentAssistProcessor();
+ setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
- enableAutoActivation(false);
- enableAutoInsert(false);
+ enableAutoActivation(false);
+ enableAutoInsert(false);
- setInformationControlCreator(getInformationControlCreator());
- }
+ setInformationControlCreator(getInformationControlCreator());
+ }
- private IInformationControlCreator getInformationControlCreator() {
- return new IInformationControlCreator() {
- @Override
+ private IInformationControlCreator getInformationControlCreator() {
+ return new IInformationControlCreator() {
+ @Override
public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent);
- }
- };
- }
+ return new DefaultInformationControl(parent);
+ }
+ };
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditor.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditor.java
index a11a0525c..8f1aa2745 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditor.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAEditor.java
@@ -26,24 +26,24 @@ import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
*/
public class PDAEditor extends AbstractDecoratedTextEditor {
- /**
- * Creates a PDE editor
- */
- public PDAEditor() {
- super();
- setSourceViewerConfiguration(new PDASourceViewerConfiguration());
+ /**
+ * Creates a PDE editor
+ */
+ public PDAEditor() {
+ super();
+ setSourceViewerConfiguration(new PDASourceViewerConfiguration());
setRulerContextMenuId("pda.editor.rulerMenu"); //$NON-NLS-1$
setEditorContextMenuId("pda.editor.editorMenu"); //$NON-NLS-1$
- }
+ }
- @Override
+ @Override
protected void createActions() {
- super.createActions();
- ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.debug.examples.ui.pda.editor.PDAEditorMessages"); //$NON-NLS-1$
- IAction action = new ContentAssistAction(bundle, "ContentAssistProposal.", this); //$NON-NLS-1$
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- setAction("ContentAssistProposal", action); //$NON-NLS-1$
- }
+ super.createActions();
+ ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.debug.examples.ui.pda.editor.PDAEditorMessages"); //$NON-NLS-1$
+ IAction action = new ContentAssistAction(bundle, "ContentAssistProposal.", this); //$NON-NLS-1$
+ action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ setAction("ContentAssistProposal", action); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java
index 9573c4b16..aa586afe5 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java
@@ -28,60 +28,60 @@ import org.eclipse.jface.text.rules.WordRule;
*/
public class PDAScanner extends BufferedRuleBasedScanner {
- /**
- * PDA keywods
- */
- public static final String[] fgKeywords = new String[] {
+ /**
+ * PDA keywods
+ */
+ public static final String[] fgKeywords = new String[] {
"add", "branch_not_zero", "call", "dec", "dup", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
"halt", "output", "pop", "push", "return", "var" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- };
+ };
- /**
- * Detects potential keywords
- */
- class PDAWordDetector implements IWordDetector {
+ /**
+ * Detects potential keywords
+ */
+ class PDAWordDetector implements IWordDetector {
- @Override
+ @Override
public boolean isWordStart(char c) {
- return Character.isLetter(c);
- }
+ return Character.isLetter(c);
+ }
- @Override
+ @Override
public boolean isWordPart(char c) {
- return Character.isLetter(c) || c == '_';
- }
- }
+ return Character.isLetter(c) || c == '_';
+ }
+ }
- /**
- * Detects PDA branch labels
- */
- class PDALabelDetector extends PDAWordDetector {
+ /**
+ * Detects PDA branch labels
+ */
+ class PDALabelDetector extends PDAWordDetector {
- @Override
+ @Override
public boolean isWordStart(char c) {
- return c == ':';
- }
+ return c == ':';
+ }
- @Override
+ @Override
public boolean isWordPart(char c) {
- return super.isWordPart(c) || Character.isDigit(c);
- }
- }
+ return super.isWordPart(c) || Character.isDigit(c);
+ }
+ }
- /**
- * Constructs a scanner that identifies PDA keywords.
- */
- public PDAScanner() {
- // keywords
- Token token = new Token(new TextAttribute(DebugUIPlugin.getDefault().getColor(DebugUIPlugin.KEYWORD)));
- WordRule keywords = new WordRule(new PDAWordDetector());
- for (int i = 0; i < fgKeywords.length; i++) {
- String keyword = fgKeywords[i];
- keywords.addWord(keyword, token);
- }
- // labels
- token = new Token(new TextAttribute(DebugUIPlugin.getDefault().getColor(DebugUIPlugin.LABEL)));
- WordRule labels = new WordRule(new PDALabelDetector(), token);
- setRules(new IRule[]{keywords, labels});
- }
+ /**
+ * Constructs a scanner that identifies PDA keywords.
+ */
+ public PDAScanner() {
+ // keywords
+ Token token = new Token(new TextAttribute(DebugUIPlugin.getDefault().getColor(DebugUIPlugin.KEYWORD)));
+ WordRule keywords = new WordRule(new PDAWordDetector());
+ for (int i = 0; i < fgKeywords.length; i++) {
+ String keyword = fgKeywords[i];
+ keywords.addWord(keyword, token);
+ }
+ // labels
+ token = new Token(new TextAttribute(DebugUIPlugin.getDefault().getColor(DebugUIPlugin.LABEL)));
+ WordRule labels = new WordRule(new PDALabelDetector(), token);
+ setRules(new IRule[]{keywords, labels});
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDASourceViewerConfiguration.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDASourceViewerConfiguration.java
index 4149c23ff..bf99f3b7b 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDASourceViewerConfiguration.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDASourceViewerConfiguration.java
@@ -29,30 +29,30 @@ import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
*/
public class PDASourceViewerConfiguration extends TextSourceViewerConfiguration {
- @Override
+ @Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
- return new TextHover();
- }
+ return new TextHover();
+ }
@Override
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
return new AnnotationHover();
}
- @Override
+ @Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
- PresentationReconciler reconciler = new PresentationReconciler();
- reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
- DefaultDamagerRepairer dr = new DefaultDamagerRepairer(new PDAScanner());
- reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
- reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
- return reconciler;
- }
-
- @Override
+ PresentationReconciler reconciler = new PresentationReconciler();
+ reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
+ DefaultDamagerRepairer dr = new DefaultDamagerRepairer(new PDAScanner());
+ reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ return reconciler;
+ }
+
+ @Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
- return new PDAContentAssistant();
- }
+ return new PDAContentAssistant();
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/TextHover.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/TextHover.java
index c0c6470a9..e84d3e81d 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/TextHover.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/TextHover.java
@@ -33,58 +33,58 @@ import org.eclipse.jface.text.ITextViewer;
*/
public class TextHover implements ITextHover {
- @Override
+ @Override
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
- String varName = null;
- try {
- varName = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
- } catch (BadLocationException e) {
- return null;
- }
+ String varName = null;
+ try {
+ varName = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
+ } catch (BadLocationException e) {
+ return null;
+ }
if (varName.startsWith("$") && varName.length() > 1) { //$NON-NLS-1$
- varName = varName.substring(1);
- }
+ varName = varName.substring(1);
+ }
- PDAStackFrame frame = null;
- IAdaptable debugContext = DebugUITools.getDebugContext();
- if (debugContext instanceof PDAStackFrame) {
- frame = (PDAStackFrame) debugContext;
- } else if (debugContext instanceof PDAThread) {
- PDAThread thread = (PDAThread) debugContext;
- try {
- frame = (PDAStackFrame) thread.getTopStackFrame();
- } catch (DebugException e) {
- return null;
- }
- } else if (debugContext instanceof PDADebugTarget) {
- PDADebugTarget target = (PDADebugTarget) debugContext;
- try {
- IThread[] threads = target.getThreads();
- if (threads.length > 0) {
- frame = (PDAStackFrame) threads[0].getTopStackFrame();
- }
- } catch (DebugException e) {
- return null;
- }
- }
- if (frame != null) {
- try {
- IVariable[] variables = frame.getVariables();
- for (int i = 0; i < variables.length; i++) {
- IVariable variable = variables[i];
- if (variable.getName().equals(varName)) {
+ PDAStackFrame frame = null;
+ IAdaptable debugContext = DebugUITools.getDebugContext();
+ if (debugContext instanceof PDAStackFrame) {
+ frame = (PDAStackFrame) debugContext;
+ } else if (debugContext instanceof PDAThread) {
+ PDAThread thread = (PDAThread) debugContext;
+ try {
+ frame = (PDAStackFrame) thread.getTopStackFrame();
+ } catch (DebugException e) {
+ return null;
+ }
+ } else if (debugContext instanceof PDADebugTarget) {
+ PDADebugTarget target = (PDADebugTarget) debugContext;
+ try {
+ IThread[] threads = target.getThreads();
+ if (threads.length > 0) {
+ frame = (PDAStackFrame) threads[0].getTopStackFrame();
+ }
+ } catch (DebugException e) {
+ return null;
+ }
+ }
+ if (frame != null) {
+ try {
+ IVariable[] variables = frame.getVariables();
+ for (int i = 0; i < variables.length; i++) {
+ IVariable variable = variables[i];
+ if (variable.getName().equals(varName)) {
return varName + " = " + variable.getValue().getValueString(); //$NON-NLS-1$
- }
- }
- } catch (DebugException e) {
- }
- }
- return null;
- }
+ }
+ }
+ } catch (DebugException e) {
+ }
+ }
+ return null;
+ }
- @Override
+ @Override
public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
- return WordFinder.findWord(textViewer.getDocument(), offset);
- }
+ return WordFinder.findWord(textViewer.getDocument(), offset);
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/WordFinder.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/WordFinder.java
index 1b31bd097..5eab942fe 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/WordFinder.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/WordFinder.java
@@ -25,14 +25,14 @@ import org.eclipse.jface.text.Region;
*/
public class WordFinder {
- /**
- * Returns the region in the given document that contains an identifier, or
- * <code>null</code> if none.
- *
- * @param document document to search
- * @param offset offset at which to look for an identifier
- * @return region containing an identifier, or <code>null</code>
- */
+ /**
+ * Returns the region in the given document that contains an identifier, or
+ * <code>null</code> if none.
+ *
+ * @param document document to search
+ * @param offset offset at which to look for an identifier
+ * @return region containing an identifier, or <code>null</code>
+ */
public static IRegion findWord(IDocument document, int offset) {
int start= -1;
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDALaunchShortcut.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDALaunchShortcut.java
index 4d374ae29..d45df1a79 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDALaunchShortcut.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDALaunchShortcut.java
@@ -35,42 +35,42 @@ import org.eclipse.ui.IEditorPart;
*/
public class PDALaunchShortcut implements ILaunchShortcut {
- @Override
+ @Override
public void launch(ISelection selection, String mode) {
- // must be a structured selection with one file selected
- IFile file = (IFile) ((IStructuredSelection)selection).getFirstElement();
+ // must be a structured selection with one file selected
+ IFile file = (IFile) ((IStructuredSelection)selection).getFirstElement();
- // check for an existing launch config for the pda file
- String path = file.getFullPath().toString();
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(DebugCorePlugin.ID_PDA_LAUNCH_CONFIGURATION_TYPE);
- try {
- ILaunchConfiguration[] configurations = launchManager.getLaunchConfigurations(type);
- for (int i = 0; i < configurations.length; i++) {
- ILaunchConfiguration configuration = configurations[i];
- String attribute = configuration.getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null);
- if (path.equals(attribute)) {
- DebugUITools.launch(configuration, mode);
- return;
- }
- }
- } catch (CoreException e) {
- return;
- }
+ // check for an existing launch config for the pda file
+ String path = file.getFullPath().toString();
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(DebugCorePlugin.ID_PDA_LAUNCH_CONFIGURATION_TYPE);
+ try {
+ ILaunchConfiguration[] configurations = launchManager.getLaunchConfigurations(type);
+ for (int i = 0; i < configurations.length; i++) {
+ ILaunchConfiguration configuration = configurations[i];
+ String attribute = configuration.getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null);
+ if (path.equals(attribute)) {
+ DebugUITools.launch(configuration, mode);
+ return;
+ }
+ }
+ } catch (CoreException e) {
+ return;
+ }
- try {
- // create a new configuration for the pda file
- ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, file.getName());
- workingCopy.setAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, path);
- workingCopy.setMappedResources(new IResource[]{file});
- ILaunchConfiguration configuration = workingCopy.doSave();
- DebugUITools.launch(configuration, mode);
- } catch (CoreException e1) {
- }
- }
+ try {
+ // create a new configuration for the pda file
+ ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, file.getName());
+ workingCopy.setAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, path);
+ workingCopy.setMappedResources(new IResource[]{file});
+ ILaunchConfiguration configuration = workingCopy.doSave();
+ DebugUITools.launch(configuration, mode);
+ } catch (CoreException e1) {
+ }
+ }
- @Override
+ @Override
public void launch(IEditorPart editor, String mode) {
- }
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/presentation/PDAModelPresentation.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/presentation/PDAModelPresentation.java
index 233661cef..72b9856b9 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/presentation/PDAModelPresentation.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/presentation/PDAModelPresentation.java
@@ -48,36 +48,36 @@ public class PDAModelPresentation extends LabelProvider implements IDebugModelPr
if (element instanceof PDADebugTarget) {
return getTargetText((PDADebugTarget)element);
} else if (element instanceof PDAThread) {
- return getThreadText((PDAThread)element);
- } else if (element instanceof PDAStackFrame) {
- return getStackFrameText((PDAStackFrame)element);
- } else if (element instanceof PDAWatchpoint) {
- return getWatchpointText((PDAWatchpoint)element);
- }
+ return getThreadText((PDAThread)element);
+ } else if (element instanceof PDAStackFrame) {
+ return getStackFrameText((PDAStackFrame)element);
+ } else if (element instanceof PDAWatchpoint) {
+ return getWatchpointText((PDAWatchpoint)element);
+ }
return null;
}
/**
* Returns a label for the given watchpoint.
*
- * @param watchpoint
- * @return a label for the given watchpoint
- */
- private String getWatchpointText(PDAWatchpoint watchpoint) {
- try {
+ * @param watchpoint
+ * @return a label for the given watchpoint
+ */
+ private String getWatchpointText(PDAWatchpoint watchpoint) {
+ try {
String label = watchpoint.getVariableName() + " (" + watchpoint.getFunctionName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- if (watchpoint.isAccess()) {
+ if (watchpoint.isAccess()) {
label += " [read]"; //$NON-NLS-1$
- }
- if (watchpoint.isModification()) {
+ }
+ if (watchpoint.isModification()) {
label += " [write]"; //$NON-NLS-1$
- }
- return label;
- } catch (CoreException e) {
- return null;
- }
- }
- /**
+ }
+ return label;
+ } catch (CoreException e) {
+ return null;
+ }
+ }
+ /**
* Returns a label for the given debug target
*
* @param target debug target
@@ -87,11 +87,11 @@ public class PDAModelPresentation extends LabelProvider implements IDebugModelPr
try {
String pgmPath = target.getLaunch().getLaunchConfiguration().getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null);
if (pgmPath != null) {
- IPath path = new Path(pgmPath);
+ IPath path = new Path(pgmPath);
String label = ""; //$NON-NLS-1$
- if (target.isTerminated()) {
+ if (target.isTerminated()) {
label = "<terminated>"; //$NON-NLS-1$
- }
+ }
return label + "PDA [" + path.lastSegment() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
} catch (CoreException e) {
@@ -107,11 +107,11 @@ public class PDAModelPresentation extends LabelProvider implements IDebugModelPr
* @return a label for the given stack frame
*/
private String getStackFrameText(PDAStackFrame frame) {
- try {
+ try {
return frame.getName() + " (line: " + frame.getLineNumber() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- } catch (DebugException e) {
- }
- return null;
+ } catch (DebugException e) {
+ }
+ return null;
}
@@ -122,38 +122,38 @@ public class PDAModelPresentation extends LabelProvider implements IDebugModelPr
* @return a label for the given thread
*/
private String getThreadText(PDAThread thread) {
- String label = thread.getName();
- if (thread.isStepping()) {
+ String label = thread.getName();
+ if (thread.isStepping()) {
label += " (stepping)"; //$NON-NLS-1$
- } else if (thread.isSuspended()) {
- IBreakpoint[] breakpoints = thread.getBreakpoints();
- if (breakpoints.length == 0) {
- if (thread.getError() == null) {
+ } else if (thread.isSuspended()) {
+ IBreakpoint[] breakpoints = thread.getBreakpoints();
+ if (breakpoints.length == 0) {
+ if (thread.getError() == null) {
label += " (suspended)"; //$NON-NLS-1$
- } else {
+ } else {
label += " (" + thread.getError() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- } else {
- IBreakpoint breakpoint = breakpoints[0]; // there can only be one in PDA
- if (breakpoint instanceof PDALineBreakpoint) {
- PDALineBreakpoint pdaBreakpoint = (PDALineBreakpoint) breakpoint;
- if (pdaBreakpoint instanceof PDAWatchpoint) {
- try {
- PDAWatchpoint watchpoint = (PDAWatchpoint)pdaBreakpoint;
+ }
+ } else {
+ IBreakpoint breakpoint = breakpoints[0]; // there can only be one in PDA
+ if (breakpoint instanceof PDALineBreakpoint) {
+ PDALineBreakpoint pdaBreakpoint = (PDALineBreakpoint) breakpoint;
+ if (pdaBreakpoint instanceof PDAWatchpoint) {
+ try {
+ PDAWatchpoint watchpoint = (PDAWatchpoint)pdaBreakpoint;
label += " (watchpoint: " + watchpoint.getSuspendType() + " " + watchpoint.getVariableName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } catch (CoreException e) {
- }
- } else if (pdaBreakpoint.isRunToLineBreakpoint()) {
+ } catch (CoreException e) {
+ }
+ } else if (pdaBreakpoint.isRunToLineBreakpoint()) {
label += " (run to line)"; //$NON-NLS-1$
- } else {
+ } else {
label += " (suspended at line breakpoint)"; //$NON-NLS-1$
- }
- }
- }
- } else if (thread.isTerminated()) {
+ }
+ }
+ }
+ } else if (thread.isTerminated()) {
label = "<terminated> " + label; //$NON-NLS-1$
- }
- return label;
+ }
+ return label;
}
@Override
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/AbstractDataStackViewHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/AbstractDataStackViewHandler.java
index 5e73b59c2..7673f759f 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/AbstractDataStackViewHandler.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/AbstractDataStackViewHandler.java
@@ -30,42 +30,42 @@ import org.eclipse.ui.handlers.HandlerUtil;
*/
abstract public class AbstractDataStackViewHandler extends AbstractHandler {
- @Override
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
- if (part instanceof DataStackView) {
- DataStackView view = (DataStackView)part;
+ IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
+ if (part instanceof DataStackView) {
+ DataStackView view = (DataStackView)part;
- ISelection selection = DebugUITools.getDebugContextForEventChecked(event);
- if (selection instanceof IStructuredSelection) {
- Object element = ((IStructuredSelection)selection).getFirstElement();
+ ISelection selection = DebugUITools.getDebugContextForEventChecked(event);
+ if (selection instanceof IStructuredSelection) {
+ Object element = ((IStructuredSelection)selection).getFirstElement();
- PDAThread thread = null;
- if (element instanceof PDAThread) {
- thread = (PDAThread)element;
- } else if (element instanceof PDAStackFrame) {
- thread = (PDAThread)((PDAStackFrame)element).getThread();
- }
+ PDAThread thread = null;
+ if (element instanceof PDAThread) {
+ thread = (PDAThread)element;
+ } else if (element instanceof PDAStackFrame) {
+ thread = (PDAThread)((PDAStackFrame)element).getThread();
+ }
- if (element != null) {
- doExecute(
- view,
- thread,
- HandlerUtil.getCurrentSelectionChecked(event));
- }
- }
- } else {
+ if (element != null) {
+ doExecute(
+ view,
+ thread,
+ HandlerUtil.getCurrentSelectionChecked(event));
+ }
+ }
+ } else {
throw new ExecutionException("Handler must be with DataStackView only"); //$NON-NLS-1$
- }
- return null;
- }
+ }
+ return null;
+ }
- /**
- * Performs the actual handler operation.
- *
- * @param view The view that the handler was invoked in.
- * @param target The current active debug target.
- * @param selection The current selection in view.
- */
- abstract protected void doExecute(DataStackView view, PDAThread target, ISelection selection) throws ExecutionException;
+ /**
+ * Performs the actual handler operation.
+ *
+ * @param view The view that the handler was invoked in.
+ * @param target The current active debug target.
+ * @param selection The current selection in view.
+ */
+ abstract protected void doExecute(DataStackView view, PDAThread target, ISelection selection) throws ExecutionException;
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CanPushTester.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CanPushTester.java
index b741227ce..d5dd6784d 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CanPushTester.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CanPushTester.java
@@ -28,23 +28,23 @@ public class CanPushTester extends PropertyTester {
private static final String CAN_PUSH_PROPERTY = "canPush"; //$NON-NLS-1$
- @Override
+ @Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (CAN_PUSH_PROPERTY.equals(property)) {
- if (receiver instanceof IAdaptable) {
+ if (CAN_PUSH_PROPERTY.equals(property)) {
+ if (receiver instanceof IAdaptable) {
PDADebugElement element = ((IAdaptable) receiver).getAdapter(PDADebugElement.class);
- PDAThread thread = null;
- if (element instanceof PDAThread) {
- thread = (PDAThread)element;
- } else if (element instanceof PDAStackFrame) {
- thread = (PDAThread)((PDAStackFrame)element).getThread();
- }
+ PDAThread thread = null;
+ if (element instanceof PDAThread) {
+ thread = (PDAThread)element;
+ } else if (element instanceof PDAStackFrame) {
+ thread = (PDAThread)((PDAStackFrame)element).getThread();
+ }
- if (thread != null) {
- return thread.canPushData();
- }
- }
- }
- return false;
- }
+ if (thread != null) {
+ return thread.canPushData();
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/DataStackView.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/DataStackView.java
index 2f3250e7a..3b95d2909 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/DataStackView.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/DataStackView.java
@@ -44,7 +44,7 @@ import org.eclipse.ui.progress.UIJob;
*/
public class DataStackView extends AbstractDebugView implements IDebugContextListener {
- private PDAThread fThread;
+ private PDAThread fThread;
class StackViewContentProvider implements ITreeContentProvider {
@@ -118,46 +118,46 @@ public class DataStackView extends AbstractDebugView implements IDebugContextLis
@Override
public void dispose() {
- DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).removeDebugContextListener(this);
+ DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).removeDebugContextListener(this);
super.dispose();
}
@Override
public void debugContextChanged(final DebugContextEvent event) {
new UIJob(getSite().getShell().getDisplay(), "DataStackView update") { //$NON-NLS-1$
- {
- setSystem(true);
- }
+ {
+ setSystem(true);
+ }
- @Override
+ @Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- if (getViewer() != null) { // runs asynchronously, view may be disposed
- update(event.getContext());
- }
- return Status.OK_STATUS;
- }
- }.schedule();
+ if (getViewer() != null) { // runs asynchronously, view may be disposed
+ update(event.getContext());
+ }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
}
- /**
- * Updates the view for the selected thread (if suspended)
- */
- private void update(ISelection context) {
- fThread = null;
-
- if (context instanceof IStructuredSelection) {
- Object element = ((IStructuredSelection)context).getFirstElement();
- if (element instanceof PDAThread) {
- fThread = (PDAThread)element;
- } else if (element instanceof PDAStackFrame) {
- fThread = (PDAThread)((PDAStackFrame)element).getThread();
- }
- }
+ /**
+ * Updates the view for the selected thread (if suspended)
+ */
+ private void update(ISelection context) {
+ fThread = null;
+
+ if (context instanceof IStructuredSelection) {
+ Object element = ((IStructuredSelection)context).getFirstElement();
+ if (element instanceof PDAThread) {
+ fThread = (PDAThread)element;
+ } else if (element instanceof PDAStackFrame) {
+ fThread = (PDAThread)((PDAStackFrame)element).getThread();
+ }
+ }
Object input = null;
if (fThread != null && fThread.isSuspended()) {
- input = fThread;
+ input = fThread;
}
getViewer().setInput(input);
getViewer().refresh();
- }
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PopHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PopHandler.java
index 5fccc4c1c..74274ca4b 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PopHandler.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PopHandler.java
@@ -31,35 +31,35 @@ import org.eclipse.jface.viewers.TreeViewer;
*/
public class PopHandler extends AbstractDataStackViewHandler {
- @Override
+ @Override
protected void doExecute(DataStackView view, PDAThread thread, ISelection selection) throws ExecutionException {
- TreeViewer viewer = (TreeViewer)view.getViewer();
- Object popee = selection instanceof IStructuredSelection
- ? ((IStructuredSelection)selection).getFirstElement() : null;
- if (popee != null) {
- try {
- IValue[] stack = thread.getDataStack();
+ TreeViewer viewer = (TreeViewer)view.getViewer();
+ Object popee = selection instanceof IStructuredSelection
+ ? ((IStructuredSelection)selection).getFirstElement() : null;
+ if (popee != null) {
+ try {
+ IValue[] stack = thread.getDataStack();
List<IValue> restore = new ArrayList<>();
- for (int i = 0; i < stack.length; i++) {
- Object value = stack[i];
- if (popee.equals(value)) {
- // pop & stop
- thread.popData();
- break;
- } else {
- // remember value to push back on
- restore.add(thread.popData());
- }
- }
- while (!restore.isEmpty()) {
- IValue value = restore.remove(restore.size() - 1);
- thread.pushData(value.getValueString());
- }
- } catch (DebugException e) {
+ for (int i = 0; i < stack.length; i++) {
+ Object value = stack[i];
+ if (popee.equals(value)) {
+ // pop & stop
+ thread.popData();
+ break;
+ } else {
+ // remember value to push back on
+ restore.add(thread.popData());
+ }
+ }
+ while (!restore.isEmpty()) {
+ IValue value = restore.remove(restore.size() - 1);
+ thread.pushData(value.getValueString());
+ }
+ } catch (DebugException e) {
throw new ExecutionException("Failed to execute push command", e); //$NON-NLS-1$
- }
- viewer.refresh();
- }
- }
+ }
+ viewer.refresh();
+ }
+ }
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PushHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PushHandler.java
index 592c02c19..0dd182361 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PushHandler.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/PushHandler.java
@@ -26,17 +26,17 @@ import org.eclipse.jface.window.Window;
*/
public class PushHandler extends AbstractDataStackViewHandler {
- @Override
+ @Override
protected void doExecute(DataStackView view, PDAThread thread, ISelection selection) throws ExecutionException {
InputDialog dialog = new InputDialog(view.getSite().getShell(), "Specify Value", "Enter value to push", null, null); //$NON-NLS-1$ //$NON-NLS-2$
- if (dialog.open() == Window.OK) {
- try {
- thread.pushData(dialog.getValue());
- } catch (DebugException e) {
+ if (dialog.open() == Window.OK) {
+ try {
+ thread.pushData(dialog.getValue());
+ } catch (DebugException e) {
throw new ExecutionException("Failed to execute push command", e); //$NON-NLS-1$
- }
- }
- view.getViewer().refresh();
- }
+ }
+ }
+ view.getViewer().refresh();
+ }
}

Back to the top