Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Swanson2001-06-01 14:40:46 +0000
committerDarin Swanson2001-06-01 14:40:46 +0000
commitae229faac55f760112bf48ccf302cf578f899698 (patch)
treec549d548ca9da03afa4ca07b4c47bc2ceef14000
parent0273d19b5155b2ec5b59fc47b69392750a7bcfef (diff)
downloadeclipse.platform.debug-ae229faac55f760112bf48ccf302cf578f899698.tar.gz
eclipse.platform.debug-ae229faac55f760112bf48ccf302cf578f899698.tar.xz
eclipse.platform.debug-ae229faac55f760112bf48ccf302cf578f899698.zip
1GEMBB2v0_117
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlActionDelegate.java40
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java1
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAndRemoveActionDelegate.java1
5 files changed, 35 insertions, 13 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlAction.java
index 7b381f95a..7f6ae62e5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlAction.java
@@ -40,7 +40,6 @@ public class ControlAction extends SelectionProviderAction {
* The actual work is deferred to the delegate.
*/
public void run() {
- fDelegate.selectionChanged(this, getStructuredSelection());
fDelegate.run();
}
@@ -49,8 +48,7 @@ public class ControlAction extends SelectionProviderAction {
* Updates the enable state based on what and how much is selected.
*/
public void selectionChanged(IStructuredSelection sel) {
- setEnabled(fDelegate.getEnableStateForSelection(sel));
+ fDelegate.selectionChanged(this, sel);
}
-
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlActionDelegate.java
index 548cac598..ab5b77d5a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlActionDelegate.java
@@ -5,14 +5,14 @@ package org.eclipse.debug.internal.ui;
* All Rights Reserved.
*/
-import java.util.Iterator; import org.eclipse.core.runtime.MultiStatus; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.IDebugStatusConstants; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import java.util.Iterator; import org.eclipse.core.runtime.MultiStatus; import org.eclipse.debug.core.*; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.*; import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; import org.eclipse.ui.actions.SelectionProviderAction;
public abstract class ControlActionDelegate implements IWorkbenchWindowActionDelegate {
protected static final String ERROR= "error.";
protected static final String STATUS= "status";
-
- protected IStructuredSelection fStructuredSelection;
+
+ protected String fMode= ILaunchManager.DEBUG_MODE;
/**
* It's crucial that delegate actions have a zero-arg constructor so that
@@ -28,14 +28,26 @@ public abstract class ControlActionDelegate implements IWorkbenchWindowActionDel
* that do have a ControlAction owner, this is the place to do any
* action specific initialization.
*/
- public void initializeForOwner(ControlAction controlAction) {
+ public void initializeForOwner(ControlAction controlAction) {
+ LaunchesViewer provider= (LaunchesViewer)controlAction.getSelectionProvider();
+ IContentProvider contentProvider= provider.getContentProvider();
+ fMode= ILaunchManager.DEBUG_MODE;
+ if (contentProvider instanceof ProcessesContentProvider) {
+ fMode= ILaunchManager.RUN_MODE;
+ }
}
/**
* Do the specific action using the current selection.
*/
public void run() {
- final Iterator enum= fStructuredSelection.iterator();
+ LaunchesView view= getLaunchesView(fMode);
+ if (view == null) {
+ return;
+ }
+ IStructuredSelection selection= (IStructuredSelection)view.getSite().getSelectionProvider().getSelection();
+
+ final Iterator enum= selection.iterator();
String pluginId= DebugUIPlugin.getDefault().getDescriptor().getUniqueIdentifier();
final MultiStatus ms=
new MultiStatus(pluginId, IDebugStatusConstants.REQUEST_FAILED, DebugUIUtils.getResourceString(getPrefix() + STATUS), null);
@@ -78,13 +90,16 @@ public abstract class ControlActionDelegate implements IWorkbenchWindowActionDel
}
/**
+ * Only interested in selection changes in the launches view
* @see IActionDelegate
*/
- public void selectionChanged(IAction action, ISelection selection){
- if (selection instanceof IStructuredSelection) {
- fStructuredSelection= (IStructuredSelection)selection;
- action.setEnabled(getEnableStateForSelection(fStructuredSelection));
+ public void selectionChanged(IAction action, ISelection s) {
+ LaunchesView view= getLaunchesView(fMode);
+ if (view == null) {
+ return;
}
+ IStructuredSelection selection= (IStructuredSelection)view.getSite().getSelectionProvider().getSelection();
+ action.setEnabled(getEnableStateForSelection(selection));
}
/**
@@ -116,6 +131,13 @@ public abstract class ControlActionDelegate implements IWorkbenchWindowActionDel
protected boolean enableForMultiSelection() {
return true;
}
+
+ protected LaunchesView getLaunchesView(String mode) {
+ IWorkbenchWindow window= DebugUIPlugin.getActiveWorkbenchWindow();
+ return
+ DebugUIPlugin.getDefault().findDebugPart(window, mode);
+
+ }
/**
* Does the specific action of this action to the process.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java
index 057ee3c73..94629c76a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java
@@ -23,6 +23,7 @@ public class CopyToClipboardActionDelegate extends ControlActionDelegate {
public void initializeForOwner(ControlAction controlAction) {
controlAction.setEnabled(!controlAction.getStructuredSelection().isEmpty());
fViewer = (ContentViewer)controlAction.getSelectionProvider();
+ super.initializeForOwner(controlAction);
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
index d3dc8bd67..5f0e4c9a4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
@@ -339,7 +339,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ISelectionChanged
}
/**
- * Returns a <code>true</code> if the specified window contains a debugger part for the
+ * Returns a launches view if the specified window contains the debugger part for the
* specified debug mode.
*/
protected LaunchesView findDebugPart(IWorkbenchWindow window, String mode) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAndRemoveActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAndRemoveActionDelegate.java
index d7fc897d8..c6bbe680b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAndRemoveActionDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAndRemoveActionDelegate.java
@@ -18,6 +18,7 @@ public class TerminateAndRemoveActionDelegate extends ControlActionDelegate {
* @see ControlActionDelegate
*/
public void initializeForOwner(ControlAction controlAction) {
+ super.initializeForOwner(controlAction);
controlAction.setEnabled(!controlAction.getStructuredSelection().isEmpty());
}

Back to the top