Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2009-09-11 18:54:31 +0000
committerPawel Piech2009-09-11 18:54:31 +0000
commitc4038c98424e7972ac934c397f48eabf6f9222d6 (patch)
tree8e0ca2c7e562dfba64f66e49a471bd3ef98aa993 /org.eclipse.debug.examples.ui
parentb4a5f63c927fcca911789d0a42a6695eb017a5fd (diff)
downloadeclipse.platform.debug-c4038c98424e7972ac934c397f48eabf6f9222d6.tar.gz
eclipse.platform.debug-c4038c98424e7972ac934c397f48eabf6f9222d6.tar.xz
eclipse.platform.debug-c4038c98424e7972ac934c397f48eabf6f9222d6.zip
Bug 286256 - Request to move Restart icon to core debug framework
Diffstat (limited to 'org.eclipse.debug.examples.ui')
-rw-r--r--org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.debug.examples.ui/plugin.xml8
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java40
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java54
4 files changed, 103 insertions, 1 deletions
diff --git a/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF
index 2b5754ac0..25f04b1e7 100644
--- a/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Example Debug UI Plug-in
Bundle-SymbolicName: org.eclipse.debug.examples.ui;singleton:=true
-Bundle-Version: 1.1.0
+Bundle-Version: 1.2.0
Bundle-Activator: org.eclipse.debug.examples.ui.pda.DebugUIPlugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
diff --git a/org.eclipse.debug.examples.ui/plugin.xml b/org.eclipse.debug.examples.ui/plugin.xml
index 55d4a1bdf..8a98ff28e 100644
--- a/org.eclipse.debug.examples.ui/plugin.xml
+++ b/org.eclipse.debug.examples.ui/plugin.xml
@@ -204,6 +204,14 @@
<adapter type="org.eclipse.debug.ui.actions.IRunToLineTarget"/>
<!--#endif -->
</factory>
+ <factory
+ adaptableType="org.eclipse.debug.examples.core.pda.model.PDADebugElement"
+ class="org.eclipse.debug.examples.ui.pda.adapters.CommandAdapterFactory">
+ <adapter
+ type="org.eclipse.debug.core.commands.IRestartHandler">
+ </adapter>
+ </factory>
+-->
<!-- FLEXIBLE HIERARCHY EXAMPLE
<factory
adaptableType="org.eclipse.debug.examples.core.pda.model.PDADebugTarget"
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java
new file mode 100644
index 000000000..3375fb088
--- /dev/null
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Wind River Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.ui.pda.adapters;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.core.commands.IRestartHandler;
+import org.eclipse.debug.examples.core.pda.model.PDADebugTarget;
+
+/**
+ * Adapter factory that provides debug command handler adapters for the
+ * PDA debugger.
+ *
+ * @since 3.6
+ */
+public class CommandAdapterFactory implements IAdapterFactory {
+
+ private static IRestartHandler fgRestartHandler = new PDARestartDebugCommand();
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (IRestartHandler.class.equals(adapterType)) {
+ if (adaptableObject instanceof PDADebugTarget) {
+ return fgRestartHandler;
+ }
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return new Class[]{IRestartHandler.class};
+ }
+
+}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java
new file mode 100644
index 000000000..7bb788b24
--- /dev/null
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Wind River Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.ui.pda.adapters;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.IRequest;
+import org.eclipse.debug.core.commands.AbstractDebugCommand;
+import org.eclipse.debug.core.commands.IEnabledStateRequest;
+import org.eclipse.debug.core.commands.IRestartHandler;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.examples.core.pda.model.PDADebugTarget;
+
+/**
+ * Restart debug command handler. It restarts the current debug session.
+ */
+public class PDARestartDebugCommand extends AbstractDebugCommand implements IRestartHandler {
+
+ protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
+ for (int i = 0; i < targets.length; i++) {
+ ((PDADebugTarget)targets[i]).restart();
+ monitor.worked(1);
+ }
+ }
+
+ protected Object getTarget(Object element) {
+ IDebugTarget target = (IDebugTarget)getAdapter(element, IDebugTarget.class);
+ if (target instanceof PDADebugTarget) {
+ return target;
+ }
+ return null;
+ }
+
+ protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
+ throws CoreException
+ {
+ for (int i = 0; i < targets.length; i++) {
+ if (((PDADebugTarget)targets[i]).isTerminated()) {
+ return false;
+ }
+ monitor.worked(1);
+ }
+ return true;
+ }
+
+}

Back to the top