Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2018-11-20 16:20:42 +0000
committerJonah Graham2018-11-22 21:47:02 +0000
commit170e654b4796bad1453ae85a427b97317d67a69a (patch)
tree6ca9b8a8fedd5fd25f97eb79c408312e256ff981 /dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt
parent35996a5c5ca5c254959ba48241eaada6dbf8628d (diff)
downloadorg.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.gz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.xz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.zip
Bug 540373: Cleanup: Format & Remove trailing whitespace
This was done by selecting all projects in Eclipse then Source -> Clean Up... -> choosing: - Format source code - Remove trailing white spaces on all lines and completing the wizard Change-Id: I63685372c6bcc67719bcf145123bcb72e5b00394
Diffstat (limited to 'dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt')
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java62
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDASuspendTrigger.java55
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAUIPlugin.java300
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/SessionAdapterSet.java196
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/actions/PDATerminateCommand.java177
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDABreakpointAdapter.java178
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAEditorAdapterFactory.java25
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAWatchpointFunctionFieldEditorFactory.java12
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/AnnotationHover.java4
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAContentAssistProcessor.java139
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAContentAssistant.java40
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAEditor.java46
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAScanner.java125
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDASourceViewerConfiguration.java53
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PopFrameActionDelegate.java43
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/TextHover.java117
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/WordFinder.java62
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/launcher/PDAMainTab.java56
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/launcher/PDATabGroup.java14
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/PDAExpressionVMProvider.java15
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/PDAVMAdapter.java51
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDALaunchVMProvider.java60
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAThreadsVMNode.java140
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAVirtualMachineVMNode.java182
24 files changed, 1075 insertions, 1077 deletions
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java
index e6de35a1ec5..ab925100b7a 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAAdapterFactory.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -33,36 +33,42 @@ import org.eclipse.debug.ui.contexts.ISuspendTrigger;
* </p>
*/
@ThreadSafe
-@SuppressWarnings({"restriction"})
-public class PDAAdapterFactory implements IAdapterFactory
-{
- // This IAdapterFactory method returns adapters for the PDA launch object only.
- @SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (!(adaptableObject instanceof PDALaunch)) return null;
+@SuppressWarnings({ "restriction" })
+public class PDAAdapterFactory implements IAdapterFactory {
+ // This IAdapterFactory method returns adapters for the PDA launch object only.
+ @SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (!(adaptableObject instanceof PDALaunch))
+ return null;
+
+ PDALaunch launch = (PDALaunch) adaptableObject;
- PDALaunch launch = (PDALaunch)adaptableObject;
+ // Check for valid session.
+ // Note: even if the session is no longer active, the adapter set
+ // should still be returned. This is because the view model may still
+ // need to show elements representing a terminated process/thread/etc.
+ DsfSession session = launch.getSession();
+ if (session == null)
+ return null;
- // Check for valid session.
- // Note: even if the session is no longer active, the adapter set
- // should still be returned. This is because the view model may still
- // need to show elements representing a terminated process/thread/etc.
- DsfSession session = launch.getSession();
- if (session == null) return null;
+ SessionAdapterSet adapterSet = PDAUIPlugin.getDefault().getAdapterSet(launch);
+ if (adapterSet == null)
+ return null;
- SessionAdapterSet adapterSet = PDAUIPlugin.getDefault().getAdapterSet(launch);
- if (adapterSet == null) return null;
-
- // Returns the adapter type for the launch object.
- if (adapterType.equals(IElementContentProvider.class)) return adapterSet.fViewModelAdapter;
- else if (adapterType.equals(IModelProxyFactory.class)) return adapterSet.fViewModelAdapter;
- else if (adapterType.equals(ISuspendTrigger.class)) return adapterSet.fSuspendTrigger;
- else return null;
- }
+ // Returns the adapter type for the launch object.
+ if (adapterType.equals(IElementContentProvider.class))
+ return adapterSet.fViewModelAdapter;
+ else if (adapterType.equals(IModelProxyFactory.class))
+ return adapterSet.fViewModelAdapter;
+ else if (adapterType.equals(ISuspendTrigger.class))
+ return adapterSet.fSuspendTrigger;
+ else
+ return null;
+ }
- @SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3
- public Class[] getAdapterList() {
- return new Class[] { IElementContentProvider.class, IModelProxyFactory.class, ISuspendTrigger.class };
- }
+ @SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3
+ public Class[] getAdapterList() {
+ return new Class[] { IElementContentProvider.class, IModelProxyFactory.class, ISuspendTrigger.class };
+ }
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDASuspendTrigger.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDASuspendTrigger.java
index ec00277d250..ecc8aeb5bff 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDASuspendTrigger.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDASuspendTrigger.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -30,30 +30,31 @@ import org.eclipse.debug.core.ILaunch;
* @since 2.1
*/
public class PDASuspendTrigger extends DsfSuspendTrigger {
-
- public PDASuspendTrigger(DsfSession session, ILaunch launch) {
- super(session, launch);
- }
-
- @Override
- protected void getLaunchTopContainers(final DataRequestMonitor<IContainerDMContext[]> rm) {
- try {
- getSession().getExecutor().execute(new DsfRunnable() {
- public void run() {
- PDACommandControl control =
- getServicesTracker().getService(PDACommandControl.class);
- if (control != null) {
- rm.setData(new IContainerDMContext[] { control.getContext() });
- } else {
- rm.setStatus(new Status(IStatus.ERROR, PDAUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Not available", null));
- }
- rm.done();
-
- }
- });
- } catch (RejectedExecutionException e) {
- rm.setStatus(new Status(IStatus.ERROR, PDAUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Not available", e));
- rm.done();
- }
- }
+
+ public PDASuspendTrigger(DsfSession session, ILaunch launch) {
+ super(session, launch);
+ }
+
+ @Override
+ protected void getLaunchTopContainers(final DataRequestMonitor<IContainerDMContext[]> rm) {
+ try {
+ getSession().getExecutor().execute(new DsfRunnable() {
+ public void run() {
+ PDACommandControl control = getServicesTracker().getService(PDACommandControl.class);
+ if (control != null) {
+ rm.setData(new IContainerDMContext[] { control.getContext() });
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, PDAUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ "Not available", null));
+ }
+ rm.done();
+
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ rm.setStatus(new Status(IStatus.ERROR, PDAUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ "Not available", e));
+ rm.done();
+ }
+ }
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAUIPlugin.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAUIPlugin.java
index ebf52c5c4e8..3c264326424 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAUIPlugin.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/PDAUIPlugin.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -38,65 +38,64 @@ import org.osgi.framework.BundleContext;
/**
* The main plugin class to be used in the desktop.
*/
-public class PDAUIPlugin extends AbstractUIPlugin implements ILaunchesListener2{
-
- public static String PLUGIN_ID = "org.eclipse.cdt.examples.dsf.pda.ui ";
-
+public class PDAUIPlugin extends AbstractUIPlugin implements ILaunchesListener2 {
+
+ public static String PLUGIN_ID = "org.eclipse.cdt.examples.dsf.pda.ui ";
+
//The shared instance.
private static PDAUIPlugin plugin;
-
+
private static BundleContext fContext;
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$
-
- /**
- * PDA program image
- */
- public final static String IMG_OBJ_PDA = "IMB_OBJ_PDA";
-
- /**
- * Keyword color
- */
- public final static RGB KEYWORD = new RGB(0,0,255);
- public final static RGB LABEL = new RGB(128, 128, 0);
-
- /**
- * Managed colors
- */
- private Map<RGB, Color> fColors = new HashMap<RGB, Color>();
-
- /**
- * Active adapter sets. They are accessed using the DSF session ID
- * which owns the debug services.
- */
- private Map<String, SessionAdapterSet> fSessionAdapterSets =
- Collections.synchronizedMap(new HashMap<String, SessionAdapterSet>());
-
- /**
- * Map of launches for which adapter sets have already been disposed.
- * This map (used as a set) is maintained in order to avoid re-creating an
- * adapter set after the launch was removed from the launch manager, but
- * while the launch is still being held by other classes which may
- * request its adapters. A weak map is used to avoid leaking
- * memory once the launches are no longer referenced.
- * <p>
- * Access to this map is synchronized using the fSessionAdapterSets
- * instance.
- * </p>
- */
- private Map<ILaunch, Object> fDisposedSessionAdapterSets =
- new WeakHashMap<ILaunch, Object>();
-
- private void disposeAdapterSet(PDALaunch launch) {
- String sessionId = launch.getSession().getId();
- synchronized(fSessionAdapterSets) {
- if ( fSessionAdapterSets.containsKey(sessionId) ) {
- fSessionAdapterSets.remove(sessionId).dispose();
- fDisposedSessionAdapterSets.put(launch, null);
- }
- }
- }
+
+ /**
+ * PDA program image
+ */
+ public final static String IMG_OBJ_PDA = "IMB_OBJ_PDA";
+
+ /**
+ * Keyword color
+ */
+ public final static RGB KEYWORD = new RGB(0, 0, 255);
+ public final static RGB LABEL = new RGB(128, 128, 0);
+
+ /**
+ * Managed colors
+ */
+ private Map<RGB, Color> fColors = new HashMap<RGB, Color>();
+
+ /**
+ * Active adapter sets. They are accessed using the DSF session ID
+ * which owns the debug services.
+ */
+ private Map<String, SessionAdapterSet> fSessionAdapterSets = Collections
+ .synchronizedMap(new HashMap<String, SessionAdapterSet>());
+
+ /**
+ * Map of launches for which adapter sets have already been disposed.
+ * This map (used as a set) is maintained in order to avoid re-creating an
+ * adapter set after the launch was removed from the launch manager, but
+ * while the launch is still being held by other classes which may
+ * request its adapters. A weak map is used to avoid leaking
+ * memory once the launches are no longer referenced.
+ * <p>
+ * Access to this map is synchronized using the fSessionAdapterSets
+ * instance.
+ * </p>
+ */
+ private Map<ILaunch, Object> fDisposedSessionAdapterSets = new WeakHashMap<ILaunch, Object>();
+
+ private void disposeAdapterSet(PDALaunch launch) {
+ String sessionId = launch.getSession().getId();
+ synchronized (fSessionAdapterSets) {
+ if (fSessionAdapterSets.containsKey(sessionId)) {
+ fSessionAdapterSets.remove(sessionId).dispose();
+ fDisposedSessionAdapterSets.put(launch, null);
+ }
+ }
+ }
/**
* The constructor.
@@ -111,9 +110,9 @@ public class PDAUIPlugin extends AbstractUIPlugin implements ILaunchesListener2{
*/
@Override
public void start(BundleContext context) throws Exception {
- fContext = context;
+ fContext = context;
super.start(context);
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
}
/**
@@ -121,14 +120,14 @@ public class PDAUIPlugin extends AbstractUIPlugin implements ILaunchesListener2{
*/
@Override
public void stop(BundleContext context) throws Exception {
- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
disposeAdapterSets();
super.stop(context);
plugin = null;
fContext = null;
- for (Map.Entry<RGB, Color> entry : fColors.entrySet()) {
- entry.getValue().dispose();
- }
+ for (Map.Entry<RGB, Color> entry : fColors.entrySet()) {
+ entry.getValue().dispose();
+ }
}
/**
@@ -139,105 +138,104 @@ public class PDAUIPlugin extends AbstractUIPlugin implements ILaunchesListener2{
}
public static BundleContext getBundleContext() {
- return fContext;
+ return fContext;
}
-
+
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
declareImage(IMG_OBJ_PDA, PATH_OBJECT + "pda.gif");
}
-
- /**
- * 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) {
- URL url = BundleUtility.find("org.eclipse.cdt.examples.dsf.pda.ui", path);
- ImageDescriptor 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;
- }
-
- SessionAdapterSet getAdapterSet(PDALaunch launch) {
- // Find the correct set of adapters based on the launch. If not found
- // it means that we have a new launch, and we have to create a
- // new set of adapters.
- SessionAdapterSet adapterSet;
- synchronized(fSessionAdapterSets) {
- // The adapter set for the given launch was already disposed.
- // Return a null adapter.
- if (fDisposedSessionAdapterSets.containsKey(launch)) {
- return null;
- }
- String sessionId = launch.getSession().getId();
- adapterSet = fSessionAdapterSets.get(sessionId);
- if (adapterSet == null) {
- adapterSet = new SessionAdapterSet(launch);
- fSessionAdapterSets.put(sessionId, adapterSet);
- }
- }
- return adapterSet;
- }
-
- SessionAdapterSet getAdapterSet(String sessionId) {
- DsfSession session = DsfSession.getSession(sessionId);
- ILaunch launch = (ILaunch)session.getModelAdapter(ILaunch.class);
- if (launch instanceof PDALaunch) {
- return getAdapterSet((PDALaunch)launch);
- }
- return null;
- }
-
+
+ /**
+ * 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) {
+ URL url = BundleUtility.find("org.eclipse.cdt.examples.dsf.pda.ui", path);
+ ImageDescriptor 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;
+ }
+
+ SessionAdapterSet getAdapterSet(PDALaunch launch) {
+ // Find the correct set of adapters based on the launch. If not found
+ // it means that we have a new launch, and we have to create a
+ // new set of adapters.
+ SessionAdapterSet adapterSet;
+ synchronized (fSessionAdapterSets) {
+ // The adapter set for the given launch was already disposed.
+ // Return a null adapter.
+ if (fDisposedSessionAdapterSets.containsKey(launch)) {
+ return null;
+ }
+ String sessionId = launch.getSession().getId();
+ adapterSet = fSessionAdapterSets.get(sessionId);
+ if (adapterSet == null) {
+ adapterSet = new SessionAdapterSet(launch);
+ fSessionAdapterSets.put(sessionId, adapterSet);
+ }
+ }
+ return adapterSet;
+ }
+
+ SessionAdapterSet getAdapterSet(String sessionId) {
+ DsfSession session = DsfSession.getSession(sessionId);
+ ILaunch launch = (ILaunch) session.getModelAdapter(ILaunch.class);
+ if (launch instanceof PDALaunch) {
+ return getAdapterSet((PDALaunch) launch);
+ }
+ return null;
+ }
+
/**
* Dispose adapter sets for all launches.
*/
private void disposeAdapterSets() {
- for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
- if (launch instanceof PDALaunch) {
- disposeAdapterSet((PDALaunch)launch);
- }
- }
- }
-
- public void launchesRemoved(ILaunch[] launches) {
- // Dispose the set of adapters for a launch only after the launch is
- // removed from the view. If the launch is terminated, the adapters
- // are still needed to populate the contents of the view.
- for (ILaunch launch : launches) {
- if (launch instanceof PDALaunch) {
- disposeAdapterSet((PDALaunch)launch);
- }
- }
- }
-
- public void launchesTerminated(ILaunch[] launches) {
- }
-
- public void launchesAdded(ILaunch[] launches) {
- }
-
- public void launchesChanged(ILaunch[] launches) {
- }
+ for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
+ if (launch instanceof PDALaunch) {
+ disposeAdapterSet((PDALaunch) launch);
+ }
+ }
+ }
-}
+ public void launchesRemoved(ILaunch[] launches) {
+ // Dispose the set of adapters for a launch only after the launch is
+ // removed from the view. If the launch is terminated, the adapters
+ // are still needed to populate the contents of the view.
+ for (ILaunch launch : launches) {
+ if (launch instanceof PDALaunch) {
+ disposeAdapterSet((PDALaunch) launch);
+ }
+ }
+ }
+
+ public void launchesTerminated(ILaunch[] launches) {
+ }
+ public void launchesAdded(ILaunch[] launches) {
+ }
+
+ public void launchesChanged(ILaunch[] launches) {
+ }
+
+}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/SessionAdapterSet.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/SessionAdapterSet.java
index cafbf5db912..48a4dfba1a4 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/SessionAdapterSet.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/SessionAdapterSet.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -41,100 +41,102 @@ import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
* Contains the set of adapters that are created for each session instance.
*/
class SessionAdapterSet {
- // View Model adapter
- final PDAVMAdapter fViewModelAdapter;
-
- // Source lookup and positioning adapter
- final DsfSourceDisplayAdapter fSourceDisplayAdapter;
-
- // Command adapters
- final DsfStepIntoCommand fStepIntoCommand;
- final DsfStepOverCommand fStepOverCommand;
- final DsfStepReturnCommand fStepReturnCommand;
- final DsfSuspendCommand fSuspendCommand;
- final DsfResumeCommand fResumeCommand;
- final PDATerminateCommand fTerminateCommand;
- final PDASuspendTrigger fSuspendTrigger;
-
- // Adapters for integration with other UI actions
- final IDebugModelProvider fDebugModelProvider;
- final PDALaunch fLaunch;
-
- final SteppingController fSteppingController;
-
- final IModelSelectionPolicyFactory fModelSelectionPolicyFactory;
-
- SessionAdapterSet(PDALaunch launch) {
- // Initialize launch and session.
- fLaunch = launch;
- DsfSession session = launch.getSession();
-
- // register stepping controller
- fSteppingController = new SteppingController(session);
- session.registerModelAdapter(SteppingController.class, fSteppingController);
-
- // Initialize VM
- fViewModelAdapter = new PDAVMAdapter(session, fSteppingController);
-
- // Initialize source lookup
- fSourceDisplayAdapter = new DsfSourceDisplayAdapter(session, (ISourceLookupDirector)launch.getSourceLocator(), fSteppingController);
- session.registerModelAdapter(ISourceDisplay.class, fSourceDisplayAdapter);
-
- // Default selection policy
- fModelSelectionPolicyFactory = new DefaultDsfModelSelectionPolicyFactory();
- session.registerModelAdapter(IModelSelectionPolicyFactory.class, fModelSelectionPolicyFactory);
-
- // Initialize retargetable command handler.
- fStepIntoCommand = new DsfStepIntoCommand(session, null);
- fStepOverCommand = new DsfStepOverCommand(session, null);
- fStepReturnCommand = new DsfStepReturnCommand(session);
- fSuspendCommand = new DsfSuspendCommand(session);
- fResumeCommand = new DsfResumeCommand(session);
- fTerminateCommand = new PDATerminateCommand(session);
- fSuspendTrigger = new PDASuspendTrigger(session, fLaunch);
-
- session.registerModelAdapter(IStepIntoHandler.class, fStepIntoCommand);
- session.registerModelAdapter(IStepOverHandler.class, fStepOverCommand);
- session.registerModelAdapter(IStepReturnHandler.class, fStepReturnCommand);
- session.registerModelAdapter(ISuspendHandler.class, fSuspendCommand);
- session.registerModelAdapter(IResumeHandler.class, fResumeCommand);
- session.registerModelAdapter(ITerminateHandler.class, fTerminateCommand);
-
- // Initialize debug model provider
- fDebugModelProvider = new IDebugModelProvider() {
- public String[] getModelIdentifiers() {
- return new String[] { PDAPlugin.ID_PDA_DEBUG_MODEL };
- }
- };
- session.registerModelAdapter(IDebugModelProvider.class, fDebugModelProvider);
- }
-
- void dispose() {
- DsfSession session = fLaunch.getSession();
-
- fViewModelAdapter.dispose();
-
- session.unregisterModelAdapter(ISourceDisplay.class);
- if (fSourceDisplayAdapter != null) fSourceDisplayAdapter.dispose();
-
- session.unregisterModelAdapter(SteppingController.class);
- fSteppingController.dispose();
-
- session.unregisterModelAdapter(IModelSelectionPolicyFactory.class);
-
- session.unregisterModelAdapter(IStepIntoHandler.class);
- session.unregisterModelAdapter(IStepOverHandler.class);
- session.unregisterModelAdapter(IStepReturnHandler.class);
- session.unregisterModelAdapter(ISuspendHandler.class);
- session.unregisterModelAdapter(IResumeHandler.class);
- session.unregisterModelAdapter(ITerminateHandler.class);
- fStepIntoCommand.dispose();
- fStepOverCommand.dispose();
- fStepReturnCommand.dispose();
- fSuspendCommand.dispose();
- fResumeCommand.dispose();
- fTerminateCommand.dispose();
- fSuspendTrigger.dispose();
- }
-
+ // View Model adapter
+ final PDAVMAdapter fViewModelAdapter;
+
+ // Source lookup and positioning adapter
+ final DsfSourceDisplayAdapter fSourceDisplayAdapter;
+
+ // Command adapters
+ final DsfStepIntoCommand fStepIntoCommand;
+ final DsfStepOverCommand fStepOverCommand;
+ final DsfStepReturnCommand fStepReturnCommand;
+ final DsfSuspendCommand fSuspendCommand;
+ final DsfResumeCommand fResumeCommand;
+ final PDATerminateCommand fTerminateCommand;
+ final PDASuspendTrigger fSuspendTrigger;
+
+ // Adapters for integration with other UI actions
+ final IDebugModelProvider fDebugModelProvider;
+ final PDALaunch fLaunch;
+
+ final SteppingController fSteppingController;
+
+ final IModelSelectionPolicyFactory fModelSelectionPolicyFactory;
+
+ SessionAdapterSet(PDALaunch launch) {
+ // Initialize launch and session.
+ fLaunch = launch;
+ DsfSession session = launch.getSession();
+
+ // register stepping controller
+ fSteppingController = new SteppingController(session);
+ session.registerModelAdapter(SteppingController.class, fSteppingController);
+
+ // Initialize VM
+ fViewModelAdapter = new PDAVMAdapter(session, fSteppingController);
+
+ // Initialize source lookup
+ fSourceDisplayAdapter = new DsfSourceDisplayAdapter(session, (ISourceLookupDirector) launch.getSourceLocator(),
+ fSteppingController);
+ session.registerModelAdapter(ISourceDisplay.class, fSourceDisplayAdapter);
+
+ // Default selection policy
+ fModelSelectionPolicyFactory = new DefaultDsfModelSelectionPolicyFactory();
+ session.registerModelAdapter(IModelSelectionPolicyFactory.class, fModelSelectionPolicyFactory);
+
+ // Initialize retargetable command handler.
+ fStepIntoCommand = new DsfStepIntoCommand(session, null);
+ fStepOverCommand = new DsfStepOverCommand(session, null);
+ fStepReturnCommand = new DsfStepReturnCommand(session);
+ fSuspendCommand = new DsfSuspendCommand(session);
+ fResumeCommand = new DsfResumeCommand(session);
+ fTerminateCommand = new PDATerminateCommand(session);
+ fSuspendTrigger = new PDASuspendTrigger(session, fLaunch);
+
+ session.registerModelAdapter(IStepIntoHandler.class, fStepIntoCommand);
+ session.registerModelAdapter(IStepOverHandler.class, fStepOverCommand);
+ session.registerModelAdapter(IStepReturnHandler.class, fStepReturnCommand);
+ session.registerModelAdapter(ISuspendHandler.class, fSuspendCommand);
+ session.registerModelAdapter(IResumeHandler.class, fResumeCommand);
+ session.registerModelAdapter(ITerminateHandler.class, fTerminateCommand);
+
+ // Initialize debug model provider
+ fDebugModelProvider = new IDebugModelProvider() {
+ public String[] getModelIdentifiers() {
+ return new String[] { PDAPlugin.ID_PDA_DEBUG_MODEL };
+ }
+ };
+ session.registerModelAdapter(IDebugModelProvider.class, fDebugModelProvider);
+ }
+
+ void dispose() {
+ DsfSession session = fLaunch.getSession();
+
+ fViewModelAdapter.dispose();
+
+ session.unregisterModelAdapter(ISourceDisplay.class);
+ if (fSourceDisplayAdapter != null)
+ fSourceDisplayAdapter.dispose();
+
+ session.unregisterModelAdapter(SteppingController.class);
+ fSteppingController.dispose();
+
+ session.unregisterModelAdapter(IModelSelectionPolicyFactory.class);
+
+ session.unregisterModelAdapter(IStepIntoHandler.class);
+ session.unregisterModelAdapter(IStepOverHandler.class);
+ session.unregisterModelAdapter(IStepReturnHandler.class);
+ session.unregisterModelAdapter(ISuspendHandler.class);
+ session.unregisterModelAdapter(IResumeHandler.class);
+ session.unregisterModelAdapter(ITerminateHandler.class);
+ fStepIntoCommand.dispose();
+ fStepOverCommand.dispose();
+ fStepReturnCommand.dispose();
+ fSuspendCommand.dispose();
+ fResumeCommand.dispose();
+ fTerminateCommand.dispose();
+ fSuspendTrigger.dispose();
+ }
+
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/actions/PDATerminateCommand.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/actions/PDATerminateCommand.java
index ea0b9c7bfcc..449eda6d08f 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/actions/PDATerminateCommand.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/actions/PDATerminateCommand.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -33,101 +33,98 @@ import org.eclipse.debug.core.commands.ITerminateHandler;
/**
* The terminate command is specialized for the PDA debugger. Currently there
- * is no standard interface for terminating a debug session in DSF, because the
- * details of initiating and shutting down a debug session vary greatly in
+ * is no standard interface for terminating a debug session in DSF, because the
+ * details of initiating and shutting down a debug session vary greatly in
* different debuggers.
*/
public class PDATerminateCommand implements ITerminateHandler {
- // The executor and the services tracker, both initialized from a DSF session.
- private final DsfSession fSession;
- private final DsfServicesTracker fTracker;
-
- public PDATerminateCommand(DsfSession session) {
- fSession = session;
- fTracker = new DsfServicesTracker(PDAUIPlugin.getBundleContext(), session.getId());
- }
+ // The executor and the services tracker, both initialized from a DSF session.
+ private final DsfSession fSession;
+ private final DsfServicesTracker fTracker;
+
+ public PDATerminateCommand(DsfSession session) {
+ fSession = session;
+ fTracker = new DsfServicesTracker(PDAUIPlugin.getBundleContext(), session.getId());
+ }
+
+ public void dispose() {
+ // DSF services tracker always has to be disposed, because the OSGi services
+ // use reference counting.
+ fTracker.dispose();
+ }
+
+ // Run control may not be available after a connection is terminated and shut down.
+ public void canExecute(final IEnabledStateRequest request) {
+ // Terminate can only operate on a single element.
+ if (request.getElements().length != 1 || !(request.getElements()[0] instanceof IDMVMContext)) {
+ request.setEnabled(false);
+ request.done();
+ return;
+ }
+
+ // Find the PDA program context in the selected element. If one is not found,
+ // the action should be disabled.
+ IDMVMContext vmc = (IDMVMContext) request.getElements()[0];
+ final PDAVirtualMachineDMContext pdaProgramCtx = DMContexts.getAncestorOfType(vmc.getDMContext(),
+ PDAVirtualMachineDMContext.class);
+ if (pdaProgramCtx == null) {
+ request.setEnabled(false);
+ request.done();
+ return;
+ }
- public void dispose() {
- // DSF services tracker always has to be disposed, because the OSGi services
- // use reference counting.
- fTracker.dispose();
- }
+ try {
+ fSession.getExecutor().execute(new DsfRunnable() {
+ public void run() {
+ // Get the processes service and the exec context.
+ PDACommandControl commandControl = fTracker.getService(PDACommandControl.class);
+ if (commandControl == null || pdaProgramCtx == null) {
+ // Context or service already invalid.
+ request.setEnabled(false);
+ request.done();
+ } else {
+ // Check whether the control is terminated.
+ request.setEnabled(!commandControl.isTerminated());
+ request.done();
+ }
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ // The DSF session for this context is no longer active. It's possible to check
+ // for this condition before calling fSession.getExecutor().execute(), but
+ // since this method is executing in a different thread than the session control,
+ // there would still be a chance for a race condition leading to this exception.
+ request.setEnabled(false);
+ request.done();
+ }
+ }
- // Run control may not be available after a connection is terminated and shut down.
- public void canExecute(final IEnabledStateRequest request) {
- // Terminate can only operate on a single element.
- if (request.getElements().length != 1 ||
- !(request.getElements()[0] instanceof IDMVMContext) )
- {
- request.setEnabled(false);
- request.done();
- return;
- }
+ public boolean execute(final IDebugCommandRequest request) {
+ // Skip the checks and assume that this method is called only if the action
+ // was enabled.
- // Find the PDA program context in the selected element. If one is not found,
- // the action should be disabled.
- IDMVMContext vmc = (IDMVMContext)request.getElements()[0];
- final PDAVirtualMachineDMContext pdaProgramCtx = DMContexts.getAncestorOfType(vmc.getDMContext(), PDAVirtualMachineDMContext.class);
- if (pdaProgramCtx == null) {
- request.setEnabled(false);
- request.done();
- return;
- }
-
- try {
- fSession.getExecutor().execute(
- new DsfRunnable() {
- public void run() {
- // Get the processes service and the exec context.
- PDACommandControl commandControl = fTracker.getService(PDACommandControl.class);
- if (commandControl == null || pdaProgramCtx == null) {
- // Context or service already invalid.
- request.setEnabled(false);
- request.done();
- } else {
- // Check whether the control is terminated.
- request.setEnabled(!commandControl.isTerminated());
- request.done();
- }
- }
- });
- } catch (RejectedExecutionException e) {
- // The DSF session for this context is no longer active. It's possible to check
- // for this condition before calling fSession.getExecutor().execute(), but
- // since this method is executing in a different thread than the session control,
- // there would still be a chance for a race condition leading to this exception.
- request.setEnabled(false);
- request.done();
- }
- }
+ try {
+ fSession.getExecutor().submit(new DsfRunnable() {
+ public void run() {
+ // If the command control service is available, attempt to terminate the program.
+ PDACommandControl commandControl = fTracker.getService(PDACommandControl.class);
+ if (commandControl != null) {
- public boolean execute(final IDebugCommandRequest request) {
- // Skip the checks and assume that this method is called only if the action
- // was enabled.
+ commandControl.terminate(new RequestMonitor(ImmediateExecutor.getInstance(), null) {
+ @Override
+ protected void handleCompleted() {
+ request.setStatus(getStatus());
+ request.done();
+ }
+ });
+ }
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ request.setStatus(new Status(IStatus.ERROR, PDAUIPlugin.PLUGIN_ID, "PDA debug session is shut down."));
+ request.done();
+ }
+ return false;
+ }
- try {
- fSession.getExecutor().submit(new DsfRunnable() {
- public void run() {
- // If the command control service is available, attempt to terminate the program.
- PDACommandControl commandControl = fTracker.getService(PDACommandControl.class);
- if (commandControl != null) {
-
- commandControl.terminate(
- new RequestMonitor(ImmediateExecutor.getInstance(), null) {
- @Override
- protected void handleCompleted() {
- request.setStatus(getStatus());
- request.done();
- }
- });
- }
- }
- });
- } catch (RejectedExecutionException e) {
- request.setStatus(new Status(IStatus.ERROR, PDAUIPlugin.PLUGIN_ID, "PDA debug session is shut down."));
- request.done();
- }
- return false;
- }
-
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDABreakpointAdapter.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDABreakpointAdapter.java
index 28cab6385e3..26e89118a42 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDABreakpointAdapter.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDABreakpointAdapter.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -33,11 +33,10 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
-
/**
* Adapter to create breakpoints in PDA files.
* <p>
- * This class is identical to the corresponding in PDA debugger implemented in
+ * This class is identical to the corresponding in PDA debugger implemented in
* org.eclipse.debug.examples.ui.
* </p>
*/
@@ -51,11 +50,12 @@ public class PDABreakpointAdapter implements IToggleBreakpointsTargetExtension {
IResource resource = textEditor.getEditorInput().getAdapter(IResource.class);
ITextSelection textSelection = (ITextSelection) selection;
int lineNumber = textSelection.getStartLine();
- IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(PDAPlugin.ID_PDA_DEBUG_MODEL);
+ IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager()
+ .getBreakpoints(PDAPlugin.ID_PDA_DEBUG_MODEL);
for (int i = 0; i < breakpoints.length; i++) {
IBreakpoint breakpoint = breakpoints[i];
if (breakpoint instanceof ILineBreakpoint && resource.equals(breakpoint.getMarker().getResource())) {
- if (((ILineBreakpoint)breakpoint).getLineNumber() == (lineNumber + 1)) {
+ if (((ILineBreakpoint) breakpoint).getLineNumber() == (lineNumber + 1)) {
// remove
breakpoint.delete();
return;
@@ -67,17 +67,18 @@ public class PDABreakpointAdapter implements IToggleBreakpointsTargetExtension {
DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
}
}
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) {
return getEditor(part) != null;
}
-
+
/**
* Returns the editor being used to edit a PDA file, associated with the
* given part, or <code>null</code> if none.
- *
+ *
* @param part workbench part
* @return the editor being used to edit a PDA file, associated with the
* given part, or <code>null</code> if none
@@ -93,39 +94,42 @@ public class PDABreakpointAdapter implements IToggleBreakpointsTargetExtension {
}
}
}
- return null;
+ return null;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
public void toggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
}
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) {
return false;
}
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
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];
- // look for existing watchpoint to delete
- IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(PDAPlugin.ID_PDA_DEBUG_MODEL);
+ 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];
+ // look for existing watchpoint to delete
+ IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager()
+ .getBreakpoints(PDAPlugin.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();
+ PDAWatchpoint watchpoint = (PDAWatchpoint) breakpoint;
+ String otherVar = watchpoint.getVariableName();
+ String otherFcn = watchpoint.getFunctionName();
if (otherVar.equals(var) && otherFcn.equals(fcn)) {
breakpoint.delete();
return;
@@ -134,95 +138,97 @@ public class PDABreakpointAdapter implements IToggleBreakpointsTargetExtension {
}
// create watchpoint
PDAWatchpoint watchpoint = new PDAWatchpoint(resource, lineNumber + 1, fcn, var, true, true);
- DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(watchpoint);
- }
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(watchpoint);
+ }
}
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
return getVariableAndFunctionName(part, selection) != null;
}
-
+
/**
* Returns the variable and function names at the current line, or <code>null</code> if none.
- *
+ *
* @param part text editor
* @param selection text selection
* @return the variable and function names at the current line, or <code>null</code> if none.
* The array has two elements, the first is the variable name, the second is the function name.
*/
private 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();
- if (string.startsWith("var ")) {
- 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;
+ 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 ")) {
+ 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;
}
-
+
/**
* Returns the name of the function containing the given variable defined at the given
* line number in the specified document.
- *
+ *
* @param document PDA source file
* @param varName variable name
* @param line line numbner at which the variable is defined
* @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());
- if (lineText.startsWith(":")) {
- String label = lineText.substring(1);
- if (source.indexOf("call " + label) >= 0) {
- return label;
- }
- }
- lineIndex--;
- } catch (BadLocationException e) {
- }
- }
- return "_main_";
+ // 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(":")) {
+ String label = lineText.substring(1);
+ if (source.indexOf("call " + label) >= 0) {
+ return label;
+ }
+ }
+ lineIndex--;
+ } catch (BadLocationException e) {
+ }
+ }
+ return "_main_";
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#toggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
+ if (canToggleWatchpoints(part, selection)) {
+ toggleWatchpoints(part, selection);
+ } else {
+ toggleLineBreakpoints(part, selection);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#canToggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public boolean canToggleBreakpoints(IWorkbenchPart part, ISelection selection) {
+ return canToggleLineBreakpoints(part, selection) || canToggleWatchpoints(part, selection);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#toggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
- if (canToggleWatchpoints(part, selection)) {
- toggleWatchpoints(part, selection);
- } else {
- toggleLineBreakpoints(part, selection);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#canToggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public boolean canToggleBreakpoints(IWorkbenchPart part, ISelection selection) {
- return canToggleLineBreakpoints(part, selection) || canToggleWatchpoints(part, selection);
- }
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAEditorAdapterFactory.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAEditorAdapterFactory.java
index d1d0e286558..3825c25e1d0 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAEditorAdapterFactory.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAEditorAdapterFactory.java
@@ -7,49 +7,48 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
* Wind River Systems - adopted to use with DSF
*******************************************************************************/
package org.eclipse.cdt.examples.dsf.pda.ui.breakpoints;
+
import org.eclipse.cdt.examples.dsf.pda.ui.editor.PDAEditor;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
import org.eclipse.ui.texteditor.ITextEditor;
-
-
/**
* Creates a toggle breakpoint adapter
* <p>
- * This class is identical to the corresponding in PDA debugger implemented in
+ * This class is identical to the corresponding in PDA debugger implemented in
* org.eclipse.debug.examples.ui.
* </p>
*/
public class PDAEditorAdapterFactory implements IAdapterFactory {
- @SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ @SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof PDAEditor) {
ITextEditor editorPart = (ITextEditor) adaptableObject;
IResource resource = editorPart.getEditorInput().getAdapter(IResource.class);
if (resource != null) {
String extension = resource.getFileExtension();
if (extension != null && extension.equals("pda")) {
- if (adapterType.equals(IToggleBreakpointsTarget.class)) {
- return new PDABreakpointAdapter();
- }
+ if (adapterType.equals(IToggleBreakpointsTarget.class)) {
+ return new PDABreakpointAdapter();
+ }
}
- }
+ }
}
return null;
}
- @SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3
- public Class[] getAdapterList() {
- return new Class[]{IToggleBreakpointsTarget.class};
+ @SuppressWarnings("unchecked") // IAdapterFactory is Java 1.3
+ public Class[] getAdapterList() {
+ return new Class[] { IToggleBreakpointsTarget.class };
}
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAWatchpointFunctionFieldEditorFactory.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAWatchpointFunctionFieldEditorFactory.java
index c9ccba836da..12845189e70 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAWatchpointFunctionFieldEditorFactory.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/breakpoints/PDAWatchpointFunctionFieldEditorFactory.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -19,11 +19,11 @@ import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.widgets.Composite;
/**
- *
+ *
*/
public class PDAWatchpointFunctionFieldEditorFactory implements IFieldEditorFactory {
-
- public FieldEditor createFieldEditor(String name, String labelText, Composite parent) {
- return new StringFieldEditor(name, labelText, parent);
- }
+
+ public FieldEditor createFieldEditor(String name, String labelText, Composite parent) {
+ return new StringFieldEditor(name, labelText, parent);
+ }
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/AnnotationHover.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/AnnotationHover.java
index ea301b65386..88840ca205c 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/AnnotationHover.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/AnnotationHover.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -27,7 +27,7 @@ import org.eclipse.jface.text.source.ISourceViewer;
/**
* Returns hover for breakpoints.
* <p>
- * This class is identical to the corresponding in PDA debugger implemented in
+ * This class is identical to the corresponding in PDA debugger implemented in
* org.eclipse.debug.examples.ui.
* </p>
*/
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAContentAssistProcessor.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAContentAssistProcessor.java
index 843d3a3496c..daab38e1e3c 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAContentAssistProcessor.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAContentAssistProcessor.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -29,78 +29,79 @@ import org.eclipse.jface.text.contentassist.IContextInformationValidator;
public class PDAContentAssistProcessor implements IContentAssistProcessor {
- 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) {
- }
- }
-
- List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
- 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));
- }
- }
- } 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));
- }
- }
- if (!proposals.isEmpty()) {
- return proposals.toArray(new ICompletionProposal[proposals.size()]);
- }
- return null;
- }
+ 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) {
+ }
+ }
+
+ List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
+ 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));
+ }
+ }
+ } 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));
+ }
+ }
+ if (!proposals.isEmpty()) {
+ return proposals.toArray(new ICompletionProposal[proposals.size()]);
+ }
+ return null;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
- */
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
- return null;
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
+ */
+ public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
+ return null;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
- */
- public char[] getCompletionProposalAutoActivationCharacters() {
- return null;
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
+ */
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ return null;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
- */
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
+ */
+ public char[] getContextInformationAutoActivationCharacters() {
+ return null;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
- */
- public String getErrorMessage() {
- return null;
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
+ */
+ public String getErrorMessage() {
+ return null;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
- */
- public IContextInformationValidator getContextInformationValidator() {
- return null;
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
+ */
+ public IContextInformationValidator getContextInformationValidator() {
+ return null;
+ }
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAContentAssistant.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAContentAssistant.java
index 7c490901bbb..59ff54e8512 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAContentAssistant.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAContentAssistant.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -23,24 +23,24 @@ import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.swt.widgets.Shell;
public class PDAContentAssistant extends ContentAssistant {
-
- public PDAContentAssistant() {
- super();
-
- PDAContentAssistProcessor processor= new PDAContentAssistProcessor();
- setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
-
- enableAutoActivation(false);
- enableAutoInsert(false);
-
- setInformationControlCreator(getInformationControlCreator());
- }
- private IInformationControlCreator getInformationControlCreator() {
- return new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent);
- }
- };
- }
+ public PDAContentAssistant() {
+ super();
+
+ PDAContentAssistProcessor processor = new PDAContentAssistProcessor();
+ setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
+
+ enableAutoActivation(false);
+ enableAutoInsert(false);
+
+ setInformationControlCreator(getInformationControlCreator());
+ }
+
+ private IInformationControlCreator getInformationControlCreator() {
+ return new IInformationControlCreator() {
+ public IInformationControl createInformationControl(Shell parent) {
+ return new DefaultInformationControl(parent);
+ }
+ };
+ }
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAEditor.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAEditor.java
index 08064f776d5..d0267ae877f 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAEditor.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAEditor.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -26,27 +26,27 @@ import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
* PDA editor
*/
public class PDAEditor extends AbstractDecoratedTextEditor {
-
- /**
- * Creates a PDE editor
- */
- public PDAEditor() {
- super();
- setSourceViewerConfiguration(new PDASourceViewerConfiguration());
- setRulerContextMenuId("pda.editor.rulerMenu");
- setEditorContextMenuId("pda.editor.editorMenu");
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
- */
- protected void createActions() {
- super.createActions();
- ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.cdt.examples.dsf.pda.ui.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$
- }
-
-
+ /**
+ * Creates a PDE editor
+ */
+ public PDAEditor() {
+ super();
+ setSourceViewerConfiguration(new PDASourceViewerConfiguration());
+ setRulerContextMenuId("pda.editor.rulerMenu");
+ setEditorContextMenuId("pda.editor.editorMenu");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
+ */
+ protected void createActions() {
+ super.createActions();
+ ResourceBundle bundle = ResourceBundle
+ .getBundle("org.eclipse.cdt.examples.dsf.pda.ui.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/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAScanner.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAScanner.java
index 03f350e02b7..193577cbc30 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAScanner.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDAScanner.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -23,74 +23,71 @@ import org.eclipse.jface.text.rules.IWordDetector;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.text.rules.WordRule;
-
/**
* PDA editor keyword scanner.
*/
public class PDAScanner extends BufferedRuleBasedScanner {
-
- /**
- * PDA keywods
- */
- public static final String[] fgKeywords = new String[] {
- "add", "branch_not_zero", "call", "dec", "dup",
- "halt", "output", "pop", "push", "return", "var"
- };
-
- /**
- * Detects potential keywords
- */
- class PDAWordDetector implements IWordDetector {
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.rules.IWordDetector#isWordStart(char)
- */
- public boolean isWordStart(char c) {
- return Character.isLetter(c);
- }
+ /**
+ * PDA keywods
+ */
+ public static final String[] fgKeywords = new String[] { "add", "branch_not_zero", "call", "dec", "dup", "halt",
+ "output", "pop", "push", "return", "var" };
+
+ /**
+ * Detects potential keywords
+ */
+ class PDAWordDetector implements IWordDetector {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.rules.IWordDetector#isWordStart(char)
+ */
+ public boolean isWordStart(char c) {
+ return Character.isLetter(c);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.rules.IWordDetector#isWordPart(char)
+ */
+ public boolean isWordPart(char c) {
+ return Character.isLetter(c) || c == '_';
+ }
+ }
+
+ /**
+ * Detects PDA branch labels
+ */
+ class PDALabelDetector extends PDAWordDetector {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.rules.IWordDetector#isWordStart(char)
+ */
+ public boolean isWordStart(char c) {
+ return c == ':';
+ }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.rules.IWordDetector#isWordPart(char)
- */
- public boolean isWordPart(char c) {
- return Character.isLetter(c) || c == '_';
- }
- }
-
- /**
- * Detects PDA branch labels
- */
- class PDALabelDetector extends PDAWordDetector {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.rules.IWordDetector#isWordStart(char)
- */
- public boolean isWordStart(char c) {
- return c == ':';
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.rules.IWordDetector#isWordPart(char)
- */
- public boolean isWordPart(char c) {
- return super.isWordPart(c) || Character.isDigit(c);
- }
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.rules.IWordDetector#isWordPart(char)
+ */
+ public boolean isWordPart(char c) {
+ return super.isWordPart(c) || Character.isDigit(c);
+ }
+ }
- /**
- * Constructs a scanner that identifies PDA keywords.
- */
- public PDAScanner() {
- // keywords
- Token token = new Token(new TextAttribute(PDAUIPlugin.getDefault().getColor(PDAUIPlugin.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(PDAUIPlugin.getDefault().getColor(PDAUIPlugin.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(PDAUIPlugin.getDefault().getColor(PDAUIPlugin.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(PDAUIPlugin.getDefault().getColor(PDAUIPlugin.LABEL)));
+ WordRule labels = new WordRule(new PDALabelDetector(), token);
+ setRules(new IRule[] { keywords, labels });
+ }
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDASourceViewerConfiguration.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDASourceViewerConfiguration.java
index 66fc237fb25..995e82c2ec2 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDASourceViewerConfiguration.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PDASourceViewerConfiguration.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -30,12 +30,12 @@ import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
*/
public class PDASourceViewerConfiguration extends TextSourceViewerConfiguration {
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
- */
- public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
- return new TextHover();
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
+ */
+ public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
+ return new TextHover();
+ }
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAnnotationHover(org.eclipse.jface.text.source.ISourceViewer)
@@ -43,25 +43,24 @@ public class PDASourceViewerConfiguration extends TextSourceViewerConfiguration
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
return new AnnotationHover();
}
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
- */
- 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;
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer)
- */
- public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
- return new PDAContentAssistant();
- }
-
-
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
+ */
+ 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;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer)
+ */
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ return new PDAContentAssistant();
+ }
+
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PopFrameActionDelegate.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PopFrameActionDelegate.java
index ed76a4de938..dec43546770 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PopFrameActionDelegate.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/PopFrameActionDelegate.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -22,9 +22,8 @@ import org.eclipse.ui.IActionDelegate2;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
-
public class PopFrameActionDelegate implements IObjectActionDelegate, IActionDelegate2 {
-
+
//private PDAThread fThread = null;
/* (non-Javadoc)
@@ -37,7 +36,7 @@ public class PopFrameActionDelegate implements IObjectActionDelegate, IActionDel
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run(IAction action) {
- /*
+ /*
try {
fThread.pop();
} catch (DebugException e) {
@@ -48,26 +47,26 @@ public class PopFrameActionDelegate implements IObjectActionDelegate, IActionDel
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
- /* if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- Object element = ss.getFirstElement();
- if (element instanceof PDAStackFrame) {
- PDAStackFrame frame = (PDAStackFrame) element;
- //#ifdef ex5
-//# // TODO: Exercise 5 - enable the action if the frame's thread supports it
- //#else
- fThread = (PDAThread) frame.getThread();
- try {
- action.setEnabled(fThread.canPop() && fThread.getTopStackFrame().equals(frame));
- } catch (DebugException e) {
+ /* if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ Object element = ss.getFirstElement();
+ if (element instanceof PDAStackFrame) {
+ PDAStackFrame frame = (PDAStackFrame) element;
+ //#ifdef ex5
+ //# // TODO: Exercise 5 - enable the action if the frame's thread supports it
+ //#else
+ fThread = (PDAThread) frame.getThread();
+ try {
+ action.setEnabled(fThread.canPop() && fThread.getTopStackFrame().equals(frame));
+ } catch (DebugException e) {
+ }
+ return;
+ //#endif
}
- return;
- //#endif
+
}
-
- }
- action.setEnabled(false);
- */
+ action.setEnabled(false);
+ */
}
/* (non-Javadoc)
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/TextHover.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/TextHover.java
index 9dc7911e4b4..a9ae065aab5 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/TextHover.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/TextHover.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -19,68 +19,67 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.ITextViewer;
-
/**
* Produces debug hover for the PDA debugger.
*/
public class TextHover implements ITextHover {
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
- */
- public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
- /*String varName = null;
- try {
- varName = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
- } catch (BadLocationException e) {
- return null;
- }
- if (varName.startsWith("$") && varName.length() > 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)) {
- return varName + " = " + variable.getValue().getValueString();
- }
- }
- } catch (DebugException e) {
- }
- }*/
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer, int)
- */
- public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
- return WordFinder.findWord(textViewer.getDocument(), offset);
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
+ */
+ public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
+ /*String varName = null;
+ try {
+ varName = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength());
+ } catch (BadLocationException e) {
+ return null;
+ }
+ if (varName.startsWith("$") && varName.length() > 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)) {
+ return varName + " = " + variable.getValue().getValueString();
+ }
+ }
+ } catch (DebugException e) {
+ }
+ }*/
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer, int)
+ */
+ public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
+ return WordFinder.findWord(textViewer.getDocument(), offset);
+ }
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/WordFinder.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/WordFinder.java
index b8037aac5a4..6cbfbc3b55b 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/WordFinder.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/editor/WordFinder.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -15,7 +15,6 @@
*******************************************************************************/
package org.eclipse.cdt.examples.dsf.pda.ui.editor;
-
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
@@ -25,50 +24,49 @@ import org.eclipse.jface.text.Region;
* Looks for an identifier in a source file
*/
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;
- int end= -1;
-
-
+
+ int start = -1;
+ int end = -1;
+
try {
-
- int pos= offset;
+
+ int pos = offset;
char c;
-
+
while (pos >= 0) {
- c= document.getChar(pos);
+ c = document.getChar(pos);
if (!Character.isJavaIdentifierPart(c))
break;
--pos;
}
-
- start= pos;
-
- pos= offset;
- int length= document.getLength();
-
+
+ start = pos;
+
+ pos = offset;
+ int length = document.getLength();
+
while (pos < length) {
- c= document.getChar(pos);
+ c = document.getChar(pos);
if (!Character.isJavaIdentifierPart(c))
break;
++pos;
}
-
- end= pos;
-
+
+ end = pos;
+
} catch (BadLocationException x) {
}
-
+
if (start > -1 && end > -1) {
if (start == offset && end == offset)
return new Region(offset, 0);
@@ -77,7 +75,7 @@ public class WordFinder {
else
return new Region(start + 1, end - start - 1);
}
-
+
return null;
}
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/launcher/PDAMainTab.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/launcher/PDAMainTab.java
index 448dd1791e4..969ec0f793c 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/launcher/PDAMainTab.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/launcher/PDAMainTab.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -15,7 +15,6 @@
*******************************************************************************/
package org.eclipse.cdt.examples.dsf.pda.ui.launcher;
-
import org.eclipse.cdt.examples.dsf.pda.PDAPlugin;
import org.eclipse.cdt.examples.dsf.pda.ui.PDAUIPlugin;
import org.eclipse.core.resources.IFile;
@@ -43,25 +42,24 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ResourceListSelectionDialog;
-
/**
* Tab to specify the PDA program to run/debug.
* <p>
- * This class is identical to the corresponding in PDA debugger implemented in
+ * This class is identical to the corresponding in PDA debugger implemented in
* org.eclipse.debug.examples.ui.
* </p>
*/
public class PDAMainTab extends AbstractLaunchConfigurationTab {
-
+
private Text fProgramText;
private Button fProgramButton;
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
Font font = parent.getFont();
-
+
Composite comp = new Composite(parent, SWT.NONE);
setControl(comp);
GridLayout topLayout = new GridLayout();
@@ -69,15 +67,15 @@ public class PDAMainTab extends AbstractLaunchConfigurationTab {
topLayout.numColumns = 3;
comp.setLayout(topLayout);
comp.setFont(font);
-
+
createVerticalSpacer(comp, 3);
-
+
Label programLabel = new Label(comp, SWT.NONE);
programLabel.setText("&Program:");
GridData gd = new GridData(GridData.BEGINNING);
programLabel.setLayoutData(gd);
programLabel.setFont(font);
-
+
fProgramText = new Text(comp, SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
fProgramText.setLayoutData(gd);
@@ -87,7 +85,7 @@ public class PDAMainTab extends AbstractLaunchConfigurationTab {
updateLaunchConfigurationDialog();
}
});
-
+
fProgramButton = createPushButton(comp, "&Browse...", null); //$NON-NLS-1$
fProgramButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -95,12 +93,13 @@ public class PDAMainTab extends AbstractLaunchConfigurationTab {
}
});
}
-
+
/**
- * Open a resource chooser to select a PDA program
+ * Open a resource chooser to select a PDA program
*/
protected void browsePDAFiles() {
- ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE);
+ ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(),
+ ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE);
dialog.setTitle("PDA Program");
dialog.setMessage("Select PDA Program");
if (dialog.open() == Window.OK) {
@@ -108,27 +107,29 @@ public class PDAMainTab extends AbstractLaunchConfigurationTab {
IFile file = (IFile) files[0];
fProgramText.setText(file.getFullPath().toString());
}
-
+
}
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
}
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
*/
public void initializeFrom(ILaunchConfiguration configuration) {
//#ifdef ex1
-//# // TODO: Exercise 1 - retrieve the program path attribute from the launch configuration
-//# String program = null;
-//# if (program != null) {
-//# fProgramText.setText(program);
-//# }
+ //# // TODO: Exercise 1 - retrieve the program path attribute from the launch configuration
+ //# String program = null;
+ //# if (program != null) {
+ //# fProgramText.setText(program);
+ //# }
//#else
try {
String program = null;
- program = configuration.getAttribute(PDAPlugin.ATTR_PDA_PROGRAM, (String)null);
+ program = configuration.getAttribute(PDAPlugin.ATTR_PDA_PROGRAM, (String) null);
if (program != null) {
fProgramText.setText(program);
}
@@ -137,6 +138,7 @@ public class PDAMainTab extends AbstractLaunchConfigurationTab {
}
//#endif
}
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
@@ -146,20 +148,20 @@ public class PDAMainTab extends AbstractLaunchConfigurationTab {
program = null;
}
//#ifdef ex1
-//# // TODO: Exercise 1 - update the launch configuration with the path to
-//# // currently specified program
+ //# // TODO: Exercise 1 - update the launch configuration with the path to
+ //# // currently specified program
//#else
configuration.setAttribute(PDAPlugin.ATTR_PDA_PROGRAM, program);
//#endif
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
*/
public String getName() {
return "Main";
}
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
*/
@@ -168,8 +170,8 @@ public class PDAMainTab extends AbstractLaunchConfigurationTab {
setMessage(null);
String text = fProgramText.getText();
//#ifdef ex1
-//# // TODO: Exercise 1 - validate the currently specified program exists and is not
-//# // empty, providing the user with feedback.
+ //# // TODO: Exercise 1 - validate the currently specified program exists and is not
+ //# // empty, providing the user with feedback.
//#else
if (text.length() > 0) {
IPath path = new Path(text);
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/launcher/PDATabGroup.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/launcher/PDATabGroup.java
index 612eaafe4e8..cce0d095b13 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/launcher/PDATabGroup.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/launcher/PDATabGroup.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
@@ -24,7 +24,7 @@ import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
/**
* Tab group for a PDA application
* <p>
- * This class is identical to the corresponding in PDA debugger implemented in
+ * This class is identical to the corresponding in PDA debugger implemented in
* org.eclipse.debug.examples.ui.
* </p>
*/
@@ -34,14 +34,10 @@ public class PDATabGroup extends AbstractLaunchConfigurationTabGroup {
*/
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
//#ifdef ex1
-//# // TODO: Exercise 1 - add the PDA main tab, source lookup tab and common
-//# // tab to the tab group
+ //# // TODO: Exercise 1 - add the PDA main tab, source lookup tab and common
+ //# // tab to the tab group
//#else
- setTabs(new ILaunchConfigurationTab[] {
- new PDAMainTab(),
- new SourceLookupTab(),
- new CommonTab()
- });
+ setTabs(new ILaunchConfigurationTab[] { new PDAMainTab(), new SourceLookupTab(), new CommonTab() });
//#endif
}
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/PDAExpressionVMProvider.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/PDAExpressionVMProvider.java
index 0332909da55..f1c66d0a546 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/PDAExpressionVMProvider.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/PDAExpressionVMProvider.java
@@ -38,7 +38,7 @@ import org.eclipse.jface.viewers.TreePath;
public class PDAExpressionVMProvider extends ExpressionVMProvider implements IElementFormatProvider {
static String myPersistId = "org.eclipse.cdt.examples.dsf.pda.ui.variablePersistable";
-
+
public PDAExpressionVMProvider(AbstractVMAdapter adapter, IPresentationContext context, DsfSession session) {
super(adapter, context, session);
}
@@ -52,10 +52,11 @@ public class PDAExpressionVMProvider extends ExpressionVMProvider implements IEl
rm.done();
return;
}
- SimpleMapPersistable<String> persistable = (SimpleMapPersistable<String>) p;
+ SimpleMapPersistable<String> persistable = (SimpleMapPersistable<String>) p;
Object x = elementPath.getLastSegment();
if (x instanceof VariableVMNode.VariableExpressionVMC) {
- IExpressionDMContext ctx = DMContexts.getAncestorOfType(((VariableVMNode.VariableExpressionVMC) x).getDMContext(), IExpressionDMContext.class);
+ IExpressionDMContext ctx = DMContexts.getAncestorOfType(
+ ((VariableVMNode.VariableExpressionVMC) x).getDMContext(), IExpressionDMContext.class);
if (ctx == null) {
rm.setData(null);
} else {
@@ -82,11 +83,12 @@ public class PDAExpressionVMProvider extends ExpressionVMProvider implements IEl
}
@SuppressWarnings("unchecked")
- public void setActiveFormat(IPresentationContext context, IVMNode[] node, Object viewerInput, TreePath[] elementPath, String format) {
+ public void setActiveFormat(IPresentationContext context, IVMNode[] node, Object viewerInput,
+ TreePath[] elementPath, String format) {
Object p = context.getProperty(myPersistId);
SimpleMapPersistable<String> persistable = null;
if (p instanceof SimpleMapPersistable) {
- persistable = (SimpleMapPersistable<String>) p;
+ persistable = (SimpleMapPersistable<String>) p;
} else {
persistable = new SimpleMapPersistable<String>(String.class);
context.setProperty(myPersistId, persistable);
@@ -95,7 +97,8 @@ public class PDAExpressionVMProvider extends ExpressionVMProvider implements IEl
for (int i = 0; i < elementPath.length; i++) {
Object x = elementPath[i].getLastSegment();
if (x instanceof VariableVMNode.VariableExpressionVMC) {
- IExpressionDMContext ctx = DMContexts.getAncestorOfType(((VariableVMNode.VariableExpressionVMC) x).getDMContext(), IExpressionDMContext.class);
+ IExpressionDMContext ctx = DMContexts.getAncestorOfType(
+ ((VariableVMNode.VariableExpressionVMC) x).getDMContext(), IExpressionDMContext.class);
if (ctx == null)
continue;
persistable.setValue(ctx.getExpression(), format);
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/PDAVMAdapter.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/PDAVMAdapter.java
index 480af3c2ea0..7a2bfaa70e0 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/PDAVMAdapter.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/PDAVMAdapter.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Winnie Lai (Texas Instruments) - Individual Element Number Format example (Bug 202556)
@@ -29,30 +29,29 @@ import org.eclipse.debug.ui.IDebugUIConstants;
@ThreadSafe
@SuppressWarnings("restriction")
-public class PDAVMAdapter extends AbstractDebugVMAdapter
-{
- public PDAVMAdapter(DsfSession session, SteppingController controller) {
- super(session, controller);
- getSession().registerModelAdapter(IColumnPresentationFactory.class, this);
- }
+public class PDAVMAdapter extends AbstractDebugVMAdapter {
+ public PDAVMAdapter(DsfSession session, SteppingController controller) {
+ super(session, controller);
+ getSession().registerModelAdapter(IColumnPresentationFactory.class, this);
+ }
+
+ @Override
+ public void dispose() {
+ getSession().unregisterModelAdapter(IColumnPresentationFactory.class);
+ super.dispose();
+ }
- @Override
- public void dispose() {
- getSession().unregisterModelAdapter(IColumnPresentationFactory.class);
- super.dispose();
- }
-
- @Override
- protected AbstractDMVMProvider createViewModelProvider(IPresentationContext context) {
- if ( IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId()) ) {
- return new PDALaunchVMProvider(this, context, getSession());
- } else if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) ) {
- return new VariableVMProvider(this, context, getSession());
- } else if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(context.getId()) ) {
- return new PDAExpressionVMProvider(this, context, getSession());
- } else if (IDebugUIConstants.ID_REGISTER_VIEW.equals(context.getId()) ) {
- return new RegisterVMProvider(this, context, getSession());
- }
- return null;
- }
+ @Override
+ protected AbstractDMVMProvider createViewModelProvider(IPresentationContext context) {
+ if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) {
+ return new PDALaunchVMProvider(this, context, getSession());
+ } else if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId())) {
+ return new VariableVMProvider(this, context, getSession());
+ } else if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(context.getId())) {
+ return new PDAExpressionVMProvider(this, context, getSession());
+ } else if (IDebugUIConstants.ID_REGISTER_VIEW.equals(context.getId())) {
+ return new RegisterVMProvider(this, context, getSession());
+ }
+ return null;
+ }
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDALaunchVMProvider.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDALaunchVMProvider.java
index 39d0d4ad1c2..4a7d3450f08 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDALaunchVMProvider.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDALaunchVMProvider.java
@@ -7,10 +7,10 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
- * Ericsson - Modified for new functionality
+ * Ericsson - Modified for new functionality
*******************************************************************************/
package org.eclipse.cdt.examples.dsf.pda.ui.viewmodel.launch;
@@ -27,42 +27,40 @@ import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.ILaunchesListener2;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
-
/**
- * View Model provider for the Launch (AKA Debug) view. The launch VM
+ * View Model provider for the Launch (AKA Debug) view. The launch VM
* provider is configured with three nodes:
* <ul>
- * <li> LaunchRootVMNode - This is the root of the PDA view model.</li>
+ * <li> LaunchRootVMNode - This is the root of the PDA view model.</li>
* <li> PDAVirtualMachineVMNode - Supplies the element representing PDA VM</li>
* <li> PDAThreadsVMNode - Supplies the PDA thread elements</li>
- * <li> StackFramesVMNode - Supplies the stack frame elements.</li>
- * <li> StandardProcessVMNode - Supplies elements representing the PDA
+ * <li> StackFramesVMNode - Supplies the stack frame elements.</li>
+ * <li> StandardProcessVMNode - Supplies elements representing the PDA
* debugger process.</li>
- * </ul>
+ * </ul>
*/
@SuppressWarnings("restriction")
-public class PDALaunchVMProvider extends AbstractLaunchVMProvider
- implements IDebugEventSetListener, ILaunchesListener2
-{
- @ThreadSafe
- public PDALaunchVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session)
- {
- super(adapter, presentationContext, session);
-
- IRootVMNode launchNode = new LaunchRootVMNode(this);
- setRootNode(launchNode);
+public class PDALaunchVMProvider extends AbstractLaunchVMProvider
+ implements IDebugEventSetListener, ILaunchesListener2 {
+ @ThreadSafe
+ public PDALaunchVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext,
+ DsfSession session) {
+ super(adapter, presentationContext, session);
+
+ IRootVMNode launchNode = new LaunchRootVMNode(this);
+ setRootNode(launchNode);
+
+ // Launch node is a parent to the processes and program nodes.
+ IVMNode pdaVirtualMachineNode = new PDAVirtualMachineVMNode(this, getSession());
+ IVMNode processesNode = new StandardProcessVMNode(this);
+ addChildNodes(launchNode, new IVMNode[] { pdaVirtualMachineNode, processesNode });
+
+ // Virtual machine node is under the PDA threads node.
+ IVMNode threadsNode = new PDAThreadsVMNode(this, getSession());
+ addChildNodes(pdaVirtualMachineNode, new IVMNode[] { threadsNode });
- // Launch node is a parent to the processes and program nodes.
- IVMNode pdaVirtualMachineNode = new PDAVirtualMachineVMNode(this, getSession());
- IVMNode processesNode = new StandardProcessVMNode(this);
- addChildNodes(launchNode, new IVMNode[] { pdaVirtualMachineNode, processesNode});
-
- // Virtual machine node is under the PDA threads node.
- IVMNode threadsNode = new PDAThreadsVMNode(this, getSession());
- addChildNodes(pdaVirtualMachineNode, new IVMNode[] { threadsNode });
-
- // Stack frames node is under the PDA threads node.
- IVMNode stackFramesNode = new StackFramesVMNode(this, getSession());
- addChildNodes(threadsNode, new IVMNode[] { stackFramesNode });
- }
+ // Stack frames node is under the PDA threads node.
+ IVMNode stackFramesNode = new StackFramesVMNode(this, getSession());
+ addChildNodes(threadsNode, new IVMNode[] { stackFramesNode });
+ }
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAThreadsVMNode.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAThreadsVMNode.java
index 3ffe3092093..975ddb212b3 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAThreadsVMNode.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAThreadsVMNode.java
@@ -7,10 +7,10 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
- * Ericsson - Modified for multi threaded functionality
+ * Ericsson - Modified for multi threaded functionality
*******************************************************************************/
package org.eclipse.cdt.examples.dsf.pda.ui.viewmodel.launch;
@@ -32,81 +32,81 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoPr
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest;
import org.eclipse.ui.IMemento;
-
/**
- * View model node supplying the PDA thread elements. It extends
+ * View model node supplying the PDA thread elements. It extends
* the base threads node and adds label and memento generation.
*/
@SuppressWarnings("restriction")
-public class PDAThreadsVMNode extends AbstractThreadVMNode
- implements IElementLabelProvider, IElementMementoProvider
-{
- public PDAThreadsVMNode(AbstractDMVMProvider provider, DsfSession session) {
- super(provider, session);
- }
+public class PDAThreadsVMNode extends AbstractThreadVMNode implements IElementLabelProvider, IElementMementoProvider {
+ public PDAThreadsVMNode(AbstractDMVMProvider provider, DsfSession session) {
+ super(provider, session);
+ }
+
+ @Override
+ public String toString() {
+ return "PDAThreadVMNode(" + getSession().getId() + ")";
+ }
- @Override
- public String toString() {
- return "PDAThreadVMNode(" + getSession().getId() + ")";
- }
-
- @Override
- protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- final PDAThreadDMContext dmc = findDmcInPath(updates[i].getViewerInput(), updates[i].getElementPath(), PDAThreadDMContext.class);
- if (dmc != null) {
- updates[i].setProperty(ILaunchVMConstants.PROP_ID, Integer.toString(dmc.getID()));
- } else {
- updates[i].setStatus(new Status(IStatus.ERROR, PDAUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$
- }
- }
- super.updatePropertiesInSessionThread(updates);
- }
+ @Override
+ protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
+ for (int i = 0; i < updates.length; i++) {
+ final PDAThreadDMContext dmc = findDmcInPath(updates[i].getViewerInput(), updates[i].getElementPath(),
+ PDAThreadDMContext.class);
+ if (dmc != null) {
+ updates[i].setProperty(ILaunchVMConstants.PROP_ID, Integer.toString(dmc.getID()));
+ } else {
+ updates[i].setStatus(new Status(IStatus.ERROR, PDAUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$
+ }
+ }
+ super.updatePropertiesInSessionThread(updates);
+ }
private String produceThreadElementName(String viewName, PDAThreadDMContext execCtx) {
- return "Thread." + execCtx.getID();
- }
+ return "Thread." + execCtx.getID();
+ }
+
+ private static final String MEMENTO_NAME = "THREAD_MEMENTO_NAME";
+
+ /*
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider#compareElements(org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest[])
+ */
+ public void compareElements(IElementCompareRequest[] requests) {
+ for (IElementCompareRequest request : requests) {
+ Object element = request.getElement();
+ IMemento memento = request.getMemento();
+ String mementoName = memento.getString(MEMENTO_NAME);
+ if (mementoName != null) {
+ if (element instanceof IDMVMContext) {
+ IDMContext dmc = ((IDMVMContext) element).getDMContext();
+ if (dmc instanceof PDAThreadDMContext) {
+ String elementName = produceThreadElementName(request.getPresentationContext().getId(),
+ (PDAThreadDMContext) dmc);
+ request.setEqual(elementName.equals(mementoName));
+ }
+ }
+ }
+ request.done();
+ }
+ }
- private static final String MEMENTO_NAME = "THREAD_MEMENTO_NAME";
-
- /*
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider#compareElements(org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest[])
- */
- public void compareElements(IElementCompareRequest[] requests) {
- for ( IElementCompareRequest request : requests ) {
- Object element = request.getElement();
- IMemento memento = request.getMemento();
- String mementoName = memento.getString(MEMENTO_NAME);
- if (mementoName != null) {
- if (element instanceof IDMVMContext) {
- IDMContext dmc = ((IDMVMContext)element).getDMContext();
- if ( dmc instanceof PDAThreadDMContext) {
- String elementName = produceThreadElementName(
- request.getPresentationContext().getId(), (PDAThreadDMContext) dmc );
- request.setEqual( elementName.equals( mementoName ) );
- }
- }
- }
- request.done();
- }
- }
-
- /*
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider#encodeElements(org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest[])
- */
- public void encodeElements(IElementMementoRequest[] requests) {
- for ( IElementMementoRequest request : requests ) {
- Object element = request.getElement();
- IMemento memento = request.getMemento();
- if (element instanceof IDMVMContext) {
- IDMContext dmc = ((IDMVMContext)element).getDMContext();
- if ( dmc instanceof PDAThreadDMContext) {
- String elementName = produceThreadElementName( request.getPresentationContext().getId(), (PDAThreadDMContext) dmc );
- memento.putString(MEMENTO_NAME, elementName);
- }
- }
- request.done();
- }
- }
+ /*
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider#encodeElements(org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest[])
+ */
+ public void encodeElements(IElementMementoRequest[] requests) {
+ for (IElementMementoRequest request : requests) {
+ Object element = request.getElement();
+ IMemento memento = request.getMemento();
+ if (element instanceof IDMVMContext) {
+ IDMContext dmc = ((IDMVMContext) element).getDMContext();
+ if (dmc instanceof PDAThreadDMContext) {
+ String elementName = produceThreadElementName(request.getPresentationContext().getId(),
+ (PDAThreadDMContext) dmc);
+ memento.putString(MEMENTO_NAME, elementName);
+ }
+ }
+ request.done();
+ }
+ }
}
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAVirtualMachineVMNode.java b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAVirtualMachineVMNode.java
index 5e12f3684a0..e56e163d47e 100644
--- a/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAVirtualMachineVMNode.java
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda.ui/src/org/eclipse/cdt/examples/dsf/pda/ui/viewmodel/launch/PDAVirtualMachineVMNode.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - Initial API and implementation
* Wind River Systems - Factored out AbstractContainerVMNode
@@ -15,7 +15,6 @@
package org.eclipse.cdt.examples.dsf.pda.ui.viewmodel.launch;
-
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.AbstractContainerVMNode;
@@ -35,107 +34,106 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoPr
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest;
import org.eclipse.ui.IMemento;
-
/**
* View Model node representing a PDA virtual machine. It extends
- * the base container node and adds label and memento generation.
+ * the base container node and adds label and memento generation.
*/
@SuppressWarnings("restriction")
-public class PDAVirtualMachineVMNode extends AbstractContainerVMNode
- implements IElementMementoProvider
-{
+public class PDAVirtualMachineVMNode extends AbstractContainerVMNode implements IElementMementoProvider {
public PDAVirtualMachineVMNode(AbstractDMVMProvider provider, DsfSession session) {
- super(provider, session);
+ super(provider, session);
}
@Override
- public String toString() {
- return "PDAContainerVMNode(" + getSession().getId() + ")";
- }
-
+ public String toString() {
+ return "PDAContainerVMNode(" + getSession().getId() + ")";
+ }
@Override
protected void updateElementsInSessionThread(IChildrenUpdate update) {
- // Get the instance of the service. Note that there is no race condition
- // in getting the service since this method is called only in the
- // service executor thread.
- final PDACommandControl commandControl = getServicesTracker().getService(PDACommandControl.class);
-
- // Check if the service is available. If it is not, no elements are
- // updated.
- if (commandControl == null) {
- handleFailedUpdate(update);
- return;
- }
-
- update.setChild(createVMContext(commandControl.getContext()), 0);
- update.done();
+ // Get the instance of the service. Note that there is no race condition
+ // in getting the service since this method is called only in the
+ // service executor thread.
+ final PDACommandControl commandControl = getServicesTracker().getService(PDACommandControl.class);
+
+ // Check if the service is available. If it is not, no elements are
+ // updated.
+ if (commandControl == null) {
+ handleFailedUpdate(update);
+ return;
+ }
+
+ update.setChild(createVMContext(commandControl.getContext()), 0);
+ update.done();
+ }
+
+ @Override
+ protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
+ for (int i = 0; i < updates.length; i++) {
+ // Find the PDA program context.
+ final PDAVirtualMachineDMContext dmc = findDmcInPath(updates[i].getViewerInput(),
+ updates[i].getElementPath(), PDAVirtualMachineDMContext.class);
+ if (dmc != null) {
+ updates[i].setProperty(PROP_NAME, "PDA");
+ updates[i].setProperty(ILaunchVMConstants.PROP_ID, dmc.getProgram());
+ } else {
+ updates[i].setStatus(new Status(IStatus.ERROR, PDAUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$
+ }
+ }
+ super.updatePropertiesInSessionThread(updates);
+ }
+
+ private String produceProgramElementName(String viewName, PDAVirtualMachineDMContext execCtx) {
+ return "PDA." + execCtx.getProgram(); //$NON-NLS-1$
+ }
+
+ private final String MEMENTO_NAME = "PDAPROGRAM_MEMENTO_NAME"; //$NON-NLS-1$
+
+ public void compareElements(IElementCompareRequest[] requests) {
+
+ for (IElementCompareRequest request : requests) {
+
+ Object element = request.getElement();
+ IMemento memento = request.getMemento();
+ String mementoName = memento.getString(MEMENTO_NAME);
+
+ if (mementoName != null) {
+ if (element instanceof IDMVMContext) {
+
+ IDMContext dmc = ((IDMVMContext) element).getDMContext();
+
+ if (dmc instanceof PDAVirtualMachineDMContext) {
+
+ String elementName = produceProgramElementName(request.getPresentationContext().getId(),
+ (PDAVirtualMachineDMContext) dmc);
+ request.setEqual(elementName.equals(mementoName));
+ }
+ }
+ }
+ request.done();
+ }
}
- @Override
- protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- // Find the PDA program context.
- final PDAVirtualMachineDMContext dmc =
- findDmcInPath(updates[i].getViewerInput(), updates[i].getElementPath(), PDAVirtualMachineDMContext.class);
- if (dmc != null) {
- updates[i].setProperty(PROP_NAME, "PDA");
- updates[i].setProperty(ILaunchVMConstants.PROP_ID, dmc.getProgram());
- } else {
- updates[i].setStatus(new Status(IStatus.ERROR, PDAUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, "Invalid context", null)); //$NON-NLS-1$
- }
- }
- super.updatePropertiesInSessionThread(updates);
- }
-
- private String produceProgramElementName( String viewName , PDAVirtualMachineDMContext execCtx ) {
- return "PDA." + execCtx.getProgram(); //$NON-NLS-1$
- }
-
- private final String MEMENTO_NAME = "PDAPROGRAM_MEMENTO_NAME"; //$NON-NLS-1$
-
- public void compareElements(IElementCompareRequest[] requests) {
-
- for ( IElementCompareRequest request : requests ) {
-
- Object element = request.getElement();
- IMemento memento = request.getMemento();
- String mementoName = memento.getString(MEMENTO_NAME);
-
- if (mementoName != null) {
- if (element instanceof IDMVMContext) {
-
- IDMContext dmc = ((IDMVMContext)element).getDMContext();
-
- if ( dmc instanceof PDAVirtualMachineDMContext) {
-
- String elementName = produceProgramElementName( request.getPresentationContext().getId(), (PDAVirtualMachineDMContext) dmc );
- request.setEqual( elementName.equals( mementoName ) );
- }
- }
- }
- request.done();
- }
- }
-
- public void encodeElements(IElementMementoRequest[] requests) {
-
- for ( IElementMementoRequest request : requests ) {
-
- Object element = request.getElement();
- IMemento memento = request.getMemento();
-
- if (element instanceof IDMVMContext) {
-
- IDMContext dmc = ((IDMVMContext)element).getDMContext();
-
- if ( dmc instanceof PDAVirtualMachineDMContext) {
-
- String elementName = produceProgramElementName( request.getPresentationContext().getId(), (PDAVirtualMachineDMContext) dmc );
- memento.putString(MEMENTO_NAME, elementName);
- }
- }
- request.done();
- }
- }
+ public void encodeElements(IElementMementoRequest[] requests) {
+
+ for (IElementMementoRequest request : requests) {
+
+ Object element = request.getElement();
+ IMemento memento = request.getMemento();
+
+ if (element instanceof IDMVMContext) {
+
+ IDMContext dmc = ((IDMVMContext) element).getDMContext();
+
+ if (dmc instanceof PDAVirtualMachineDMContext) {
+
+ String elementName = produceProgramElementName(request.getPresentationContext().getId(),
+ (PDAVirtualMachineDMContext) dmc);
+ memento.putString(MEMENTO_NAME, elementName);
+ }
+ }
+ request.done();
+ }
+ }
}

Back to the top