Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2001-05-18 10:25:56 +0000
committerDarin Wright2001-05-18 10:25:56 +0000
commit3e4fc4400f54e51207e1b92bdc1232e6e68d5e88 (patch)
tree3a47ad5727e750d31a2d475c6abb70e016394dfb /org.eclipse.debug.ui/ui/org/eclipse/debug
downloadeclipse.platform.debug-3e4fc4400f54e51207e1b92bdc1232e6e68d5e88.tar.gz
eclipse.platform.debug-3e4fc4400f54e51207e1b92bdc1232e6e68d5e88.tar.xz
eclipse.platform.debug-3e4fc4400f54e51207e1b92bdc1232e6e68d5e88.zip
*** empty log message ***
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugView.java160
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AddToInspectorAction.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BasicContentProvider.java90
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java92
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsView.java254
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ChangeVariableValueAction.java199
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ClearOutputAction.java32
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ColorManager.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleDocument.java433
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleGotoLineAction.java104
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleOutputTextStore.java63
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsolePreferencePage.java76
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleView.java210
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleViewer.java168
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleViewerAction.java48
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlAction.java56
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlActionDelegate.java145
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java89
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugAction.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugContentProvider.java267
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugDropDownAction.java32
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugMenuManager.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPerspective.java59
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java216
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPreferencePage.java53
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java1111
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIResources.properties252
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIUtils.java74
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugView.java506
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java460
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DisconnectActionDelegate.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/EnableDisableBreakpointAction.java125
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ExecutionAction.java261
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugPreferenceConstants.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java51
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectItem.java41
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorAction.java56
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorContentProvider.java234
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorList.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorView.java159
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorViewAddToInspectorAction.java64
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchDropDownAction.java98
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchSelectionAction.java71
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWithAction.java132
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizard.java217
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardDialog.java55
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardNode.java104
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardProjectSelectionPage.java290
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardSelectionPage.java232
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LauncherPropertyPage.java250
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchesView.java219
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchesViewer.java87
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchesViewerFilter.java66
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java159
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/OpenBreakpointMarkerAction.java55
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/OpenMarkerAction.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ProcessesContentProvider.java61
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RelaunchActionDelegate.java65
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RelaunchHistoryLaunchAction.java53
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RelaunchLastAction.java70
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllBreakpointsAction.java86
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllFromInspectorAction.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveBreakpointAction.java77
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveFromInspectorAction.java55
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveTerminatedAction.java82
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResumeActionDelegate.java56
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RunAction.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RunDropDownAction.java32
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ShowQualifiedAction.java58
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ShowTypesAction.java61
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepActionDelegate.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepIntoActionDelegate.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepOverActionDelegate.java36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepReturnActionDelegate.java36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StringMatcher.java409
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SuspendActionDelegate.java50
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateActionDelegate.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAllAction.java66
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAndRemoveActionDelegate.java59
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesContentProvider.java98
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesView.java162
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java116
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugModelPresentation.java161
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java387
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIEventFilter.java56
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugViewAdapter.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchWizard.java61
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/package.html87
88 files changed, 11374 insertions, 0 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugView.java
new file mode 100644
index 000000000..37099a6b2
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugView.java
@@ -0,0 +1,160 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.debug.ui.IDebugViewAdapter; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Menu; import org.eclipse.ui.IPartListener; import org.eclipse.ui.IViewSite; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; import org.eclipse.ui.part.ViewPart;
+
+/**
+ * Functionality common to views in the debugger
+ */
+
+public abstract class AbstractDebugView extends ViewPart implements IDebugViewAdapter, IPartListener {
+
+ protected final static String TITLE_TOOLTIPTEXT= "title_toolTipText";
+
+ protected StructuredViewer fViewer = null;
+
+ /**
+ * @see IAdaptable
+ */
+ public Object getAdapter(Class adapter) {
+ if (adapter == IDebugViewAdapter.class) {
+ return this;
+ }
+ return super.getAdapter(adapter);
+ }
+
+
+ /**
+ * @see IViewPart
+ */
+ public void init(IViewSite site) throws PartInitException {
+ super.init(site);
+ getSite().getPage().addPartListener(this);
+ }
+
+ public void dispose() {
+ getSite().getPage().removePartListener(this);
+ super.dispose();
+ }
+
+ /**
+ * @see IDebugViewAdapter
+ */
+ public StructuredViewer getViewer() {
+ return fViewer;
+ }
+
+ /**
+ * @see IDebugViewAdapter
+ */
+ public IDebugModelPresentation getPresentation(String id) {
+ return ((DelegatingModelPresentation)fViewer.getLabelProvider()).getPresentation(id);
+ }
+
+ protected void createContextMenu(Control menuControl) {
+ MenuManager menuMgr= new MenuManager("#PopUp");
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager mgr) {
+ fillContextMenu(mgr);
+ }
+ });
+ Menu menu= menuMgr.createContextMenu(menuControl);
+ menuControl.setMenu(menu);
+
+ // register the context menu such that other plugins may contribute to it
+ getSite().registerContextMenu(menuMgr, fViewer);
+ }
+
+ /**
+ * Configures the toolBar
+ */
+ protected void initializeToolBar() {
+ final IToolBarManager tbm= getViewSite().getActionBars().getToolBarManager();
+ configureToolBar(tbm);
+ getViewSite().getActionBars().updateActionBars();
+
+ // this is in a runnable to be run after this view's pane
+ // is created
+ Runnable r = new Runnable() {
+ public void run() {
+ IContributionItem[] items = tbm.getItems();
+ if (items != null) {
+ for (int i = 0; i < items.length; i++) {
+ if (items[i] instanceof ActionContributionItem) {
+ IAction action = ((ActionContributionItem)items[i]).getAction();
+ if (action.isChecked()) {
+ action.run();
+ }
+ }
+ }
+ }
+ }
+ };
+ IWorkbenchWindow w = DebugUIPlugin.getActiveWorkbenchWindow();
+ if (w != null) {
+ w.getShell().getDisplay().asyncExec(r);
+ }
+ }
+
+ /**
+ * @see IWorkbenchPart
+ */
+ public void setFocus() {
+ fViewer.getControl().setFocus();
+ }
+
+ /**
+ * Returns the title tooltip for the View icon of this view part.
+ */
+ protected String getTitleToolTipText(String prefix) {
+ return DebugUIUtils.getResourceString(prefix + TITLE_TOOLTIPTEXT);
+ }
+
+ protected abstract void fillContextMenu(IMenuManager mgr);
+
+ protected abstract void configureToolBar(IToolBarManager tbm);
+ /**
+ * @see IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
+ */
+ public void partOpened(IWorkbenchPart arg0) {
+ }
+
+ /**
+ * @see IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart)
+ */
+ public void partDeactivated(IWorkbenchPart arg0) {
+ }
+
+ /**
+ * @see IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
+ */
+ public void partClosed(IWorkbenchPart arg0) {
+ }
+
+ /**
+ * @see IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart)
+ */
+ public void partBroughtToTop(IWorkbenchPart arg0) {
+ }
+
+ /**
+ * @see IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
+ */
+ public void partActivated(IWorkbenchPart arg0) {
+ }
+
+ /**
+ * @see WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createPartControl(Composite arg0) {
+ }
+
+
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AddToInspectorAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AddToInspectorAction.java
new file mode 100644
index 000000000..4f01ff433
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AddToInspectorAction.java
@@ -0,0 +1,37 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import java.util.Iterator;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+public class AddToInspectorAction extends InspectorAction {
+
+ private static final String PREFIX= "add_to_inspector_action.";
+
+ public AddToInspectorAction(ISelectionProvider sp) {
+ super(sp, DebugUIUtils.getResourceString(PREFIX + TEXT));
+ setToolTipText(DebugUIUtils.getResourceString(PREFIX + TOOL_TIP_TEXT));
+ setEnabled(!getStructuredSelection().isEmpty());
+ }
+
+ /**
+ * @see InspectorAction
+ */
+ protected void doAction(InspectorView view) throws DebugException {
+ IStructuredSelection s = getStructuredSelection();
+ Iterator vars = s.iterator();
+ while (vars.hasNext()) {
+ IVariable var = (IVariable)vars.next();
+ DebugUITools.inspect(var.getName(), var.getValue());
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BasicContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BasicContentProvider.java
new file mode 100644
index 000000000..f21942d17
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BasicContentProvider.java
@@ -0,0 +1,90 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.debug.core.DebugEvent; import org.eclipse.jface.viewers.*; import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.widgets.Control;
+
+public abstract class BasicContentProvider implements IStructuredContentProvider {
+
+ protected StructuredViewer fViewer;
+
+ /**
+ * @see IContentProvider#inputChanged
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ fViewer= (StructuredViewer) viewer;
+ }
+
+ /**
+ * @see Display.asyncExec(Runnable)
+ */
+ protected void asyncExec(Runnable r) {
+ if (fViewer != null) {
+ Control ctrl= fViewer.getControl();
+ if (ctrl != null) {
+ ctrl.getDisplay().asyncExec(r);
+ }
+ }
+ }
+
+ /**
+ * Refreshes the viewer - must be called in UI thread.
+ */
+ protected void refresh() {
+ if (fViewer != null) {
+ fViewer.refresh();
+ }
+ }
+
+ /**
+ * Refresh the given element in the viewer - must be called in UI thread.
+ */
+ protected void refresh(Object element) {
+ if (fViewer != null) {
+ fViewer.refresh(element);
+ }
+ }
+
+ /**
+ * @see IDebugEventListener
+ */
+ public void handleDebugEvent(final DebugEvent event) {
+ Object element= event.getSource();
+ if (element == null) {
+ return;
+ }
+ Runnable r= new Runnable() {
+ public void run() {
+ doHandleDebugEvent(event);
+ }
+ };
+
+ asyncExec(r);
+ }
+
+ /**
+ * @see ITreeContentProvider
+ */
+ public Object[] getChildren(final Object parent) {
+ final Object[][] temp= new Object[1][];
+ Runnable runnable= new Runnable() {
+ public void run() {
+ temp[0]= doGetChildren(parent);
+ }
+ };
+ BusyIndicator.showWhile(fViewer.getControl().getDisplay(), runnable);
+ return temp[0];
+ }
+
+ /**
+ * Performs an update based on the event
+ */
+ protected abstract void doHandleDebugEvent(DebugEvent event);
+
+ protected abstract Object[] doGetChildren(Object parent);
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java
new file mode 100644
index 000000000..cd198ccc0
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsContentProvider.java
@@ -0,0 +1,92 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.debug.core.*;
+import org.eclipse.jface.viewers.TableViewer;
+
+/**
+ * Provides the contents for a breakpoints viewer
+ */
+public class BreakpointsContentProvider extends BasicContentProvider implements IBreakpointListener {
+
+ /**
+ * Creates this content provider
+ */
+ public BreakpointsContentProvider() {
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this);
+ }
+
+ /**
+ * Returns all the breakpoint markers in the current open workspace
+ */
+ public Object[] getElements(Object parent) {
+ return ((IBreakpointManager) parent).getBreakpoints();
+ }
+
+ /**
+ * @see IContentProvider
+ */
+ public void dispose() {
+ DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this);
+ }
+
+ /**
+ * @see IBreakpointListener
+ */
+ public void breakpointAdded(final IMarker breakpoint) {
+ if (breakpoint.exists()) {
+ asyncExec(new Runnable() {
+ public void run() {
+ ((TableViewer)fViewer).add(breakpoint);
+ }
+ });
+ }
+ }
+
+ /**
+ * @see IBreakpointListener
+ */
+ public void breakpointRemoved(final IMarker breakpoint, IMarkerDelta delta) {
+ asyncExec(new Runnable() {
+ public void run() {
+ ((TableViewer)fViewer).remove(breakpoint);
+ }
+ });
+ }
+
+ /**
+ * @see IBreakpointListener
+ */
+ public void breakpointChanged(final IMarker breakpoint, IMarkerDelta delta) {
+ if (breakpoint.exists()) {
+ asyncExec(new Runnable() {
+ public void run() {
+ refresh(breakpoint);
+ }
+ });
+ }
+ }
+
+ /**
+ * @see BasicContentProvider#doHandleDebug(Event)
+ */
+ protected void doHandleDebugEvent(DebugEvent event) {
+ //not a registered debug event listener
+ }
+
+ /**
+ * @see BasicContentProvider#doGetChildren(Object)
+ */
+ protected Object[] doGetChildren(Object parent) {
+ //not a tree content provider
+ return null;
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsView.java
new file mode 100644
index 000000000..c7d17c49f
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/BreakpointsView.java
@@ -0,0 +1,254 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBreakpointManager;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.*;
+import org.eclipse.ui.model.WorkbenchViewerSorter;
+
+/**
+ * This view shows the breakpoints registered with the breakpoint manager
+ */
+public class BreakpointsView extends AbstractDebugView implements ISelectionChangedListener, IDoubleClickListener {
+
+ protected final static String PREFIX= "breakpoints_view.";
+
+ /**
+ * The various actions of the context menu of this view
+ */
+ private OpenMarkerAction fOpenMarkerAction;
+ private RemoveBreakpointAction fRemoveBreakpointAction;
+ private RemoveAllBreakpointsAction fRemoveAllBreakpointsAction;
+ private EnableDisableBreakpointAction fEnableDisableBreakpointAction;
+ private ShowQualifiedAction fShowQualifiedNamesAction;
+
+ /**
+ * @see IWorkbenchPart
+ */
+ public void createPartControl(Composite parent) {
+ fViewer= new TableViewer(parent, SWT.MULTI| SWT.H_SCROLL | SWT.V_SCROLL);
+ fViewer.setContentProvider(new BreakpointsContentProvider());
+ fViewer.setLabelProvider(new DelegatingModelPresentation());
+ fViewer.setSorter(new WorkbenchViewerSorter());
+ initializeActions();
+ initializeToolBar();
+
+ createContextMenu(((TableViewer)fViewer).getTable());
+
+ fViewer.setInput(DebugPlugin.getDefault().getBreakpointManager());
+ fViewer.addSelectionChangedListener(this);
+ fViewer.addDoubleClickListener(this);
+ fViewer.getControl().addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent e) {
+ handleKeyPressed(e);
+ }
+ });
+
+ setTitleToolTip(getTitleToolTipText(PREFIX));
+ }
+
+ /**
+ * @see IWorkbenchPart
+ */
+ public void dispose() {
+ super.dispose();
+ if (fViewer != null) {
+ fViewer.removeSelectionChangedListener(this);
+ fViewer.removeDoubleClickListener(this);
+ }
+ cleanupActions();
+ }
+
+ /**
+ * Initializes the actions of this view
+ */
+ protected void initializeActions() {
+ fRemoveBreakpointAction= new RemoveBreakpointAction(fViewer);
+ fRemoveBreakpointAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_REMOVE));
+ fRemoveBreakpointAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE));
+ fRemoveBreakpointAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE));
+
+ fRemoveAllBreakpointsAction= new RemoveAllBreakpointsAction();
+ fRemoveAllBreakpointsAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_REMOVE_ALL));
+ fRemoveAllBreakpointsAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE_ALL));
+ fRemoveAllBreakpointsAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE_ALL));
+ boolean enable= DebugPlugin.getDefault().getBreakpointManager().getBreakpoints().length == 0 ? false : true;
+ fRemoveAllBreakpointsAction.setEnabled(enable);
+
+ fShowQualifiedNamesAction = new ShowQualifiedAction(fViewer);
+ fShowQualifiedNamesAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_QUALIFIED_NAMES));
+ fShowQualifiedNamesAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_QUALIFIED_NAMES));
+ fShowQualifiedNamesAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_QUALIFIED_NAMES));
+ fShowQualifiedNamesAction.setChecked(true);
+
+ fOpenMarkerAction= new OpenBreakpointMarkerAction(fViewer);
+ ISharedImages images= DebugUIPlugin.getDefault().getWorkbench().getSharedImages();
+ fOpenMarkerAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_OPEN_MARKER));
+
+ fEnableDisableBreakpointAction= new EnableDisableBreakpointAction(fViewer);
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(fEnableDisableBreakpointAction);
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(fRemoveAllBreakpointsAction);
+ }
+
+ /**
+ * Cleans up the actions when this part is disposed
+ */
+ protected void cleanupActions() {
+ if (fEnableDisableBreakpointAction != null) {
+ DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(fEnableDisableBreakpointAction);
+ }
+ if (fRemoveAllBreakpointsAction != null) {
+ DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(fRemoveAllBreakpointsAction);
+ }
+ }
+
+ /**
+ * Opens a marker for the current selection.
+ * An editor will be opened if <code>open</code> is <code>true</code>
+ * This will only occur for selections containing a single breakpoint.
+ */
+ public void openMarkerForCurrentSelection(boolean open) {
+ IStructuredSelection selection= (IStructuredSelection) fViewer.getSelection();
+ if (selection.size() != 1) {
+ //Single selection only
+ return;
+ }
+ //Get the selected marker
+ IMarker breakpoint= (IMarker) selection.getFirstElement();
+ if (!breakpoint.exists()) {
+ return;
+ }
+ IWorkbenchWindow dwindow= getSite().getWorkbenchWindow();
+ IWorkbenchPage page= dwindow.getActivePage();
+ IEditorPart editor= getOpenEditor(breakpoint, page);
+ if (editor != null) {
+ editor.gotoMarker(breakpoint);
+ return;
+ }
+ if (!open) {
+ return;
+ }
+
+ openEditorForBreakpoint(breakpoint, page);
+ }
+
+ /**
+ * Open an editor for the breakpoint.
+ */
+ protected void openEditorForBreakpoint(IMarker breakpoint, IWorkbenchPage page) {
+ String id= getBreakpointManager().getModelIdentifier(breakpoint);
+ IDebugModelPresentation presentation= getPresentation(id);
+ IEditorInput input= presentation.getEditorInput(breakpoint);
+ String editorId= presentation.getEditorId(input, breakpoint);
+ if (input != null) {
+ try {
+ IEditorPart editor;
+ editor= page.openEditor(input, editorId);
+ editor.gotoMarker(breakpoint);
+ } catch (PartInitException e) {
+ DebugUIUtils.logError(e);
+ }
+ }
+ }
+
+ /**
+ * Adds items to the context menu
+ */
+ protected void fillContextMenu(IMenuManager menu) {
+ menu.add(new Separator(IDebugUIConstants.EMPTY_NAVIGATION_GROUP));
+ menu.add(new Separator(IDebugUIConstants.NAVIGATION_GROUP));
+ menu.add(fOpenMarkerAction);
+ menu.add(new Separator(IDebugUIConstants.EMPTY_BREAKPOINT_GROUP));
+ menu.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP));
+ menu.add(fEnableDisableBreakpointAction);
+ menu.add(fRemoveBreakpointAction);
+ menu.add(fRemoveAllBreakpointsAction);
+ menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
+ menu.add(new Separator(IDebugUIConstants.RENDER_GROUP));
+ menu.add(fShowQualifiedNamesAction);
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ /**
+ * @see IDoubleClickListener
+ */
+ public void doubleClick(DoubleClickEvent event) {
+ openMarkerForCurrentSelection(true);
+ }
+
+ /**
+ * @see ISelectionChangedListener
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (event.getSelection().isEmpty()) {
+ return;
+ }
+ //FIXME: See PR 1G4CLUB
+ openMarkerForCurrentSelection(false);
+ }
+
+ /**
+ * Returns whether an editor is open on this breakpoint's
+ * resource
+ */
+ protected IEditorPart getOpenEditor(IMarker breakpoint, IWorkbenchPage page) {
+ //attempt to find the editor for the input
+ String id= getBreakpointManager().getModelIdentifier(breakpoint);
+ IDebugModelPresentation presentation= getPresentation(id);
+ IEditorInput editorElement = presentation.getEditorInput(breakpoint);
+ IEditorPart[] editors= page.getEditors();
+ for (int i= 0; i < editors.length; i++) {
+ IEditorPart part= editors[i];
+ if (part.getEditorInput().equals(editorElement)) {
+ page.bringToTop(part);
+ return part;
+ }
+ }
+ //did not find an open editor
+ return null;
+ }
+
+ /**
+ * Configures the toolBar
+ */
+ protected void configureToolBar(IToolBarManager tbm) {
+ tbm.add(fRemoveBreakpointAction);
+ tbm.add(fRemoveAllBreakpointsAction);
+ tbm.add(fOpenMarkerAction);
+ tbm.add(fShowQualifiedNamesAction);
+ }
+
+ /**
+ * Convience method to retrieve the breakpoint manager
+ */
+ protected IBreakpointManager getBreakpointManager() {
+ return DebugPlugin.getDefault().getBreakpointManager();
+ }
+
+ /**
+ * Handles key events in viewer. Specifically interested in
+ * the Delete key.
+ */
+ protected void handleKeyPressed(KeyEvent event) {
+ if (event.character == SWT.DEL && event.stateMask == 0
+ && fRemoveBreakpointAction.isEnabled()) {
+ fRemoveBreakpointAction.run();
+ }
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ChangeVariableValueAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ChangeVariableValueAction.java
new file mode 100644
index 000000000..e250f8b69
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ChangeVariableValueAction.java
@@ -0,0 +1,199 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import java.util.Iterator;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IValueModification;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.TreeEditor;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.actions.SelectionProviderAction;
+
+/**
+ * Action for changing the value of primitives and <code>String</code> variables.
+ */
+public class ChangeVariableValueAction extends SelectionProviderAction {
+
+ // Fields for inline editing
+ protected Composite fComposite;
+ protected Tree fTree;
+ protected Label fEditorLabel;
+ protected Text fEditorText;
+ protected TreeEditor fTreeEditor;
+ protected IVariable fVariable;
+
+ private static final String PREFIX= "change_variable_value_action.";
+ private static final String ERROR= PREFIX + "error.";
+ private static final String DIALOG_TITLE= PREFIX + "dialog.title";
+ private static final String DIALOG_MESSAGE= PREFIX + "dialog.message";
+ private static final String DIALOG_INVALID= PREFIX + "dialog.invalid";
+
+ public ChangeVariableValueAction(Viewer viewer) {
+ super(viewer, DebugUIUtils.getResourceString(PREFIX + TEXT));
+ setDescription(DebugUIUtils.getResourceString(PREFIX + DESCRIPTION));
+ fTree= ((TreeViewer)viewer).getTree();
+ fTreeEditor= new TreeEditor(fTree);
+ }
+
+ /**
+ * Edit the variable value with an inline text editor.
+ */
+ protected void doActionPerformed(final IVariable variable) {
+ final Shell activeShell= DebugUIPlugin.getActiveWorkbenchWindow().getShell();
+
+ // If a previous edit is still in progress, finish it
+ if (fEditorText != null) {
+ saveChangesAndCleanup(fVariable, activeShell);
+ }
+ fVariable = variable;
+
+ // Use a Composite containing a Label and a Text. This allows us to edit just
+ // the value, while still showing the variable name.
+ fComposite = new Composite(fTree, SWT.NONE);
+ fComposite.setBackground(fTree.getBackground());
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ fComposite.setLayout(layout);
+
+ fEditorLabel = new Label(fComposite, SWT.LEFT);
+ fEditorLabel.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+ fEditorText = new Text(fComposite, SWT.BORDER | SWT.SINGLE | SWT.LEFT);
+ fEditorText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
+ String valueString= "";
+ try {
+ valueString= fVariable.getValue().getValueString();
+ } catch (DebugException de) {
+ DebugUIUtils.errorDialog(activeShell, ERROR, de.getStatus());
+ }
+ TreeItem[] selectedItems = fTree.getSelection();
+ fTreeEditor.horizontalAlignment = SWT.LEFT;
+ fTreeEditor.grabHorizontal = true;
+ fTreeEditor.setEditor(fComposite, selectedItems[0]);
+
+ // This is a hack. There is no API on model presentation to get just the
+ // variable name, so we have to make do with just calling IVariable.getName()
+ String varName = "";
+ try {
+ varName = fVariable.getName();
+ } catch (DebugException de) {
+ }
+ fEditorLabel.setText(varName + "=");
+
+ fEditorText.setText(valueString);
+ fEditorText.selectAll();
+
+ fComposite.layout(true);
+ fComposite.setVisible(true);
+ fEditorText.setFocus();
+
+ // CR means commit the change, ESC means abort changing the value
+ fEditorText.addKeyListener(new KeyAdapter() {
+ public void keyReleased(KeyEvent event) {
+ if (event.character == SWT.CR) {
+ saveChangesAndCleanup(fVariable, activeShell);
+ }
+ if (event.character == SWT.ESC) {
+ cleanup();
+ }
+ }
+ });
+
+ // If the focus is lost, then act as if user hit CR and commit change
+ fEditorText.addFocusListener(new FocusAdapter() {
+ public void focusLost(FocusEvent fe) {
+ saveChangesAndCleanup(fVariable, activeShell);
+ }
+ });
+ }
+
+ /**
+ * If the new value validates, save it, and dispose the text widget,
+ * otherwise sound the system bell and leave the user in the editor.
+ */
+ protected void saveChangesAndCleanup(IVariable variable, Shell shell) {
+ String newValue= fEditorText.getText();
+ try {
+ if (!variable.verifyValue(newValue)) {
+ shell.getDisplay().beep();
+ return;
+ }
+ variable.setValue(newValue);
+ } catch (DebugException de) {
+ DebugUIUtils.errorDialog(shell, ERROR, de.getStatus());
+ }
+ cleanup();
+ }
+
+ /**
+ * Tidy up the widgets that were used
+ */
+ private void cleanup() {
+ if (fEditorText != null) {
+ fEditorText.dispose();
+ fEditorText = null;
+ fVariable = null;
+ fTreeEditor.setEditor(null, null);
+ fComposite.setVisible(false);
+ }
+ }
+
+ /**
+ * Updates the enabled state of this action based
+ * on the selection
+ */
+ protected void update(IStructuredSelection sel) {
+ Iterator iter= sel.iterator();
+ if (iter.hasNext()) {
+ Object object= iter.next();
+ if (object instanceof IValueModification) {
+ IValueModification varMod= (IValueModification)object;
+ if (!varMod.supportsValueModification()) {
+ setEnabled(false);
+ return;
+ }
+ setEnabled(!iter.hasNext());
+ return;
+ }
+ }
+ setEnabled(false);
+ }
+
+ /**
+ * @see Action
+ */
+ public void run() {
+ Iterator iterator= getStructuredSelection().iterator();
+ doActionPerformed((IVariable)iterator.next());
+ }
+
+ /**
+ * @see SelectionProviderAction
+ */
+ public void selectionChanged(IStructuredSelection sel) {
+ update(sel);
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ClearOutputAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ClearOutputAction.java
new file mode 100644
index 000000000..aa09aab18
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ClearOutputAction.java
@@ -0,0 +1,32 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.jface.action.Action;
+
+/**
+ * Clears the output of the selected launches
+ */
+public class ClearOutputAction extends Action {
+
+ private final static String PREFIX= "clear_output_action.";
+ private ConsoleViewer fConsoleViewer;
+
+ public ClearOutputAction(ConsoleViewer viewer) {
+ super(DebugUIUtils.getResourceString(PREFIX + TEXT));
+ fConsoleViewer= viewer;
+ setToolTipText(DebugUIUtils.getResourceString(PREFIX + TOOL_TIP_TEXT));
+ }
+
+ /**
+ * @see Action
+ */
+ public void run() {
+ fConsoleViewer.clearDocument();
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ColorManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ColorManager.java
new file mode 100644
index 000000000..8458b465a
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ColorManager.java
@@ -0,0 +1,33 @@
+package org.eclipse.debug.internal.ui;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Generic color manager.
+ */
+public class ColorManager {
+
+ protected Map fColorTable= new HashMap(10);
+
+ public Color getColor(RGB rgb) {
+ Color color= (Color) fColorTable.get(rgb);
+ if (color == null) {
+ color= new Color(Display.getCurrent(), rgb);
+ fColorTable.put(rgb, color);
+ }
+ return color;
+ }
+
+ public void dispose() {
+ Iterator e= fColorTable.values().iterator();
+ while (e.hasNext())
+ ((Color) e.next()).dispose();
+ }
+}
+
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleDocument.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleDocument.java
new file mode 100644
index 000000000..2ca659fa2
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleDocument.java
@@ -0,0 +1,433 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 1999, 2000
+ */
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.IStreamMonitor;
+import org.eclipse.debug.core.model.IStreamsProxy;
+import org.eclipse.jface.text.*;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+
+public class ConsoleDocument extends AbstractDocument implements IDebugEventListener {
+ public final static int fgMinimumSize= 500;
+ public final static int fgMinMaxRation= 5;
+
+ private boolean fClosed= false;
+ private int fMinSize= fgMinimumSize;
+ private int fMaxSize= fgMinimumSize * fgMinMaxRation;
+
+ protected IProcess fProcess;
+ private IStreamsProxy fProxy;
+ private int fLastStreamWriteEnd= 0;
+ private int fNewStreamWriteEnd= 0;
+ protected boolean fNeedsToStartReading= true;
+
+ public static final int OUT= 0;
+ public static final int ERR= 1;
+
+ protected List fStyleRanges= new ArrayList(2);
+
+ protected ConsoleViewer fConsoleViewer= null;
+
+ protected IStreamListener fSystemOutListener= new IStreamListener() {
+ public void streamAppended(String newText, IStreamMonitor monitor) {
+ systemOutAppended(newText);
+ }
+ };
+
+ protected IStreamListener fSystemErrListener= new IStreamListener() {
+ public void streamAppended(String newText, IStreamMonitor monitor) {
+ systemErrAppended(newText);
+ }
+ };
+
+ public ConsoleDocument(IProcess process) {
+ super();
+ fProcess= process;
+ setTextStore(new ConsoleOutputTextStore(fMaxSize));
+ setLineTracker(new DefaultLineTracker());
+
+ if (process != null) {
+ fProxy= process.getStreamsProxy();
+ }
+ if (process != null) {
+ DebugPlugin.getDefault().addDebugEventListener(this);
+ }
+ completeInitialization();
+ }
+
+ public void close() {
+ stopReading();
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ fClosed= true;
+ fStyleRanges= Collections.EMPTY_LIST;
+ set("");
+ }
+
+ /**
+ * If the buffer is longer than fMaxSize,
+ * trim it back to fMinSize.
+ */
+ protected void ensureSizeConstraints() {
+ if (getLength() > fMaxSize) {
+ replace(0, getLength() - fMinSize, "");
+ }
+ }
+
+ /**
+ * Fires the <code>DocumentEvent</code>, but also
+ * writes to the proxy if the user is entering input and
+ * has hit "Enter".
+ */
+ protected void fireDocumentChanged(DocumentEvent event) {
+ super.fireDocumentChanged(event);
+ String eventText= event.getText();
+ if (eventText == null || 0 >= eventText.length() || eventText.length() > 2) {
+ return;
+ }
+ String[] lineDelimiters= event.getDocument().getLegalLineDelimiters();
+ for (int i= 0; i < lineDelimiters.length; i++) {
+ if (lineDelimiters[i].equals(eventText)) {
+ try {
+ String inText= event.getDocument().get();
+ inText= inText.substring(fNewStreamWriteEnd, inText.length());
+ if (inText.length() == 0) {
+ return;
+ }
+ fProxy.write(inText);
+ fLastStreamWriteEnd= getLength();
+ return;
+ } catch (IOException ioe) {
+ DebugUIUtils.logError(ioe);
+ }
+ }
+ }
+ }
+
+ public boolean isClosed() {
+ return fClosed;
+ }
+
+ public void replace(int pos, int replaceLength, String text) {
+ if (isReadOnly() || pos < getStartOfEditableContent()) {
+ return;
+ }
+
+ replace0(pos, replaceLength, text);
+ int docLength= getLength();
+ if (docLength == fNewStreamWriteEnd) {
+ //removed all of the user input text
+ fStyleRanges.remove(fStyleRanges.size() - 1);
+ } else {
+ updateInputStyleRange(docLength);
+ //notify the viewer that the style ranges have changed.
+ fireDocumentChanged(new DocumentEvent(this, 0, 0, ""));
+ }
+ }
+
+ /**
+ * Replace text used to add content from streams even though
+ * the process is terminated (and therefore the doc is "read only")
+ */
+ protected void replace0(int pos, int replaceLength, String text) {
+ try {
+ super.replace(pos, replaceLength, text);
+ } catch (BadLocationException ble) {
+ DebugUIUtils.logError(ble);
+ }
+
+ if (text != null && text.length() - replaceLength > fMaxSize / 2) {
+ ensureSizeConstraints();
+ }
+ }
+
+
+ public void setBufferSize(int minSize, int maxSize) {
+ fMinSize= (minSize < fgMinimumSize ? fgMinimumSize : minSize);
+ fMaxSize= (maxSize < minSize * fgMinMaxRation ? minSize * fgMinMaxRation : maxSize);
+
+ if (getStore() instanceof ConsoleOutputTextStore)
+ ((ConsoleOutputTextStore) getStore()).setMinimalBufferSize(fMinSize);
+
+ ensureSizeConstraints();
+ }
+
+ public void set(String text) {
+ fNewStreamWriteEnd= text.length();
+ super.set(text);
+ fLastStreamWriteEnd= fNewStreamWriteEnd;
+ ensureSizeConstraints();
+ }
+
+ protected void startReading() {
+ if (fProxy == null) {
+ return;
+ }
+
+ if (!fNeedsToStartReading) {
+ return;
+ }
+ fNeedsToStartReading= false;
+ IStreamMonitor monitor= fProxy.getOutputStreamMonitor();
+ if (monitor != null) {
+ monitor.addListener(fSystemOutListener);
+ String contents= monitor.getContents();
+ if (contents.length() > 0) {
+ fNewStreamWriteEnd= getLength() + contents.length();
+ replace0(getLength(), 0, contents);
+ updateOutputStyleRanges(OUT);
+ fLastStreamWriteEnd= getLength();
+ }
+ }
+ monitor= fProxy.getErrorStreamMonitor();
+ if (monitor != null) {
+ monitor.addListener(fSystemErrListener);
+ String contents= monitor.getContents();
+ if (contents.length() > 0) {
+ fNewStreamWriteEnd= getLength() + contents.length();
+ replace0(getLength(), 0, contents);
+ updateOutputStyleRanges(ERR);
+ fLastStreamWriteEnd= getLength();
+ }
+ }
+ }
+
+ protected void stopReading() {
+ if (fProxy == null) {
+ return;
+ }
+ fNeedsToStartReading= true;
+ IStreamMonitor monitor= fProxy.getOutputStreamMonitor();
+ monitor.removeListener(fSystemOutListener);
+ monitor= fProxy.getErrorStreamMonitor();
+ monitor.removeListener(fSystemErrListener);
+ }
+
+ /**
+ * System out or System error has had text append to it.
+ * Adds the new text to the document.
+ */
+ protected void streamAppended(final String text, final int source) {
+ update(new Runnable() {
+ public void run() {
+ int appendedLength= text.length();
+ fNewStreamWriteEnd= fLastStreamWriteEnd + appendedLength;
+ ConsoleDocument.this.replace0(fLastStreamWriteEnd, 0, text);
+ updateOutputStyleRanges(source);
+ fLastStreamWriteEnd= fNewStreamWriteEnd;
+ }
+ });
+ }
+
+ /**
+ * @see IInputStreamListener
+ */
+ protected void systemErrAppended(String text) {
+ streamAppended(text, ERR);
+ }
+
+ /**
+ * @see IInputStreamListener
+ */
+ protected void systemOutAppended(String text) {
+ streamAppended(text, OUT);
+ }
+
+ public boolean equals(Object obj) {
+ boolean correctInstance= obj instanceof ConsoleDocument;
+ if (fProcess != null) {
+ return correctInstance && fProcess.equals(((ConsoleDocument)obj).fProcess);
+ } else {
+ return correctInstance && ((ConsoleDocument)obj).fProcess == null;
+ }
+ }
+
+ public int hashCode() {
+ return (fProcess != null) ? fProcess.hashCode() : super.hashCode();
+ }
+
+ protected StyleRange[] getStyleRanges() {
+ if (fStyleRanges.isEmpty()) {
+ return new StyleRange[]{};
+ }
+ StyleRange[] sRanges= new StyleRange[fStyleRanges.size()];
+ return (StyleRange[])fStyleRanges.toArray(sRanges);
+ }
+
+ /**
+ * Coalese that last two style ranges if they are similar
+ */
+ protected void coaleseRanges() {
+ int size= fStyleRanges.size();
+ if (size > 1) {
+ StyleRange last= (StyleRange) fStyleRanges.get(size - 1);
+ StyleRange nextToLast= (StyleRange) fStyleRanges.get(size - 2);
+ if (last.similarTo(nextToLast)) {//same color?
+ StyleRange newRange= new StyleRange(nextToLast.start, last.length + nextToLast.length, last.foreground, null);
+ fStyleRanges.remove(size - 1);
+ fStyleRanges.remove(size - 2);
+ addNewStyleRange(newRange);
+ }
+ }
+ }
+
+ /**
+ * Returns whether the document's underlying process is
+ * terminated.
+ */
+ protected boolean isReadOnly() {
+ return (fProcess != null) ? fProcess.isTerminated() : true;
+ }
+
+ /**
+ * Updates the current input style range.
+ */
+ protected void updateInputStyleRange(int docLength) {
+ if (fClosed) {
+ return;
+ }
+ if (docLength != fNewStreamWriteEnd) {
+ StyleRange input=
+ new StyleRange(fNewStreamWriteEnd, docLength - fNewStreamWriteEnd,
+ ConsolePreferencePage.getPreferenceColor(ConsolePreferencePage.CONSOLE_SYS_IN_RGB),
+ null);
+ if (!fStyleRanges.isEmpty()) {
+ if (((StyleRange)fStyleRanges.get(fStyleRanges.size() - 1)).similarTo(input)) {
+ //remove the top "input" range...continuing input
+ fStyleRanges.remove(fStyleRanges.size() - 1);
+ }
+ }
+
+ addNewStyleRange(input);
+ }
+ }
+
+ protected void updateOutputStyleRanges(int sourceStream) {
+ if (fClosed) {
+ return;
+ }
+ int docLength= getLength();
+ if (docLength == 0) {
+ return;
+ }
+
+ if ((fNewStreamWriteEnd == 0) && (0 == fLastStreamWriteEnd)) {
+ return;
+ }
+
+ if (fNewStreamWriteEnd == fLastStreamWriteEnd) {
+ return;
+ }
+
+ Color newRangeColor=
+ (sourceStream == ConsoleDocument.OUT) ? ConsolePreferencePage.getPreferenceColor(ConsolePreferencePage.CONSOLE_SYS_OUT_RGB) : ConsolePreferencePage.getPreferenceColor(ConsolePreferencePage.CONSOLE_SYS_ERR_RGB);
+
+ StyleRange newRange= new StyleRange(fLastStreamWriteEnd, fNewStreamWriteEnd - fLastStreamWriteEnd, newRangeColor, null);
+ if (!fStyleRanges.isEmpty()) {
+ if ((docLength != fNewStreamWriteEnd) &&
+ ((StyleRange)fStyleRanges.get(fStyleRanges.size() - 1)).foreground ==
+ ConsolePreferencePage.getPreferenceColor(ConsolePreferencePage.CONSOLE_SYS_IN_RGB)) {
+ //remove the top "input" range..it will get recalculated in updateInputStyleRanges
+ fStyleRanges.remove(fStyleRanges.size() - 1);
+ }
+ }
+
+ addNewStyleRange(newRange);
+ coaleseRanges();
+ updateInputStyleRange(docLength);
+ //notify the viewer that the style ranges have changed.
+ fireDocumentChanged(new DocumentEvent(this, 0, 0, null));
+ }
+
+ /**
+ * Adds a new style range if the document is not closed.
+ * Note that the document can be closed by a separate thread.
+ * This is the reason for the copy of the style ranges.
+ */
+ protected void addNewStyleRange(StyleRange newRange) {
+ List tempRanges= fStyleRanges;
+ if (fClosed) {
+ return;
+ }
+ tempRanges.add(newRange);
+ }
+
+ protected void setStyleRanges(List ranges) {
+ fStyleRanges= ranges;
+ }
+
+ protected void clearDocument() {
+ fStyleRanges= new ArrayList(2);
+ set("");
+ }
+
+ /**
+ * Returns the position after which editing of the
+ * content is allowable.
+ */
+ protected int getStartOfEditableContent() {
+ return fLastStreamWriteEnd;
+ }
+
+ /**
+ * Make visible to the ConsoleViewer
+ */
+ protected ITextStore getStore() {
+ return super.getStore();
+ }
+
+ /**
+ * @see IDebugEventListener
+ */
+ public void handleDebugEvent(DebugEvent event) {
+ if (fProcess == null) {
+ return;
+ }
+ if (event.getKind() == DebugEvent.TERMINATE) {
+ Object element= event.getSource();
+ if (element != null && element.equals(fProcess)) {
+ update( new Runnable() {
+ public void run() {
+ fireDocumentChanged(new DocumentEvent(ConsoleDocument.this, 0, 0, null));
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Posts the update code "behind" the running operation if the
+ * UI will be updated.
+ */
+ protected void update(Runnable runnable) {
+ if (fConsoleViewer != null) {
+ fConsoleViewer.getControl().getDisplay().asyncExec(runnable);
+ } else {
+ Display display= DebugUIPlugin.getDefault().getDisplay();
+ if (display != null) {
+ display.asyncExec(runnable);
+ }
+ }
+ }
+
+ /**
+ * Sets the console viewer that this document is viewed within.
+ * Can be set to <code>null</code> if no longer currently being
+ * viewed.
+ */
+ protected void setConsoleViewer(ConsoleViewer viewer) {
+ fConsoleViewer = viewer;
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleGotoLineAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleGotoLineAction.java
new file mode 100644
index 000000000..08976934a
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleGotoLineAction.java
@@ -0,0 +1,104 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import java.util.ResourceBundle;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Shell;
+
+public class ConsoleGotoLineAction extends ConsoleViewerAction {
+
+ /**
+ * Validates whether the text found in the input field of the
+ * dialog forms a valid line number, i.e. one to which can be
+ * jumped.
+ */
+ class NumberValidator implements IInputValidator {
+
+ public String isValid(String input) {
+ try {
+ int i= Integer.parseInt(input);
+ if (i <= 0 || fLastLine < i)
+ return fBundle.getString(fPrefix + "dialog.invalid_range");
+
+ } catch (NumberFormatException x) {
+ return fBundle.getString(fPrefix + "dialog.invalid_input");
+ }
+
+ return "";
+ }
+ };
+
+ protected int fLastLine;
+ protected ResourceBundle fBundle;
+ protected String fPrefix;
+ protected ConsoleViewer fConsoleViewer;
+
+ /**
+ * Constructs a goto line action for the console using the provided resource bundle
+ */
+ public ConsoleGotoLineAction(ResourceBundle bundle, String prefix, ConsoleViewer viewer) {
+ super(bundle, prefix, viewer, -1);
+ fBundle= bundle;
+ fPrefix= prefix;
+ fConsoleViewer= viewer;
+ }
+
+ /**
+ * @see TextEditorAction
+ */
+ public void update() {
+ }
+
+ /**
+ * Jumps to the line.
+ */
+ protected void gotoLine(int line) {
+
+ IDocument document= fConsoleViewer.getDocument();
+ try {
+ int start= document.getLineOffset(line);
+ int length= document.getLineLength(line);
+
+ fConsoleViewer.getTextWidget().setSelection(start, start + length);
+ fConsoleViewer.revealRange(start, length);
+ } catch (BadLocationException x) {
+ // ignore
+ }
+ }
+
+ /**
+ * @see Action
+ */
+ public void run() {
+ try {
+ Point selection= fConsoleViewer.getTextWidget().getSelection();
+ IDocument document= fConsoleViewer.getDocument();
+ fLastLine= document.getLineOfOffset(document.getLength()) + 1;
+ int startLine= selection == null ? 1 : fConsoleViewer.getTextWidget().getLineAtOffset(selection.x) + 1;
+ String title= fBundle.getString(fPrefix + "dialog.title");
+ String message= fBundle.getString(fPrefix + "dialog.message");
+ String value= Integer.toString(startLine);
+ Shell activeShell= DebugUIPlugin.getActiveWorkbenchWindow().getShell();
+ InputDialog d= new InputDialog(activeShell, title, message, value, new NumberValidator());
+ d.open();
+
+ try {
+ int line= Integer.parseInt(d.getValue());
+ gotoLine(line - 1);
+ } catch (NumberFormatException x) {
+ }
+ } catch (BadLocationException x) {
+ return;
+ }
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleOutputTextStore.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleOutputTextStore.java
new file mode 100644
index 000000000..c9c83fce4
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleOutputTextStore.java
@@ -0,0 +1,63 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 1999, 2000
+ */
+
+import org.eclipse.jface.text.ITextStore;
+
+public class ConsoleOutputTextStore implements ITextStore {
+
+ private StringBuffer fBuffer;
+
+ public ConsoleOutputTextStore(int bufferSize) {
+ fBuffer= new StringBuffer(bufferSize);
+ }
+
+ /**
+ * @see ITextStore
+ */
+ public char get(int pos) {
+ return fBuffer.charAt(pos);
+ }
+
+ /**
+ * @see ITextStore
+ */
+ public String get(int pos, int length) {
+ return fBuffer.substring(pos, pos + length);
+ }
+
+ /**
+ * @see ITextStore
+ */
+ public int getLength() {
+ return fBuffer.length();
+ }
+
+ /**
+ * @see ITextStore
+ */
+ public void replace(int pos, int length, String text) {
+ if (text == null) {
+ text= "";
+ }
+ fBuffer.replace(pos, pos + length, text);
+ }
+
+ /**
+ * @see ITextStore
+ */
+ public void set(String text) {
+ fBuffer= new StringBuffer(text);
+ }
+
+ /**
+ * @see StringBuffer#ensureCapacity
+ */
+ public void setMinimalBufferSize(int bufferSize) {
+ fBuffer.ensureCapacity(bufferSize);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsolePreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsolePreferencePage.java
new file mode 100644
index 000000000..7961e65f1
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsolePreferencePage.java
@@ -0,0 +1,76 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.jface.preference.*; import org.eclipse.swt.graphics.*; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * A page to set the preferences for the console
+ */
+public class ConsolePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage, IDebugPreferenceConstants {
+
+ private static final String PREFIX= "console_preferences.";
+ private static final String DESCRIPTION= PREFIX + "description";
+ private static final String OUT= PREFIX + "out";
+ private static final String ERR= PREFIX + "err";
+ private static final String IN= PREFIX + "in";
+ private static final String FONT=PREFIX + "font";
+
+ /**
+ * Create the console page.
+ */
+ public ConsolePreferencePage() {
+ super(GRID);
+ setDescription(DebugUIUtils.getResourceString(DESCRIPTION));
+ IPreferenceStore store= DebugUIPlugin.getDefault().getPreferenceStore();
+ setPreferenceStore(store);
+ }
+
+ /**
+ * Create all field editors for this page
+ */
+ public void createFieldEditors() {
+
+ // Note: first String value is the key for the preference bundle and second the
+ // second String value is the label displayed in front of the editor.
+ ColorFieldEditor sysout= new ColorFieldEditor(CONSOLE_SYS_OUT_RGB, DebugUIUtils.getResourceString(OUT), getFieldEditorParent());
+ ColorFieldEditor syserr= new ColorFieldEditor(CONSOLE_SYS_ERR_RGB, DebugUIUtils.getResourceString(ERR), getFieldEditorParent());
+ ColorFieldEditor sysin= new ColorFieldEditor(CONSOLE_SYS_IN_RGB, DebugUIUtils.getResourceString(IN), getFieldEditorParent());
+
+ FontFieldEditor font= new FontFieldEditor(CONSOLE_FONT, DebugUIUtils.getResourceString(FONT), getFieldEditorParent());
+ addField(sysout);
+ addField(syserr);
+ addField(sysin);
+ addField(font);
+ }
+
+ /**
+ * @see IWorkbenchPreferencePage#init
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+ /**
+ * Returns the a color based on the type.
+ */
+ protected static Color getPreferenceColor(String type) {
+ IPreferenceStore pstore= DebugUIPlugin.getDefault().getPreferenceStore();
+ RGB outRGB= PreferenceConverter.getColor(pstore, type);
+ ColorManager colorManager= DebugUIPlugin.getDefault().getColorManager();
+ return colorManager.getColor(outRGB);
+ }
+
+ /**
+ * Returns the font data that describes the font to use for the console
+ */
+ protected static FontData getConsoleFontData() {
+ IPreferenceStore pstore= DebugUIPlugin.getDefault().getPreferenceStore();
+ FontData fontData= PreferenceConverter.getFontData(pstore, CONSOLE_FONT);
+ return fontData;
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleView.java
new file mode 100644
index 000000000..e1bd8a32f
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleView.java
@@ -0,0 +1,210 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import java.util.*;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.action.*;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IFindReplaceTarget;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.texteditor.FindReplaceAction;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+import org.eclipse.ui.texteditor.IUpdate;
+
+public class ConsoleView extends ViewPart {
+
+ protected final static String PREFIX= "console_view.";
+
+ protected ConsoleViewer fConsoleViewer= null;
+ protected ClearOutputAction fClearOutputAction= null;
+
+ protected Map fGlobalActions= new HashMap(10);
+ protected List fSelectionActions = new ArrayList(7);
+
+ /**
+ * @see ViewPart#createChild(IWorkbenchPartContainer)
+ */
+ public void createPartControl(Composite parent) {
+ fConsoleViewer= new ConsoleViewer(parent);
+ initializeActions();
+ initializeToolBar();
+
+ // create context menu
+ MenuManager menuMgr= new MenuManager("#PopUp", IDebugUIConstants.ID_CONSOLE_VIEW);
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager mgr) {
+ fillContextMenu(mgr);
+ }
+ });
+ Menu menu= menuMgr.createContextMenu(fConsoleViewer.getTextWidget());
+ fConsoleViewer.getTextWidget().setMenu(menu);
+ // register the context menu such that other plugins may contribute to it
+ getSite().registerContextMenu(menuMgr.getId(), menuMgr, fConsoleViewer);
+
+ fConsoleViewer.getSelectionProvider().addSelectionChangedListener(getSelectionChangedListener());
+ setViewerInput(DebugUIPlugin.getDefault().getCurrentProcess());
+ setTitleToolTip(DebugUIUtils.getResourceString(PREFIX + AbstractDebugView.TITLE_TOOLTIPTEXT));
+ }
+
+ /**
+ * @see IWorkbenchPart
+ */
+ public void setFocus() {
+ fConsoleViewer.getControl().setFocus();
+ }
+
+ /**
+ * Sets the input of the viewer of this view in the
+ * UI thread.
+ */
+ protected void setViewerInput(final IAdaptable element) {
+ setViewerInput(element, true);
+ }
+
+ /**
+ * Sets the input of the viewer of this view in the
+ * UI thread. The current input process is determined
+ * if so specified.
+ */
+ protected void setViewerInput(final IAdaptable element, final boolean determineCurrentProcess) {
+ if (fConsoleViewer == null) {
+ return;
+ }
+ Display display= fConsoleViewer.getControl().getDisplay();
+ if (display != null) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ IDocument doc= DebugUIPlugin.getDefault().getConsoleDocument((IProcess) element, determineCurrentProcess);
+ fConsoleViewer.setDocument(doc);
+ }
+ });
+ }
+ }
+
+ /**
+ * Initialize the actions of this view
+ */
+ private void initializeActions() {
+ fClearOutputAction= new ClearOutputAction(fConsoleViewer);
+ fClearOutputAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_CLEAR));
+ fClearOutputAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_CLEAR));
+ fClearOutputAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_CLEAR));
+
+ ResourceBundle bundle= DebugUIUtils.getResourceBundle();
+ // In order for the clipboard actions to accessible via their shortcuts
+ // (e.g., Ctrl-C, Ctrl-V), we *must* set a global action handler for
+ // each action
+ IActionBars actionBars= getViewSite().getActionBars();
+ setGlobalAction(actionBars, ITextEditorActionConstants.CUT, new ConsoleViewerAction(bundle, "cut_action.", fConsoleViewer, fConsoleViewer.CUT));
+ setGlobalAction(actionBars, ITextEditorActionConstants.COPY, new ConsoleViewerAction(bundle, "copy_action.", fConsoleViewer, fConsoleViewer.COPY));
+ setGlobalAction(actionBars, ITextEditorActionConstants.PASTE, new ConsoleViewerAction(bundle, "paste_action.", fConsoleViewer, fConsoleViewer.PASTE));
+ setGlobalAction(actionBars, ITextEditorActionConstants.SELECT_ALL, new ConsoleViewerAction(bundle, "select_all_action.", fConsoleViewer, fConsoleViewer.SELECT_ALL));
+ setGlobalAction(actionBars, ITextEditorActionConstants.FIND, new FindReplaceAction(bundle, "find_replace_action.", getSite().getWorkbenchWindow()));
+ setGlobalAction(actionBars, ITextEditorActionConstants.GOTO_LINE, new ConsoleGotoLineAction(bundle, "goto_line_action.", fConsoleViewer));
+
+ fSelectionActions.add(ITextEditorActionConstants.CUT);
+ fSelectionActions.add(ITextEditorActionConstants.COPY);
+ fSelectionActions.add(ITextEditorActionConstants.PASTE);
+ }
+
+ protected void setGlobalAction(IActionBars actionBars, String actionID, IAction action) {
+ fGlobalActions.put(actionID, action);
+ actionBars.setGlobalActionHandler(actionID, action);
+ }
+
+ public void markAsSelectionDependentAction(String actionId) {
+ if (!fSelectionActions.contains(actionId)) {
+ fSelectionActions.add(actionId);
+ }
+ }
+
+ /**
+ * Configures the toolBar.
+ */
+ private void initializeToolBar() {
+ IToolBarManager tbm= getViewSite().getActionBars().getToolBarManager();
+ tbm.add(fClearOutputAction);
+ getViewSite().getActionBars().updateActionBars();
+ }
+
+ /**
+ * Adds the text manipulation actions to the <code>ConsoleViewer</code>
+ */
+ protected void fillContextMenu(IMenuManager menu) {
+ Point selectionRange= fConsoleViewer.getTextWidget().getSelection();
+ ConsoleDocument doc= (ConsoleDocument) fConsoleViewer.getDocument();
+ if (doc == null) {
+ return;
+ }
+ if (doc.isReadOnly() || selectionRange.x < doc.getStartOfEditableContent()) {
+ menu.add((IAction)fGlobalActions.get(ITextEditorActionConstants.COPY));
+ menu.add((IAction)fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));
+ } else {
+ menu.add((IAction)fGlobalActions.get(ITextEditorActionConstants.CUT));
+ menu.add((IAction)fGlobalActions.get(ITextEditorActionConstants.COPY));
+ menu.add((IAction)fGlobalActions.get(ITextEditorActionConstants.PASTE));
+ menu.add((IAction)fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));
+ }
+
+ menu.add(new Separator("FIND"));
+ menu.add((IAction)fGlobalActions.get(ITextEditorActionConstants.FIND));
+ menu.add((IAction)fGlobalActions.get(ITextEditorActionConstants.GOTO_LINE));
+
+ menu.add(fClearOutputAction);
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ /**
+ * @see WorkbenchPart#getAdapter(Class)
+ */
+ public Object getAdapter(Class required) {
+ if (IFindReplaceTarget.class.equals(required)) {
+ return fConsoleViewer.getFindReplaceTarget();
+ }
+ return super.getAdapter(required);
+ }
+
+ protected final ISelectionChangedListener getSelectionChangedListener() {
+ return new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateSelectionDependentActions();
+ }
+ };
+ }
+
+ protected void updateSelectionDependentActions() {
+ Iterator iterator= fSelectionActions.iterator();
+ while (iterator.hasNext())
+ updateAction((String)iterator.next());
+ }
+
+ protected void updateAction(String actionId) {
+ IAction action= (IAction)fGlobalActions.get(actionId);
+ if (action instanceof IUpdate)
+ ((IUpdate) action).update();
+ }
+
+ public void dispose() {
+ if (fConsoleViewer != null) {
+ fConsoleViewer.dispose();
+ }
+ super.dispose();
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleViewer.java
new file mode 100644
index 000000000..6e2c829e7
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleViewer.java
@@ -0,0 +1,168 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.jface.text.*; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyleRange; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.events.VerifyEvent; import org.eclipse.swt.events.VerifyListener; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.widgets.Composite;
+
+public class ConsoleViewer extends TextViewer implements IPropertyChangeListener{
+
+ /**
+ * Font used in the underlying text widget
+ */
+ protected Font fFont;
+
+ protected InternalDocumentListener fInternalDocumentListener= new InternalDocumentListener();
+ /**
+ * Internal document listener.
+ */
+ class InternalDocumentListener implements IDocumentListener {
+ /*
+ * @see IDocumentListener#documentAboutToBeChanged
+ */
+ public void documentAboutToBeChanged(DocumentEvent e) {
+ }
+
+ /*
+ * @see IDocumentListener#documentChanged
+ */
+ public void documentChanged(DocumentEvent e) {
+ ConsoleDocument doc= (ConsoleDocument) getDocument();
+ if (doc == null || doc.isClosed()) {
+ return;
+ }
+ revealEndOfDocument();
+ if (doc.isReadOnly()) {
+ StyledText widget= getTextWidget();
+ widget.setEditable(false);
+ }
+ updateStyleRanges(doc);
+ }
+ }
+
+ /**
+ * Creates a new console viewer and adds verification checking
+ * to only allow text modification if the text is being modified
+ * in the editable portion of the underlying document.
+ *
+ * @see org.eclipse.swt.events.VerifyListener
+ */
+ public ConsoleViewer(Composite parent) {
+ super(parent, SWT.H_SCROLL | SWT.V_SCROLL);
+
+ getTextWidget().setDoubleClickEnabled(true);
+ getTextWidget().addVerifyListener( new VerifyListener() {
+ public void verifyText(VerifyEvent e) {
+ ConsoleDocument doc= (ConsoleDocument) getDocument();
+ if (doc != null && doc.getStartOfEditableContent() > e.start) {
+ e.doit= false;
+ }
+ }
+ });
+
+ DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
+ FontData data= ConsolePreferencePage.getConsoleFontData();
+ fFont= new Font(getControl().getDisplay(), data);
+ getTextWidget().setFont(fFont);
+ }
+
+ /**
+ * Reveals (makes visible) the end of the current document
+ */
+ protected void revealEndOfDocument() {
+ IDocument doc= getDocument();
+ int docLength= doc.getLength();
+ if (docLength > 0) {
+ revealRange(docLength - 1, 1);
+ StyledText widget= getTextWidget();
+ widget.setCaretOffset(docLength);
+
+ }
+ }
+
+ protected void updateStyleRanges(ConsoleDocument doc) {
+ StyleRange[] ranges= doc.getStyleRanges();
+ int lastRangeIndex= ranges.length;
+ if (lastRangeIndex > 0) {
+ StyledText widget= getTextWidget();
+ int storeLength= doc.getStore().getLength();
+ StyleRange lastRange= ranges[lastRangeIndex - 1];
+ if (!(storeLength - 1 < lastRange.start) &&
+ lastRange.start + lastRange.length <= widget.getContent().getCharCount()) {
+ widget.setStyleRanges(ranges);
+ }
+ }
+ }
+
+ /**
+ * Clears the contents of the current document.
+ */
+ public void clearDocument() {
+ IDocument doc= getDocument();
+ if (doc != null) {
+ ((ConsoleDocument) doc).clearDocument();
+ }
+ }
+
+ /**
+ * @see ITextViewer#setDocument(IDocument)
+ */
+ public void setDocument(IDocument doc) {
+ ConsoleDocument oldDoc= (ConsoleDocument) getDocument();
+ ConsoleDocument document= (ConsoleDocument)doc;
+ if (oldDoc == null && document == null) {
+ return;
+ }
+ if (oldDoc != null) {
+ oldDoc.removeDocumentListener(fInternalDocumentListener);
+ oldDoc.setConsoleViewer(null);
+ if (oldDoc.equals(document)) {
+ document.addDocumentListener(fInternalDocumentListener);
+ document.setConsoleViewer(this);
+ return;
+ }
+ }
+
+ super.setDocument(document);
+ if (document != null) {
+ getTextWidget().setEditable(!document.isReadOnly());
+ updateStyleRanges(document);
+ revealEndOfDocument();
+ document.addDocumentListener(fInternalDocumentListener);
+ document.setConsoleViewer(this);
+ }
+ }
+
+ /**
+ * @see IFindReplaceTarget#canPerformFind
+ */
+ protected boolean canPerformFind() {
+ return (getTextWidget() != null && getVisibleDocument() != null && getVisibleDocument().getLength() > 0);
+ }
+
+ /**
+ * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ String propertyName= event.getProperty();
+ if (!propertyName.equals(IDebugPreferenceConstants.CONSOLE_FONT)) {
+ return;
+ }
+ FontData data= ConsolePreferencePage.getConsoleFontData();
+ Font temp= fFont;
+ fFont= new Font(getControl().getDisplay(), data);
+ getTextWidget().setFont(fFont);
+ temp.dispose();
+ }
+
+ /**
+ * Dispose this viewer and resources
+ */
+ protected void dispose() {
+ fFont.dispose();
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleViewerAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleViewerAction.java
new file mode 100644
index 000000000..c5ff5661f
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsoleViewerAction.java
@@ -0,0 +1,48 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import java.util.ResourceBundle;
+import org.eclipse.jface.text.ITextOperationTarget;
+import org.eclipse.ui.texteditor.TextEditorAction;
+
+public class ConsoleViewerAction extends TextEditorAction {
+
+ private int fOperationCode= -1;
+ private ITextOperationTarget fOperationTarget;
+
+ public ConsoleViewerAction(ResourceBundle bundle, String prefix, ConsoleViewer viewer, int operationCode) {
+ super(bundle, prefix, null);
+ fOperationCode= operationCode;
+ fOperationTarget= viewer.getTextOperationTarget();
+ update();
+ }
+
+ /**
+ * @see TextEditorAction
+ */
+ public void update() {
+
+ boolean wasEnabled= isEnabled();
+ boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode));
+ setEnabled(isEnabled);
+
+ if (wasEnabled != isEnabled) {
+ firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE : Boolean.FALSE, isEnabled ? Boolean.TRUE : Boolean.FALSE);
+ }
+ }
+
+ /**
+ * @see Action
+ */
+ public void run() {
+ if (fOperationCode != -1 && fOperationTarget != null) {
+ fOperationTarget.doOperation(fOperationCode);
+ }
+ }
+}
+
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
new file mode 100644
index 000000000..75f5b2072
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlAction.java
@@ -0,0 +1,56 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.ui.actions.SelectionProviderAction;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * Provides the common functionality of the control actions.
+ * In order to avoid duplication of code, ControlActions defer to
+ * delegates to perform all of the real work. This is necessary so that
+ * these actions can be used as regular SelectionProviderActions,
+ * but also be used as contributed IWorkbenchWindowActionDelegates,
+ * which must have zero-argument constructors.
+ */
+public class ControlAction extends SelectionProviderAction {
+
+ /**
+ * The delegate does all of the real work. This class only responds to
+ * run() requests and selectionChanged notifications. In both cases,
+ * it defers to the delegate.
+ */
+ protected ControlActionDelegate fDelegate;
+
+ public ControlAction(ISelectionProvider selectionProvider, ControlActionDelegate delegate) {
+ super(selectionProvider, "");
+ fDelegate= delegate;
+ fDelegate.initializeForOwner(this);
+ setText(DebugUIUtils.getResourceString(fDelegate.getPrefix() + TEXT));
+ setToolTipText(DebugUIUtils.getResourceString(fDelegate.getPrefix() + TOOL_TIP_TEXT));
+ }
+
+ /**
+ * @see Action
+ * The actual work is deferred to the delegate.
+ */
+ public void run() {
+ fDelegate.selectionChanged(this, getStructuredSelection());
+ fDelegate.run();
+ }
+
+ /**
+ * @see SelectionProviderAction
+ * Updates the enable state based on what and how much is selected.
+ */
+ public void selectionChanged(IStructuredSelection sel) {
+ setEnabled(fDelegate.getEnableStateForSelection(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
new file mode 100644
index 000000000..3bd2e2604
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ControlActionDelegate.java
@@ -0,0 +1,145 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.IDebugStatusConstants;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+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 java.util.Iterator;
+
+public abstract class ControlActionDelegate implements IWorkbenchWindowActionDelegate {
+
+ protected static final String ERROR= "error.";
+ protected static final String STATUS= "status";
+
+ protected IStructuredSelection fStructuredSelection;
+
+ /**
+ * It's crucial that delegate actions have a zero-arg constructor so that
+ * they can be reflected into existence when referenced in an action set
+ * in the plugin's plugin.xml file.
+ */
+ public ControlActionDelegate() {
+ }
+
+ /**
+ * Not all ControlActionDelegates have an owner, only those that aren't
+ * specified as part of an action set in plugin.xml. For those delegates,
+ * that do have a ControlAction owner, this is the place to do any
+ * action specific initialization.
+ */
+ public void initializeForOwner(ControlAction controlAction) {
+ }
+
+ /**
+ * Do the specific action using the current selection.
+ */
+ public void run() {
+ final Iterator enum= fStructuredSelection.iterator();
+ String pluginId= DebugUIPlugin.getDefault().getDescriptor().getUniqueIdentifier();
+ final MultiStatus ms=
+ new MultiStatus(pluginId, IDebugStatusConstants.REQUEST_FAILED, DebugUIUtils.getResourceString(getPrefix() + STATUS), null);
+ BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
+ public void run() {
+ while (enum.hasNext()) {
+ Object element= enum.next();
+ if (isEnabledFor(element)) {
+ try {
+ doAction(element);
+ } catch (DebugException e) {
+ ms.merge(e.getStatus());
+ }
+ }
+ }
+ }
+ });
+ if (!ms.isOK()) {
+ DebugUIUtils.errorDialog(DebugUIPlugin.getActiveWorkbenchWindow().getShell(), getPrefix() + ERROR, ms);
+ }
+ }
+
+ /**
+ * @see IWorkbenchWindowActionDelegate
+ */
+ public void dispose(){
+ }
+
+ /**
+ * @see IWorkbenchWindowActionDelegate
+ */
+ public void init(IWorkbenchWindow window){
+ }
+
+ /**
+ * @see IActionDelegate
+ */
+ public void run(IAction action){
+ run();
+ }
+
+ /**
+ * @see IActionDelegate
+ */
+ public void selectionChanged(IAction action, ISelection selection){
+ if (selection instanceof IStructuredSelection) {
+ fStructuredSelection= (IStructuredSelection)selection;
+ }
+ }
+
+ /**
+ * Return whether the action should be enabled or not based on the given selection.
+ */
+ public boolean getEnableStateForSelection(IStructuredSelection selection) {
+ if (selection.size() == 0) {
+ return false;
+ }
+ Iterator enum= selection.iterator();
+ int count= 0;
+ while (enum.hasNext()) {
+ count++;
+ if (count > 1 && enableForMultiSelection()) {
+ return false;
+ }
+ Object element= enum.next();
+ if (!isEnabledFor(element)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Returns whether this action should be enabled if there is
+ * multi selection.
+ */
+ protected boolean enableForMultiSelection() {
+ return true;
+ }
+
+ /**
+ * Does the specific action of this action to the process.
+ */
+ protected abstract void doAction(Object element) throws DebugException;
+
+ /**
+ * Returns the resource bundle prefix for this action
+ */
+ protected abstract String getPrefix();
+
+ /**
+ * Returns whether this action will work for the given element
+ */
+ public abstract boolean isEnabledFor(Object element);
+
+} \ No newline at end of file
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
new file mode 100644
index 000000000..c1b0c2111
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/CopyToClipboardActionDelegate.java
@@ -0,0 +1,89 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.jface.viewers.ContentViewer;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.dnd.*;
+
+public class CopyToClipboardActionDelegate extends ControlActionDelegate {
+
+ private ContentViewer fViewer;
+
+ private static final String PREFIX= "copy_to_clipboard_action.";
+
+ /**
+ * @see ControlActionDelegate
+ */
+ public void initializeForOwner(ControlAction controlAction) {
+ controlAction.setEnabled(!controlAction.getStructuredSelection().isEmpty());
+ fViewer = (ContentViewer)controlAction.getSelectionProvider();
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected String getPrefix() {
+ return PREFIX;
+ }
+ /**
+ * @see ControlActionDelegate
+ */
+ public boolean isEnabledFor(Object element) {
+ return element instanceof IDebugElement;
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected void doAction(final Object element) {
+ StringBuffer buffer= new StringBuffer();
+ IDebugElement de= (IDebugElement) element;
+ append(de, buffer, (ILabelProvider)fViewer.getLabelProvider(), 0);
+
+ RTFTransfer rtfTransfer = RTFTransfer.getInstance();
+ TextTransfer plainTextTransfer = TextTransfer.getInstance();
+ Clipboard clipboard= new Clipboard(fViewer.getControl().getDisplay());
+ clipboard.setContents(
+ new String[]{buffer.toString()},
+ new Transfer[]{plainTextTransfer});
+ }
+
+ /**
+ * Appends the representation of the specified element (using the label provider and indent)
+ * to the buffer. For elements down to stack frames, children representations
+ * are append to the buffer as well.
+ */
+ protected void append(IDebugElement e, StringBuffer buffer, ILabelProvider lp, int indent) {
+ for (int i= 0; i < indent; i++) {
+ buffer.append('\t');
+ }
+ buffer.append(lp.getText(e));
+ buffer.append(System.getProperty("line.separator"));
+ if (e.getElementType() < IDebugElement.STACK_FRAME) {
+ IDebugElement[] children= new IDebugElement[]{};
+ try {
+ children= e.getChildren();
+ } catch (DebugException de) {
+ }
+ for (int i = 0;i < children.length; i++) {
+ IDebugElement de= children[i];
+ append(de, buffer, lp, indent + 1);
+ }
+ }
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected boolean enableForMultiSelection() {
+ return false;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugAction.java
new file mode 100644
index 000000000..c8cabbed2
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugAction.java
@@ -0,0 +1,34 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.IDebugUIConstants;
+
+/**
+ * An execution action that uses launchers in
+ * debug mode.
+ */
+public class DebugAction extends ExecutionAction {
+
+ protected final static String PREFIX= "debug_action.";
+
+ public DebugAction() {
+ setText(DebugUIUtils.getResourceString(PREFIX + TEXT));
+ setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_DEBUG));
+ setToolTipText(DebugUIUtils.getResourceString(PREFIX + TOOL_TIP_TEXT));
+ }
+
+ /**
+ * @see ExecutionAction
+ */
+ protected String getMode() {
+ return ILaunchManager.DEBUG_MODE;
+ }
+
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugContentProvider.java
new file mode 100644
index 000000000..ffbb2be29
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugContentProvider.java
@@ -0,0 +1,267 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.*;
+import org.eclipse.jface.viewers.IBasicPropertyConstants;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+
+/**
+ * Provides the contents for a debug mode of the Launches viewer.
+ */
+public class DebugContentProvider extends BasicContentProvider implements IDebugEventListener, ILaunchListener, ITreeContentProvider {
+
+ /**
+ * Constructs a new content provider.
+ */
+ public DebugContentProvider() {
+ DebugPlugin plugin= DebugPlugin.getDefault();
+ plugin.addDebugEventListener(this);
+ plugin.getLaunchManager().addLaunchListener(this);
+ }
+
+ /**
+ * @see BasicContentProvider#doGetChildren(Object)
+ */
+ protected Object[] doGetChildren(Object parent) {
+ if (parent instanceof IDebugElement) {
+ IDebugElement de= (IDebugElement) parent;
+ if (de.getElementType() < IDebugElement.STACK_FRAME) {
+ try {
+ return de.getChildren();
+ } catch (DebugException e) {
+ DebugUIUtils.logError(e);
+ }
+ }
+ } else
+ if (parent instanceof ILaunch) {
+ return ((ILaunch)parent).getChildren();
+ } else
+ if (parent instanceof ILaunchManager) {
+ return ((ILaunchManager) parent).getLaunches();
+ }
+ return new Object[0];
+ }
+
+ /**
+ * Returns the <code>ILaunch</code>es for the <code>ILaunchManager</code>
+ */
+ public Object[] getElements(Object element) {
+ if (element instanceof ILaunchManager) {
+ return ((ILaunchManager) element).getLaunches();
+ }
+ return new Object[0];
+ }
+
+ /**
+ * @see org.eclipse.jface.viewer.ITreeContentProvider
+ */
+ public Object getParent(Object item) {
+ Object parent= null;
+ if (item instanceof IDebugElement) {
+ IDebugElement de= (IDebugElement) item;
+ parent= de.getParent();
+ if (parent == null) {
+ parent= de.getLaunch();
+ }
+ } else
+ if (item instanceof IProcess) {
+ parent= ((IProcess) item).getLaunch();
+ } else
+ if (item instanceof ILaunch) {
+ parent= DebugPlugin.getDefault().getLaunchManager();
+ }
+ return parent;
+ }
+
+ /**
+ * @see BasicContentProvider#doHandleDebug(Event)
+ */
+ public void doHandleDebugEvent(DebugEvent event) {
+ Object element= event.getSource();
+ if (element instanceof IDebugElement && ((IDebugElement) element).getElementType() == IDebugElement.VARIABLE) {
+ // the debug view does not show variables
+ return;
+ }
+ switch (event.getKind()) {
+ case DebugEvent.CREATE :
+ insert(element);
+ break;
+ case DebugEvent.TERMINATE :
+ clearSourceSelection();
+ Object parent= getParent(element);
+ refresh(parent);
+ updateButtons();
+ break;
+ case DebugEvent.RESUME :
+ if (element instanceof ISuspendResume) {
+ if (((ISuspendResume)element).isSuspended()) {
+ return;
+ }
+ }
+ clearSourceSelection();
+ if (event.getDetail() != DebugEvent.STEP_START) {
+ refresh(element);
+ if (element instanceof IThread) {
+ //select and reveal will update buttons
+ //via selection changed callback
+ selectAndReveal(element);
+ break;
+ }
+ }
+ labelChanged(element);
+ updateButtons();
+ break;
+ case DebugEvent.SUSPEND :
+ refresh(element);
+ if (!DebugUIPlugin.getDefault().userPreferenceToSwitchPerspective(true)) {
+ Object tos= null;
+ if (element instanceof IThread) {
+ // select the top stack frame
+ try {
+ tos= ((IThread) element).getTopStackFrame();
+ } catch (DebugException de) {
+ }
+ }
+ if (tos != null) {
+ selectAndReveal(tos);
+ }
+ }
+ updateButtons();
+ break;
+ case DebugEvent.CHANGE :
+ refresh(element);
+ updateButtons();
+ break;
+ }
+ }
+
+ /**
+ * Helper method for inserting the given element - must be called in UI thread
+ */
+ protected void insert(Object element) {
+ final Object parent= getParent(element);
+ // a parent can be null for a debug target or process that has not yet been associated
+ // with a launch
+ if (parent != null) {
+ ((LaunchesViewer) fViewer).add(parent, element);
+ }
+ }
+
+ /**
+ * Helper method to remove the given element - must be called in UI thread
+ */
+ private void remove(Object element) {
+ ((LaunchesViewer) fViewer).remove(element);
+ }
+
+ /**
+ * Helper method to update the label of the given element - must be called in UI thread
+ */
+ protected void labelChanged(Object element) {
+ ((LaunchesViewer) fViewer).update(element, new String[] {IBasicPropertyConstants.P_TEXT});
+ }
+
+ /**
+ * Helper method to update the buttons of the viewer - must be called in UI thread
+ */
+ protected void updateButtons() {
+ ((LaunchesViewer)fViewer).updateButtons();
+ }
+
+ /**
+ * Helper method to update the selection of the viewer - must be called in UI thread
+ */
+ protected void updateMarkerForSelection() {
+ ((LaunchesViewer)fViewer).updateMarkerForSelection();
+ }
+
+ /**
+ * Helper method to select and reveal the given element - must be called in UI thread
+ */
+ protected void selectAndReveal(Object element) {
+ ((LaunchesViewer) fViewer).setSelection(new StructuredSelection(element), true);
+ }
+
+ /**
+ * @see ITreeContentProvider
+ */
+ public boolean hasChildren(Object item) {
+ if (item instanceof IStackFrame) {
+ return false;
+ // No children shown for IStackFrames in this view (see the variables view instead).
+ } else
+ if (item instanceof IDebugElement) {
+ try {
+ return ((IDebugElement) item).hasChildren();
+ } catch (DebugException de) {
+ }
+ } else
+ if (item instanceof ILaunch) {
+ return true;
+ } else
+ if (item instanceof ILaunchManager) {
+ return ((ILaunchManager) item).getLaunches().length > 0;
+ }
+ return false;
+ }
+
+ /**
+ * @see ILaunchListener
+ */
+ public void launchDeregistered(final ILaunch launch) {
+ Runnable r= new Runnable() {
+ public void run() {
+ remove(launch);
+ updateButtons();
+ }
+ };
+
+ asyncExec(r);
+ }
+
+ /**
+ * @see ILaunchListener
+ */
+ public void launchRegistered(final ILaunch launch) {
+ Runnable r= new Runnable() {
+ public void run() {
+ insert(launch);
+ if (!DebugUIPlugin.getDefault().userPreferenceToSwitchPerspective(true)) {
+ Object dt = launch.getDebugTarget();
+ if (dt != null) {
+ selectAndReveal(dt);
+ }
+ }
+ }
+ };
+
+ asyncExec(r);
+ }
+
+ /**
+ * Unregisters this content provider from the debug model so that
+ * this object can be garbage-collected.
+ */
+ public void dispose() {
+ DebugPlugin plugin= DebugPlugin.getDefault();
+ plugin.removeDebugEventListener(this);
+ plugin.getLaunchManager().removeLaunchListener(this);
+ }
+
+ /**
+ * Clear the selection in the editor - must be called in UI thread
+ */
+ private void clearSourceSelection() {
+ if (fViewer != null) {
+ ((LaunchesViewer)fViewer).clearSourceSelection();
+ }
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugDropDownAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugDropDownAction.java
new file mode 100644
index 000000000..28beb0cb1
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugDropDownAction.java
@@ -0,0 +1,32 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchManager;
+
+public class DebugDropDownAction extends LaunchDropDownAction {
+
+ public DebugDropDownAction() {
+ super(new DebugAction());
+ }
+
+ /**
+ * @see LaunchDropDownAction
+ */
+ public String getMode() {
+ return ILaunchManager.DEBUG_MODE;
+ }
+
+ /**
+ * @see LaunchDropDownAction
+ */
+ public ILaunch[] getHistory() {
+ return DebugUIPlugin.getDefault().getDebugHistory();
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugMenuManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugMenuManager.java
new file mode 100644
index 000000000..2f172b68b
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugMenuManager.java
@@ -0,0 +1,26 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+
+public class DebugMenuManager extends MenuManager implements IMenuListener {
+
+ public DebugMenuManager(String text, String id) {
+ super(text, id);
+ setDirty(true);
+ addMenuListener(this);
+ }
+
+ public void menuAboutToShow(IMenuManager manager) {
+ setDirty(true);
+ }
+
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPerspective.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPerspective.java
new file mode 100644
index 000000000..9d943f76b
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPerspective.java
@@ -0,0 +1,59 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+/**
+ * The debug perspective
+ */
+public class DebugPerspective implements IPerspectiveFactory {
+
+ /**
+ * @see IPerspectiveFactory
+ */
+ public void createInitialLayout(IPageLayout layout) {
+
+ IFolderLayout consoleFolder = layout.createFolder(IInternalDebugUIConstants.ID_CONSOLE_FOLDER_VIEW, IPageLayout.BOTTOM, (float)0.75, layout.getEditorArea());
+ consoleFolder.addView(IPageLayout.ID_TASK_LIST);
+ consoleFolder.addView(IDebugUIConstants.ID_CONSOLE_VIEW);
+
+
+ IFolderLayout navFolder= layout.createFolder(IInternalDebugUIConstants.ID_NAVIGATOR_FOLDER_VIEW, IPageLayout.TOP, (float) 0.5, layout.getEditorArea());
+ navFolder.addView(IPageLayout.ID_RES_NAV);
+ navFolder.addView(IDebugUIConstants.ID_PROCESS_VIEW);
+ navFolder.addView(IDebugUIConstants.ID_DEBUG_VIEW);
+
+ IFolderLayout folder= layout.createFolder(IInternalDebugUIConstants.ID_TOOLS_FOLDER_VIEW, IPageLayout.RIGHT, (float) 0.5, IInternalDebugUIConstants.ID_NAVIGATOR_FOLDER_VIEW);
+
+ folder.addView(IDebugUIConstants.ID_BREAKPOINT_VIEW);
+ folder.addView(IDebugUIConstants.ID_INSPECTOR_VIEW);
+ folder.addView(IDebugUIConstants.ID_VARIABLE_VIEW);
+
+ layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, (float) 0.75, layout.getEditorArea());
+
+ layout.addActionSet(IDebugUIConstants.DEBUG_ACTION_SET);
+
+ setContentsOfShowViewMenu(layout);
+ }
+
+ /**
+ * Sets the intial contents of the Show View menu.
+ */
+ protected void setContentsOfShowViewMenu(IPageLayout layout) {
+ layout.addShowViewShortcut(IDebugUIConstants.ID_DEBUG_VIEW);
+ layout.addShowViewShortcut(IDebugUIConstants.ID_PROCESS_VIEW);
+ layout.addShowViewShortcut(IDebugUIConstants.ID_BREAKPOINT_VIEW);
+ layout.addShowViewShortcut(IDebugUIConstants.ID_INSPECTOR_VIEW);
+ layout.addShowViewShortcut(IDebugUIConstants.ID_VARIABLE_VIEW);
+ layout.addShowViewShortcut(IDebugUIConstants.ID_CONSOLE_VIEW);
+ layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
new file mode 100644
index 000000000..6cbe01af7
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java
@@ -0,0 +1,216 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+
+/**
+ * The images provided by the debug plugin.
+ */
+public class DebugPluginImages {
+
+ /**
+ * The image registry containing <code>Image</code>s.
+ */
+ private static ImageRegistry imageRegistry;
+
+ /**
+ * A table of all the <code>ImageDescriptor</code>s.
+ */
+ private static HashMap imageDescriptors;
+
+ /* Declare Common paths */
+ private static URL ICON_BASE_URL= null;
+ static {
+ try {
+ ICON_BASE_URL= new URL(DebugUIPlugin.getDefault().getDescriptor().getInstallURL(), "icons/");
+ } catch (MalformedURLException e) {
+ // do nothing
+ }
+ }
+
+ // Use IPath and toOSString to build the names to ensure they have the slashes correct
+ private final static String CTOOL= "full/ctool16/"; //basic colors - size 16x16
+ private final static String LOCALTOOL= "full/clcl16/"; //basic colors - size 16x16
+ private final static String DLCL= "full/dlcl16/"; //disabled - size 16x16
+ private final static String ELCL= "full/elcl16/"; //enabled - size 16x16
+ private final static String OBJECT= "full/obj16/"; //basic colors - size 16x16
+ private final static String WIZBAN= "full/wizban/"; //basic colors - size 16x16
+
+ /**
+ * Declare all images
+ */
+ private static void declareImages() {
+ // Actions
+ declareRegistryImage(IDebugUIConstants.IMG_ACT_DEBUG, CTOOL + "debug_exc.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_ACT_RUN, CTOOL + "run_exc.gif");
+
+ //menus
+
+ //Local toolbars
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_RESUME, LOCALTOOL + "resume_co.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_SUSPEND, LOCALTOOL + "suspend_co.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_TERMINATE, LOCALTOOL + "terminate_co.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_DISCONNECT, LOCALTOOL + "disconnect_co.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_STEPINTO, LOCALTOOL + "stepinto_co.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_STEPOVER, LOCALTOOL + "stepover_co.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_STEPRETURN, LOCALTOOL + "stepreturn_co.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_CLEAR, LOCALTOOL + "clear_co.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_REMOVE_TERMINATED, LOCALTOOL + "rem_all_co.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_QUALIFIED_NAMES, LOCALTOOL + "qnames_co.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_TYPE_NAMES, LOCALTOOL + "tnames_co.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_REMOVE, LOCALTOOL + "rem_co.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_LCL_REMOVE_ALL, LOCALTOOL + "rem_all_co.gif");
+
+ // disabled local toolbars
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_RESUME, DLCL + "resume_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_SUSPEND, DLCL + "suspend_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_TERMINATE, DLCL + "terminate_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_DISCONNECT, DLCL + "disconnect_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_STEPINTO, DLCL + "stepinto_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_STEPOVER, DLCL + "stepover_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_STEPRETURN, DLCL + "stepreturn_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_CLEAR, DLCL + "clear_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_REMOVE_TERMINATED, DLCL + "rem_all_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_QUALIFIED_NAMES, DLCL + "qnames_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_TYPE_NAMES, DLCL + "tnames_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_REMOVE, DLCL + "rem_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_REMOVE_ALL, DLCL + "rem_all_co.gif");
+
+ // enabled local toolbars
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_RESUME, ELCL + "resume_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_SUSPEND, ELCL + "suspend_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_TERMINATE, ELCL + "terminate_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_DISCONNECT, ELCL + "disconnect_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STEPINTO, ELCL + "stepinto_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STEPOVER, ELCL + "stepover_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STEPRETURN, ELCL + "stepreturn_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_CLEAR, ELCL + "clear_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_REMOVE_TERMINATED, ELCL + "rem_all_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_QUALIFIED_NAMES, ELCL + "qnames_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_TYPE_NAMES, ELCL + "tnames_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_REMOVE, ELCL + "rem_co.gif");
+ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_REMOVE_ALL, ELCL + "rem_all_co.gif");
+
+
+ //Object
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_LAUNCH_DEBUG, OBJECT + "ldebug_obj.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_LAUNCH_RUN, OBJECT + "lrun_obj.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET, OBJECT + "debugt_obj.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_TERMINATED, OBJECT + "debugtt_obj.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING, OBJECT + "thread_obj.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED, OBJECT + "threads_obj.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_THREAD_TERMINATED, OBJECT + "threadt_obj.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_STACKFRAME, OBJECT + "stckframe_obj.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT, OBJECT + "brkp_obj.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT_DISABLED, OBJECT + "brkpd_obj.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_OS_PROCESS, OBJECT + "osprc_obj.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_OS_PROCESS_TERMINATED, OBJECT + "osprct_obj.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_OBJS_EXPRESSION, OBJECT + "expression_obj.gif");
+
+ //Wizard Banners
+ declareRegistryImage(IDebugUIConstants.IMG_WIZBAN_DEBUG, WIZBAN + "debug_wiz.gif");
+ declareRegistryImage(IDebugUIConstants.IMG_WIZBAN_RUN, WIZBAN + "run_wiz.gif");
+ }
+
+ /**
+ * Declare an Image in the registry table.
+ * @param key The key to use when registering the image
+ * @param path The path where the image can be found. This path is relative to where
+ * this plugin class is found (i.e. typically the packages directory)
+ */
+ private final static void declareRegistryImage(String key, String path) {
+ ImageDescriptor desc= ImageDescriptor.getMissingImageDescriptor();
+ try {
+ desc= ImageDescriptor.createFromURL(makeIconFileURL(path));
+ } catch (MalformedURLException me) {
+
+ }
+ imageRegistry.put(key, desc);
+ imageDescriptors.put(key, desc);
+ }
+
+ /**
+ * Returns the ImageRegistry.
+ */
+ public static ImageRegistry getImageRegistry() {
+ if (imageRegistry == null) {
+ initializeImageRegistry();
+ }
+ return imageRegistry;
+ }
+
+ /**
+ * Initialize the image registry by declaring all of the required
+ * graphics. This involves creating JFace image descriptors describing
+ * how to create/find the image should it be needed.
+ * The image is not actually allocated until requested.
+ *
+ * Prefix conventions
+ * Wizard Banners WIZBAN_
+ * Preference Banners PREF_BAN_
+ * Property Page Banners PROPBAN_
+ * Color toolbar CTOOL_
+ * Enable toolbar ETOOL_
+ * Disable toolbar DTOOL_
+ * Local enabled toolbar ELCL_
+ * Local Disable toolbar DLCL_
+ * Object large OBJL_
+ * Object small OBJS_
+ * View VIEW_
+ * Product images PROD_
+ * Misc images MISC_
+ *
+ * Where are the images?
+ * The images (typically gifs) are found in the same location as this plugin class.
+ * This may mean the same package directory as the package holding this class.
+ * The images are declared using this.getClass() to ensure they are looked up via
+ * this plugin class.
+ * @see JFace's ImageRegistry
+ */
+ public static ImageRegistry initializeImageRegistry() {
+ imageRegistry= new ImageRegistry();
+ imageDescriptors = new HashMap(30);
+ declareImages();
+ return imageRegistry;
+ }
+
+ /**
+ * Returns the <code>Image<code> identified by the given key,
+ * or <code>null</code> if it does not exist.
+ */
+ public static Image getImage(String key) {
+ return getImageRegistry().get(key);
+ }
+
+ /**
+ * Returns the <code>ImageDescriptor<code> identified by the given key,
+ * or <code>null</code> if it does not exist.
+ */
+ public static ImageDescriptor getImageDescriptor(String key) {
+ if (imageDescriptors == null) {
+ initializeImageRegistry();
+ }
+ return (ImageDescriptor)imageDescriptors.get(key);
+ }
+
+ private static URL makeIconFileURL(String iconPath) throws MalformedURLException {
+ if (ICON_BASE_URL == null) {
+ throw new MalformedURLException();
+ }
+
+ return new URL(ICON_BASE_URL, iconPath);
+ }
+}
+
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPreferencePage.java
new file mode 100644
index 000000000..196f784b8
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPreferencePage.java
@@ -0,0 +1,53 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.SWT;
+
+/*
+ * The page for setting the default debugger preferences.
+ */
+public class DebugPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage, IDebugPreferenceConstants {
+
+ private static final String PREFIX= "debug_preferences.";
+ private static final String DEBUG= PREFIX + "debug";
+ private static final String RUN= PREFIX + "run";
+ private static final String C_OPEN= PREFIX + "console_open";
+
+ public DebugPreferencePage() {
+ super(GRID);
+
+ IPreferenceStore store= DebugUIPlugin.getDefault().getPreferenceStore();
+ setPreferenceStore(store);
+ }
+
+ /**
+ * @see FieldEditorPreferencePage#createFieldEditors
+ */
+ protected void createFieldEditors() {
+ BooleanFieldEditor debug= new BooleanFieldEditor(IDebugUIConstants.PREF_AUTO_SHOW_DEBUG_VIEW, DebugUIUtils.getResourceString(DEBUG), SWT.NONE, getFieldEditorParent());
+ BooleanFieldEditor run= new BooleanFieldEditor(IDebugUIConstants.PREF_AUTO_SHOW_PROCESS_VIEW, DebugUIUtils.getResourceString(RUN), SWT.NONE, getFieldEditorParent());
+ BooleanFieldEditor consoleOpen= new BooleanFieldEditor(CONSOLE_OPEN, DebugUIUtils.getResourceString(C_OPEN), SWT.NONE, getFieldEditorParent());
+
+ addField(debug);
+ addField(run);
+ addField(consoleOpen);
+ }
+
+ /**
+ * @see IWorkbenchPreferencePage#init
+ */
+ public void init(IWorkbench workbench) {
+ }
+}
+
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
new file mode 100644
index 000000000..6aba06e03
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
@@ -0,0 +1,1111 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import java.util.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.debug.core.*; import org.eclipse.debug.core.model.*; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugUIEventFilter; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferenceConverter; import org.eclipse.jface.resource.ImageRegistry; import org.eclipse.jface.text.*; import org.eclipse.jface.util.ListenerList; import org.eclipse.jface.viewers.*; import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.*; import org.eclipse.ui.model.IWorkbenchAdapter; import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * The Debug UI Plugin.
+ *
+ */
+public class DebugUIPlugin extends AbstractUIPlugin implements ISelectionChangedListener,
+ IDebugEventListener,
+ ISelectionListener,
+ IDocumentListener,
+ ILaunchListener,
+ IResourceChangeListener {
+
+ /**
+ * The singleton debug plugin instance
+ */
+ private static DebugUIPlugin fgDebugUIPlugin= null;
+
+ /**
+ * The selection providers for the debug UI
+ */
+ protected List fSelectionProviders= new ArrayList(2);
+
+ /**
+ * The desktop parts that contain the selections
+ */
+ protected List fSelectionParts= new ArrayList(2);
+
+ /**
+ * The list of selection listeners for the debug UI
+ */
+ protected ListenerList fListeners= new ListenerList(2);
+
+ /**
+ * The mappings of processes to their console documents.
+ */
+ protected Map fConsoleDocuments= new HashMap(3);
+
+ /**
+ * The process that is/can provide output to the console
+ * view.
+ */
+ protected IProcess fCurrentProcess= null;
+
+ /**
+ * Colors to be used in the debug ui
+ */
+ protected ColorManager fColorManager= new ColorManager();
+
+ /**
+ * The most recent launch
+ */
+ protected ILaunch fRecentLaunch = null;
+
+ protected final static int MAX_HISTORY_SIZE= 5;
+ /**
+ * The most recent debug launches
+ */
+ protected ILaunch[] fDebugHistory = new ILaunch[MAX_HISTORY_SIZE];
+
+ /**
+ * The launched resources for the most recent debug launches.
+ * The position of each resource corresponds to the position of the
+ * associated launch in fDebugHistory.
+ */
+ protected IResource[] fDebugHistoryResources = new IResource[MAX_HISTORY_SIZE];
+
+ /**
+ * The most recent run launches
+ */
+ protected ILaunch[] fRunHistory = new ILaunch[MAX_HISTORY_SIZE];
+
+ /**
+ * The launched resources for the most recent run launches
+ * The position of each resource corresponds to the position of the
+ * associated launch in fRunHistory.
+ */
+ protected IResource[] fRunHistoryResources = new IResource[MAX_HISTORY_SIZE];
+
+ /**
+ * Event filters for the debug UI
+ */
+ protected ListenerList fEventFilters = new ListenerList(2);
+
+ /**
+ * The visitor used to traverse resource deltas and keep the run & debug
+ * histories in synch with resource deletions.
+ */
+ protected static ResourceDeletedVisitor fgDeletedVisitor;
+
+
+ /**
+ * Visitor for handling resource deltas
+ */
+ class ResourceDeletedVisitor implements IResourceDeltaVisitor {
+
+ /**
+ * @see IResourceDeltaVisitor
+ */
+ public boolean visit(IResourceDelta delta) {
+ if (delta.getKind() != IResourceDelta.REMOVED) {
+ return true;
+ }
+ IResource resource= delta.getResource();
+ updateHistoriesForDeletedResource(resource);
+ return true;
+ }
+ }
+
+ /**
+ * Constructs the debug UI plugin
+ */
+ public DebugUIPlugin(IPluginDescriptor descriptor) {
+ super(descriptor);
+ fgDebugUIPlugin= this;
+ }
+
+ /**
+ * On a SUSPEND event, switch to the perspective specified
+ * by the launcher.
+ *
+ * @see IDebugEventListener
+ */
+ public void handleDebugEvent(final DebugEvent event) {
+ // open the debugger if this is a suspend event and the debugger is not yet open
+ // and the preferences are set to switch
+ if (event.getKind() == DebugEvent.SUSPEND) {
+ Display display= getDisplay();
+ if (display != null) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ if (showSuspendEvent(event)) {
+ if (getPreferenceStore().getBoolean(IDebugUIConstants.PREF_AUTO_SHOW_DEBUG_VIEW)) {
+ switchToDebugPerspective0(event.getSource(), ILaunchManager.DEBUG_MODE, true);
+ }
+ }
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Poll the filters to determine if the event should be shown
+ */
+ protected boolean showSuspendEvent(DebugEvent event) {
+ Object s= event.getSource();
+ if (s instanceof ITerminate) {
+ if (((ITerminate)s).isTerminated()) {
+ return false;
+ }
+ }
+ if (!fEventFilters.isEmpty()) {
+ Object[] filters = fEventFilters.getListeners();
+ for (int i = 0; i < filters.length; i++) {
+ if (!((IDebugUIEventFilter)filters[i]).showDebugEvent(event)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Poll the filters to determine if the launch should be shown
+ */
+ protected boolean showLaunch(ILaunch launch) {
+ if (!fEventFilters.isEmpty()) {
+ Object[] filters = fEventFilters.getListeners();
+ for (int i = 0; i < filters.length; i++) {
+ if (!((IDebugUIEventFilter)filters[i]).showLaunch(launch)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+
+ /**
+ * Opens the a workbench page with the layout specified by the launcher
+ * if it had not already been opened in any workbench window.
+ * If the switch is suspend triggered, a switch only occurs if
+ * a debug view is not present in any workbench window.
+ */
+ private void switchToDebugPerspective0(Object source, String mode, boolean suspendTriggered) {
+ String layoutId= getLauncherPerspective(source);
+ Object[] results= findDebugPresentation(source, mode, layoutId, suspendTriggered);
+ if (results == null) {
+ return;
+ }
+ IWorkbenchWindow window= null;
+ IWorkbenchPage page= null;
+ if (results.length == 0) {
+ window= getActiveWorkbenchWindow();
+ } else {
+ window= (IWorkbenchWindow)results[0];
+ page= (IWorkbenchPage)results[1];
+ }
+
+ page= activateDebugLayoutPage(page, window, layoutId);
+ // bring debug to the front
+ activateDebuggerPart(source, page, mode);
+ }
+
+ /**
+ * Debug ui thread safe access to a display
+ */
+ protected Display getDisplay() {
+ IWorkbench workbench= getWorkbench();
+ if (workbench != null) {
+ IWorkbenchWindow[] windows= workbench.getWorkbenchWindows();
+ Display display= null;
+ if (windows != null && windows.length > 0) {
+ return windows[0].getShell().getDisplay();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Activates (may include creates) a debugger part based on the mode
+ * in the specified page.
+ */
+ protected void activateDebuggerPart(final Object source, IWorkbenchPage page, String mode) {
+ LaunchesView debugPart= null;
+ try {
+ if (mode == ILaunchManager.DEBUG_MODE) {
+ debugPart= (LaunchesView) page.showView(IDebugUIConstants.ID_DEBUG_VIEW);
+ } else {
+ debugPart= (LaunchesView) page.showView(IDebugUIConstants.ID_PROCESS_VIEW);
+ }
+ } catch (PartInitException pie) {
+ IStatus status= new Status(IStatus.ERROR, getDescriptor().getUniqueIdentifier(), IDebugStatusConstants.INTERNAL_ERROR, pie.getMessage(), pie);
+ DebugUIUtils.errorDialog(page.getWorkbenchWindow().getShell(), "debug_ui_plugin.switch_perspective.error.", status);
+ }
+ if (debugPart != null) {
+ final LaunchesView dp= debugPart;
+ Display display= getDisplay();
+ display.asyncExec(new Runnable() {
+ public void run() {
+ dp.autoExpand(source);
+ }
+ });
+ }
+ }
+
+ /**
+ * Checks all active pages for a debugger view.
+ * If no debugger view is found, looks for a page in any window
+ * that has the specified debugger layout id.
+ *
+ * @return an Object array that
+ * is null if a debugger part has been found
+ * is empty if no page could be found with the debugger layout id
+ * has two elements if a debugger layout page is found
+ * first element is a window, the second is a page
+ */
+ protected Object[] findDebugPresentation(final Object source, String mode, String layoutId, boolean suspendTriggered) {
+ IWorkbenchWindow[] windows= getWorkbench().getWorkbenchWindows();
+ IWorkbenchWindow activeWindow= getActiveWorkbenchWindow();
+ int i;
+ if (suspendTriggered) {
+ final LaunchesView part= findDebugPart(activeWindow, mode);
+ if (part != null) {
+ Display display= getDisplay();
+ display.asyncExec(new Runnable() {
+ public void run() {
+ part.autoExpand(source);
+ }
+ });
+ return null;
+ }
+ //check active pages for debugger view
+ for (i= 0; i < windows.length; i++) {
+ IWorkbenchWindow window= windows[i];
+ final LaunchesView lPart= findDebugPart(window, mode);
+ if (lPart != null) {
+ Display display= getDisplay();
+ display.asyncExec(new Runnable() {
+ public void run() {
+ lPart.autoExpand(source);
+ }
+ });
+ return null;
+ }
+ }
+ }
+
+ //check the pages for the debugger layout.
+ //check the pages of the active window first
+ IWorkbenchPage page= null;
+ IWorkbenchPage[] pages= activeWindow.getPages();
+ for (int j= 0; j < pages.length; j++) {
+ if (pages[j].getPerspective().getId().equals(layoutId)) {
+ page= pages[j];
+ break;
+ }
+ }
+ if (page != null) {
+ return new Object[]{activeWindow, page};
+ }
+
+ i= 0;
+ i: for (i= 0; i < windows.length; i++) {
+ IWorkbenchWindow window= windows[i];
+ if (window.equals(activeWindow)) {
+ continue;
+ }
+ pages= window.getPages();
+
+ j: for (int j= 0; j < pages.length; j++) {
+ if (pages[j].getPerspective().getId().equals(layoutId)) {
+ page= pages[j];
+ break i;
+ }
+ }
+ }
+
+ if (page != null) {
+ return new Object[]{windows[i], page};
+ }
+
+ return new Object[0];
+ }
+
+ /**
+ * Returns a <code>true</code> if the specified window contains a debugger part for the
+ * specified debug mode.
+ */
+ protected LaunchesView findDebugPart(IWorkbenchWindow window, String mode) {
+ IWorkbenchPage activePage= window.getActivePage();
+ IViewPart debugPart= null;
+ if (mode == ILaunchManager.DEBUG_MODE) {
+ debugPart= activePage.findView(IDebugUIConstants.ID_DEBUG_VIEW);
+ } else {
+ debugPart= activePage.findView(IDebugUIConstants.ID_PROCESS_VIEW);
+ }
+ return (LaunchesView)debugPart;
+ }
+
+ /**
+ * Activates (may include creates) and returns a debugger page with the
+ * specified layout in the supplied window.
+ *
+ * @return the page that was activated (and possibly created)
+ */
+ protected IWorkbenchPage activateDebugLayoutPage(IWorkbenchPage page, IWorkbenchWindow window, String layoutId) {
+ window.getShell().forceFocus();
+ if (page == null) {
+ try {
+ IContainer root= ResourcesPlugin.getWorkspace().getRoot();
+ page= window.openPage(layoutId, root);
+ } catch (WorkbenchException e) {
+ IStatus status= new Status(IStatus.ERROR, getDescriptor().getUniqueIdentifier(), IDebugStatusConstants.INTERNAL_ERROR, e.getMessage(), e);
+ DebugUIUtils.errorDialog(window.getShell(), "debug_ui_plugin.switch_perspective.error.", status);
+ return null;
+ }
+ } else {
+ window.setActivePage(page);
+ }
+ return page;
+ }
+ /**
+ * Returns the launcher perspective specified in the launcher
+ * associated with the source of a <code>DebugEvent</code>
+ */
+ protected String getLauncherPerspective(Object eventSource) {
+ ILaunch launch= null;
+ if (eventSource instanceof IDebugElement) {
+ launch= ((IDebugElement) eventSource).getLaunch();
+ } else
+ if (eventSource instanceof ILaunch) {
+ launch= (ILaunch) eventSource;
+ }
+ ILaunchManager launchManager= DebugPlugin.getDefault().getLaunchManager();
+ String perspectiveID= launch == null ? null : launch.getLauncher().getPerspectiveIdentifier();
+ if (perspectiveID == null) {
+ perspectiveID= IDebugUIConstants.ID_DEBUG_PERSPECTIVE;
+ }
+ return perspectiveID;
+ }
+
+ /**
+ * Returns the singleton instance of the debug plugin.
+ */
+ public static DebugUIPlugin getDefault() {
+ return fgDebugUIPlugin;
+ }
+
+ public static IWorkbenchWindow getActiveWorkbenchWindow() {
+ return getDefault().getWorkbench().getActiveWorkbenchWindow();
+ }
+
+ /**
+ * Creates an extension. If the extension plugin has not
+ * been loaded a busy cursor will be activated during the duration of
+ * the load.
+ *
+ * @param element the config element defining the extension
+ * @param classAttribute the name of the attribute carrying the class
+ * @returns the extension object
+ */
+public static Object createExtension(final IConfigurationElement element, final String classAttribute) throws CoreException {
+ // If plugin has been loaded create extension.
+ // Otherwise, show busy cursor then create extension.
+ IPluginDescriptor plugin = element.getDeclaringExtension().getDeclaringPluginDescriptor();
+ if (plugin.isPluginActivated()) {
+ return element.createExecutableExtension(classAttribute);
+ } else {
+ final Object [] ret = new Object[1];
+ final CoreException [] exc = new CoreException[1];
+ BusyIndicator.showWhile(null, new Runnable() {
+ public void run() {
+ try {
+ ret[0] = element.createExecutableExtension(classAttribute);
+ } catch (CoreException e) {
+ exc[0] = e;
+ }
+ }
+ });
+ if (exc[0] != null) {
+ throw exc[0];
+ }
+ else {
+ return ret[0];
+ }
+ }
+}
+
+ protected ImageRegistry createImageRegistry() {
+ return DebugPluginImages.initializeImageRegistry();
+ }
+
+ /**
+ * Shuts down this plug-in and discards all plug-in state.
+ * If a plug-in has been started, this method is automatically
+ * invoked by the platform core when the workbench is closed.
+ * <p>
+ * This method is intended to perform simple termination
+ * of the plug-in environment. The platform may terminate invocations
+ * that do not complete in a timely fashion.
+ * </p><p>
+ * By default this will save the preference and dialog stores (if they are in use).
+ * </p><p>
+ * Subclasses which override this method must call super first.
+ * </p>
+ */
+ public void shutdown() throws CoreException {
+ super.shutdown();
+ removeSelectionListener(this);
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ ILaunchManager launchManager= DebugPlugin.getDefault().getLaunchManager();
+ launchManager.removeLaunchListener(this);
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ fColorManager.dispose();
+ Iterator docs= fConsoleDocuments.values().iterator();
+ while (docs.hasNext()) {
+ ConsoleDocument doc= (ConsoleDocument)docs.next();
+ doc.removeDocumentListener(this);
+ doc.close();
+ }
+ }
+
+ /**
+ * Starts up this plug-in.
+ * <p>
+ * This method is automatically invoked by the platform core
+ * the first time any code in the plug-in is executed.
+ * <p>
+ */
+ public void startup() throws CoreException {
+ DebugPlugin.getDefault().addDebugEventListener(this);
+ ILaunchManager launchManager= DebugPlugin.getDefault().getLaunchManager();
+ launchManager.addLaunchListener(this);
+ addSelectionListener(this);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
+ //set up the docs for launches already registered
+ ILaunch[] launches= launchManager.getLaunches();
+ for (int i = 0; i < launches.length; i++) {
+ launchRegistered(launches[i]);
+ }
+ }
+
+ /**
+ * Adds the selection provider for the debug UI.
+ */
+ public void addSelectionProvider(ISelectionProvider provider, IWorkbenchPart part) {
+ fSelectionProviders.add(provider);
+ fSelectionParts.add(part);
+ provider.addSelectionChangedListener(this);
+ }
+
+ /**
+ * Removes the selection provider from the debug UI.
+ */
+ public void removeSelectionProvider(ISelectionProvider provider, IWorkbenchPart part) {
+ fSelectionProviders.remove(provider);
+ fSelectionParts.remove(part);
+ provider.removeSelectionChangedListener(this);
+ selectionChanged(null);
+ }
+
+ /**
+ * Adds an <code>ISelectionListener</code> to the debug selection manager.
+ */
+ public void addSelectionListener(ISelectionListener l) {
+ fListeners.add(l);
+ }
+
+ /**
+ * Removes an <code>ISelectionListener</code> from the debug selection manager.
+ */
+ public synchronized void removeSelectionListener(ISelectionListener l) {
+ fListeners.remove(l);
+ }
+
+ /**
+ * Selection has changed in the debug selection provider.
+ * Notify the listeners.
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ Object[] copiedListeners= fListeners.getListeners();
+
+ ISelection selection= null;
+ ISelectionProvider provider= null;
+ IWorkbenchPart part= null;
+ if (event != null) {
+ selection= event.getSelection();
+ provider= (ISelectionProvider) event.getSource();
+ int index= fSelectionProviders.indexOf(provider);
+ if (index == -1) {
+ return;
+ }
+ part= (IWorkbenchPart) fSelectionParts.get(index);
+ }
+ for (int i= 0; i < copiedListeners.length; i++) {
+ ((ISelectionListener)copiedListeners[i]).selectionChanged(part, selection);
+ }
+ }
+
+ /**
+ * Sets the console document for the specified process.
+ * If the document is <code>null</code> the mapping for the
+ * process is removed.
+ */
+ public void setConsoleDocument(IProcess process, IDocument doc) {
+ if (doc == null) {
+ fConsoleDocuments.remove(process);
+ } else {
+
+ fConsoleDocuments.put(process, doc);
+ }
+ }
+
+ /**
+ * Returns the correct document for the process, determining the current
+ * process if required (process argument is null).
+ */
+ public IDocument getConsoleDocument(IProcess process) {
+ return getConsoleDocument(process, true);
+ }
+ /**
+ * Returns the correct document for the process, determining the current
+ * process if specified.
+ */
+ public IDocument getConsoleDocument(IProcess process, boolean determineCurrentProcess) {
+ if (process != null) {
+ IDocument document= (IDocument) fConsoleDocuments.get(process);
+ if (document != null) {
+ return document;
+ }
+ document= new ConsoleDocument((IProcess) process);
+ fConsoleDocuments.put(process, document);
+ return document;
+ }
+
+ if (determineCurrentProcess) {
+ if (getCurrentProcess() == null) {
+ setCurrentProcess(determineCurrentProcess());
+ }
+
+ IProcess currentProcess= getCurrentProcess();
+ if (currentProcess != null) {
+ IDocument document= (IDocument) fConsoleDocuments.get(currentProcess);
+ if (document != null) {
+ return document;
+ }
+ document= new ConsoleDocument(currentProcess);
+ fConsoleDocuments.put(currentProcess, document);
+ return document;
+ }
+ }
+
+ return new ConsoleDocument(null);
+ }
+
+ /**
+ * Returns the color manager to use in the debug UI
+ */
+ public ColorManager getColorManager() {
+ return fColorManager;
+ }
+
+ /**
+ * @see AbstractUIPlugin#initializeDefaultPreferences
+ */
+ protected void initializeDefaultPreferences(IPreferenceStore prefs) {
+ prefs.setDefault(IDebugUIConstants.PREF_AUTO_SHOW_DEBUG_VIEW, true);
+ prefs.setDefault(IDebugUIConstants.PREF_AUTO_SHOW_PROCESS_VIEW, true);
+ prefs.setDefault(IDebugPreferenceConstants.CONSOLE_OPEN, true);
+
+ PreferenceConverter.setDefault(prefs, IDebugPreferenceConstants.CONSOLE_SYS_OUT_RGB, new RGB(0, 0, 255));
+ PreferenceConverter.setDefault(prefs, IDebugPreferenceConstants.CONSOLE_SYS_IN_RGB, new RGB(0, 200, 125));
+ PreferenceConverter.setDefault(prefs, IDebugPreferenceConstants.CONSOLE_SYS_ERR_RGB, new RGB(255, 0, 0));
+ }
+
+ /**
+ * @see ISelectionListener
+ */
+ public void selectionChanged(IWorkbenchPart part, ISelection sel) {
+ if (!(part instanceof LaunchesView)) {
+ return;
+ }
+
+ IWorkbenchWindow window= getActiveWorkbenchWindow();
+ IWorkbenchPage page= window.getActivePage();
+ if (page == null) {
+ return;
+ }
+ Object input= null;
+ if (sel instanceof IStructuredSelection) {
+ input= ((IStructuredSelection) sel).getFirstElement();
+ }
+ ConsoleView consoleView= (ConsoleView)page.findView(IDebugUIConstants.ID_CONSOLE_VIEW);
+ if (input == null) {
+ if (consoleView != null && getCurrentProcess() != null) {
+ consoleView.setViewerInput(getCurrentProcess());
+ } else {
+ IProcess currentProcess= determineCurrentProcess();
+ if (currentProcess == null) {
+ setCurrentProcess(currentProcess);
+ if (consoleView != null) {
+ consoleView.setViewerInput(currentProcess);
+ }
+ }
+ }
+ } else {
+ IProcess processFromInput= getProcessFromInput(input);
+ if (processFromInput == null) {
+ consoleView.setViewerInput(null, false);
+ setCurrentProcess(null);
+ return;
+ }
+ if (!processFromInput.equals(getCurrentProcess())) {
+ setCurrentProcess(processFromInput);
+ if (consoleView != null) {
+ consoleView.setViewerInput(processFromInput);
+ } else {
+ IDocument doc= getConsoleDocument(processFromInput);
+ if (doc != null) {
+ doc.addDocumentListener(this);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the current process to use as input for the console view.
+ * Returns the first <code>IProcess</code> that has a launch and is associated with a debug target.
+ * If no debug targets, returns the first <code>IProcess</code> found in the launch manager.
+ * Can return <code>null</code>.
+ */
+ public IProcess determineCurrentProcess() {
+
+ ILaunchManager launchManager= DebugPlugin.getDefault().getLaunchManager();
+ IDebugTarget[] debugTargets= launchManager.getDebugTargets();
+ for (int i = 0; i < debugTargets.length; i++) {
+ IDebugTarget target= debugTargets[i];
+ IProcess process= target.getProcess();
+ if (process != null && process.getLaunch() != null) {
+ return process;
+ }
+ }
+
+ IProcess[] processes= launchManager.getProcesses();
+ if ((processes != null) && (processes.length > 0)) {
+ return processes[0];
+ }
+
+ return null;
+ }
+
+ protected IProcess getProcessFromInput(Object input) {
+ IProcess processInput= null;
+ if (input instanceof IProcess) {
+ processInput= (IProcess) input;
+ } else
+ if (input instanceof ILaunch) {
+ IDebugTarget target= ((ILaunch) input).getDebugTarget();
+ if (target != null) {
+ processInput= target.getProcess();
+ } else {
+ IProcess[] processes= ((ILaunch) input).getProcesses();
+ if ((processes != null) && (processes.length > 0)) {
+ processInput= processes[0];
+ }
+ }
+ } else
+ if (input instanceof IDebugElement) {
+ processInput= ((IDebugElement) input).getProcess();
+ }
+
+ if ((processInput == null) || (processInput.getLaunch() == null)) {
+ return null;
+ } else {
+ return processInput;
+ }
+ }
+
+ /**
+ * @see IDocumentListener
+ */
+ public void documentAboutToBeChanged(final DocumentEvent e) {
+ // if the prefence is set, show the conosle
+ if (!getPreferenceStore().getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN)) {
+ return;
+ }
+
+ Display display= getDisplay();
+ if (display != null) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchWindow window = getActiveWorkbenchWindow();
+ if (window != null) {
+ IWorkbenchPage page= window.getActivePage();
+ if (page != null) {
+ try { // show the console
+ ConsoleView consoleView= (ConsoleView)page.findView(IDebugUIConstants.ID_CONSOLE_VIEW);
+ if(consoleView == null) {
+ IWorkbenchPart activePart= page.getActivePart();
+ consoleView= (ConsoleView)page.showView(IDebugUIConstants.ID_CONSOLE_VIEW);
+ consoleView.setViewerInput(getCurrentProcess());
+ //restore focus stolen by the creation of the console
+ page.activate(activePart);
+ } else {
+ page.bringToTop(consoleView);
+ }
+ } catch (PartInitException pie) {
+ }
+ }
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * @see IDocumentListener
+ */
+ public void documentChanged(DocumentEvent e) {
+ }
+
+ public IProcess getCurrentProcess() {
+ return fCurrentProcess;
+ }
+
+ public void setCurrentProcess(IProcess process) {
+ if (fCurrentProcess != null) {
+ getConsoleDocument(fCurrentProcess).removeDocumentListener(this);
+ }
+ fCurrentProcess= process;
+ if (fCurrentProcess != null) {
+ getConsoleDocument(fCurrentProcess).addDocumentListener(this);
+ }
+ }
+
+ /**
+ * @see IResourceChangeListener
+ */
+ public void resourceChanged(IResourceChangeEvent event) {
+ IResourceDelta delta= event.getDelta();
+ if (delta != null) {
+ try {
+ if (fgDeletedVisitor == null) {
+ fgDeletedVisitor= new ResourceDeletedVisitor();
+ }
+ delta.accept(fgDeletedVisitor, false);
+ } catch (CoreException ce) {
+ DebugUIUtils.logError(ce);
+ }
+ }
+ }
+
+
+ /**
+ * @see ILaunchListener
+ */
+ public void launchDeregistered(ILaunch launch) {
+ Display display= getDisplay();
+ if (display != null) {
+ display.syncExec(new Runnable () {
+ public void run() {
+ IProcess currentProcess= getCurrentProcess();
+ if (currentProcess != null && currentProcess.getLaunch() == null) {
+ ConsoleDocument doc= (ConsoleDocument)getConsoleDocument(currentProcess);
+ doc.removeDocumentListener(DebugUIPlugin.this);
+ doc.close();
+ setConsoleDocument(currentProcess, null);
+ fCurrentProcess= null;
+ }
+ }
+ });
+ }
+ setCurrentProcess(determineCurrentProcess());
+ setConsoleInput(getCurrentProcess());
+ }
+
+ /**
+ * Must not assume that will only be called from the UI thread.
+ *
+ * @see ILaunchListener
+ */
+ public void launchRegistered(final ILaunch launch) {
+ fRecentLaunch = launch;
+ updateHistories(launch);
+ switchToDebugPerspectiveIfPreferred(launch);
+
+ IProcess newProcess= null;
+
+ IDebugTarget target= launch.getDebugTarget();
+ if (target != null) {
+ newProcess= target.getProcess();
+ } else {
+ IProcess[] processes= launch.getProcesses();
+ if ((processes != null) && (processes.length > 0)) {
+ newProcess= processes[processes.length - 1];
+ }
+ }
+
+ Display display= getDisplay();
+ if (display != null) {
+ display.syncExec(new Runnable () {
+ public void run() {
+ IProcess[] processes= launch.getProcesses();
+ if (processes != null) {
+ for (int i= 0; i < processes.length; i++) {
+ ConsoleDocument doc= new ConsoleDocument(processes[i]);
+ doc.startReading();
+ setConsoleDocument(processes[i], doc);
+ }
+ }
+ }
+ });
+ }
+
+ setCurrentProcess(newProcess);
+ setConsoleInput(newProcess);
+ }
+
+ /**
+ * In a thread safe manner, switches the workbench to the debug perspective
+ * if the user preferences specify to do so.
+ */
+ protected void switchToDebugPerspectiveIfPreferred(final ILaunch launch) {
+ Display display= getDisplay();
+ if (display != null) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ String mode= launch.getLaunchMode();
+ boolean isDebug= mode.equals(ILaunchManager.DEBUG_MODE);
+ boolean doSwitch= userPreferenceToSwitchPerspective(isDebug);
+ if (doSwitch) {
+ if (showLaunch(launch)) {
+ switchToDebugPerspective0(launch, mode, false);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Must be called in the UI thread
+ */
+ public boolean userPreferenceToSwitchPerspective(boolean isDebug) {
+ IPreferenceStore prefs= getPreferenceStore();
+ return isDebug ? prefs.getBoolean(IDebugUIConstants.PREF_AUTO_SHOW_DEBUG_VIEW) : prefs.getBoolean(IDebugUIConstants.PREF_AUTO_SHOW_PROCESS_VIEW);
+ }
+
+ /**
+ * Sets the input console view viewer input for all
+ * consoles that exist in a thread safe manner.
+ */
+ protected void setConsoleInput(final IProcess process) {
+ Display display= getDisplay();
+ if (display != null) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchWindow[] windows= getWorkbench().getWorkbenchWindows();
+ for (int j= 0; j < windows.length; j++) {
+ IWorkbenchWindow window= windows[j];
+ IWorkbenchPage[] pages= window.getPages();
+ if (pages != null) {
+ for (int i= 0; i < pages.length; i++) {
+ IWorkbenchPage page= pages[i];
+ ConsoleView consoleView= (ConsoleView)page.findView(IDebugUIConstants.ID_CONSOLE_VIEW);
+ if (consoleView != null) {
+ consoleView.setViewerInput(process);
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Returns the collection of most recent debug launches, which
+ * can be empty.
+ *
+ * @return an array of launches
+ */
+ public ILaunch[] getDebugHistory() {
+ return fDebugHistory;
+ }
+
+ /**
+ * Returns the set of most recent run launches, which can be empty.
+ *
+ * @return an array of launches
+ */
+ public ILaunch[] getRunHistory() {
+ return fRunHistory;
+ }
+
+ /**
+ * Returns the most recent launch, or <code>null</code> if there
+ * have been no launches.
+ *
+ * @return the last launch, or <code>null</code> if none
+ */
+ public ILaunch getLastLaunch() {
+ return fRecentLaunch;
+ }
+
+ /**
+ * Adjust all histories for the given deleted resource.
+ */
+ protected void updateHistoriesForDeletedResource(IResource deletedResource) {
+ updateHistoryForDeletedResource(deletedResource, fDebugHistory, fDebugHistoryResources);
+ updateHistoryForDeletedResource(deletedResource, fRunHistory, fRunHistoryResources);
+ }
+
+ /**
+ * Remove the given resource from the resource history, and remove the corresponding
+ * launch from the launch history.
+ */
+ protected void updateHistoryForDeletedResource(IResource deletedResource, ILaunch[] launchHistory, IResource[] resourceHistory) {
+ int resourceLength = resourceHistory.length;
+ for (int i = 0; i < resourceLength; i++) {
+ if (deletedResource.equals(resourceHistory[i])) {
+ if (i < resourceLength - 1) {
+ System.arraycopy(resourceHistory, i + 1, resourceHistory, i, resourceLength - (i + 1));
+ System.arraycopy(launchHistory, i + 1, launchHistory, i, resourceLength - (i + 1));
+ }
+ resourceHistory[resourceLength - 1]= null;
+ launchHistory[resourceLength - 1]= null;
+ }
+ }
+ }
+
+ /**
+ * Given a launch, try to add it to both of the run & debug histories.
+ */
+ protected void updateHistories(ILaunch launch) {
+ if (isVisible(launch.getLauncher())) {
+ IResource resource= getResourceForLaunch(launch);
+ String launchMode= launch.getLaunchMode();
+ String otherLaunchMode= launchMode == ILaunchManager.DEBUG_MODE ? ILaunchManager.RUN_MODE : ILaunchManager.DEBUG_MODE;
+ ILaunch[] history= launchMode == ILaunchManager.DEBUG_MODE ? fDebugHistory : fRunHistory;
+ ILaunch[] otherHistory= otherLaunchMode == ILaunchManager.RUN_MODE ? fRunHistory : fDebugHistory;
+ IResource[] resourceHistory= launchMode == ILaunchManager.DEBUG_MODE ? fDebugHistoryResources : fRunHistoryResources;
+ IResource[] otherResourceHistory= otherLaunchMode == ILaunchManager.RUN_MODE ? fRunHistoryResources : fDebugHistoryResources;
+ updateHistory(history, launchMode, launch, resource, resourceHistory);
+ updateHistory(otherHistory, otherLaunchMode, launch, resource, otherResourceHistory);
+ }
+ }
+
+ /**
+ * Add the given launch to the given history (whose mode is specified by
+ * historyMode) if the launcher used by the launch supports the history mode.
+ */
+ protected void updateHistory(ILaunch[] history, String historyMode, ILaunch launch, IResource resource, IResource[] resourceHistory) {
+
+ // First make sure the launcher used supports the mode of the history list
+ ILauncher launcher= launch.getLauncher();
+ Set supportedLauncherModes= launcher.getModes();
+ if (!supportedLauncherModes.contains(historyMode)) {
+ return;
+ }
+
+ // Look for the launch in the history list
+ int index;
+ boolean found= false;
+ for (index= 0; index < history.length; index++) {
+ ILaunch historyLaunch= history[index];
+ if (historyLaunch != null && historyLaunch.getElement().equals(launch.getElement()) &&
+ launcher.equals(historyLaunch.getLauncher())) {
+ found= true;
+ break;
+ }
+ }
+
+ //It's already listed as the most recent launch, so nothing to do
+ if (index == 0 && found) {
+ return;
+ }
+
+ // It's in the history, but not the most recent, so make it the most recent
+ if (found) {
+ //removes from old position
+ System.arraycopy(history, index + 1, history, index, history.length - (index + 1));
+ System.arraycopy(resourceHistory, index + 1, resourceHistory, index, resourceHistory.length - (index + 1));
+ }
+
+ // It's not in the history, so add it to the beginning, removing the last
+ // launch in the list if the list is already at maximum size
+ System.arraycopy(history, 0, history, 1, history.length - 1);
+ System.arraycopy(resourceHistory, 0, resourceHistory, 1, resourceHistory.length - 1);
+ history[0]= launch;
+ resourceHistory[0]= resource;
+ }
+
+ /**
+ * Return the IResource adapter associated with the given launch, or null
+ * if there is none.
+ */
+ protected IResource getResourceForLaunch(ILaunch launch) {
+ Object candidate= launch.getElement();
+ IResource resource= null;
+ // If the launched element doesn't have an IResource adapter, work up the parental
+ // chain until we find someone who does
+ while (candidate instanceof IAdaptable) {
+ IResource candidateResource= (IResource)((IAdaptable)candidate).getAdapter(IResource.class);
+ if (candidateResource != null) {
+ return candidateResource;
+ }
+ IWorkbenchAdapter workbenchAdapter= (IWorkbenchAdapter)((IAdaptable)candidate).getAdapter(IWorkbenchAdapter.class);
+ if (workbenchAdapter != null) {
+ candidate= workbenchAdapter.getParent(candidate);
+ } else {
+ return null;
+ }
+ }
+ return resource;
+ }
+
+ public void addEventFilter(IDebugUIEventFilter filter) {
+ fEventFilters.add(filter);
+ }
+
+ /**
+ * Removes the event filter after the current set
+ * of events posted to the queue have been processed.
+ */
+ public void removeEventFilter(final IDebugUIEventFilter filter) {
+ Display display= getDisplay();
+ Runnable runnable = new Runnable() {
+ public void run() {
+ fEventFilters.remove(filter);
+ }
+ };
+ display.asyncExec(runnable);
+ }
+
+ /**
+ * Returns whether the given launcher should be visible in the UI.
+ * If a launcher is not visible, it will not appear
+ * in the UI - i.e. not as a default launcher, not in the run/debug
+ * drop downs, and not in the launch history.
+ * Based on the public attribute.
+ */
+ public boolean isVisible(ILauncher launcher) {
+ IConfigurationElement e = launcher.getConfigurationElement();
+ String publc= e.getAttribute("public");
+ if (publc == null || publc.equals("true")) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns whether the given launcher specifies a wizard.
+ */
+ public boolean hasWizard(ILauncher launcher) {
+ IConfigurationElement e = launcher.getConfigurationElement();
+ return e.getAttribute("wizard") != null;
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIResources.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIResources.properties
new file mode 100644
index 000000000..09ce262dc
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIResources.properties
@@ -0,0 +1,252 @@
+##############################################################
+# Licensed Materials - Property of IBM,
+# WebSphere Studio Workbench
+# (c) Copyright IBM Corp 2001
+##############################################################
+
+##############################################################
+# DebugUIPlugin
+##############################################################
+debug_ui_plugin.switch_perspective.error.title=Problem Switching to the Debug Perspective
+debug_ui_plugin.switch_perspective.error.message=Exceptions occurred switching to the specified debug layout
+
+##############################################################
+# Console property page
+##############################################################
+console_preferences.description=Console text color settings.
+console_preferences.out=Standard Out:
+console_preferences.err=Standard Error:
+console_preferences.in=Standard In:
+console_preferences.font=Console font setting:
+
+##############################################################
+# Debug preference page
+##############################################################
+debug_preferences.debug=Switch to Debug view when debugging
+debug_preferences.run=Switch to Process view when running
+debug_preferences.console_open=Show console when there is program output
+
+##############################################################
+# Launcher property page
+##############################################################
+launcher_preferences.description=Select default launcher
+launcher_preferences.run_debug=Run/Debug
+launcher_preferences.none=none
+launcher_preferences.error.title=Launcher property page
+launcher_preferences.error.message=Exceptions occurred saving the launcher preferences
+
+##############################################################
+# Launch wizard
+##############################################################
+launch_wizard.title.debug=Debug
+launch_wizard.title.run=Run
+
+##############################################################
+# Launch wizard project page
+##############################################################
+launch_wizard_project_page.title=Select Project
+launch_wizard_project_page.select_elements= Select a project for the launch context.
+launch_wizard_project_page.select_error_elements=No projects available.
+launch_wizard_project_page.pattern_label=Enter a pattern to select a range of projects
+
+##############################################################
+# Launch wizard page
+##############################################################
+launch_wizard_page.title=Select Launcher
+launch_wizard_page.launcher= Select a launcher:
+launch_wizard_page.select_error_launcher=No launchers registered.
+launch_wizard_page.default_launcher=Set as &default launcher
+
+launch_wizard_node.error.title=Problem Opening Wizard
+launch_wizard_node.error.message=The selected wizard could not be started.
+
+##############################################################
+# Action resources
+##############################################################
+
+add_to_inspector_action.text=&Inspect
+add_to_inspector_action.toolTipText=Adds selected variables to inspector
+
+change_variable_value_action.text=&Change Variable Value
+change_variable_value_action.description=Changes the value of a simple type variable
+change_variable_value_action.error.title=Setting variable value
+change_variable_value_action.error.message=Setting the variable value failed
+change_variable_value_action.dialog.message=Enter the new value for the variable \"{0}\"
+change_variable_value_action.dialog.invalid=Value is not valid for the variable \"{0}\"
+change_variable_value_action.dialog.title=Change Variable Value
+
+clear_output_action.text=&Clear Output
+clear_output_action.toolTipText=Clear output
+
+copy_action.label=Copy@Ctrl+C
+copy_action.tooltip=Copy
+copy_action.description=Copy
+
+copy_to_clipboard_action.text=&Copy Stack
+copy_to_clipboard_action.toolTipText=Copy to clipboard
+##only needed due to inheritance
+copy_to_clipboard_action.status=
+
+cut_action.label=Cut@Ctrl+X
+cut_action.tooltip=Cut
+cut_action.description=Cut
+
+debug_action.text=&Debug@F9
+debug_action.toolTipText=Debug
+
+disconnect_action.text=&Disconnect
+disconnect_action.toolTipText=Disconnect
+disconnect_action.status=Disconnect failed
+disconnect_action.error.title=Disconnect
+disconnect_action.error.message=Exceptions occurred attempting to disconnect
+
+enable_disable_breakpoint_action.text=&Enable/Disable
+enable_disable_breakpoint_action.text.enable=&Enable
+enable_disable_breakpoint_action.text.disable=&Disable
+enable_disable_breakpoint_action.error.title=Enabling/disabling breakpoints
+enable_disable_breakpoint_action.error.message=Exceptions occurred enabling/disabling the breakpoint(s)
+
+execution_action.error.title= Error finding default launchers
+execution_action.error.message=Exceptions occurred determining the default launcher(s)
+execution_action.status=Error occurred retrieving default launcher
+
+find_replace_action.label=Find/Replace@Ctrl+F
+find_replace_action.tooltip=Find/Replace
+find_replace_action.image=
+find_replace_action.description=Find/Replace
+
+goto_line_action.label=Goto Line@Ctrl+G
+goto_line_action.tooltip=Goto Line
+goto_line_action.image=
+goto_line_action.description=Goto Line
+goto_line_action.dialog.title=Goto Line
+goto_line_action.dialog.message=Enter line number:
+goto_line_action.dialog.invalid_input=Not a number
+goto_line_action.dialog.invalid_range=Line number out of range
+
+launch_with_action.text.debug=Debug
+launch_with_action.text.run=Run
+
+open_breakpoint_marker_action.text=&Go to File
+open_breakpoint_marker_action.toolTipText=Go to file for breakpoint
+
+paste_action.label=Paste@Ctrl+V
+paste_action.tooltip=Paste
+paste_action.description=Pastes clipboard text
+
+relaunch_action.text=Re&launch
+relaunch_action.toolTipText=Relaunch
+##only needed due to inheritance
+relaunch_action.status=
+
+remove_all_breakpoints_action.text=Remove &All
+remove_all_breakpoints_action.toolTipText=Remove all breakpoints
+remove_all_breakpoints_action.error.title=Removing all breakpoints
+remove_all_breakpoints_action.error.message=Exceptions occurred removing breakpoints
+remove_all_breakpoints_action.status=Breakpoint(s) removal failed
+
+remove_all_from_inspector_action.text=Remove &All
+remove_all_from_inspector_action.toolTipText=Remove all variables from inspector
+
+remove_all_terminated_action.text=Remove &All Terminated
+remove_all_terminated_action.toolTipText=Remove all terminated launches
+
+remove_breakpoint_action.text=&Remove
+remove_breakpoint_action.toolTipText=Remove selected breakpoints
+remove_breakpoint_action.error.title=Removing a breakpoint
+remove_breakpoint_action.error.message=Exceptions occurred attempting to remove a breakpoint
+remove_breakpoint_action.status=Breakpoint(s) removal failed
+
+remove_from_inspector_action.text=&Remove
+remove_from_inspector_action.toolTipText=Remove selected variables from inspector
+
+resume_action.text=&Resume
+resume_action.toolTipText=Resume
+resume_action.status=Resume failed
+resume_action.error.title=Resume
+resume_action.error.message=Exceptions occurred attempting to resume
+
+run_action.text=R&un@Alt+F9
+run_action.toolTipText=Run
+
+select_all_action.label=Select All@Ctrl+A
+select_all_action.tooltip=Select All
+select_all_action.description=Select All
+
+show_qualified_action.toolTipText.show=Show qualified names
+show_qualified_action.toolTipText.hide=Hide qualified names
+
+show_types_action.toolTipText.show=Show types names
+show_types_action.toolTipText.hide=Hide types names
+
+step_into_action.text=Step &Into
+step_into_action.toolTipText=Step into
+step_into_action.status=Step into failed
+step_into_action.error.title=Step Into
+step_into_action.error.message=Exceptions occurred attempting to step into the frame
+
+step_over_action.text=Step O&ver
+step_over_action.toolTipText=Step over
+step_over_action.status=Step over failed
+step_over_action.error.title=Stop over
+step_over_action.error.message=Exceptions occurred attempting to step over the frame
+
+step_return_action.text=R&un to return
+step_return_action.toolTipText=Run to return
+step_return_action.status=Run to return failed
+step_return_action.error.title=Run to return
+step_return_action.error.message=Exceptions occurred attempting to run to return of the frame
+
+suspend_action.text=&Suspend
+suspend_action.toolTipText=Suspend
+suspend_action.status=Suspend failed
+suspend_action.error.title=Suspend
+suspend_action.error.message=Exceptions occurred attempting to suspend
+
+terminate_action.text=&Terminate
+terminate_action.toolTipText=Terminate
+terminate_action.status=Terminate failed.
+terminate_action.error.title=Terminate
+terminate_action.error.message=Exceptions occurred attempting to terminate
+
+terminate_all_action.text=Termi&nate All
+terminate_all_action.toolTipText=Terminate all
+terminate_all_action.error.title=Terminate all
+terminate_all_action.error.message=Exceptions occurred attempting to terminate all
+terminate_all_action.status=Terminate all failed
+
+terminate_and_remove_action.text=Ter&minate and Remove
+terminate_and_remove_action.toolTipText=Terminate and Remove
+terminate_and_remove_action.error.title=Terminate and remove
+terminate_and_remove_action.error.message=Exceptions occurred attempting to terminate and remove
+terminate_and_remove_action.status=Terminate and remove failed
+
+##############################################################
+# Label provider
+##############################################################
+label_provider.terminated=<terminated>
+label_provider.unknown=<unknown>
+
+##############################################################
+# Breakpoint Labels
+##############################################################
+breakpoint_label.line_number=Line:
+breakpoint_label.unknown_line_number=<unknown>
+breakpoint_label.unknown_resource=ERROR
+breakpoint_label.expired=<expired>
+breakpoint_label.hit_count=<Hit Count: {0}>
+
+##############################################################
+# Delegating Model Presentation Labels
+##############################################################
+presentation.breakpoint_label=Breakpoint
+
+##############################################################
+# Debug views title tool tips
+##############################################################
+debug_view.title_toolTipText=Debug sessions and associated program stacks
+launches_view.title_toolTipText=System processes
+variables_view.title_toolTipText=Variables and their values for a selected stack frame
+breakpoints_view.title_toolTipText= Breakpoints in the workbench
+inspector_view.title_toolTipText=Evaluated expression
+console_view.title_toolTipText=Program output \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIUtils.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIUtils.java
new file mode 100644
index 000000000..c6ab08c97
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIUtils.java
@@ -0,0 +1,74 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * This class serves as a location for utility methods for the debug UI.
+ */
+public class DebugUIUtils {
+
+ private static ResourceBundle fgResourceBundle;
+
+ /**
+ * Utility method with conventions
+ */
+ public static void errorDialog(Shell shell, String resourcePrefix, IStatus s) {
+ String message= getResourceString(resourcePrefix + "message");
+ // if the 'message' resource string and the IStatus' message are the same,
+ // don't show both in the dialog
+ if (s != null && message.equals(s.getMessage())) {
+ message= null;
+ }
+ String title= getResourceString(resourcePrefix + "title");
+ ErrorDialog.openError(shell, title, message, s);
+ }
+
+ /**
+ * Utility method
+ */
+ public static String getResourceString(String key) {
+ if (fgResourceBundle == null) {
+ fgResourceBundle= getResourceBundle();
+ }
+ if (fgResourceBundle != null) {
+ return fgResourceBundle.getString(key);
+ } else {
+ return "!" + key + "!";
+ }
+ }
+
+ /**
+ * Returns the resource bundle used by all parts of the debug ui package.
+ */
+ public static ResourceBundle getResourceBundle() {
+ try {
+ return ResourceBundle.getBundle("org.eclipse.debug.internal.ui.DebugUIResources");
+ } catch (MissingResourceException e) {
+ MessageDialog.openError(DebugUIPlugin.getActiveWorkbenchWindow().getShell(), "Error", e.toString());
+ }
+ return null;
+ }
+
+ /**
+ * Convenience method to log internal UI errors
+ */
+ public static void logError(Exception e) {
+ if (DebugUIPlugin.getDefault().isDebugging()) {
+ System.out.println("Internal error logged from UI: ");
+ e.printStackTrace();
+ System.out.println();
+ }
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugView.java
new file mode 100644
index 000000000..a8d8512b2
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugView.java
@@ -0,0 +1,506 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.*;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.ui.*;
+import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.texteditor.ITextEditor;
+
+public class DebugView extends LaunchesView {
+
+ protected final static String PREFIX= "debug_view.";
+
+ protected ControlAction fResumeAction;
+ protected ControlAction fSuspendAction;
+ protected ControlAction fStepIntoAction;
+ protected ControlAction fStepOverAction;
+ protected ControlAction fStepReturnAction;
+ protected ControlAction fCopyToClipboardAction;
+
+ protected ShowQualifiedAction fShowQualifiedAction;
+
+ /**
+ * A marker for the source selection and icon for an
+ * instruction pointer. This marker is transient.
+ */
+ private IMarker fInstructionPointer;
+ private boolean fShowingMarker = false;
+
+ // marker attributes
+ private final static String[] fgStartEnd =
+ new String[] {IMarker.CHAR_START, IMarker.CHAR_END};
+
+ private final static String[] fgLineStartEnd =
+ new String[] {IMarker.LINE_NUMBER, IMarker.CHAR_START, IMarker.CHAR_END};
+
+ /**
+ * The editor associated with this debug view,
+ * or <code>null</code> if none.
+ */
+ private IEditorPart fEditor;
+ private Integer fEditorMemento;
+ private static final String DEBUG_EDITOR= DebugUIPlugin.getDefault().getDescriptor().getUniqueIdentifier() + ".DEBUG_EDITOR";
+
+
+ /**
+ * Creates a debug view and an instruction pointer marker for the view
+ */
+ public DebugView() {
+ try {
+ fInstructionPointer = ResourcesPlugin.getWorkspace().getRoot().createMarker(IInternalDebugUIConstants.INSTRUCTION_POINTER);
+ } catch (CoreException e) {
+ DebugUIUtils.logError(e);
+ }
+ }
+
+ /**
+ * @see IWorkbenchPart
+ */
+ public void dispose() {
+ if (fViewer != null) {
+ fViewer.removeSelectionChangedListener(this);
+ }
+ super.dispose();
+ fEditor = null;
+ }
+
+ /**
+ * Returns the configured instruction pointer.
+ * Selection is based on the line number OR char start and char end.
+ */
+ protected IMarker getInstructionPointer(final int lineNumber, final int charStart, final int charEnd, final boolean isTopStackFrame) {
+
+ IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ if (lineNumber == -1) {
+ fInstructionPointer.setAttributes(fgStartEnd,
+ new Object[] {new Integer(charStart), new Integer(charEnd)});
+ } else {
+ fInstructionPointer.setAttributes(fgLineStartEnd,
+ new Object[] {new Integer(lineNumber), new Integer(charStart), new Integer(charEnd)});
+ }
+ }
+ };
+
+ try {
+ workspace.run(runnable, null);
+ } catch (CoreException ce) {
+ DebugUIUtils.logError(ce);
+ }
+
+ return fInstructionPointer;
+ }
+
+ /**
+ * Initializes the actions of this view.
+ */
+ protected void initializeActions(LaunchesViewer viewer) {
+ super.initializeActions(viewer);
+
+ fResumeAction= new ControlAction(viewer, new ResumeActionDelegate());
+ viewer.addSelectionChangedListener(fResumeAction);
+ fResumeAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_RESUME));
+ fResumeAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_RESUME));
+ fResumeAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESUME));
+ fResumeAction.setEnabled(false);
+
+ fSuspendAction= new ControlAction(viewer, new SuspendActionDelegate());
+ viewer.addSelectionChangedListener(fSuspendAction);
+ fSuspendAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_SUSPEND));
+ fSuspendAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_SUSPEND));
+ fSuspendAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_SUSPEND));
+ fSuspendAction.setEnabled(false);
+
+ fStepIntoAction= new ControlAction(viewer, new StepIntoActionDelegate());
+ viewer.addSelectionChangedListener(fStepIntoAction);
+ fStepIntoAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_STEPINTO));
+ fStepIntoAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEPINTO));
+ fStepIntoAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEPINTO));
+ fStepIntoAction.setEnabled(false);
+
+ fStepOverAction= new ControlAction(viewer, new StepOverActionDelegate());
+ viewer.addSelectionChangedListener(fStepOverAction);
+ fStepOverAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_STEPOVER));
+ fStepOverAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEPOVER));
+ fStepOverAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEPOVER));
+ fStepOverAction.setEnabled(false);
+
+ fStepReturnAction= new ControlAction(viewer, new StepReturnActionDelegate());
+ viewer.addSelectionChangedListener(fStepReturnAction);
+ fStepReturnAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_STEPRETURN));
+ fStepReturnAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_STEPRETURN));
+ fStepReturnAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STEPRETURN));
+ fStepReturnAction.setEnabled(false);
+
+ fCopyToClipboardAction= new ControlAction(viewer, new CopyToClipboardActionDelegate());
+
+ fShowQualifiedAction= new ShowQualifiedAction(viewer);
+ fShowQualifiedAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_QUALIFIED_NAMES));
+ fShowQualifiedAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_QUALIFIED_NAMES));
+ fShowQualifiedAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_QUALIFIED_NAMES));
+ fShowQualifiedAction.setChecked(false);
+ }
+
+ /**
+ * Configures the toolBar
+ */
+ protected void configureToolBar(IToolBarManager tbm) {
+ tbm.add(fResumeAction);
+ tbm.add(fSuspendAction);
+ tbm.add(fTerminateAction);
+ tbm.add(fDisconnectAction);
+ tbm.add(fRemoveTerminatedAction);
+ tbm.add(new Separator("#StepGroup"));
+ tbm.add(fStepIntoAction);
+ tbm.add(fStepOverAction);
+ tbm.add(fStepReturnAction);
+ tbm.add(new Separator("#RenderGroup"));
+ tbm.add(fShowQualifiedAction);
+ }
+
+ /**
+ * The selection has changed in the viewer. Show the
+ * associated source code if it is a stack frame.
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ super.selectionChanged(event);
+ showMarkerForCurrentSelection();
+ }
+
+ /**
+ * Opens a marker for the current selection if it is a stack frame.
+ * If the current selection is a thread, deselection occurs.
+ * Otherwise, nothing will happen.
+ */
+ protected void showMarkerForCurrentSelection() {
+ if (!fShowingMarker) {
+ try {
+ fShowingMarker = true;
+ ISelection selection= fViewer.getSelection();
+ Object obj= null;
+ if (selection instanceof IStructuredSelection) {
+ obj= ((IStructuredSelection) selection).getFirstElement();
+ }
+ if (obj == null || !(obj instanceof IDebugElement)) {
+ return;
+ }
+
+ IDebugElement debugElement= (IDebugElement) obj;
+ if (debugElement.getElementType() != IDebugElement.STACK_FRAME) {
+ return;
+ }
+
+ IStackFrame stackFrame= (IStackFrame) debugElement;
+
+ // Get the corresponding element.
+ ISourceLocator locator= stackFrame.getSourceLocator();
+ if (locator == null) {
+ return;
+ }
+ Object sourceElement = locator.getSourceElement(stackFrame);
+ if (sourceElement == null) {
+ return;
+ }
+
+ // translate to an editor input using the model presentation
+ IDebugModelPresentation presentation = getPresentation(stackFrame.getModelIdentifier());
+ IEditorInput editorInput = null;
+ String editorId= null;
+ if (presentation != null) {
+ editorInput= presentation.getEditorInput(sourceElement);
+ editorId= presentation.getEditorId(editorInput, sourceElement);
+ }
+
+ if (editorInput != null) {
+ boolean isTopStackFrame= false;
+ int lineNumber= 0;
+ try {
+ isTopStackFrame= stackFrame.getThread().getTopStackFrame() == stackFrame;
+ } catch (DebugException de) {
+ }
+ try {
+ lineNumber= stackFrame.getLineNumber();
+ } catch (DebugException de) {
+ }
+ openEditorAndSetMarker(editorInput, editorId, lineNumber, -1, -1, isTopStackFrame);
+ }
+ } finally {
+ fShowingMarker= false;
+ }
+ }
+ }
+
+ /**
+ * Get the active window and open/bring to the front an editor on the source element.
+ * Selection is based on the line number OR the char start and end.
+ */
+ protected void openEditorAndSetMarker(IEditorInput input, String editorId, int lineNumber, int charStart, int charEnd, boolean isTopStackFrame) {
+ IWorkbenchWindow dwindow= getSite().getWorkbenchWindow();
+ if (dwindow == null) {
+ return;
+ }
+
+
+ IWorkbenchPage page= dwindow.getActivePage();
+ IEditorPart editor= null;
+ IEditorPart[] editorParts= page.getEditors();
+
+
+ // restore editor on startup
+ if (fEditorMemento != null) {
+ if (editorParts.length > fEditorMemento.intValue())
+ fEditor = editorParts[fEditorMemento.intValue()];
+ fEditorMemento = null;
+ }
+
+
+ for (int i= 0; i < editorParts.length; i++) {
+ IEditorPart part= editorParts[i];
+ if (input.equals(part.getEditorInput())) {
+ editor= part;
+ break;
+ }
+ }
+
+ if (editor == null) {
+ if (fEditor != null) {
+ if (!fEditor.isDirty()) {
+ page.closeEditor(fEditor, false);
+ }
+ }
+ try {
+ editor= page.openEditor(input, editorId);
+ fEditor = editor;
+ page.activate(this);
+ } catch (PartInitException e) {
+ DebugUIUtils.logError(e);
+ }
+
+ } else {
+ page.bringToTop(editor);
+ }
+
+ if (editor != null && (lineNumber >= 0 || charStart >= 0)) {
+ //have an editor and either a lineNumber or a starting character
+ IMarker marker= getInstructionPointer(lineNumber, charStart, charEnd, isTopStackFrame);
+ editor.gotoMarker(marker);
+ }
+ }
+
+ /**
+ * Deselect any source in the active editor that was 'programmatically' selected by
+ * the debugger.
+ */
+ public void clearSourceSelection() {
+ // Get the active editor
+ IEditorPart editor= getSite().getPage().getActiveEditor();
+ if ((editor == null) || !(editor instanceof ITextEditor)) {
+ return;
+ }
+ ITextEditor textEditor= (ITextEditor)editor;
+
+ // Get the current text selection in the editor. If there is none,
+ // then there's nothing to do
+ ITextSelection textSelection= (ITextSelection)textEditor.getSelectionProvider().getSelection();
+ if (textSelection.isEmpty()) {
+ return;
+ }
+ int startChar= textSelection.getOffset();
+ int endChar= startChar + textSelection.getLength() - 1;
+ int startLine= textSelection.getStartLine();
+
+ // Check to see if the current selection looks the same as the last 'programmatic'
+ // selection in fSourceLocationMarker. If not, it must be a user selection, which
+ // we leave alone. In practice, we can leave alone any user selections on other lines,
+ // but if the user makes a selection on the same line as the last programmatic selection,
+ // it will get cleared.
+ int lastCharStart= fInstructionPointer.getAttribute(IMarker.CHAR_START, -1);
+ int lastCharEnd= fInstructionPointer.getAttribute(IMarker.CHAR_END, -1);;
+ if (lastCharStart == -1) {
+ // subtract 1 since editor is 0-based
+ if (fInstructionPointer.getAttribute(IMarker.LINE_NUMBER, -1) - 1 != startLine) {
+ return;
+ }
+ } else if ((lastCharStart != startChar) ||
+ (lastCharEnd != endChar)) {
+ return;
+ }
+
+ ITextSelection nullSelection= getNullSelection(startLine, startChar);
+ textEditor.getSelectionProvider().setSelection(nullSelection);
+ }
+
+ /**
+ * Creates and returns an ITextSelection that is a zero-length selection located at the
+ * start line and start char.
+ */
+ protected ITextSelection getNullSelection(final int startLine, final int startChar) {
+ return new ITextSelection() {
+ public int getStartLine() {
+ return startLine;
+ }
+ public int getEndLine() {
+ return startLine;
+ }
+ public int getOffset() {
+ return startChar;
+ }
+ public String getText() {
+ return "";
+ }
+ public int getLength() {
+ return 0;
+ }
+ public boolean isEmpty() {
+ return true;
+ }
+ };
+ }
+ /**
+ * Updates the enablement of the buttons in the view
+ */
+ protected void updateButtons() {
+ ISelection s= fViewer.getSelection();
+ if (s instanceof IStructuredSelection) {
+ IStructuredSelection selection= (IStructuredSelection) s;
+ fTerminateAction.selectionChanged(selection);
+ fDisconnectAction.selectionChanged(selection);
+ fSuspendAction.selectionChanged(selection);
+ fResumeAction.selectionChanged(selection);
+ fStepIntoAction.selectionChanged(selection);
+ fStepOverAction.selectionChanged(selection);
+ fStepReturnAction.selectionChanged(selection);
+ }
+ fRemoveTerminatedAction.update();
+ }
+
+ /**
+ * Adds items to the context menu.
+ */
+ protected void fillContextMenu(IMenuManager menu) {
+ menu.add(new Separator(IDebugUIConstants.EMPTY_EDIT_GROUP));
+ menu.add(new Separator(IDebugUIConstants.EDIT_GROUP));
+ menu.add(fCopyToClipboardAction);
+ menu.add(new Separator(IDebugUIConstants.EMPTY_STEP_GROUP));
+ menu.add(new Separator(IDebugUIConstants.STEP_GROUP));
+ menu.add(fStepIntoAction);
+ menu.add(fStepOverAction);
+ menu.add(fStepReturnAction);
+ menu.add(new Separator(IDebugUIConstants.EMPTY_THREAD_GROUP));
+ menu.add(new Separator(IDebugUIConstants.THREAD_GROUP));
+ menu.add(fResumeAction);
+ menu.add(fSuspendAction);
+ menu.add(fTerminateAction);
+ menu.add(fDisconnectAction);
+ menu.add(new Separator(IDebugUIConstants.EMPTY_LAUNCH_GROUP));
+ menu.add(new Separator(IDebugUIConstants.LAUNCH_GROUP));
+ menu.add(fTerminateAndRemoveAction);
+ menu.add(fTerminateAllAction);
+ menu.add(fRemoveTerminatedAction);
+ menu.add(fRelaunchAction);
+ menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
+ menu.add(new Separator(IDebugUIConstants.RENDER_GROUP));
+ menu.add(fShowQualifiedAction);
+ menu.add(new Separator(IDebugUIConstants.PROPERTY_GROUP));
+ fPropertyDialogAction.setEnabled(fPropertyDialogAction.isApplicableForSelection());
+ menu.add(fPropertyDialogAction);
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ /**
+ * Returns the content provider to use for this viewer
+ * of this view.
+ */
+ protected DebugContentProvider getContentProvider() {
+ return new DebugContentProvider();
+ }
+
+ /**
+ * Auto-expand and select the given element - must be called in UI thread.
+ * This is used to implement auto-expansion-and-select on a SUSPEND event.
+ */
+ public void autoExpand(Object element) {
+ Object selectee = element;
+ if (element instanceof IThread) {
+ // try the top stack frame
+ try {
+ selectee = ((IThread)element).getTopStackFrame();
+ } catch (DebugException de) {
+ }
+ if (selectee == null) {
+ selectee = element;
+ }
+ } else if (element instanceof ILaunch) {
+ Object dt = ((ILaunch)element).getDebugTarget();
+ if (dt != null) {
+ selectee= dt;
+ }
+ }
+ //ensures that the child item exists in the viewer widget
+ //set selection only works if the child exists
+ fViewer.refresh(element);
+ fViewer.setSelection(new StructuredSelection(selectee), true);
+ }
+
+ /**
+ * Returns the resource bundle prefix for this action
+ */
+ protected String getPrefix(){
+ return PREFIX;
+ }
+
+ /**
+ * @see IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
+ */
+ public void partClosed(IWorkbenchPart part) {
+ if (part.equals(fEditor)) {
+ fEditor = null;
+ }
+ super.partClosed(part);
+ }
+
+ /**
+ * @see IViewPart
+ */
+ public void init(IViewSite site, IMemento memento) throws PartInitException {
+ super.init(site,memento);
+ if (memento != null) {
+ fEditorMemento = memento.getInteger(DEBUG_EDITOR);
+ }
+ }
+
+ /**
+ * @see IViewPart
+ */
+ public void saveState(IMemento memento) {
+ if (fEditor != null) {
+ IWorkbenchPage page = getSite().getPage();
+ if (page != null) {
+ IEditorPart[] editors = page.getEditors();
+ for (int i = 0; i < editors.length; i++) {
+ if (fEditor.equals(editors[i])) {
+ memento.putInteger(DEBUG_EDITOR, i);
+ break;
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
new file mode 100644
index 000000000..43388f5e2
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java
@@ -0,0 +1,460 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.*;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.*;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * A model presentation that delegates to the appropriate extension. This
+ * presentation contains a table of specialized presentations that are defined
+ * as <code>org.eclipse.debug.ui.debugModelPresentations</code> extensions. When
+ * asked to render an object from a debug model, this presentation delegates
+ * to the extension registered for that debug model.
+ */
+public class DelegatingModelPresentation implements IDebugModelPresentation {
+
+ private final static String TOP_PREFIX= "presentation.";
+ private final static String BREAKPOINT_LABEL= TOP_PREFIX + "breakpoint_label";
+
+ /**
+ * A mapping of attribute ids to their values
+ * @see IDebugModelPresentation#setAttribute
+ */
+ protected HashMap fAttributes= new HashMap(3);
+ /**
+ * A table of label providers keyed by debug model identifiers.
+ */
+ protected HashMap fLabelProviders= new HashMap(5);
+
+ // Resource String keys
+ private static final String PREFIX= "label_provider.";
+ private static final String TERMINATED= PREFIX + "terminated";
+ private static final String UNKNOWN= PREFIX + "unknown";
+
+ /**
+ * Constructs a new DelegatingLabelProvider that delegates to extensions
+ * of kind <code>org.eclipse.debug.ui.debugLabelProvider</code>
+ */
+ public DelegatingModelPresentation() {
+ IPluginDescriptor descriptor= DebugUIPlugin.getDefault().getDescriptor();
+ IExtensionPoint point= descriptor.getExtensionPoint(IDebugUIConstants.ID_DEBUG_MODEL_PRESENTATION);
+ if (point != null) {
+ IExtension[] extensions= point.getExtensions();
+ for (int i= 0; i < extensions.length; i++) {
+ IExtension extension= extensions[i];
+ IConfigurationElement[] configElements= extension.getConfigurationElements();
+ for (int j= 0; j < configElements.length; j++) {
+ IConfigurationElement elt= configElements[j];
+ String id= elt.getAttribute("id");
+ if (id != null) {
+ IDebugModelPresentation lp= new LazyModelPresentation(elt);
+ fLabelProviders.put(id, lp);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Delegate to all extensions.
+ *
+ * @see ILabelProvider
+ */
+ public void addListener(ILabelProviderListener listener) {
+ Iterator i= fLabelProviders.values().iterator();
+ while (i.hasNext()) {
+ ((ILabelProvider) i.next()).addListener(listener);
+ }
+ }
+
+ /**
+ * Delegate to all extensions.
+ *
+ * @see ILabelProvider
+ */
+ public void dispose() {
+ Iterator i= fLabelProviders.values().iterator();
+ while (i.hasNext()) {
+ ((ILabelProvider) i.next()).dispose();
+ }
+ }
+
+ /**
+ * Returns an image for the item
+ * Can return <code>null</code>
+ */
+ public Image getImage(Object item) {
+ if (item instanceof IDebugElement || item instanceof IMarker) {
+ IDebugModelPresentation lp= getConfiguredPresentation(item);
+ if (lp != null) {
+ Image image= lp.getImage(item);
+ if (image != null) {
+ return image;
+ }
+ }
+ // default to show the simple element name
+ return getDefaultImage(item);
+ } else {
+ ImageRegistry iRegistry= DebugUIPlugin.getDefault().getImageRegistry();
+ if (item instanceof IProcess) {
+ if (((IProcess) item).isTerminated()) {
+ return iRegistry.get(IDebugUIConstants.IMG_OBJS_OS_PROCESS_TERMINATED);
+ } else {
+ return iRegistry.get(IDebugUIConstants.IMG_OBJS_OS_PROCESS);
+ }
+ } else
+ if (item instanceof ILaunch) {
+ String mode= ((ILaunch) item).getLaunchMode();
+ if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+ return iRegistry.get(IDebugUIConstants.IMG_ACT_DEBUG);
+ } else {
+ return iRegistry.get(IDebugUIConstants.IMG_ACT_RUN);
+ }
+ } else
+ if (item instanceof InspectItem) {
+ return iRegistry.get(IDebugUIConstants.IMG_OBJS_EXPRESSION);
+ } else
+ if (item instanceof IAdaptable) {
+ IWorkbenchAdapter de= (IWorkbenchAdapter) ((IAdaptable) item).getAdapter(IWorkbenchAdapter.class);
+ if (de != null) {
+ ImageDescriptor descriptor= de.getImageDescriptor(item);
+ if( descriptor != null) {
+ return descriptor.createImage();
+ }
+ }
+ }
+
+ return null;
+
+ }
+ }
+
+ /**
+ * @see IDebugModelPresentation
+ */
+ public IEditorInput getEditorInput(Object item) {
+ IDebugModelPresentation lp= getConfiguredPresentation(item);
+ if (lp != null) {
+ return lp.getEditorInput(item);
+ }
+ return null;
+ }
+
+ /**
+ * @see IDebugModelPresentation
+ */
+ public String getEditorId(IEditorInput input, Object objectInput) {
+ IDebugModelPresentation lp= getConfiguredPresentation(objectInput);
+ if (lp != null) {
+ return lp.getEditorId(input, objectInput);
+ }
+ return null;
+ }
+
+
+ /**
+ * Returns a default image for the debug element
+ */
+ public String getDefaultText(Object element) {
+ if (element instanceof IDebugElement) {
+ try {
+ return ((IDebugElement) element).getName();
+ } catch (DebugException de) {
+ }
+ } else
+ if (element instanceof IMarker) {
+ IMarker m= (IMarker) element;
+ try {
+ if (m.exists() && m.isSubtypeOf(IDebugConstants.BREAKPOINT_MARKER)) {
+ return DebugUIUtils.getResourceString(BREAKPOINT_LABEL);
+ }
+ } catch (CoreException e) {
+ }
+ }
+ return DebugUIUtils.getResourceString(UNKNOWN);
+ }
+
+ /**
+ * Returns a default image for the debug element
+ */
+ public Image getDefaultImage(Object element) {
+ ImageRegistry iRegistry= DebugUIPlugin.getDefault().getImageRegistry();
+ if (element instanceof IThread) {
+ IThread thread = (IThread)element;
+ if (thread.isSuspended()) {
+ return iRegistry.get(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED);
+ } else if (thread.isTerminated()) {
+ return iRegistry.get(IDebugUIConstants.IMG_OBJS_THREAD_TERMINATED);
+ } else {
+ return iRegistry.get(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING);
+ }
+ } else
+ if (element instanceof IStackFrame) {
+ return iRegistry.get(IDebugUIConstants.IMG_OBJS_STACKFRAME);
+ } else
+ if (element instanceof IProcess) {
+ if (((IProcess) element).isTerminated()) {
+ return iRegistry.get(IDebugUIConstants.IMG_OBJS_OS_PROCESS_TERMINATED);
+ } else {
+ return iRegistry.get(IDebugUIConstants.IMG_OBJS_OS_PROCESS);
+ }
+ } else
+ if (element instanceof IDebugTarget) {
+ IDebugTarget target= (IDebugTarget) element;
+ if (target.isTerminated() || target.isDisconnected()) {
+ return iRegistry.get(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET_TERMINATED);
+ } else {
+ return iRegistry.get(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET);
+ }
+ } else
+ if (element instanceof IMarker) {
+ try {
+ IMarker m= (IMarker) element;
+ if (m.exists() && m.isSubtypeOf(IDebugConstants.BREAKPOINT_MARKER)) {
+ if (DebugPlugin.getDefault().getBreakpointManager().isEnabled(m)) {
+ return DebugPluginImages.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
+ } else {
+ return DebugPluginImages.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT_DISABLED);
+ }
+
+ }
+ } catch (CoreException e) {
+ DebugUIUtils.logError(e);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns a label for the item
+ */
+ public String getText(Object item) {
+ boolean displayVariableTypes= showVariableTypeNames();
+ boolean displayQualifiedNames= showQualifiedNames();
+ if (item instanceof InspectItem) {
+ return getInspectItemText((InspectItem)item);
+ } else if (item instanceof IDebugElement || item instanceof IMarker) {
+ IDebugModelPresentation lp= getConfiguredPresentation(item);
+ if (lp != null) {
+ String label= lp.getText(item);
+ if (label != null) {
+ return label;
+ }
+ }
+ if (item instanceof IVariable) {
+ IVariable var= (IVariable) item;
+ StringBuffer buf= new StringBuffer();
+ try {
+ IValue value = var.getValue();
+
+ if (displayVariableTypes) {
+ buf.append(value.getReferenceTypeName());
+ buf.append(' ');
+ }
+ buf.append(var.getName());
+ buf.append(" = ");
+ buf.append(value.getValueString());
+ return buf.toString();
+ } catch (DebugException de) {
+ }
+ }
+ // default to show the simple element name
+ return getDefaultText(item);
+ } else {
+
+ String label= null;
+ if (item instanceof IProcess) {
+ label= ((IProcess) item).getLabel();
+ } else
+ if (item instanceof ILauncher) {
+ label = ((ILauncher)item).getLabel();
+ } else
+ if (item instanceof ILaunch) {
+ label= getLaunchText((ILaunch) item);
+ } else if (item instanceof InspectItem) {
+ try {
+ InspectItem var= (InspectItem) item;
+ StringBuffer buf= new StringBuffer();
+ buf.append(var.getLabel());
+ buf.append(" = ");
+ IValue value = var.getValue();
+ if (displayVariableTypes) {
+ buf.append(value.getReferenceTypeName());
+ buf.append(' ');
+ }
+ buf.append(value.getValueString());
+ return buf.toString();
+ } catch (DebugException de) {
+ return getDefaultText(item);
+ }
+ } else {
+ label= getDesktopLabel(item);
+ }
+
+ if ((item instanceof ITerminate) && ((ITerminate) item).isTerminated()) {
+ label= DebugUIUtils.getResourceString(TERMINATED) + label;
+ }
+ return label;
+ }
+ }
+
+ /**
+ * InspectItems have their left halves rendered here, and their
+ * right halves rendered by the registered model presentation.
+ */
+ protected String getInspectItemText(InspectItem inspectItem) {
+ StringBuffer buffer= new StringBuffer(inspectItem.getLabel());
+ String valueString= null;
+ IDebugModelPresentation lp= getConfiguredPresentation(inspectItem);
+ IValue value= inspectItem.getValue();
+ if (lp != null) {
+ valueString= lp.getText(value);
+ }
+ if ((valueString == null) || (valueString.length() < 1)) {
+ try {
+ valueString= value.getValueString();
+ } catch (DebugException de) {
+ }
+ }
+ if (valueString != null && valueString.length() > 0) {
+ buffer.append("= ");
+ buffer.append(valueString);
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Delegate to all extensions.
+ *
+ * @see ILabelProvider
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ Iterator i= fLabelProviders.values().iterator();
+ while (i.hasNext()) {
+ ((ILabelProvider) i.next()).removeListener(listener);
+ }
+ }
+
+ public String getDesktopLabel(Object object) {
+ if (object instanceof IAdaptable) {
+ IWorkbenchAdapter de= (IWorkbenchAdapter) ((IAdaptable) object).getAdapter(IWorkbenchAdapter.class);
+ if (de != null) {
+ return de.getLabel(object);
+ }
+ }
+
+ return DebugUIUtils.getResourceString(UNKNOWN);
+ }
+
+ /**
+ * Delegate to the appropriate label provider.
+ *
+ * @see ILabelProvider
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ if (element instanceof IDebugElement) {
+ IDebugModelPresentation lp= getConfiguredPresentation((IDebugElement) element);
+ if (lp != null) {
+ return lp.isLabelProperty(element, property);
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns a configured model presentation for the given object,
+ * or <code>null</code> if one is not registered.
+ */
+ protected IDebugModelPresentation getConfiguredPresentation(Object element) {
+ String id= null;
+ if (element instanceof IDebugElement) {
+ IDebugElement de= (IDebugElement) element;
+ id= de.getModelIdentifier();
+ } else if (element instanceof InspectItem) {
+ IValue value= ((InspectItem)element).getValue();
+ id= value.getModelIdentifier();
+ } else
+ if (element instanceof IMarker) {
+ IMarker m= (IMarker) element;
+ try {
+ if (m.exists()) {
+ id= (String) m.getAttribute(IDebugConstants.MODEL_IDENTIFIER);
+ }
+ } catch (CoreException e) {
+ DebugUIUtils.logError(e);
+ }
+ }
+ if (id != null) {
+ return getPresentation(id);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the presentation registered for the given id, or <code>null</code>
+ * of nothing is registered for the id.
+ */
+ protected IDebugModelPresentation getPresentation(String id) {
+ IDebugModelPresentation lp= (IDebugModelPresentation) fLabelProviders.get(id);
+ if (lp != null) {
+ Iterator keys= fAttributes.keySet().iterator();
+ while (keys.hasNext()) {
+ String key= (String)keys.next();
+ lp.setAttribute(key, fAttributes.get(key));
+ }
+ return lp;
+ }
+ return null;
+ }
+
+ /**
+ * Used to render launch history items in the re-launch drop downs
+ */
+ protected String getLaunchText(ILaunch launch) {
+ return getDesktopLabel(launch.getElement()) + " [" + getText(launch.getLauncher()) + "]";
+ }
+
+ /**
+ * @see IDebugModelPresentation
+ */
+ public void setAttribute(String id, Object value) {
+ if (value == null) {
+ return;
+ }
+ fAttributes.put(id, value);
+ }
+
+ protected boolean showVariableTypeNames() {
+ Boolean show= (Boolean) fAttributes.get(DISPLAY_VARIABLE_TYPE_NAMES);
+ show= show == null ? new Boolean(false) : show;
+ return show.booleanValue();
+ }
+
+ protected boolean showQualifiedNames() {
+ Boolean show= (Boolean) fAttributes.get(DISPLAY_QUALIFIED_NAMES);
+ show= show == null ? new Boolean(false) : show;
+ return show.booleanValue();
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DisconnectActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DisconnectActionDelegate.java
new file mode 100644
index 000000000..a43aa4375
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DisconnectActionDelegate.java
@@ -0,0 +1,37 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IDisconnect;
+
+public class DisconnectActionDelegate extends ControlActionDelegate {
+
+ private static final String PREFIX= "disconnect_action.";
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected void doAction(Object element) throws DebugException {
+ if (element instanceof IDisconnect)
+ ((IDisconnect) element).disconnect();
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ public boolean isEnabledFor(Object element) {
+ return element instanceof IDisconnect && ((IDisconnect) element).canDisconnect();
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected String getPrefix() {
+ return PREFIX;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/EnableDisableBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/EnableDisableBreakpointAction.java
new file mode 100644
index 000000000..7ff8e5be6
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/EnableDisableBreakpointAction.java
@@ -0,0 +1,125 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.*;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.ui.actions.SelectionProviderAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import java.util.Iterator;
+
+/**
+ * Enables or disables a breakpoint
+ */
+public class EnableDisableBreakpointAction extends SelectionProviderAction implements IBreakpointListener {
+
+ private final static String PREFIX= "enable_disable_breakpoint_action.";
+ private final static String ENABLE= PREFIX + TEXT + ".enable";
+ private final static String DISABLE= PREFIX + TEXT + ".disable";
+ private final static String ERROR= PREFIX + "error.";
+ /**
+ * Creates the action to enable/disable breakpoints
+ */
+ public EnableDisableBreakpointAction(ISelectionProvider selectionProvider) {
+ super(selectionProvider, DebugUIUtils.getResourceString(PREFIX + TEXT));
+ setEnabled(!getStructuredSelection().isEmpty());
+ }
+
+ /**
+ * Returns the breakpoint manager
+ */
+ protected IBreakpointManager getBreakpointManager() {
+ return DebugPlugin.getDefault().getBreakpointManager();
+ }
+
+ /**
+ * @see Action
+ */
+ public void run() {
+ IStructuredSelection selection= (IStructuredSelection) getStructuredSelection();
+ //Get the selected marker
+ Iterator enum= selection.iterator();
+ if (!enum.hasNext()) {
+ return;
+ }
+
+ IBreakpointManager manager= getBreakpointManager();
+ MultiStatus ms= new MultiStatus(DebugUIPlugin.getDefault().getDescriptor().getUniqueIdentifier(), IDebugStatusConstants.REQUEST_FAILED, "Enable/Disable breakpoint(s) failed", null);
+ while (enum.hasNext()) {
+ IMarker breakpoint= (IMarker) enum.next();
+ boolean enabled= manager.isEnabled(breakpoint);
+ try {
+ manager.setEnabled(breakpoint, !enabled);
+ } catch (CoreException e) {
+ ms.merge(e.getStatus());
+ }
+ }
+ if (!ms.isOK()) {
+ DebugUIUtils.errorDialog(DebugUIPlugin.getActiveWorkbenchWindow().getShell(), ERROR, ms);
+ }
+ }
+
+ /**
+ * @see SelectionProviderAction
+ */
+ public void selectionChanged(IStructuredSelection sel) {
+ Iterator enum= sel.iterator();
+ if (!enum.hasNext()) {
+ //No selection
+ setEnabled(false);
+ return;
+ }
+ IMarker marker= (IMarker)enum.next();
+ if (!enum.hasNext()) {
+ //single selection
+ boolean enabled= getBreakpointManager().isEnabled(marker);
+ if (enabled) {
+ setText(DebugUIUtils.getResourceString(DISABLE));
+ } else {
+ setText(DebugUIUtils.getResourceString(ENABLE));
+ }
+ } else {
+ // multi- selection
+ setText(DebugUIUtils.getResourceString(PREFIX + TEXT));
+ }
+ setEnabled(true);
+ }
+
+ /**
+ * @see IBreakpointListener
+ */
+ public void breakpointAdded(IMarker breakpoint) {
+ }
+
+ /**
+ * @see IBreakpointListener
+ */
+ public void breakpointRemoved(IMarker breakpoint, IMarkerDelta delta) {
+ }
+
+ /**
+ * @see IBreakpointListener
+ */
+ public void breakpointChanged(IMarker breakpoint, IMarkerDelta delta) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ ISelection s= getSelectionProvider().getSelection();
+ if (s instanceof IStructuredSelection) {
+ selectionChanged((IStructuredSelection) s);
+ }
+ }
+ });
+ }
+
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ExecutionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ExecutionAction.java
new file mode 100644
index 000000000..4dd676405
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ExecutionAction.java
@@ -0,0 +1,261 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import java.util.*;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+
+/**
+ * This is the debug action which appears in the desktop menu and toolbar.
+ */
+public abstract class ExecutionAction extends Action {
+
+ private final static String PREFIX= "execution_action.";
+ private final static String ERROR= "error.";
+ private final static String STATUS= PREFIX + "status";
+
+ /**
+ * @see Action
+ */
+ public void run() {
+
+ final IWorkbenchWindow dwindow= DebugUIPlugin.getActiveWorkbenchWindow();
+ final IStructuredSelection selection= resolveSelection(dwindow);
+
+ // if the selection is a debug element, system process, or launch, try to do a relaunch
+ if (selection != null && attemptRelaunch(selection)) {
+ return;
+ }
+
+ // otherwise, resolve a launcher and an element
+ final Object[] launchers= resolveLaunchers(selection);
+ if (launchers.length == 0) {
+ // could not determine any launchers to use to launch
+ // very unlikely to happen
+ beep();
+ return;
+ }
+
+ BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
+ public void run() {
+ // if there are no choices to make, do the launch
+ if (launchers.length == 1 && selection != null) {
+ ILauncher launcher= (ILauncher)launchers[0];
+ Object[] elements= selection.toArray();
+ launcher.launch(elements, getMode());
+ } else {
+ // must choose a launcher
+ useWizard(launchers, dwindow.getShell(), selection);
+ }
+ }
+ });
+ }
+
+ /**
+ * Returns the mode of a launcher to use for this action
+ */
+ protected abstract String getMode();
+
+ /**
+ * Returns the launch manager.
+ */
+ protected static ILaunchManager getLaunchManager() {
+ return DebugPlugin.getDefault().getLaunchManager();
+ }
+
+ /**
+ * Relaunches the launch in the specified mode.
+ */
+ public void relaunch(ILaunch launch, String mode) {
+ RelaunchActionDelegate.relaunch(launch, mode);
+ }
+
+ /**
+ * Determines and returns the selection that provides context for the launch,
+ * or <code>null</code> if there is no selection.
+ */
+ protected IStructuredSelection resolveSelection(IWorkbenchWindow window) {
+ if (window == null) {
+ return null;
+ }
+ ISelection selection= window.getSelectionService().getSelection();
+ if (selection == null || selection.isEmpty() || !(selection instanceof IStructuredSelection)) {
+ // there is no obvious selection - go fishing
+ selection= null;
+ IWorkbenchPage page= window.getActivePage();
+ if (page == null) {
+ //workspace is closed
+ return null;
+ }
+
+ // first, see if there is an active editor, and try its input element
+ IEditorPart editor= page.getActiveEditor();
+ Object element= null;
+ if (editor != null) {
+ element= editor.getEditorInput();
+ }
+
+ if (selection == null && element != null) {
+ selection= new StructuredSelection(element);
+ }
+ }
+ return (IStructuredSelection)selection;
+ }
+
+ /**
+ * Resolves and returns the applicable launcher(s) to be used to launch the
+ * elements in the specified selection.
+ */
+ protected Object[] resolveLaunchers(IStructuredSelection selection) {
+ List launchers;
+ if (selection == null || selection.isEmpty()) {
+ launchers= Arrays.asList(getLaunchManager().getLaunchers(getMode()));
+ } else {
+ launchers= new ArrayList(2);
+ Iterator elements= selection.iterator();
+ MultiStatus status= new MultiStatus(DebugUIPlugin.getDefault().getDescriptor().getUniqueIdentifier(), IDebugStatusConstants.REQUEST_FAILED, DebugUIUtils.getResourceString(STATUS), null);
+ while (elements.hasNext()) {
+ Object element= elements.next();
+ ILauncher defaultLauncher= null;
+ try {
+ IResource resource= null;
+ if (element instanceof IAdaptable) {
+ IAdaptable el= (IAdaptable)element;
+ resource= (IResource)el.getAdapter(IResource.class);
+ }
+ IProject project= null;
+ if (resource != null) {
+ project= resource.getProject();
+ }
+ if (project != null) {
+ defaultLauncher= getLaunchManager().getDefaultLauncher(project);
+ }
+ if (defaultLauncher != null) {
+ if (!defaultLauncher.getModes().contains(getMode())) {
+ defaultLauncher= null;
+ }
+ }
+ } catch (CoreException e) {
+ status.merge(e.getStatus());
+ }
+ if (defaultLauncher != null) {
+ if (!launchers.contains(defaultLauncher)) {
+ launchers.add(defaultLauncher);
+ }
+ }
+ }
+ if (!status.isOK()) {
+ DebugUIUtils.errorDialog(DebugUIPlugin.getActiveWorkbenchWindow().getShell(), PREFIX + ERROR, status);
+ }
+ if (launchers.isEmpty()) {
+ launchers= Arrays.asList(getLaunchManager().getLaunchers(getMode()));
+ }
+ }
+
+ return resolveVisibleLaunchers(launchers);
+ }
+
+ protected Object[] resolveVisibleLaunchers(List launchers) {
+ List visibleLaunchers= new ArrayList(2);
+ Iterator itr= launchers.iterator();
+ while (itr.hasNext()) {
+ ILauncher launcher= (ILauncher)itr.next();
+ if (DebugUIPlugin.getDefault().isVisible(launcher)) {
+ //cannot use itr.remove() as the list may be a fixed size list
+ visibleLaunchers.add(launcher);
+ }
+ }
+ return visibleLaunchers.toArray();
+ }
+
+ protected Object[] resolveWizardLaunchers(Object[] launchers) {
+ List wizardLaunchers= new ArrayList(2);
+ for (int i= 0 ; i < launchers.length; i++) {
+ ILauncher launcher= (ILauncher)launchers[i];
+ if (DebugUIPlugin.getDefault().hasWizard(launcher)) {
+ wizardLaunchers.add(launcher);
+ }
+ }
+ return wizardLaunchers.toArray();
+ }
+
+ /**
+ * If the selection contains re-launchables, a relaunch is performed
+ * for each launch and true is returned, otherwise, false is returned.
+ */
+ protected boolean attemptRelaunch(IStructuredSelection selection) {
+ // if the selection is a debug element, system process, or launch, do a relaunch
+ Iterator objects= selection.iterator();
+ List relaunchables= null;
+ while (objects.hasNext()) {
+ Object object= objects.next();
+ ILaunch launch= null;
+ if (object instanceof IDebugElement) {
+ launch= ((IDebugElement)object).getLaunch();
+ } else if (object instanceof ILaunch) {
+ launch= (ILaunch)object;
+ } else if (object instanceof IProcess) {
+ launch= ((IProcess)object).getLaunch();
+ }
+ if (launch != null) {
+ if (relaunchables == null) {
+ relaunchables= new ArrayList(1);
+ relaunchables.add(launch);
+ } else if (!relaunchables.contains(launch)) {
+ relaunchables.add(launch);
+ }
+ }
+ }
+ if (relaunchables == null) {
+ return false;
+ } else {
+ Iterator itr= relaunchables.iterator();
+ while (itr.hasNext()) {
+ relaunch((ILaunch)itr.next(), getMode());
+ }
+ return true;
+ }
+ }
+
+ /**
+ * Use the wizard to do the launch.
+ */
+ protected void useWizard(Object[] launchers, Shell shell, IStructuredSelection selection) {
+ launchers= resolveWizardLaunchers(launchers);
+ LaunchWizard lw= new LaunchWizard(launchers, selection, getMode());
+ LaunchWizardDialog dialog= new LaunchWizardDialog(shell, lw);
+ dialog.open();
+ }
+
+ /**
+ * Ring the bell
+ */
+ protected void beep() {
+ Display display= Display.getCurrent();
+ if (display != null) {
+ display.beep();
+ }
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugPreferenceConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugPreferenceConstants.java
new file mode 100644
index 000000000..74af401cc
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugPreferenceConstants.java
@@ -0,0 +1,42 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+/**
+ * Constants defining the keys to be used for accessing preferences
+ * inside the debug ui plugin's preference bundle.
+ *
+ * In descriptions (of the keys) below describe the preference
+ * stored at the given key. The type indicates type of the stored preferences
+ *
+ * The preference store is loaded by the plugin (DebugUIPlugin).
+ * @See DebugUIPlugin.initializeDefaultPreferences() - for initialization of the store
+ */
+public interface IDebugPreferenceConstants {
+
+ /**
+ * RGB colors for displaying the content in the Console
+ */
+ public static final String CONSOLE_SYS_ERR_RGB= "Console.stdErrColor";
+ public static final String CONSOLE_SYS_OUT_RGB= "Console.stdOutColor";
+ public static final String CONSOLE_SYS_IN_RGB= "Console.stdInColor";
+
+ /**
+ * The name of the font to use for the Console
+ **/
+ public static final String CONSOLE_FONT= "Console.font";
+
+ /**
+ * (boolean) Whether or not the console view is shown
+ * when there is program ouptut.
+ */
+ public static final String CONSOLE_OPEN= "DEBUG.consoleOpen";
+
+
+}
+
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
new file mode 100644
index 000000000..6ea4dd3b5
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java
@@ -0,0 +1,51 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+public interface IInternalDebugUIConstants {
+
+ //Folders
+ public static final String ID_NAVIGATOR_FOLDER_VIEW= "org.eclipse.debug.internal.ui.NavigatorFolderView";
+ public static final String ID_TOOLS_FOLDER_VIEW= "org.eclipse.debug.internal.ui.ToolsFolderView";
+ public static final String ID_CONSOLE_FOLDER_VIEW= "org.eclipse.debug.internal.ui.ConsoleFolderView";
+
+ //Current stack frame instruction pointer
+ public static final String INSTRUCTION_POINTER= "org.eclipse.debug.ui.instructionPointer";
+
+
+ // disabled local tool images
+ public static final String IMG_DLCL_RESUME= "IMG_DLCL_RESUME";
+ public static final String IMG_DLCL_SUSPEND= "IMG_DLCL_SUSPEND";
+ public static final String IMG_DLCL_TERMINATE= "IMG_DLCL_TERMINATE";
+ public static final String IMG_DLCL_DISCONNECT= "IMG_DLCL_DISCONNECT";
+ public static final String IMG_DLCL_STEPINTO= "IMG_DLCL_STEPINTO";
+ public static final String IMG_DLCL_STEPOVER= "IMG_DLCL_STEPOVER";
+ public static final String IMG_DLCL_STEPRETURN= "IMG_DLCL_STEPRETURN";
+ public static final String IMG_DLCL_CLEAR= "IMG_DLCL_CLEAR";
+ public static final String IMG_DLCL_REMOVE_TERMINATED= "IMG_DLCL_REMOVE_TERMINATED";
+ public static final String IMG_DLCL_QUALIFIED_NAMES= "IMG_DLCL_QUALIFIED_NAMES";
+ public static final String IMG_DLCL_TYPE_NAMES= "IMG_DLCL_TYPE_NAMES";
+ public static final String IMG_DLCL_REMOVE= "IMG_DLCL_REMOVE";
+ public static final String IMG_DLCL_REMOVE_ALL= "IMG_DLCL_REMOVE_ALL";
+
+ // enabled local tool images
+ public static final String IMG_ELCL_RESUME= "IMG_ELCL_RESUME";
+ public static final String IMG_ELCL_SUSPEND= "IMG_ELCL_SUSPEND";
+ public static final String IMG_ELCL_TERMINATE= "IMG_ELCL_TERMINATE";
+ public static final String IMG_ELCL_DISCONNECT= "IMG_ELCL_DISCONNECT";
+ public static final String IMG_ELCL_STEPINTO= "IMG_ELCL_STEPINTO";
+ public static final String IMG_ELCL_STEPOVER= "IMG_ELCL_STEPOVER";
+ public static final String IMG_ELCL_STEPRETURN= "IMG_ELCL_STEPRETURN";
+ public static final String IMG_ELCL_CLEAR= "IMG_ELCL_CLEAR";
+ public static final String IMG_ELCL_REMOVE_TERMINATED= "IMG_ELCL_REMOVE_TERMINATED";
+ public static final String IMG_ELCL_QUALIFIED_NAMES= "IMG_ELCL_QUALIFIED_NAMES";
+ public static final String IMG_ELCL_TYPE_NAMES= "IMG_ELCL_TYPE_NAMES";
+ public static final String IMG_ELCL_REMOVE= "IMG_ELCL_REMOVE";
+ public static final String IMG_ELCL_REMOVE_ALL= "IMG_ELCL_REMOVE_ALL";
+
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectItem.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectItem.java
new file mode 100644
index 000000000..dcdf9923b
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectItem.java
@@ -0,0 +1,41 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.core.runtime.PlatformObject;
+
+
+public class InspectItem extends PlatformObject {
+
+ protected String fLabel;
+ protected IValue fValue;
+
+
+ public InspectItem(String label, IValue value) {
+ fLabel = label;
+ fValue = value;
+ }
+
+ public String getLabel() {
+ return fLabel;
+ }
+
+ public IValue getValue() {
+ return fValue;
+ }
+
+ /**
+ * @see IAdaptable
+ */
+ public Object getAdapter(Class adapter) {
+ if (adapter == InspectItem.class) {
+ return this;
+ }
+ return super.getAdapter(adapter);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorAction.java
new file mode 100644
index 000000000..a2f44be72
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorAction.java
@@ -0,0 +1,56 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.SelectionProviderAction;
+
+public abstract class InspectorAction extends SelectionProviderAction {
+
+ public InspectorAction(ISelectionProvider provider, String label) {
+ super(provider, label);
+ }
+
+ /**
+ * @see IAction
+ */
+ public void run() {
+ // get the Inspector
+ IWorkbenchPage p= DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
+ InspectorView view= (InspectorView) p.findView(IDebugUIConstants.ID_INSPECTOR_VIEW);
+ if (view == null) {
+ // open a new view
+ try {
+ view= (InspectorView) p.showView(IDebugUIConstants.ID_INSPECTOR_VIEW);
+ } catch (PartInitException e) {
+ DebugUIUtils.logError(e);
+ return;
+ }
+ }
+
+ try {
+ doAction(view);
+ } catch (DebugException de) {
+ DebugUIUtils.logError(de);
+ }
+ }
+
+ /**
+ * @see SelectionProviderAction
+ */
+ public void selectionChanged(IStructuredSelection sel) {
+ setEnabled(!sel.isEmpty());
+ }
+
+ protected abstract void doAction(InspectorView view) throws DebugException;
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorContentProvider.java
new file mode 100644
index 000000000..a57688a49
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorContentProvider.java
@@ -0,0 +1,234 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+
+public class InspectorContentProvider extends BasicContentProvider implements ITreeContentProvider, IDebugEventListener {
+
+ /**
+ * The inspect items in the viewer
+ */
+ protected InspectorList fInspectorList;
+
+ /**
+ * The action that removes all the items
+ */
+ protected RemoveAllFromInspectorAction fRemoveAllFromInspectorAction;
+
+ /**
+ * A table of root values in the inspector
+ */
+ protected Hashtable fRootValuesTable;
+
+ /**
+ * Constructs a new inspector content provider
+ */
+ public InspectorContentProvider(RemoveAllFromInspectorAction action) {
+ fRemoveAllFromInspectorAction= action;
+ fInspectorList = new InspectorList(3);
+ fRootValuesTable = new Hashtable(3);
+ DebugPlugin.getDefault().addDebugEventListener(this);
+ enableRemoveAllFromInspectorAction();
+ }
+
+ /**
+ * @see ITreeContentProvider
+ */
+ public Object getParent(Object child) {
+ if (fInspectorList == child) {
+ return null;
+ } else if (child instanceof InspectItem) {
+ return fInspectorList;
+ } else if (child instanceof IVariable) {
+ Object parent = ((IVariable)child).getParent();
+ if (parent instanceof IValue) {
+ IValue value = (IValue)parent;
+ Object inspectItem = fRootValuesTable.get(value);
+ if (inspectItem != null) {
+ return inspectItem;
+ } else {
+ return value.getVariable();
+ }
+ } else {
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @see BasicContentProvider#doGetChildren(Object)
+ */
+ protected Object[] doGetChildren(Object parent) {
+ if (parent == fInspectorList) {
+ return fInspectorList.getList().toArray();
+ }
+ try {
+ if (parent instanceof IVariable) {
+ return ((IVariable)parent).getValue().getChildren();
+ }
+ if (parent instanceof InspectItem) {
+ return ((InspectItem)parent).getValue().getChildren();
+ }
+ } catch (DebugException de) {
+ DebugUIUtils.logError(de);
+ }
+ return new Object[0];
+ }
+
+ /**
+ * @see ITreeContentProvider
+ */
+ public boolean hasChildren(Object parent) {
+ if (parent == fInspectorList) {
+ return !fInspectorList.isEmpty();
+ }
+ try {
+ if (parent instanceof InspectItem) {
+ return ((InspectItem)parent).getValue().hasChildren();
+ } else{
+ return ((IVariable)parent).getValue().hasChildren();
+ }
+ } catch (DebugException de) {
+ return false;
+ }
+ }
+
+ /**
+ * @see IStructuredContentProvider
+ */
+ public Object[] getElements(Object parent) {
+ return getChildren(parent);
+ }
+
+ /**
+ * @see IContentProvider
+ */
+ public void dispose() {
+ fInspectorList = null;
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ }
+
+ /**
+ * Returns the list of inspect items being inspected.
+ */
+ public InspectorList getInspectorList() {
+ return fInspectorList;
+ }
+
+ /**
+ * @see BasicContentProvider#doHandleDebug(Event)
+ */
+ protected void doHandleDebugEvent(DebugEvent event) {
+ if (event.getKind() == DebugEvent.SUSPEND ||
+ event.getKind() == DebugEvent.TERMINATE ||
+ event.getKind() == DebugEvent.CHANGE) {
+ // remove any de-allocated values
+ Iterator itr = fInspectorList.getList().iterator();
+ while (itr.hasNext()) {
+ InspectItem item = (InspectItem)itr.next();
+ boolean allocated= false;
+ try {
+ allocated= item.getValue().isAllocated();
+ } catch (DebugException de) {
+ }
+ if (!allocated) {
+ itr.remove();
+ fRootValuesTable.remove(item.getValue());
+ }
+ }
+ refresh();
+ enableRemoveAllFromInspectorAction();
+ }
+ }
+
+ /**
+ * Helper method to remove the given element
+ */
+ protected void remove(final Object element) {
+ Runnable r= new Runnable() {
+ public void run() {
+ ((TreeViewer)fViewer).remove(element);
+ enableRemoveAllFromInspectorAction();
+ }
+ };
+ asyncExec(r);
+ }
+
+ /**
+ * Helper method to remove all elements
+ */
+ protected void removeAll() {
+ Runnable r= new Runnable() {
+ public void run() {
+ fInspectorList.getList().clear();
+ refresh();
+ enableRemoveAllFromInspectorAction();
+ }
+ };
+ asyncExec(r);
+ }
+
+ /**
+ * Helper method for inserting the given element
+ */
+ protected void insert(final Object element) {
+ final Object parent = getParent(element);
+ if (parent != null) {
+ Runnable r= new Runnable() {
+ public void run() {
+ TreeViewer tempViewer= (TreeViewer)fViewer;
+ tempViewer.add(parent, element);
+ tempViewer.setExpandedState(element, true);
+ tempViewer.setSelection(new StructuredSelection(element));
+ enableRemoveAllFromInspectorAction();
+ }
+ };
+ asyncExec(r);
+ }
+ }
+
+ /**
+ * Adds a inspect item to the list
+ */
+ public void addToInspector(InspectItem item) {
+ List inspectorList = getInspectorList().getList();
+ if (!inspectorList.contains(item)) {
+ fRootValuesTable.put(item.getValue(), item);
+ inspectorList.add(item);
+ insert(item);
+ }
+ }
+
+ /**
+ * Removes a inspect item from the list
+ */
+ public void removeFromInspector(InspectItem item) {
+ getInspectorList().getList().remove(item);
+ fRootValuesTable.remove(item.getValue());
+ remove(item);
+ }
+
+ /**
+ * Enable/disable the <code>RemoveAllFromInspectorAction<code> based on whether the inspector
+ * list is currently empty.
+ */
+ public void enableRemoveAllFromInspectorAction() {
+ boolean enable= getInspectorList().isEmpty() ? false : true;
+ fRemoveAllFromInspectorAction.setEnabled(enable);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorList.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorList.java
new file mode 100644
index 000000000..2ed884c80
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorList.java
@@ -0,0 +1,38 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.core.runtime.PlatformObject;
+import java.util.List;
+import java.util.Vector;
+
+public class InspectorList extends PlatformObject {
+
+ protected Vector fInspectorList;
+
+ /**
+ * @see IAdaptable
+ */
+ public Object getAdapter(Class adapter) {
+ if (adapter == InspectItem.class) {
+ return this;
+ }
+ return super.getAdapter(adapter);
+ }
+
+ public InspectorList(int initialCapacity) {
+ fInspectorList= new Vector(initialCapacity);
+ }
+
+ public List getList() {
+ return fInspectorList;
+ }
+
+ public boolean isEmpty() {
+ return fInspectorList.isEmpty();
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorView.java
new file mode 100644
index 000000000..5aa6f92fc
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorView.java
@@ -0,0 +1,159 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jface.action.*; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.part.DrillDownAdapter;
+
+/**
+ * A view that shows items that have been added to a inspector
+ */
+public class InspectorView extends AbstractDebugView {
+
+ protected final static String PREFIX= "inspector_view.";
+
+ protected InspectorContentProvider fContentProvider= null;
+ protected ShowQualifiedAction fShowQualifiedAction;
+ protected ShowTypesAction fShowTypesAction;
+ protected InspectorViewAddToInspectorAction fAddToInspectorAction;
+ protected RemoveFromInspectorAction fRemoveFromInspectorAction;
+ protected RemoveAllFromInspectorAction fRemoveAllFromInspectorAction;
+ protected ChangeVariableValueAction fChangeVariableAction;
+
+ protected DrillDownAdapter fDrillPart;
+
+ /**
+ * @see IWorkbenchPart
+ */
+ public void createPartControl(Composite parent) {
+ TreeViewer vv = new TreeViewer(parent, SWT.MULTI);
+ fViewer= vv;
+ fDrillPart = new DrillDownAdapter(vv);
+ initializeActions();
+ initializeToolBar();
+ fContentProvider= new InspectorContentProvider(fRemoveAllFromInspectorAction);
+ fViewer.setContentProvider(fContentProvider);
+ fViewer.setLabelProvider(new DelegatingModelPresentation());
+ fViewer.setUseHashlookup(true);
+
+ createContextMenu(vv.getTree());
+
+ fViewer.setInput(fContentProvider.getInspectorList());
+ fViewer.getControl().addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent e) {
+ handleKeyPressed(e);
+ }
+ });
+
+ setTitleToolTip(getTitleToolTipText(PREFIX));
+ }
+
+ /**
+ * Initializes the actions of this view.
+ */
+ protected void initializeActions() {
+ fShowTypesAction= new ShowTypesAction(fViewer);
+ fShowTypesAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_TYPE_NAMES));
+ fShowTypesAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TYPE_NAMES));
+ fShowTypesAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TYPE_NAMES));
+ fShowTypesAction.setChecked(false);
+
+ fShowQualifiedAction= new ShowQualifiedAction(fViewer);
+ fShowQualifiedAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_QUALIFIED_NAMES));
+ fShowQualifiedAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_QUALIFIED_NAMES));
+ fShowQualifiedAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_QUALIFIED_NAMES));
+ fShowQualifiedAction.setChecked(false);
+
+ fAddToInspectorAction = new InspectorViewAddToInspectorAction(fViewer);
+
+ fRemoveFromInspectorAction= new RemoveFromInspectorAction(fViewer);
+ fRemoveFromInspectorAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_REMOVE));
+ fRemoveFromInspectorAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE));
+ fRemoveFromInspectorAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE));
+
+ fRemoveAllFromInspectorAction= new RemoveAllFromInspectorAction(fViewer);
+ fRemoveAllFromInspectorAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_REMOVE_ALL));
+ fRemoveAllFromInspectorAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE_ALL));
+ fRemoveAllFromInspectorAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE_ALL));
+
+ fChangeVariableAction= new ChangeVariableValueAction(fViewer);
+ fChangeVariableAction.setEnabled(false);
+ }
+
+ /**
+ * Configures the toolBar
+ */
+ protected void configureToolBar(IToolBarManager tbm) {
+ fDrillPart.addNavigationActions(tbm);
+ tbm.add(new Separator(this.getClass().getName()));
+ tbm.add(fShowTypesAction);
+ tbm.add(fShowQualifiedAction);
+ tbm.add(new Separator(this.getClass().getName()));
+ tbm.add(fRemoveFromInspectorAction);
+ tbm.add(fRemoveAllFromInspectorAction);
+ }
+
+ /**
+ * Adds items to the context menu including any extension defined actions.
+ */
+ protected void fillContextMenu(IMenuManager menu) {
+
+ // Add the actions defined in this view
+ menu.add(new Separator(IDebugUIConstants.EMPTY_EXPRESSION_GROUP));
+ menu.add(new Separator(IDebugUIConstants.EXPRESSION_GROUP));
+ menu.add(fAddToInspectorAction);
+ menu.add(fChangeVariableAction);
+ menu.add(fRemoveFromInspectorAction);
+ menu.add(fRemoveAllFromInspectorAction);
+ menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
+ menu.add(new Separator(IDebugUIConstants.RENDER_GROUP));
+ menu.add(fShowTypesAction);
+ menu.add(fShowQualifiedAction);
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ /**
+ * Adds a inspect item to the list, and sets the selection to either
+ * the first child or to the item if it has no children.
+ */
+ public void addToInspector(InspectItem item) {
+ fContentProvider.addToInspector(item);
+ }
+
+ /**
+ * Removes a items from the list
+ */
+ public void removeFromInspector(Object object) {
+ // first we have to get the root item to remove
+ while (! (object instanceof InspectItem && object != null)) {
+ object = fContentProvider.getParent(object);
+ }
+ if (object != null) {
+ fContentProvider.removeFromInspector((InspectItem)object);
+ }
+ }
+
+ /**
+ * Removes all items from the list
+ */
+ public void removeAllFromInspector() {
+ fContentProvider.removeAll();
+ fViewer.setInput(null);
+ fDrillPart.reset();
+ }
+
+ /**
+ * Handles key events in viewer. Specifically interested in
+ * the Delete key.
+ */
+ protected void handleKeyPressed(KeyEvent event) {
+ if (event.character == SWT.DEL && event.stateMask == 0
+ && fRemoveFromInspectorAction.isEnabled()) {
+ fRemoveFromInspectorAction.run();
+ }
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorViewAddToInspectorAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorViewAddToInspectorAction.java
new file mode 100644
index 000000000..75f7a99f3
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InspectorViewAddToInspectorAction.java
@@ -0,0 +1,64 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import java.util.Iterator;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * This action applies specifically to the <code>InspectorView</code>, whereas
+ * <code>AddToInspectorAction</code> applies to a more generic variables view.
+ * The difference is that this action has to avoid re-adding items
+ * to the inspector.
+ */
+public class InspectorViewAddToInspectorAction extends AddToInspectorAction {
+
+ public InspectorViewAddToInspectorAction(ISelectionProvider sp) {
+ super(sp);
+ }
+
+ /**
+ * @see AddToInspectorAction
+ * Top-level items in the inspector are of type <code>InspectItem</code>.
+ * Children are <code>IVariable</code>s. So to avoid re-adding top-level items to
+ * the inspector, we simply check the type, and only add <code>IVariable</code>s.
+ */
+ protected void doAction(InspectorView view) throws DebugException {
+ IStructuredSelection s = getStructuredSelection();
+ Iterator vars = s.iterator();
+ while (vars.hasNext()) {
+ Object item= vars.next();
+ if (item instanceof IVariable) {
+ IVariable var = (IVariable)item;
+ DebugUITools.inspect(var.getName(), var.getValue());
+ }
+ }
+ }
+
+ /**
+ * @see InspectorAction
+ */
+ public void selectionChanged(IStructuredSelection sel) {
+ if (sel == null) {
+ setEnabled(false);
+ return;
+ }
+ Iterator iterator= sel.iterator();
+ while (iterator.hasNext()) {
+ Object item= iterator.next();
+ if (item instanceof IVariable) {
+ setEnabled(true);
+ return;
+ }
+ }
+ setEnabled(false);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchDropDownAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchDropDownAction.java
new file mode 100644
index 000000000..8960af12b
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchDropDownAction.java
@@ -0,0 +1,98 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowPulldownDelegate;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+
+/**
+ * Superclass of run & debug pulldown actions.
+ */
+public abstract class LaunchDropDownAction implements IWorkbenchWindowPulldownDelegate {
+
+ private ExecutionAction fLaunchAction;
+
+ /**
+ * Create a new instance of this class
+ */
+ public LaunchDropDownAction(ExecutionAction launchAction) {
+ fLaunchAction= launchAction;
+ }
+
+ private void createMenuForAction(Menu parent, Action action) {
+ ActionContributionItem item= new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+
+ /**
+ * @see IWorkbenchWindowActionDelegate
+ */
+ public void dispose() {
+ }
+
+ /**
+ * @see IWorkbenchWindowPulldownDelegate
+ */
+ public Menu getMenu(Control parent) {
+ Menu menu= new Menu(parent);
+ ILaunch[] historyList= getHistory();
+ int count= 0;
+ for (int i = 0; i < historyList.length; i++) {
+ ILaunch launch= historyList[i];
+ if (launch != null) {
+ RelaunchHistoryLaunchAction newAction= new RelaunchHistoryLaunchAction(launch, getMode());
+ createMenuForAction(menu, newAction);
+ count++;
+ }
+ }
+ if (count > 0) {
+ new MenuItem(menu, SWT.SEPARATOR);
+ }
+ createMenuForAction(menu, new LaunchWithAction(getMode()));
+
+ return menu;
+ }
+
+ /**
+ * @see IActionDelegate
+ */
+ public void run(IAction action) {
+ fLaunchAction.run();
+ }
+
+ /**
+ * @see IActionDelegate
+ */
+ public void selectionChanged(IAction action, ISelection selection){
+ }
+
+ /**
+ * @see IWorkbenchWindowActionDelegate
+ */
+ public void init(IWorkbenchWindow window){
+ }
+
+ /**
+ * Returns an array of previous launches applicable to this drop down
+ */
+ public abstract ILaunch[] getHistory();
+
+ /**
+ * Returns the mode (e.g., 'run' or 'debug') of this drop down
+ */
+ public abstract String getMode();
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchSelectionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchSelectionAction.java
new file mode 100644
index 000000000..0b8dbbc8e
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchSelectionAction.java
@@ -0,0 +1,71 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILauncher;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+public class LaunchSelectionAction extends Action {
+
+ protected ILauncher fLauncher;
+ protected String fMode;
+ protected Object fElement;
+
+ public LaunchSelectionAction(ILauncher launcher, Object element, String mode) {
+ super();
+ fLauncher= launcher;
+ fMode= mode;
+ fElement= element;
+ setText(new DelegatingModelPresentation().getText(launcher));
+ ImageDescriptor descriptor= null;
+ if (fMode.equals(ILaunchManager.DEBUG_MODE)) {
+ descriptor= DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_DEBUG);
+ } else {
+ descriptor= DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_RUN);
+ }
+
+ if (descriptor != null) {
+ setImageDescriptor(descriptor);
+ }
+ }
+
+ /**
+ * @see IAction
+ */
+ public void run() {
+ BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
+ public void run() {
+ if (fElement != null) {
+ fLauncher.launch(new Object[] {fElement}, fMode);
+ } else {
+ Shell shell= DebugUIPlugin.getActiveWorkbenchWindow().getShell();
+ if (shell != null) {
+ useWizard(new Object[] {fLauncher}, shell, StructuredSelection.EMPTY);
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Use the launch wizard to do the launch.
+ */
+ protected void useWizard(Object[] launchers, Shell shell, IStructuredSelection selection) {
+ LaunchWizard wizard= new LaunchWizard(launchers, selection, fMode, false);
+ LaunchWizardDialog dialog= new LaunchWizardDialog(shell, wizard);
+ dialog.open();
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWithAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWithAction.java
new file mode 100644
index 000000000..16d2cd1c4
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWithAction.java
@@ -0,0 +1,132 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILauncher;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+
+/**
+ * A cascading sub-menu that shows all launchers pertinent to this action's mode
+ * (e.g., 'run' or 'debug').
+ */
+public class LaunchWithAction extends Action implements IMenuCreator {
+
+ private static final String PREFIX= "launch_with_action.";
+ protected String fMode;
+
+ /**
+ * @see IAction
+ */
+ public void run() {
+ }
+
+ public LaunchWithAction(String mode) {
+ super();
+ fMode= mode;
+ String text= mode.equals(ILaunchManager.DEBUG_MODE) ? DebugUIUtils.getResourceString(PREFIX + TEXT + ".debug") : DebugUIUtils.getResourceString(PREFIX + TEXT + ".run");
+ setText(text);
+ ImageDescriptor descriptor= null;
+ if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+ descriptor= DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_DEBUG);
+ } else {
+ descriptor= DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_RUN);
+ }
+
+ if (descriptor != null) {
+ setImageDescriptor(descriptor);
+ }
+ setMenuCreator(this);
+ }
+
+ private void createMenuForAction(Menu parent, Action action) {
+ ActionContributionItem item= new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+
+ /**
+ * @see IMenuCreator
+ */
+ public void dispose() {
+ }
+
+ /**
+ * @see IMenuCreator
+ */
+ public Menu getMenu(Control parent) {
+ return null;
+ }
+
+ /**
+ * @see IMenuCreator
+ */
+ public Menu getMenu(Menu parent) {
+ Object element= null;
+ ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager();
+ ILauncher[] launchers= manager.getLaunchers(fMode);
+ IStructuredSelection selection = resolveSelection(DebugUIPlugin.getActiveWorkbenchWindow());
+ if (selection != null) {
+ element= selection.getFirstElement();
+ }
+
+ Menu menu= new Menu(parent);
+ for (int i= 0; i < launchers.length; i++) {
+ if (DebugUIPlugin.getDefault().isVisible(launchers[i])) {
+ LaunchSelectionAction newAction= new LaunchSelectionAction(launchers[i], element, fMode);
+ createMenuForAction(menu, newAction);
+ }
+ }
+ return menu;
+ }
+
+ /**
+ * Determines and returns the selection that provides context for the launch,
+ * or <code>null</code> if there is no selection.
+ */
+ protected IStructuredSelection resolveSelection(IWorkbenchWindow window) {
+ if (window == null) {
+ return null;
+ }
+ ISelection selection= window.getSelectionService().getSelection();
+ if (selection == null || selection.isEmpty() || !(selection instanceof IStructuredSelection)) {
+ // there is no obvious selection - go fishing
+ selection= null;
+ IWorkbenchPage p= window.getActivePage();
+ if (p == null) {
+ //workspace is closed
+ return null;
+ }
+ IEditorPart editor= p.getActiveEditor();
+ Object element= null;
+
+ // first, see if there is an active editor, and try its input element
+ if (editor != null) {
+ element= editor.getEditorInput();
+ }
+
+ if (selection == null && element != null) {
+ selection= new StructuredSelection(element);
+ }
+ }
+ return (IStructuredSelection)selection;
+ }
+}
+
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizard.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizard.java
new file mode 100644
index 000000000..2bcf68ba7
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizard.java
@@ -0,0 +1,217 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILauncher;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.*;
+import java.util.Iterator;
+
+/**
+ * This wizard is used when the debug or run button is pressed, and
+ * the launcher/element resolution is not 1:1. It allows the user to
+ * choose a launcher and element to launch.
+ *
+ * <p>The renderer used to render elements to launch is pluggable,
+ * allowing launchers to provide custom renderers for the elements
+ * they can launch.
+ */
+
+public class LaunchWizard extends Wizard {
+
+ //NLS
+ private static final String PREFIX = "launch_wizard.";
+ private static final String DEBUG = PREFIX + "title.debug";
+ private static final String RUN = PREFIX + "title.run";
+
+ /**
+ * The collection of available launchers
+ */
+ protected Object[] fLaunchers;
+
+ /**
+ * The selection providing context to determine launchables
+ */
+ protected IStructuredSelection fSelection;
+
+ /**
+ * The launch page
+ */
+ protected LaunchWizardSelectionPage fPage;
+
+ /**
+ * The mode of the wizard.
+ * @see ExecutionAction#getMode()
+ */
+ protected String fMode;
+
+ /**
+ * The old default launcher set for the <code>IProject</code>
+ * associated with the current selection.
+ */
+ protected ILauncher fOldDefaultLauncher= null;
+
+ /**
+ * Indicates if the default launcher has been set for the <code>IProject</code>
+ * associated with the current selection.
+ */
+ protected boolean fDefaultLauncherSet= false;
+
+ /**
+ * Indicates if the wizard needs to determine the launcher to use
+ */
+ protected boolean fSelectLauncher;
+
+ /**
+ * Constructs a wizard with a set of launchers, a selection, a mode
+ * and whether to select a launcher.
+ */
+ public LaunchWizard(Object[] allLaunchers, IStructuredSelection selection, String mode, boolean selectLauncher) {
+ fSelectLauncher= selectLauncher;
+ fLaunchers= allLaunchers;
+ fSelection= selection;
+ fMode= mode;
+ initialize();
+ }
+
+ public LaunchWizard(Object[] allLaunchers, IStructuredSelection selection, String mode) {
+ this(allLaunchers, selection, mode, allLaunchers.length > 1);
+ }
+
+ protected void initialize() {
+ setNeedsProgressMonitor(true);
+ setForcePreviousAndNextButtons(true);
+ if (fMode.equals(ILaunchManager.DEBUG_MODE)) {
+ setWindowTitle(DebugUIUtils.getResourceString(DEBUG));
+ } else {
+ setWindowTitle(DebugUIUtils.getResourceString(RUN));
+ }
+ setDefaultPageImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_OBJS_LAUNCH_DEBUG));
+ }
+ /**
+ * @see Wizard#addPages
+ */
+ public void addPages() {
+ if (fSelection == null || fSelection.isEmpty()) {
+ addPage(new LaunchWizardProjectSelectionPage(fMode));
+ }
+ if (fSelectLauncher) {
+ addPage(fPage= new LaunchWizardSelectionPage(fLaunchers, fMode));
+ }
+ }
+
+ public IStructuredSelection getSelection() {
+ return fSelection;
+ }
+
+ /**
+ * Updates the default launcher if required - i.e. if the checkbox is
+ * checked.
+ */
+ public void updateDefaultLauncher() {
+ IProject project= getProject();
+ if (fSelectLauncher && fPage.fSetAsDefaultLauncher.getSelection()) {
+ ILauncher launcher= fPage.getLauncher();
+ if (launcher != null) {
+ try {
+ fOldDefaultLauncher= DebugPlugin.getDefault().getLaunchManager().getDefaultLauncher(project);
+ DebugPlugin.getDefault().getLaunchManager().setDefaultLauncher(project, launcher);
+ fDefaultLauncherSet= true;
+ } catch (CoreException e) {
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the <code>IProject</code> that is associated with the context selection,
+ * or <code>null</code> if there is no single project associated with the selection.
+ */
+ protected IProject getProject() {
+ IProject project= null;
+ Iterator elements= fSelection.iterator();
+ while (elements.hasNext()) {
+ Object e= elements.next();
+ IResource res= null;
+ if (e instanceof IAdaptable) {
+ res= (IResource) ((IAdaptable) e).getAdapter(IResource.class);
+ }
+ if (res != null) {
+ IProject p= res.getProject();
+ if (project == null) {
+ project= p;
+ } else
+ if (!project.equals(p)) {
+ return null;
+ }
+ }
+ }
+
+ return project;
+ }
+
+ /**
+ * @see IWizard#performFinish
+ */
+ public boolean performFinish() {
+ if (!fDefaultLauncherSet) {
+ updateDefaultLauncher();
+ }
+ return true;
+ }
+
+ /**
+ * @see IWizard#performCancel
+ */
+ public boolean performCancel() {
+ if (fDefaultLauncherSet) {
+ try {
+ DebugPlugin.getDefault().getLaunchManager().setDefaultLauncher(getProject(), fOldDefaultLauncher);
+ } catch (CoreException e) {
+ return false;
+ }
+ fDefaultLauncherSet= false;
+ }
+ return true;
+ }
+
+ /**
+ * Sets the selection that is the context for the launch.
+ */
+ public void setProjectSelection(IStructuredSelection selection) {
+ fSelection= selection;
+ }
+
+ /**
+ * @see IWizard#getNextPage(IWizardPage)
+ */
+ public IWizardPage getNextPage(IWizardPage page) {
+ if (!fSelectLauncher) {
+ IWizardNode node= new LaunchWizardNode(page, (ILauncher)fLaunchers[0], fMode);
+ IWizard wizard = node.getWizard();
+ wizard.addPages();
+ return wizard.getStartingPage();
+ }
+ return super.getNextPage(page);
+ }
+
+ /**
+ * @see IWizard#canFinish()
+ */
+ public boolean canFinish() {
+ //it is the nested wizard that will finish
+ return false;
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardDialog.java
new file mode 100644
index 000000000..fa6e3851b
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardDialog.java
@@ -0,0 +1,55 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import java.lang.reflect.InvocationTargetException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Subclassed to provide access to button presses
+ */
+public class LaunchWizardDialog extends WizardDialog {
+
+ protected LaunchWizard fWizard;
+
+ /**
+ * Constructs a wizard dialog
+ */
+ public LaunchWizardDialog(Shell shell, LaunchWizard w) {
+ super(shell, w);
+ fWizard= w;
+ }
+
+ /**
+ * Only needed for VAJ support as cannot use <code>LaunchWizard.super.nextPressed()</code>
+ * in the runnable
+ */
+ private void nextPressed0() {
+ super.nextPressed();
+ }
+
+ protected void cancelPressed() {
+ fWizard.performCancel();
+ super.cancelPressed();
+ }
+
+ protected void nextPressed() {
+ try {
+ run(false, false, new IRunnableWithProgress() {
+ public void run(IProgressMonitor pm) {
+ nextPressed0();
+ }
+ });
+ } catch (InterruptedException ie) {
+ } catch (InvocationTargetException ite) {
+ }
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardNode.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardNode.java
new file mode 100644
index 000000000..04f067cb5
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardNode.java
@@ -0,0 +1,104 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.debug.core.ILauncher;
+import org.eclipse.debug.ui.ILaunchWizard;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardNode;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ * A wizard node represents a "potential" wizard. Wizard nodes
+ * allow the user to pick from several available nested wizards.
+ */
+public class LaunchWizardNode implements IWizardNode {
+
+ private static final String PREFIX= "launch_wizard_node.";
+ private static final String ERROR= PREFIX + "error.";
+
+ protected IWizard fWizard;
+ protected IWizardPage fParentWizardPage;
+ protected ILauncher fLauncher;
+
+ protected String fMode;
+ /**
+ * Creates a node that holds onto a wizard element.
+ * The wizard element provides information on how to create
+ * the wizard supplied by the ISV's extension.
+ */
+ public LaunchWizardNode(IWizardPage aWizardPage, ILauncher launcher, String mode) {
+ fParentWizardPage= aWizardPage;
+ fLauncher= launcher;
+ fMode= mode;
+ }
+
+ /**
+ * Returns the wizard represented by this wizard node.
+ */
+ public ILaunchWizard createWizard() throws CoreException {
+ IConfigurationElement config= fLauncher.getConfigurationElement();
+ ILaunchWizard wizard= (ILaunchWizard)DebugUIPlugin.getDefault().createExtension(config, "wizard");
+ wizard.init(fLauncher, fMode, ((LaunchWizard)fParentWizardPage.getWizard()).getSelection());
+ return wizard;
+ }
+
+ /**
+ * @see org.eclipse.jface.wizard.IWizardNode#getExtent()
+ */
+ public Point getExtent() {
+ return new Point(-1, -1);
+ }
+
+ /**
+ * @see org.eclipse.jface.wizards.IWizardNode#getWizard()
+ */
+ public IWizard getWizard() {
+ if (fWizard != null) {
+ return fWizard; // we've already created it
+ }
+ try {
+ fWizard= createWizard(); // create instance of target wizard
+ } catch (CoreException e) {
+ DebugUIUtils.errorDialog(fParentWizardPage.getControl().getShell(), ERROR, e.getStatus());
+ return null;
+ }
+
+ return fWizard;
+ }
+
+ /**
+ * @see org.eclipse.jface.wizard.IWizardNode#isContentCreated()
+ */
+ public boolean isContentCreated() {
+ return fWizard != null;
+ }
+
+ /**
+ * @see org.eclipse.jface.wizard.IWizardNode#dispose()
+ */
+ public void dispose() {
+ // Do nothing since the wizard wasn't created via reflection.
+ fWizard= null;
+ }
+
+ /**
+ * Returns the description specified for the launcher associated
+ * with the wizard node.
+ */
+ public String getDescription() {
+ IConfigurationElement config= fLauncher.getConfigurationElement();
+ String description= config.getAttribute("description");
+ if (description == null) {
+ description= "";
+ }
+ return description;
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardProjectSelectionPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardProjectSelectionPage.java
new file mode 100644
index 000000000..bb30f1266
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardProjectSelectionPage.java
@@ -0,0 +1,290 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+/**
+ * Used to select the project that will be used as a launch context.
+ */
+public class LaunchWizardProjectSelectionPage extends WizardPage {
+
+ private static final String PREFIX= "launch_wizard_project_page.";
+ private static final String LAUNCHER= PREFIX + "launcher";
+ private static final String SELECT_ELEMENTS= PREFIX + "select_elements";
+ private static final String SELECT_ERROR_ELEMENTS= PREFIX + "select_error_elements";
+ private static final String PATTERN_LABEL= PREFIX + "pattern_label";
+
+ /**
+ * Viewer for the projects to provide the context for the launch
+ */
+ protected TableViewer fElementsList;
+
+ /**
+ * A text field to perform pattern matching
+ */
+ protected Text fPatternText;
+
+ /**
+ * The filtered array
+ */
+ protected Object[] fFilteredElements;
+
+ /**
+ * A content provider for the elements list
+ */
+ class ElementsContentProvider implements IStructuredContentProvider {
+
+ protected IWorkspaceRoot fWorkspaceRoot;
+
+ /**
+ * @see IContentProvider#inputChanged
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ fWorkspaceRoot= (IWorkspaceRoot)newInput;
+ }
+
+ public void dispose() {
+ }
+
+ public Object[] getElements(Object parent) {
+ if (fWorkspaceRoot != null) {
+ return fWorkspaceRoot.getProjects();
+ }
+
+ return new Object[]{};
+ }
+ }
+
+ class PatternFilter extends ViewerFilter {
+ protected StringMatcher fMatcher= null;
+
+ /**
+ * @see ViewerFilter
+ */
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (fMatcher == null) {
+ return true;
+ }
+ ILabelProvider lp= (ILabelProvider) fElementsList.getLabelProvider();
+ return fMatcher.match(lp.getText(element));
+ }
+
+ public void setPattern(String pattern) {
+ fMatcher= new StringMatcher(pattern + "*", true, false);
+ }
+
+ /**
+ * Cache the filtered elements so we can single-select.
+ *
+ * @see ViewerFilter
+ */
+ public Object[] filter(Viewer viewer, Object parent, Object[] input) {
+ fFilteredElements= super.filter(viewer, parent, input);
+ return fFilteredElements;
+ }
+
+ }
+
+ class SimpleSorter extends ViewerSorter {
+ /**
+ * @seeViewerSorter#isSorterProperty(Object, Object)
+ */
+ public boolean isSorterProperty(Object element, Object property) {
+ return true;
+ }
+ }
+
+ /**
+ * Constructs a this page for the given mode
+ */
+ public LaunchWizardProjectSelectionPage(String mode) {
+ super(DebugUIUtils.getResourceString(PREFIX + "title"));
+ // Set the image for the wizard based on the mode
+ if (mode.equals(ILaunchManager.DEBUG_MODE)) {
+ setImageDescriptor(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_WIZBAN_DEBUG));
+ } else {
+ setImageDescriptor(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_WIZBAN_RUN));
+ }
+ }
+
+ /**
+ * Creates the contents of the page - a sorted list of
+ * the projects in the workspace and text area to enter
+ * a pattern to match.
+ */
+ public void createControl(Composite ancestor) {
+ Composite root= new Composite(ancestor, SWT.NONE);
+ GridLayout l= new GridLayout();
+ l.numColumns= 1;
+ l.makeColumnsEqualWidth= true;
+ root.setLayout(l);
+
+ createElementsGroup(root);
+
+ setDescription(DebugUIUtils.getResourceString(PREFIX + "title"));
+
+ setPageComplete(false);
+ setTitle(DebugUIUtils.getResourceString(PREFIX + "title"));
+ setControl(root);
+ }
+
+ public void createElementsGroup(Composite root) {
+ Label elementsLabel= new Label(root, SWT.NONE);
+ elementsLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+ elementsLabel.setText(DebugUIUtils.getResourceString(PATTERN_LABEL));
+
+ fPatternText= new Text(root, SWT.BORDER);
+ fPatternText.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+
+ fElementsList= new TableViewer(root) {
+ protected void handleDoubleSelect(SelectionEvent event) {
+ getContainer().showPage(getNextPage());
+ }
+ };
+
+ Table list= fElementsList.getTable();
+
+ GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
+ gd.heightHint= 200;
+ gd.grabExcessVerticalSpace= true;
+ list.setLayoutData(gd);
+
+ fElementsList.setContentProvider(new ElementsContentProvider());
+ fElementsList.setLabelProvider(new WorkbenchLabelProvider());
+ fElementsList.setSorter(new SimpleSorter());
+
+ final PatternFilter filter= new PatternFilter();
+ fElementsList.addFilter(filter);
+ fPatternText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ filter.setPattern(((Text) (e.widget)).getText());
+ fElementsList.refresh();
+ if (fFilteredElements.length == 1) {
+ fElementsList.setSelection(new StructuredSelection(fFilteredElements[0]), true);
+ setMessage(null);
+ setPageComplete(true);
+ } else {
+ fElementsList.setSelection(null);
+ // this should get done in the selection changed callback - but it does not work
+ if (fFilteredElements.length == 0) {
+ setMessage(DebugUIUtils.getResourceString(SELECT_ERROR_ELEMENTS));
+ } else {
+ setMessage(DebugUIUtils.getResourceString(SELECT_ELEMENTS));
+ }
+
+ setPageComplete(false);
+ }
+ }
+ });
+
+ fElementsList.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent e) {
+ if (e.getSelection().isEmpty()) {
+ setMessage(DebugUIUtils.getResourceString(SELECT_ELEMENTS));
+ setPageComplete(false);
+ } else if (e.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection ss= (IStructuredSelection) e.getSelection();
+ if (!ss.isEmpty()) {
+ ((LaunchWizard)getWizard()).setProjectSelection(ss);
+ setMessage(null);
+ setPageComplete(true);
+ }
+ }
+ }
+ });
+
+ fElementsList.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ initializeSettings();
+ }
+
+ /**
+ * Returns the selected Java project for the context of the launch or <code>null</code> if
+ * no Java project is selected.
+ */
+ protected Object[] getElements() {
+ ISelection s= fElementsList.getSelection();
+ if (s.isEmpty()) {
+ return null;
+ }
+
+ if (s instanceof IStructuredSelection) {
+ return ((IStructuredSelection) s).toArray();
+ }
+
+ return null;
+ }
+
+ /**
+ * Convenience method to set the message line
+ */
+ public void setMessage(String message) {
+ super.setErrorMessage(null);
+ super.setMessage(message);
+ }
+
+ /**
+ * Convenience method to set the error line
+ */
+ public void setErrorMessage(String message) {
+ super.setMessage(null);
+ super.setErrorMessage(message);
+ }
+
+ /**
+ * Initialize the settings:<ul>
+ * <li>If there is only one project, select it
+ * <li>Put the cursor in the pattern text area
+ * </ul>
+ */
+ protected void initializeSettings() {
+
+ Runnable runnable= new Runnable() {
+ public void run() {
+ Object[] children= ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ if (children.length == 1) {
+ fElementsList.setSelection(new StructuredSelection(children[0]), true);
+ setMessage(null);
+ setPageComplete(true);
+ } else if (children.length > 0) {
+ setMessage(DebugUIUtils.getResourceString(SELECT_ELEMENTS));
+ setPageComplete(false);
+ } else {
+ // no elements to select
+ setErrorMessage(DebugUIUtils.getResourceString(SELECT_ERROR_ELEMENTS));
+ setPageComplete(false);
+ }
+ fPatternText.setFocus();
+ }
+ };
+ Display.getCurrent().asyncExec(runnable);
+ }
+
+ /**
+ * @IWizardPage#canFlipToNextPage()
+ */
+ public boolean canFlipToNextPage() {
+ return isPageComplete();
+ }
+}
+
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardSelectionPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardSelectionPage.java
new file mode 100644
index 000000000..fe0ea4d21
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchWizardSelectionPage.java
@@ -0,0 +1,232 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILauncher;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardNode;
+import org.eclipse.jface.wizard.WizardSelectionPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+
+public class LaunchWizardSelectionPage extends WizardSelectionPage {
+
+ private static final String PREFIX= "launch_wizard_page.";
+ private static final String LAUNCHER= PREFIX + "launcher";
+ private static final String DEFAULT_LAUNCHER= PREFIX + "default_launcher";
+ private static final String SELECT_ERROR_LAUNCHER= PREFIX + "select_error_launcher";
+ /**
+ * Viewer for the launchers
+ */
+ protected TableViewer fLaunchersList;
+
+ /**
+ * List of launchers
+ */
+ protected Object[] fLaunchers;
+
+ /**
+ * Check box for setting default launcher
+ */
+ protected Button fSetAsDefaultLauncher;
+
+ /**
+ * The mode of the launch.
+ * @see ExecutionAction#getMode()
+ */
+ protected String fMode;
+
+ /**
+ * A content provider for the elements list
+ */
+ class ElementsContentProvider implements IStructuredContentProvider {
+
+ /**
+ * @see IContentProvider#inputChanged
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public void dispose() {
+ }
+
+ public Object[] getElements(Object parent) {
+ return fLaunchers;
+ }
+ }
+
+ class SimpleSorter extends ViewerSorter {
+ /**
+ * @seeViewerSorter#isSorterProperty(Object, Object)
+ */
+ public boolean isSorterProperty(Object element, Object property) {
+ return true;
+ }
+ }
+
+ public LaunchWizardSelectionPage(Object[] allLaunchers, String mode) {
+ super(DebugUIUtils.getResourceString(PREFIX + "title"));
+ fLaunchers= allLaunchers;
+ fMode= mode;
+ }
+
+ public void createControl(Composite ancestor) {
+ Composite root= new Composite(ancestor, SWT.NONE);
+ GridLayout l= new GridLayout();
+ l.numColumns= 1;
+ root.setLayout(l);
+ createLaunchersGroup(root);
+
+ setTitle(DebugUIUtils.getResourceString(PREFIX + "title"));
+ if (fMode.equals(ILaunchManager.DEBUG_MODE)) {
+ setImageDescriptor(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_WIZBAN_DEBUG));
+ } else {
+ setImageDescriptor(DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_WIZBAN_RUN));
+ }
+ initializeSettings();
+ setControl(root);
+ }
+
+ public void createLaunchersGroup(Composite root) {
+
+ Label launchersLabel= new Label(root, SWT.NONE);
+ launchersLabel.setText(DebugUIUtils.getResourceString(LAUNCHER));
+
+ fLaunchersList= new TableViewer(new Table(root, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER)) {
+ protected void handleDoubleSelect(SelectionEvent event) {
+ updateSelection(getSelection());
+ ((LaunchWizard)getWizard()).updateDefaultLauncher();
+ getContainer().showPage(getNextPage());
+ }
+ };
+
+ Table list= fLaunchersList.getTable();
+
+ GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
+ gd.heightHint= 200;
+ gd.grabExcessVerticalSpace= true;
+ gd.grabExcessHorizontalSpace= true;
+ list.setLayoutData(gd);
+
+ fLaunchersList.setContentProvider(new ElementsContentProvider());
+ fLaunchersList.setLabelProvider(new DelegatingModelPresentation());
+ fLaunchersList.setSorter(new SimpleSorter());
+ fLaunchersList.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent e) {
+ if (e.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection ss= (IStructuredSelection) e.getSelection();
+ if (!ss.isEmpty()) {
+ launcherSelected((ILauncher)ss.getFirstElement());
+ }
+ }
+ }
+ });
+ fLaunchersList.setInput(fLaunchersList);
+
+ fSetAsDefaultLauncher= new Button(root, SWT.CHECK);
+ fSetAsDefaultLauncher.setText(DebugUIUtils.getResourceString(DEFAULT_LAUNCHER));
+ }
+
+ /**
+ * Updates the elements list for the given launcher
+ */
+ protected void launcherSelected(ILauncher launcher) {
+ LaunchWizardNode node= new LaunchWizardNode(this, launcher, fMode);
+ setSelectedNode(node);
+ setMessage(null);
+ updateDefaultLauncherButton(launcher);
+ setDescription(node.getDescription());
+ }
+
+ /**
+ * Convenience method to set the error line
+ */
+ public void setErrorMessage(String message) {
+ super.setMessage(null);
+ super.setErrorMessage(message);
+ }
+
+ /**
+ * Convenience method to set the message line
+ */
+ public void setMessage(String message) {
+ super.setErrorMessage(null);
+ super.setMessage(message);
+ }
+
+ /**
+ * Initialize the settings:<ul>
+ * <li>If there is only one launcher, select it
+ * </ul>
+ */
+ protected void initializeSettings() {
+ Runnable runnable= new Runnable() {
+ public void run() {
+
+ if (fLaunchers.length == 0) {
+ setErrorMessage(DebugUIUtils.getResourceString(SELECT_ERROR_LAUNCHER));
+ } else
+ fLaunchersList.setSelection(new StructuredSelection(fLaunchers[0]));
+ }
+ };
+ Display.getCurrent().asyncExec(runnable);
+ }
+
+ protected void updateDefaultLauncherButton(ILauncher launcher) {
+ IProject project= ((LaunchWizard)getWizard()).getProject();
+ if (project == null) {
+ // disable the control, we cannot set it without a project context
+ fSetAsDefaultLauncher.setSelection(false);
+ fSetAsDefaultLauncher.setEnabled(false);
+ } else {
+ // if the launcher is not the default launcher, enable the control
+ try {
+ ILauncher defaultLauncher= DebugPlugin.getDefault().getLaunchManager().getDefaultLauncher(project);
+ if (defaultLauncher != null && defaultLauncher.equals(launcher)) {
+ // disable the setting, but show that it is set
+ fSetAsDefaultLauncher.setSelection(true);
+ fSetAsDefaultLauncher.setEnabled(false);
+ } else {
+ // allow to set as default - in fact, set as default
+ fSetAsDefaultLauncher.setSelection(true);
+ fSetAsDefaultLauncher.setEnabled(true);
+ }
+ } catch (CoreException e) {
+ // disable default launcher
+ fSetAsDefaultLauncher.setSelection(false);
+ fSetAsDefaultLauncher.setEnabled(false);
+ }
+ }
+ }
+
+ protected ILauncher getLauncher() {
+ IStructuredSelection selection= (IStructuredSelection)fLaunchersList.getSelection();
+ if (selection.isEmpty()) {
+ return null;
+ }
+ return (ILauncher) selection.getFirstElement();
+ }
+
+ /**
+ * Implemented here to provide package access
+ */
+ protected IWizardContainer getContainer() {
+ return super.getContainer();
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LauncherPropertyPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LauncherPropertyPage.java
new file mode 100644
index 000000000..d64ee2074
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LauncherPropertyPage.java
@@ -0,0 +1,250 @@
+package org.eclipse.debug.internal.ui;
+
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILauncher;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import java.util.ArrayList;
+
+/**
+ * A preference page to enable/disable default launchers for a resource.
+ */
+public class LauncherPropertyPage extends PropertyPage implements IWorkbenchPreferencePage {
+
+ private static final String PREFIX= "launcher_preferences.";
+ private static final String DESCRIPTION= PREFIX + "description";
+ private static final String RUN_DEBUG= PREFIX + "run_debug";
+ private static final String NONE= PREFIX + "none";
+ private static final String ERROR= PREFIX + "error.";
+
+ protected Combo fCombo;
+
+ /**
+ * Utility method that creates a combo instance
+ * and sets the default layout data.
+ */
+
+ private Combo createCombo(Composite parent, String[] items) {
+ Combo combo= new Combo(parent, SWT.READ_ONLY | SWT.DROP_DOWN);
+ combo.setItems(items);
+ GridData data= new GridData();
+ data.horizontalAlignment= GridData.HORIZONTAL_ALIGN_BEGINNING;
+ combo.setLayoutData(data);
+ return combo;
+ }
+
+ /**
+ * Creates composite control and sets the default layout data.
+ */
+
+ private Composite createComposite(Composite parent, int numColumns) {
+ Composite composite= new Composite(parent, SWT.NULL);
+
+ //GridLayout
+ GridLayout layout= new GridLayout();
+ layout.numColumns= numColumns;
+ composite.setLayout(layout);
+
+ //GridData
+ GridData data= new GridData();
+ data.verticalAlignment= GridData.FILL;
+ data.horizontalAlignment= GridData.FILL;
+ composite.setLayoutData(data);
+ return composite;
+ }
+
+ protected Control createContents(Composite parent){
+ return null;
+ }
+ /**
+ * Creates preference page controls on demand.
+ */
+ public void createControl(Composite parent) {
+
+ // Table to choose which tags are shown in the outliner
+ Composite pageComponent= createComposite(parent, 1);
+ createLabel(pageComponent, DebugUIUtils.getResourceString(DESCRIPTION));
+ ImageRegistry registry= DebugUIPlugin.getDefault().getImageRegistry();
+
+ ILauncher[] launchers= getLaunchManager().getLaunchers();
+ java.util.List list = new ArrayList(1);
+ list.add(DebugUIUtils.getResourceString(NONE));
+ for (int i = 0; i < launchers.length; i++) {
+ if (DebugUIPlugin.getDefault().isVisible(launchers[i]))
+ list.add(launchers[i].getLabel());
+ }
+ String[] items= new String[list.size()];
+ list.toArray(items);
+
+ //Composite box= createComposite(pageComponent, 2);
+ Composite launcherComponent= createComposite(pageComponent, 2);
+ createLabel(launcherComponent, DebugUIUtils.getResourceString(RUN_DEBUG), registry.get(IDebugUIConstants.IMG_ACT_DEBUG));
+ fCombo= createCombo(launcherComponent, items);
+
+ initializeValues();
+ setControl(pageComponent);
+ }
+
+ /**
+ * Utility method that creates a label instance
+ * and sets the default layout data.
+ */
+ private Label createLabel(Composite parent, String text) {
+ Label label= new Label(parent, SWT.LEFT);
+ label.setText(text);
+ GridData data= new GridData();
+ data.horizontalAlignment= GridData.FILL;
+ label.setLayoutData(data);
+ return label;
+ }
+
+ /**
+ * Utility method that creates a composite label instance
+ * and sets the default layout data.
+ */
+
+ private Composite createLabel(Composite parent, String text, Image image) {
+ Composite composite= createComposite(parent, 2);
+ Label imageLabel= new Label(composite, SWT.LEFT);
+ imageLabel.setImage(image);
+ Label textLabel= new Label(composite, SWT.LEFT);
+ textLabel.setText(text);
+
+ GridData data= new GridData();
+ data.horizontalAlignment= GridData.HORIZONTAL_ALIGN_BEGINNING;
+ composite.setLayoutData(data);
+
+ return composite;
+ }
+
+ /**
+ * The default button has been pressed.
+ */
+ protected void performDefaults() {
+ super.performDefaults();
+ // Select "none"
+ fCombo.select(0);
+ }
+
+ /**
+ * Returns preference store that belongs to the our plugin.
+ * This is important because we want to store
+ * our preferences separately from the desktop.
+ */
+ protected IPreferenceStore doGetPreferenceStore() {
+ return DebugUIPlugin.getDefault().getPreferenceStore();
+ }
+
+ /**
+ * This is a hook for subclasses to do special things when the ok
+ * button is pressed.
+ */
+ public boolean performOk() {
+ IProject project= getProject();
+ if (project != null) {
+ boolean ok;
+ String selection= fCombo.getText();
+ return saveLauncherProperty(project, selection);
+ }
+ return false;
+ }
+
+ /**
+ * Convenience method to get the launch manager
+ */
+ protected ILaunchManager getLaunchManager() {
+ return DebugPlugin.getDefault().getLaunchManager();
+ }
+
+ /**
+ * Returns the project this page works on
+ */
+ protected IProject getProject() {
+ IAdaptable element= getElement();
+ IProject project= null;
+ IResource resource= (IResource)element.getAdapter(IResource.class);
+ if (resource != null) {
+ return resource.getProject();
+ }
+ return null;
+ }
+
+ /**
+ * @see IWorkbenchPreferencePage
+ */
+ public void init(IWorkbench desktop) {
+ doGetPreferenceStore();
+ }
+
+ /**
+ * Initializes states of the controls.
+ */
+ private void initializeValues() {
+
+ IProject project= getProject();
+ if (project != null) {
+ try {
+ ILauncher launcher= getLaunchManager().getDefaultLauncher(project);
+ if (launcher == null) {
+ fCombo.select(0);
+ } else {
+ fCombo.setText(launcher.getLabel());
+ }
+ } catch (CoreException ce) {
+ fCombo.select(0);
+ DebugUIUtils.logError(ce);
+ }
+ }
+ }
+
+ /**
+ * Find the launcher with the given selection (name), and save it as the preference.
+ */
+ protected boolean saveLauncherProperty(IProject project, String selection) {
+ try {
+ ILauncher[] launchers= getLaunchManager().getLaunchers();
+ for (int i= 0; i < launchers.length; i++) {
+ ILauncher launcher= launchers[i];
+ if (launcher.getLabel().equals(selection)) {
+ getLaunchManager().setDefaultLauncher(project, launcher);
+ return true;
+ }
+ }
+ getLaunchManager().setDefaultLauncher(project, null);
+ } catch (CoreException e) {
+ DebugUIUtils.errorDialog(DebugUIPlugin.getActiveWorkbenchWindow().getShell(), ERROR, e.getStatus());
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * The push button has been double clicked
+ */
+ public void widgetDoubleSelected(SelectionEvent event) {
+
+ // The select all button has been double clicked
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchesView.java
new file mode 100644
index 000000000..5958af5f3
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchesView.java
@@ -0,0 +1,219 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.actions.SelectionProviderAction;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
+
+public class LaunchesView extends AbstractDebugView implements ISelectionChangedListener {
+
+ protected final static String PREFIX= "launches_view.";
+
+ protected SelectionProviderAction fTerminateAction;
+ protected RemoveTerminatedAction fRemoveTerminatedAction;
+ protected TerminateAllAction fTerminateAllAction;
+ protected SelectionProviderAction fDisconnectAction;
+ protected SelectionProviderAction fRelaunchAction;
+ protected SelectionProviderAction fTerminateAndRemoveAction;
+
+ protected PropertyDialogAction fPropertyDialogAction;
+
+ /**
+ * Updates the state of the buttons in the view
+ */
+ protected void updateButtons() {
+ ISelection s= fViewer.getSelection();
+ if (s instanceof IStructuredSelection) {
+ IStructuredSelection selection= (IStructuredSelection) s;
+ fTerminateAction.selectionChanged(selection);
+ fDisconnectAction.selectionChanged(selection);
+ }
+ fRemoveTerminatedAction.update();
+ }
+
+ /**
+ * Initializes the actions of this view.
+ */
+ protected void initializeActions(LaunchesViewer viewer) {
+
+ fTerminateAction= new ControlAction(viewer, new TerminateActionDelegate());
+ fTerminateAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_TERMINATE));
+ fTerminateAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE));
+ fTerminateAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TERMINATE));
+ fTerminateAction.setEnabled(false);
+
+ fDisconnectAction= new ControlAction(viewer, new DisconnectActionDelegate());
+ fDisconnectAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DISCONNECT));
+ fDisconnectAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DISCONNECT));
+ fDisconnectAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DISCONNECT));
+ fDisconnectAction.setEnabled(false);
+
+ fRemoveTerminatedAction= new RemoveTerminatedAction(this instanceof DebugView);
+ fRemoveTerminatedAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_REMOVE_TERMINATED));
+ fRemoveTerminatedAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE_TERMINATED));
+ fRemoveTerminatedAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE_TERMINATED));
+ fRemoveTerminatedAction.setEnabled(false);
+
+ fRelaunchAction= new ControlAction(viewer, new RelaunchActionDelegate());
+ fRelaunchAction.setEnabled(false);
+
+ fTerminateAndRemoveAction= new ControlAction(viewer, new TerminateAndRemoveActionDelegate());
+
+ fTerminateAllAction= new TerminateAllAction();
+
+ fPropertyDialogAction= new PropertyDialogAction(getSite().getWorkbenchWindow().getShell(), getSite().getSelectionProvider());
+ }
+
+ /**
+ * @see IWorkbenchPart
+ */
+ public void createPartControl(Composite parent) {
+ boolean showDebugTargets = getSite().getId().equals(IDebugUIConstants.ID_DEBUG_VIEW);
+ LaunchesViewer lv = new LaunchesViewer(parent, showDebugTargets, this);
+ fViewer= lv;
+ fViewer.addSelectionChangedListener(this);
+ fViewer.setContentProvider(getContentProvider());
+ fViewer.setLabelProvider(new DelegatingModelPresentation());
+ fViewer.setUseHashlookup(true);
+ // add my viewer as a selection provider, so selective re-launch works
+ getSite().setSelectionProvider(fViewer);
+ initializeActions(lv);
+ // register this viewer as the debug UI selection provider
+ DebugUIPlugin.getDefault().addSelectionProvider(fViewer, this);
+
+ // create context menu
+ createContextMenu(lv.getTree());
+ initializeToolBar();
+ lv.expandToLevel(2);
+ fViewer.setInput(DebugPlugin.getDefault().getLaunchManager());
+ fViewer.getControl().addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent e) {
+ handleKeyPressed(e);
+ }
+ });
+ setTitleToolTip(getTitleToolTipText(getPrefix()));
+ }
+
+ /**
+ * Configures the toolBar
+ */
+ protected void configureToolBar(IToolBarManager tbm) {
+ tbm.add(fTerminateAction);
+ tbm.add(fDisconnectAction);
+ tbm.add(fRemoveTerminatedAction);
+ }
+
+ /**
+ * @see IWorkbenchPart
+ */
+ public void setFocus() {
+ Control c = fViewer.getControl();
+ if (!c.isFocusControl()) {
+ c.setFocus();
+ //ensure that all downstream listeners
+ //know the current selection..switching from another view
+ DebugUIPlugin.getDefault().selectionChanged(new SelectionChangedEvent(fViewer, fViewer.getSelection()));
+ }
+ }
+
+ /**
+ * Adds items to the context menu
+ */
+ protected void fillContextMenu(IMenuManager mgr) {
+ fRemoveTerminatedAction.update();
+ fTerminateAllAction.update();
+
+ mgr.add(new Separator(IDebugUIConstants.EMPTY_LAUNCH_GROUP));
+ mgr.add(new Separator(IDebugUIConstants.LAUNCH_GROUP));
+
+ mgr.add(fTerminateAction);
+ mgr.add(fDisconnectAction);
+ mgr.add(new Separator());
+ mgr.add(fTerminateAndRemoveAction);
+ mgr.add(fTerminateAllAction);
+ mgr.add(fRemoveTerminatedAction);
+ mgr.add(fRelaunchAction);
+ mgr.add(new Separator(IDebugUIConstants.PROPERTY_GROUP));
+ fPropertyDialogAction.setEnabled(fPropertyDialogAction.isApplicableForSelection());
+ mgr.add(fPropertyDialogAction);
+ mgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ /**
+ * @see IWorkbenchPart
+ */
+ public void dispose() {
+ if (fViewer != null) {
+ DebugUIPlugin.getDefault().removeSelectionProvider(fViewer, this);
+ }
+ super.dispose();
+ }
+
+ /**
+ * Auto-expand and select the given element - must be called in UI thread.
+ * This is used to implement auto-expansion-and-select on a SUSPEND event.
+ */
+ public void autoExpand(Object element) {
+ Object selectee = element;
+ if (element instanceof ILaunch) {
+ IProcess[] ps= ((ILaunch)element).getProcesses();
+ if (ps != null && ps.length > 0) {
+ selectee= ps[0];
+ }
+ }
+ fViewer.setSelection(new StructuredSelection(selectee), true);
+ }
+
+ /**
+ * Returns the content provider to use for the viewer of this view.
+ */
+ protected DebugContentProvider getContentProvider() {
+ return new ProcessesContentProvider();
+ }
+
+ /**
+ * The selection has changed in the viewer. Update
+ * the state of the buttons.
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateButtons();
+ }
+
+ /**
+ * Returns the resource bundle prefix for this action
+ */
+ protected String getPrefix(){
+ return PREFIX;
+ }
+
+ /**
+ * Handles key events in viewer. Specifically interested in
+ * the Delete key.
+ */
+ protected void handleKeyPressed(KeyEvent event) {
+ if (event.character == SWT.DEL && event.stateMask == 0
+ && fTerminateAndRemoveAction.isEnabled()) {
+ fTerminateAndRemoveAction.run();
+ }
+ }
+}
+
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchesViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchesViewer.java
new file mode 100644
index 000000000..dc5047412
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchesViewer.java
@@ -0,0 +1,87 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IThread;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+
+/**
+ * The launches viewer displays a tree of launches. It can be
+ * configured to display run launches or debug launches. When
+ * displaying run launches, it filters debug targets from the viewer.
+ * When displaying debug launches, debug targets are displayed,
+ * and the debug target's corresponding system process is filtered
+ * from the view.
+ */
+public class LaunchesViewer extends TreeViewer {
+ /**
+ * The view this viewer is contained in
+ */
+ protected LaunchesView fView;
+
+ public LaunchesViewer(Composite parent, boolean showDebugTargets, LaunchesView view) {
+ super(new Tree(parent, SWT.MULTI));
+ fView= view;
+ LaunchesViewerFilter filter= new LaunchesViewerFilter(showDebugTargets);
+ addFilter(filter);
+ setUseHashlookup(true);
+ }
+
+ /**
+ * Update the buttons in my view
+ */
+ protected void updateButtons() {
+ fView.updateButtons();
+ }
+
+ protected void updateMarkerForSelection() {
+ // update the instruction pointer
+ if (fView instanceof DebugView) {
+ ((DebugView) fView).showMarkerForCurrentSelection();
+ }
+ }
+
+ /**
+ * Only sets selection if it is different from the current selection
+ */
+ public void setSelection(ISelection selection, boolean reveal) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss= (IStructuredSelection)selection;
+ Object element= ss.getFirstElement();
+ ISelection oldSelection= getSelection();
+ if (oldSelection instanceof IStructuredSelection) {
+ if (element != null) {
+ IStructuredSelection oldss= (IStructuredSelection)oldSelection;
+ Object oldElement= oldss.getFirstElement();
+ if (element.equals(oldElement)) {
+ if (element instanceof IStackFrame) {
+ //update source selection only...line number change
+ ((DebugView)fView).showMarkerForCurrentSelection();
+ } else if (element instanceof IThread) {
+ ((DebugView)fView).updateButtons();
+ }
+ return;
+ }
+ }
+ }
+ }
+ super.setSelection(selection, reveal);
+ }
+
+ protected void clearSourceSelection() {
+ if (fView instanceof DebugView) {
+ ((DebugView)fView).clearSourceSelection();
+ }
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchesViewerFilter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchesViewerFilter.java
new file mode 100644
index 000000000..9fbb90e2c
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchesViewerFilter.java
@@ -0,0 +1,66 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+
+public class LaunchesViewerFilter extends ViewerFilter {
+ private boolean fShowDebug;
+
+ public LaunchesViewerFilter(boolean showDebug) {
+ fShowDebug= showDebug;
+ }
+
+ /**
+ * Helper method for #select - returns whether the given
+ * launch should be in the viewer.
+ */
+ protected boolean showLaunch(ILaunch launch) {
+ if (launch == null) {
+ return false;
+ }
+ if (fShowDebug) {
+ return launch.getDebugTarget() != null;
+ } else {
+ IProcess[] processes= launch.getProcesses();
+ return processes.length > 0;
+ }
+ }
+
+ /**
+ * @see ViewerFilter
+ */
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ ILaunch launch= null;
+ if (element instanceof ILaunch) {
+ return showLaunch((ILaunch)element);
+
+ } else
+ if (element instanceof IProcess) {
+ launch= ((IProcess)element).getLaunch();
+ if (launch == null) {
+ return false;
+ }
+ if (fShowDebug) {
+ IDebugTarget target = launch.getDebugTarget();
+ return target != null && !element.equals(target.getProcess());
+ } else {
+ return showLaunch(launch);
+ }
+ } else
+ if (element instanceof IDebugElement) {
+ return fShowDebug;
+ }
+ return false;
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java
new file mode 100644
index 000000000..07cbd13dd
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java
@@ -0,0 +1,159 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.util.ListenerList;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * A proxy to an IDebugModelPresentation extension. Instantiates the extension
+ * when it is needed.
+ */
+
+public class LazyModelPresentation implements IDebugModelPresentation {
+
+ /**
+ * A temporary mapping of attribute ids to their values
+ * @see IDebugModelPresentation#setAttribute
+ */
+ protected HashMap fAttributes= new HashMap(3);
+
+ /**
+ * The config element that defines the extension
+ */
+ protected IConfigurationElement fConfig = null;
+
+ /**
+ * The actual presentation instance - null until called upon
+ */
+ protected IDebugModelPresentation fPresentation = null;
+
+ /**
+ * Temp holding for listeners - we do not add to presentation until
+ * it needs to be instantiated.
+ */
+ protected ListenerList fListeners= new ListenerList(5);
+ /**
+ * Constructs a lazy presentation from the config element.
+ */
+ public LazyModelPresentation(IConfigurationElement configElement) {
+ fConfig = configElement;
+ }
+
+ public Image getImage(Object element) {
+ return getPresentation().getImage(element);
+ }
+
+ public String getText(Object element) {
+ return getPresentation().getText(element);
+ }
+
+ /**
+ * @see IDebugModelPresentaion
+ */
+ public IEditorInput getEditorInput(Object element) {
+ return getPresentation().getEditorInput(element);
+ }
+
+ /**
+ * @see IDebugModelPresentaion
+ */
+ public String getEditorId(IEditorInput input, Object inputObject) {
+ return getPresentation().getEditorId(input, inputObject);
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ if (fPresentation != null) {
+ getPresentation().addListener(listener);
+ }
+ fListeners.add(listener);
+ }
+
+ public void dispose() {
+ if (fPresentation != null) {
+ getPresentation().dispose();
+ }
+ fListeners = null;
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ if (fPresentation != null) {
+ return getPresentation().isLabelProperty(element, property);
+ }
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ if (fPresentation != null) {
+ getPresentation().removeListener(listener);
+ }
+ fListeners.remove(listener);
+ }
+
+ /**
+ * @deprecated
+ */
+ public Image getLabelImage(Viewer viewer, Object element) {
+ return getPresentation().getImage(element);
+ }
+
+ /**
+ * @deprecated
+ */
+ public String getLabelText(Viewer viewer, Object element) {
+ return getPresentation().getText(element);
+ }
+
+ /**
+ * Returns the real presentation, instantiating if required.
+ */
+ protected IDebugModelPresentation getPresentation() {
+ if (fPresentation == null) {
+ try {
+ fPresentation= (IDebugModelPresentation) DebugUIPlugin.createExtension(fConfig, "class");
+ // configure it
+ if (fListeners != null) {
+ Object[] list = fListeners.getListeners();
+ for (int i= 0; i < list.length; i++) {
+ fPresentation.addListener((ILabelProviderListener)list[i]);
+ }
+ }
+ Iterator keys= fAttributes.keySet().iterator();
+ while (keys.hasNext()) {
+ String key= (String)keys.next();
+ fPresentation.setAttribute(key, fAttributes.get(key));
+ }
+ } catch (CoreException e) {
+ DebugUIUtils.logError(e);
+ }
+ }
+ return fPresentation;
+ }
+
+ /**
+ * @see IDebugModelPresentation
+ */
+ public void setAttribute(String id, Object value) {
+ if (value == null) {
+ return;
+ }
+ if (fPresentation != null) {
+ getPresentation().setAttribute(id, value);
+ }
+
+ fAttributes.put(id, value);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/OpenBreakpointMarkerAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/OpenBreakpointMarkerAction.java
new file mode 100644
index 000000000..a9101208b
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/OpenBreakpointMarkerAction.java
@@ -0,0 +1,55 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.ui.*;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import java.util.Iterator;
+
+public class OpenBreakpointMarkerAction extends OpenMarkerAction {
+
+ private static final String PREFIX= "open_breakpoint_marker_action.";
+ protected static DelegatingModelPresentation fgPresentation = new DelegatingModelPresentation();
+
+ public OpenBreakpointMarkerAction(ISelectionProvider selectionProvider) {
+ super(selectionProvider, DebugUIUtils.getResourceString(PREFIX + TEXT));
+ setToolTipText(DebugUIUtils.getResourceString(PREFIX + TOOL_TIP_TEXT));
+ }
+
+ /**
+ * @see IAction
+ */
+ public void run() {
+ IWorkbenchWindow dwindow= DebugUIPlugin.getActiveWorkbenchWindow();
+ IWorkbenchPage page= dwindow.getActivePage();
+ IEditorPart part= null;
+ // Get the resource.
+ IStructuredSelection selection= (IStructuredSelection)getStructuredSelection();
+ //Get the selected marker
+ Iterator enum= selection.iterator();
+ IMarker marker= (IMarker)enum.next();
+ IEditorInput input= fgPresentation.getEditorInput(marker);
+ String editorId= fgPresentation.getEditorId(input, marker);
+ if (input != null) {
+ try {
+ part= page.openEditor(input, editorId);
+ } catch (PartInitException e) {
+ DebugUIUtils.logError(e);
+ }
+ }
+ if (part != null) {
+ // Bring editor to front.
+ part.setFocus();
+
+ // Goto the bookmark.
+ part.gotoMarker(marker);
+ }
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/OpenMarkerAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/OpenMarkerAction.java
new file mode 100644
index 000000000..773a085d5
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/OpenMarkerAction.java
@@ -0,0 +1,57 @@
+package org.eclipse.debug.internal.ui;
+
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.SelectionProviderAction;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * Open a marker
+ */
+public class OpenMarkerAction extends SelectionProviderAction {
+
+ public OpenMarkerAction(ISelectionProvider selectionProvider, String label) {
+ super(selectionProvider, label);
+ setEnabled(getStructuredSelection().size() == 1);
+ }
+
+ /**
+ * @see IAction
+ */
+ public void run() {
+ IStructuredSelection selection= (IStructuredSelection) getStructuredSelection();
+ //Get the selected marker
+ if (selection.size() != 1) {
+ return; //Single selection only
+ }
+ Object object= selection.getFirstElement();
+ IWorkbenchWindow dwindow= DebugUIPlugin.getActiveWorkbenchWindow();
+ IWorkbenchPage page= dwindow.getActivePage();
+ try {
+ page.openEditor((IMarker)object);
+ } catch (PartInitException e) {
+ DebugUIUtils.logError(e);
+ }
+ }
+
+ /**
+ * @see SelectionProviderAction
+ */
+ public void selectionChanged(IStructuredSelection sel) {
+ if (sel.size() == 1) {
+ setEnabled(true);
+ } else {
+ setEnabled(false);
+ }
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ProcessesContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ProcessesContentProvider.java
new file mode 100644
index 000000000..f1527238c
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ProcessesContentProvider.java
@@ -0,0 +1,61 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.core.model.IProcess;
+
+/**
+ * Provides the contents for a run mode of the Launches viewer.
+ */
+public class ProcessesContentProvider extends DebugContentProvider {
+
+ /**
+ * @see BasicContentProvider#doHandleDebug(Event)
+ */
+ public void doHandleDebugEvent(DebugEvent event) {
+ Object element= event.getSource();
+ if (element instanceof IDebugElement) {
+ // the processes view is not interested in anything
+ //other than launches and processes
+ return;
+ }
+ switch (event.getKind()) {
+ case DebugEvent.CREATE :
+ insert(element);
+ break;
+ case DebugEvent.TERMINATE :
+ Object parent= getParent(element);
+ refresh(parent);
+ updateButtons();
+ break;
+ case DebugEvent.CHANGE :
+ refresh(element);
+ updateButtons();
+ break;
+ }
+ }
+
+ /**
+ * @see ILaunchListener
+ */
+ public void launchRegistered(final ILaunch launch) {
+ Runnable r= new Runnable() {
+ public void run() {
+ insert(launch);
+ if (!DebugUIPlugin.getDefault().userPreferenceToSwitchPerspective(true)) {
+ IProcess[] ps= launch.getProcesses();
+ if (ps != null && ps.length > 0) {
+ selectAndReveal(ps[0]);
+ }
+ }
+ }
+ };
+
+ asyncExec(r);
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RelaunchActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RelaunchActionDelegate.java
new file mode 100644
index 000000000..fb5fef75a
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RelaunchActionDelegate.java
@@ -0,0 +1,65 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILauncher;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IProcess;
+
+public class RelaunchActionDelegate extends ControlActionDelegate {
+
+ private static final String PREFIX= "relaunch_action.";
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected void doAction(Object object) {
+ relaunch(object, null);
+ }
+
+ /**
+ * Re-launches the launch of the given object.
+ */
+ public static void relaunch(Object object) {
+ relaunch(object, null);
+ }
+
+ /**
+ * Re-launches the launch of the given object in the specified mode.
+ */
+ public static void relaunch(Object object, String mode) {
+ ILaunch launch= null;
+ if (object instanceof IDebugElement) {
+ launch= ((IDebugElement)object).getLaunch();
+ } else if (object instanceof ILaunch) {
+ launch= (ILaunch)object;
+ } else if (object instanceof IProcess) {
+ launch= ((IProcess)object).getLaunch();
+ }
+ if (launch != null) {
+ ILauncher launcher= launch.getLauncher();
+ Object element= launch.getElement();
+ String launchMode= (mode == null) ? launch.getLaunchMode() : mode;
+ launcher.launch(new Object[]{element}, launchMode);
+ }
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ public boolean isEnabledFor(Object element) {
+ return element instanceof ILaunch || element instanceof IDebugElement || element instanceof IProcess;
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected String getPrefix() {
+ return PREFIX;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RelaunchHistoryLaunchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RelaunchHistoryLaunchAction.java
new file mode 100644
index 000000000..27c11ef24
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RelaunchHistoryLaunchAction.java
@@ -0,0 +1,53 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Re-launches a previous launch.
+ */
+public class RelaunchHistoryLaunchAction extends Action {
+
+ protected static final DelegatingModelPresentation fgPresentation= new DelegatingModelPresentation();
+ protected ILaunch fLaunch;
+ protected String fMode;
+
+ public RelaunchHistoryLaunchAction(ILaunch launch, String mode) {
+ super();
+ fLaunch= launch;
+ fMode= mode;
+ setText(fgPresentation.getLaunchText(launch));
+ ImageDescriptor descriptor= null;
+ if (launch.getLaunchMode().equals(ILaunchManager.DEBUG_MODE)) {
+ descriptor= DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_DEBUG);
+ } else {
+ descriptor= DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_RUN);
+ }
+
+ if (descriptor != null) {
+ setImageDescriptor(descriptor);
+ }
+ }
+
+ /**
+ * @see IAction
+ */
+ public void run() {
+ BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
+ public void run() {
+ RelaunchActionDelegate.relaunch(fLaunch, fMode);
+ }
+ });
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RelaunchLastAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RelaunchLastAction.java
new file mode 100644
index 000000000..0f89790e5
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RelaunchLastAction.java
@@ -0,0 +1,70 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Re-runs or re-debugs the last launch.
+ */
+public class RelaunchLastAction extends Action implements IWorkbenchWindowActionDelegate {
+
+ public RelaunchLastAction() {
+ super("&Re-Run/Debug@F10");
+ }
+
+ /**
+ * @see IAction
+ */
+ public void run() {
+ final ILaunch recent= DebugUIPlugin.getDefault().getLastLaunch();
+ if (recent == null) {
+ Display.getCurrent().beep();
+ } else {
+ BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
+ public void run() {
+ RelaunchActionDelegate.relaunch(recent);
+ }
+ });
+ }
+ }
+
+ /**
+ * @see IWorkbenchWindowActionDelegate
+ */
+ public void dispose(){
+ }
+
+ /**
+ * @see IWorkbenchWindowActionDelegate
+ */
+ public void init(IWorkbenchWindow window){
+ }
+
+ /**
+ * @see IActionDelegate
+ */
+ public void run(IAction action){
+ run();
+ }
+
+ /**
+ * @see IActionDelegate
+ */
+ public void selectionChanged(IAction action, ISelection selection){
+ }
+
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllBreakpointsAction.java
new file mode 100644
index 000000000..ea5e5fd67
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllBreakpointsAction.java
@@ -0,0 +1,86 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBreakpointListener;
+import org.eclipse.debug.core.IBreakpointManager;
+import org.eclipse.debug.core.IDebugStatusConstants;
+import org.eclipse.jface.action.Action;
+
+/**
+ * Removes all breakpoints from the source (markers) and remove all
+ * breakpoints from processes
+ */
+public class RemoveAllBreakpointsAction extends Action implements IBreakpointListener {
+
+ private static final String PREFIX= "remove_all_breakpoints_action.";
+ private static final String ERROR= "error.";
+ private static final String STATUS= PREFIX + "status";
+
+ public RemoveAllBreakpointsAction() {
+ super(DebugUIUtils.getResourceString(PREFIX + TEXT));
+ setToolTipText(DebugUIUtils.getResourceString(PREFIX + TOOL_TIP_TEXT));
+ }
+
+ /**
+ * @see IAction
+ */
+ public void run() {
+ final IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
+ final IMarker[] markers= breakpointManager.getBreakpoints();
+ final MultiStatus ms= new MultiStatus(DebugPlugin.getDefault().getDescriptor().getUniqueIdentifier(), IDebugStatusConstants.REQUEST_FAILED, DebugUIUtils.getResourceString(STATUS), null);
+ IWorkspaceRunnable r = new IWorkspaceRunnable() {
+ public void run(IProgressMonitor pm) {
+ for (int i= 0; i < markers.length; i++) {
+ try {
+ breakpointManager.removeBreakpoint(markers[i], true);
+ } catch (CoreException e) {
+ ms.merge(e.getStatus());
+ }
+ }
+ }
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(r, null);
+ } catch (CoreException e) {
+ ms.merge(e.getStatus());
+ }
+ if (!ms.isOK()) {
+ DebugUIUtils.errorDialog(DebugUIPlugin.getActiveWorkbenchWindow().getShell(), PREFIX + ERROR, ms);
+ }
+ }
+ /**
+ * @see IBreakpointListener
+ */
+ public void breakpointAdded(IMarker breakpoint) {
+ breakpointAltered();
+ }
+ /**
+ * @see IBreakpointListener
+ */
+ public void breakpointChanged(IMarker breakpoint, IMarkerDelta delta) {
+ }
+ /**
+ * @see IBreakpointListener
+ */
+ public void breakpointRemoved(IMarker breakpoint, IMarkerDelta delta) {
+ breakpointAltered();
+ }
+
+ protected void breakpointAltered() {
+ boolean enable= DebugPlugin.getDefault().getBreakpointManager().getBreakpoints().length == 0 ? false : true;
+ setEnabled(enable);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllFromInspectorAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllFromInspectorAction.java
new file mode 100644
index 000000000..4fb814b13
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveAllFromInspectorAction.java
@@ -0,0 +1,33 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+public class RemoveAllFromInspectorAction extends InspectorAction {
+
+ private static final String PREFIX= "remove_all_from_inspector_action.";
+
+ public RemoveAllFromInspectorAction(ISelectionProvider provider) {
+ super(provider, DebugUIUtils.getResourceString(PREFIX + TEXT));
+ setToolTipText(DebugUIUtils.getResourceString(PREFIX + TOOL_TIP_TEXT));
+ }
+
+ /**
+ * @see InspectorAction
+ */
+ protected void doAction(InspectorView view) {
+ // Ask view to remove all variables
+ view.removeAllFromInspector();
+ }
+ /**
+ * @see SelectionProviderAction
+ */
+ public void selectionChanged(IStructuredSelection sel) {
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveBreakpointAction.java
new file mode 100644
index 000000000..b8156b410
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveBreakpointAction.java
@@ -0,0 +1,77 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import java.util.Iterator;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBreakpointManager;
+import org.eclipse.debug.core.IDebugStatusConstants;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.actions.SelectionProviderAction;
+
+public class RemoveBreakpointAction extends SelectionProviderAction {
+
+ private final static String PREFIX= "remove_breakpoint_action.";
+ private final static String ERROR= "error.";
+ private final static String STATUS= PREFIX + "status";
+
+ public RemoveBreakpointAction(ISelectionProvider provider) {
+ super(provider, DebugUIUtils.getResourceString(PREFIX + TEXT));
+ setEnabled(!getStructuredSelection().isEmpty());
+ setToolTipText(DebugUIUtils.getResourceString(PREFIX + TOOL_TIP_TEXT));
+ }
+
+ /**
+ * @see IAction
+ */
+ public void run() {
+ IStructuredSelection selection= getStructuredSelection();
+ if (selection.isEmpty()) {
+ return;
+ }
+ IStructuredSelection es= (IStructuredSelection)selection;
+ final Iterator itr= es.iterator();
+ final MultiStatus ms = new MultiStatus(DebugUIPlugin.getDefault().getDescriptor().getUniqueIdentifier(),
+ IDebugStatusConstants.REQUEST_FAILED, DebugUIUtils.getResourceString(STATUS), null);
+
+ IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) {
+ IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
+ while (itr.hasNext()) {
+ try {
+ breakpointManager.removeBreakpoint((IMarker)itr.next(), true);
+ } catch (CoreException ce) {
+ ms.merge(ce.getStatus());
+ }
+ }
+ }
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(runnable, null);
+ } catch (CoreException ce) {
+ ms.merge(ce.getStatus());
+ }
+ if (!ms.isOK()) {
+ DebugUIUtils.errorDialog(DebugUIPlugin.getActiveWorkbenchWindow().getShell(), PREFIX + ERROR, ms);
+ }
+ }
+
+ /**
+ * @see SelectionProviderAction
+ */
+ public void selectionChanged(IStructuredSelection sel) {
+ setEnabled(!sel.isEmpty());
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveFromInspectorAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveFromInspectorAction.java
new file mode 100644
index 000000000..19e2d7b1d
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveFromInspectorAction.java
@@ -0,0 +1,55 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import java.util.Iterator;
+
+public class RemoveFromInspectorAction extends InspectorAction {
+
+ private static final String PREFIX= "remove_from_inspector_action.";
+
+ public RemoveFromInspectorAction(ISelectionProvider provider) {
+ super(provider, DebugUIUtils.getResourceString(PREFIX + TEXT));
+ setToolTipText(DebugUIUtils.getResourceString(PREFIX + TOOL_TIP_TEXT));
+ setEnabled(!getStructuredSelection().isEmpty());
+ }
+
+ /**
+ * @see InspectorAction
+ */
+ protected void doAction(InspectorView view) {
+ IStructuredSelection selection= getStructuredSelection();
+ Iterator vars= selection.iterator();
+ while (vars.hasNext()) {
+ Object item= vars.next();
+ if (item instanceof InspectItem) {
+ view.removeFromInspector(item);
+ }
+ }
+ }
+
+ /**
+ * @see InspectorAction
+ */
+ public void selectionChanged(IStructuredSelection sel) {
+ if (sel == null) {
+ setEnabled(false);
+ return;
+ }
+ Iterator iterator= sel.iterator();
+ while (iterator.hasNext()) {
+ Object item= iterator.next();
+ if (item instanceof InspectItem) {
+ setEnabled(true);
+ return;
+ }
+ }
+ setEnabled(false);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveTerminatedAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveTerminatedAction.java
new file mode 100644
index 000000000..f8f805ee0
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RemoveTerminatedAction.java
@@ -0,0 +1,82 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.texteditor.IUpdate;
+
+/**
+ * Removes all terminated/detached launches from the UI.
+ * Clears the launches output as well.
+ */
+public class RemoveTerminatedAction extends Action implements IUpdate {
+
+ private static final String PREFIX= "remove_all_terminated_action.";
+ boolean fRemoveDebug;
+
+ public RemoveTerminatedAction(boolean removeDebug) {
+ super(DebugUIUtils.getResourceString(PREFIX + TEXT));
+ setToolTipText(DebugUIUtils.getResourceString(PREFIX + TOOL_TIP_TEXT));
+ fRemoveDebug= removeDebug;
+ setEnabled(false);
+ }
+
+ /**
+ * Removes all of the terminated launches relevant to the
+ * current perspective. Has the
+ * side effect of clearing the console output.
+ * @see IAction
+ */
+ public void run() {
+ ILaunchManager lManager= DebugPlugin.getDefault().getLaunchManager();
+ Object[] launches= lManager.getLaunches();
+ for (int i= 0; i < launches.length; i++) {
+ ILaunch launch= (ILaunch)launches[i];
+ if (launch.isTerminated() && isLaunchRelevantToCurrentPerpective(launch)) {
+ lManager.deregisterLaunch(launch);
+ }
+ }
+ }
+
+ /**
+ * Updates the enabled state of this action to enabled if at
+ * least one launch is terminated and relative to the current perspective.
+ * @see IUpdate
+ */
+ public void update() {
+ ILaunchManager lManager= DebugPlugin.getDefault().getLaunchManager();
+ ILaunch[] launches= lManager.getLaunches();
+ for (int i= 0; i < launches.length; i++) {
+ ILaunch launch= launches[i];
+ if (launch.isTerminated() && isLaunchRelevantToCurrentPerpective(launch)) {
+ setEnabled(true);
+ return;
+ }
+ }
+ setEnabled(false);
+ }
+
+ /**
+ * Returns whether this launch is relevant to the
+ * current perspective...ie Run or Debug.
+ * For example, if in the debug perspective (fRemoveDebug= true)
+ * and the launch does not have a debug target, <code>false</code>
+ * will be returned.
+ */
+ protected boolean isLaunchRelevantToCurrentPerpective(ILaunch launch) {
+ if (fRemoveDebug) {
+ return launch.getDebugTarget() != null;
+ }
+ IProcess[] processes= launch.getProcesses();
+ return (processes != null && processes.length > 0);
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResumeActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResumeActionDelegate.java
new file mode 100644
index 000000000..d94c445e2
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ResumeActionDelegate.java
@@ -0,0 +1,56 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.ISuspendResume;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+public class ResumeActionDelegate extends ControlActionDelegate {
+
+ private static final String PREFIX= "resume_action.";
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected void doAction(Object object) throws DebugException {
+ IDebugElement element= (IDebugElement)object;
+ if (element instanceof ISuspendResume) {
+ ISuspendResume suspendResume= (ISuspendResume)element;
+ if (suspendResume.canResume()) {
+ suspendResume.resume();
+ }
+ }
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ public boolean isEnabledFor(Object element) {
+ return element instanceof ISuspendResume && ((ISuspendResume) element).canResume();
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ public boolean getEnableStateForSelection(IStructuredSelection selection) {
+ if (selection.size() == 1) {
+ return isEnabledFor(selection.getFirstElement());
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected String getPrefix() {
+ return PREFIX;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RunAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RunAction.java
new file mode 100644
index 000000000..69029f5d7
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RunAction.java
@@ -0,0 +1,33 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.IDebugUIConstants;
+
+/**
+ * An execution action that uses launchers in
+ * run mode.
+ */
+public class RunAction extends ExecutionAction {
+
+ protected final static String PREFIX= "run_action.";
+
+ public RunAction() {
+ setText(DebugUIUtils.getResourceString(PREFIX + TEXT));
+ setToolTipText(DebugUIUtils.getResourceString(PREFIX + TOOL_TIP_TEXT));
+ setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_RUN));
+ }
+
+ /**
+ * @see ExecutionAction
+ */
+ protected String getMode() {
+ return ILaunchManager.RUN_MODE;
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RunDropDownAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RunDropDownAction.java
new file mode 100644
index 000000000..6473a3bfa
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/RunDropDownAction.java
@@ -0,0 +1,32 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchManager;
+
+public class RunDropDownAction extends LaunchDropDownAction {
+
+ public RunDropDownAction() {
+ super(new RunAction());
+ }
+
+ /**
+ * @see LaunchDropDownAction
+ */
+ public String getMode() {
+ return ILaunchManager.RUN_MODE;
+ }
+
+ /**
+ * @see LaunchDropDownAction
+ */
+ public ILaunch[] getHistory() {
+ return DebugUIPlugin.getDefault().getRunHistory();
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ShowQualifiedAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ShowQualifiedAction.java
new file mode 100644
index 000000000..1581f628c
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ShowQualifiedAction.java
@@ -0,0 +1,58 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+
+/**
+ * An action that toggles the state of its viewer to
+ * show/hide qualified names.
+ */
+public class ShowQualifiedAction extends Action {
+
+ private static final String PREFIX= "show_qualified_action.";
+ private static final String SHOW= PREFIX + TOOL_TIP_TEXT + ".show";
+ private static final String HIDE= PREFIX + TOOL_TIP_TEXT + ".hide";
+
+ protected StructuredViewer fViewer;
+
+ public ShowQualifiedAction(StructuredViewer viewer) {
+ super(DebugUIUtils.getResourceString(SHOW));
+ fViewer= viewer;
+ setToolTipText(DebugUIUtils.getResourceString(SHOW));
+ }
+
+ /**
+ * @see Action
+ */
+ public void run() {
+ valueChanged(isChecked());
+ }
+
+ private void valueChanged(boolean on) {
+ ILabelProvider labelProvider= (ILabelProvider)fViewer.getLabelProvider();
+ if (labelProvider instanceof IDebugModelPresentation) {
+ IDebugModelPresentation debugLabelProvider= (IDebugModelPresentation)labelProvider;
+ debugLabelProvider.setAttribute(IDebugModelPresentation.DISPLAY_QUALIFIED_NAMES, (on ? Boolean.TRUE : Boolean.FALSE));
+ fViewer.refresh();
+ }
+ setToolTipText(on ? DebugUIUtils.getResourceString(HIDE) : DebugUIUtils.getResourceString(SHOW));
+
+ }
+
+ /**
+ * @see Action
+ */
+ public void setChecked(boolean value) {
+ super.setChecked(value);
+ valueChanged(value);
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ShowTypesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ShowTypesAction.java
new file mode 100644
index 000000000..ce8dc8103
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ShowTypesAction.java
@@ -0,0 +1,61 @@
+package org.eclipse.debug.internal.ui;
+
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+
+/**
+ * An action that toggles the state of a viewer to
+ * show/hide type names of variables.
+ * Only viewers that use a <code>VariableLabelProvider</code> to render its
+ * elements are effected.
+ */
+public class ShowTypesAction extends Action {
+
+ private static final String PREFIX= "show_types_action.";
+ private static final String SHOW= PREFIX + TOOL_TIP_TEXT + ".show";
+ private static final String HIDE= PREFIX + TOOL_TIP_TEXT + ".hide";
+
+ protected StructuredViewer fViewer;
+
+ public ShowTypesAction(StructuredViewer viewer) {
+ super(DebugUIUtils.getResourceString(SHOW));
+ fViewer= viewer;
+ setToolTipText(SHOW);
+ }
+
+ /**
+ * @see Action
+ */
+ public void run() {
+ valueChanged(isChecked());
+ }
+
+ private void valueChanged(boolean on) {
+ ILabelProvider labelProvider= (ILabelProvider)fViewer.getLabelProvider();
+ if (labelProvider instanceof IDebugModelPresentation) {
+ IDebugModelPresentation debugLabelProvider= (IDebugModelPresentation)labelProvider;
+ debugLabelProvider.setAttribute(IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES, (on ? Boolean.TRUE : Boolean.FALSE));
+ fViewer.refresh();
+ }
+ setToolTipText(on ? DebugUIUtils.getResourceString(HIDE) : DebugUIUtils.getResourceString(SHOW));
+ }
+
+ /**
+ * @see Action
+ */
+ public void setChecked(boolean value) {
+ super.setChecked(value);
+ valueChanged(value);
+ }
+}
+
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepActionDelegate.java
new file mode 100644
index 000000000..e3f178388
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepActionDelegate.java
@@ -0,0 +1,57 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IStep;
+
+public abstract class StepActionDelegate extends ControlActionDelegate {
+
+ /**
+ * @see ControlActionDelegate
+ */
+ public void doAction(Object object) throws DebugException {
+ IDebugElement element= (IDebugElement)object;
+ IStep steppable= null;
+ if (element instanceof IStep) {
+ steppable= (IStep) element;
+ stepAction(steppable);
+ }
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ public boolean isEnabledFor(Object element) {
+ if (element instanceof IStep) {
+ return checkCapability((IStep) element);
+ }
+ return false;
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected boolean enableForMultiSelection() {
+ return false;
+ }
+
+ /**
+ * Returns whether the <code>IStep</code> has the capability to perform the
+ * requested step action.
+ */
+ protected abstract boolean checkCapability(IStep element);
+
+ /**
+ * Performs the specific step action.
+ *
+ * @exception DebugException if the action fails
+ */
+ protected abstract void stepAction(IStep element) throws DebugException;
+
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepIntoActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepIntoActionDelegate.java
new file mode 100644
index 000000000..262699854
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepIntoActionDelegate.java
@@ -0,0 +1,37 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IStep;
+
+public class StepIntoActionDelegate extends StepActionDelegate {
+
+ private static final String PREFIX= "step_into_action.";
+
+ /**
+ * @see StepActionDelegate
+ */
+ protected boolean checkCapability(IStep element) {
+ return element.canStepInto();
+ }
+
+ /**
+ * @see StepActionDelegate
+ */
+ protected void stepAction(IStep element) throws DebugException {
+ element.stepInto();
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected String getPrefix() {
+ return PREFIX;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepOverActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepOverActionDelegate.java
new file mode 100644
index 000000000..a1d892d61
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepOverActionDelegate.java
@@ -0,0 +1,36 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IStep;
+
+public class StepOverActionDelegate extends StepActionDelegate {
+
+ private static final String PREFIX= "step_over_action.";
+
+ /**
+ * @see StepActionDelegate
+ */
+ protected boolean checkCapability(IStep element) {
+ return element.canStepOver();
+ }
+
+ /**
+ * @see StepActionDelegate
+ */
+ protected void stepAction(IStep element) throws DebugException {
+ element.stepOver();
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected String getPrefix() {
+ return PREFIX;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepReturnActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepReturnActionDelegate.java
new file mode 100644
index 000000000..47df9093b
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StepReturnActionDelegate.java
@@ -0,0 +1,36 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IStep;
+
+public class StepReturnActionDelegate extends StepActionDelegate {
+
+ private static final String PREFIX= "step_return_action.";
+
+ /**
+ * @see StepActionDelegate
+ */
+ protected boolean checkCapability(IStep element) {
+ return element.canStepReturn();
+ }
+
+ /**
+ * @see StepActionDelegate
+ */
+ protected void stepAction(IStep element) throws DebugException {
+ element.stepReturn();
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected String getPrefix() {
+ return PREFIX;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StringMatcher.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StringMatcher.java
new file mode 100644
index 000000000..5045c9352
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/StringMatcher.java
@@ -0,0 +1,409 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Copied from org.eclipse.jdt.core.util - should be pushed down to
+ * desktop/core for common functionallity.
+ */
+public class StringMatcher {
+ protected String fPattern;
+ protected int fLength; // pattern length
+ protected boolean fIgnoreWildCards;
+ protected boolean fIgnoreCase;
+ protected boolean fHasLeadingStar;
+ protected boolean fHasTrailingStar;
+ protected String fSegments[]; //the given pattern is split into * separated segments
+
+ /* boundary value beyond which we don't need to search in the text */
+ protected int fBound= 0;
+
+ protected static final char fSingleWildCard= '\u0000';
+
+ public static class Position {
+ int start; //inclusive
+ int end; //exclusive
+ public Position(int start, int end) {
+ this.start= start;
+ this.end= end;
+ }
+ public int getStart() {
+ return start;
+ }
+ public int getEnd() {
+ return end;
+ }
+ }
+
+ /**
+ * StringMatcher constructor takes in a String object that is a simple
+ * pattern which may contain ‘*’ for 0 and many characters and
+ * ‘?’ for exactly one character. Also takes as parameter a boolean object
+ * specifying if case should be ignored
+ * @deprecated Use StringMatcher(pattern, ignoreCase, ignoreWildCards).
+ */
+ public StringMatcher(String aPattern, boolean ignoreCase) {
+ this(aPattern, ignoreCase, false);
+ }
+
+ /**
+ * StringMatcher constructor takes in a String object that is a simple
+ * pattern which may contain ‘*’ for 0 and many characters and
+ * ‘?’ for exactly one character.
+ *
+ * Literal '*' and '?' characters must be escaped in the pattern
+ * e.g., "\*" means literal "*", etc.
+ *
+ * Escaping any other character (including the escape character itself),
+ * just results in that character in the pattern.
+ * e.g., "\a" means "a" and "\\" means "\"
+ *
+ * If invoking the StringMatcher with string literals in Java, don't forget
+ * escape characters are represented by "\\".
+ *
+ * @param aPattern the pattern to match text against
+ * @param ignoreCase if true, case is ignored
+ * @param ignoreWildCards if true, wild cards and their escape sequences are ignored
+ * (everything is taken literally).
+ */
+ public StringMatcher(String aPattern, boolean ignoreCase, boolean ignoreWildCards) {
+ fIgnoreCase= ignoreCase;
+ fIgnoreWildCards= ignoreWildCards;
+ fLength= aPattern.length();
+
+ /* convert case */
+ if (fIgnoreCase) {
+ fPattern= aPattern.toUpperCase();
+ } else {
+ fPattern= aPattern;
+ }
+
+ if (fIgnoreWildCards) {
+ parseNoWildCards();
+ } else {
+ parseWildCards();
+ }
+ }
+
+ /**
+ * Find the first occurrence of the pattern between <code>start</code)(inclusive)
+ * and <code>end</code>(exclusive).
+ * @param <code>text</code>, the String object to search in
+ * @param <code>start</code>, the starting index of the search range, inclusive
+ * @param <code>end</code>, the ending index of the search range, exclusive
+ * @return an <code>StringMatcher.Position</code> object that keeps the starting
+ * (inclusive) and ending positions (exclusive) of the first occurrence of the
+ * pattern in the specified range of the text; return null if not found or subtext
+ * is empty (start==end). A pair of zeros is returned if pattern is empty string
+ * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc"
+ * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned
+ */
+
+ public StringMatcher.Position find(String text, int start, int end) {
+ if (fPattern == null || text == null)
+ throw new IllegalArgumentException();
+
+ int tlen= text.length();
+ if (start < 0)
+ start= 0;
+ if (end > tlen)
+ end= tlen;
+ if (end < 0 || start >= end)
+ return null;
+ if (fLength == 0)
+ return new Position(start, start);
+ if (fIgnoreWildCards) {
+ int x= posIn(text, start, end);
+ if (x < 0)
+ return null;
+ return new Position(x, x + fLength);
+ }
+
+ int segCount= fSegments.length;
+ if (segCount == 0) //pattern contains only '*'(s)
+ return new Position(start, end);
+
+ int curPos= start;
+ int matchStart= -1;
+ for (int i= 0; i < segCount && curPos < end; ++i) {
+ String current= fSegments[i];
+ int nextMatch= regExpPosIn(text, curPos, end, current);
+ if (nextMatch < 0)
+ return null;
+ if (i == 0)
+ matchStart= nextMatch;
+ curPos= nextMatch + current.length();
+ }
+ return new Position(matchStart, curPos);
+ }
+
+ /**
+ * match the given <code>text</code> with the pattern
+ * @return true if matched eitherwise false
+ * @param <code>text</code>, a String object
+ */
+ public boolean match(String text) {
+ return match(text, 0, text.length());
+ }
+
+ /**
+ * Given the starting (inclusive) and the ending (exclusive) poisitions in the
+ * <code>text</code>, determine if the given substring matches with aPattern
+ * @return true if the specified portion of the text matches the pattern
+ * @param String <code>text</code>, a String object that contains the substring to match
+ * @param int <code>start<code> marks the starting position (inclusive) of the substring
+ * @param int <code>end<code> marks the ending index (exclusive) of the substring
+ */
+ public boolean match(String text, int start, int end) {
+ if (null == fPattern || null == text)
+ throw new IllegalArgumentException();
+
+ if (start > end)
+ return false;
+
+ if (fIgnoreWildCards)
+ return fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength);
+ int segCount= fSegments.length;
+ if (segCount == 0) //pattern contains only '*'(s) or empty pattern
+ return true;
+ if (start == end)
+ return fLength == 0;
+ if (fLength == 0)
+ return start == end;
+
+ int tlen= text.length();
+ if (start < 0)
+ start= 0;
+ if (end > tlen)
+ end= tlen;
+
+ int tCurPos= start;
+ int bound= end - fBound;
+ if (bound < 0)
+ return false;
+ int i= 0;
+ String current= fSegments[i];
+ int segLength= current.length();
+
+ /* process first segment */
+ if (!fHasLeadingStar) {
+ if (!regExpRegionMatches(text, start, current, 0, segLength)) {
+ return false;
+ } else {
+ ++i;
+ tCurPos= tCurPos + segLength;
+ }
+ }
+
+ /* process middle segments */
+ for (; i < segCount && tCurPos <= bound; ++i) {
+ current= fSegments[i];
+ int currentMatch;
+ int k= current.indexOf(fSingleWildCard);
+ if (k < 0) {
+ currentMatch= textPosIn(text, tCurPos, end, current);
+ if (currentMatch < 0)
+ return false;
+ } else {
+ currentMatch= regExpPosIn(text, tCurPos, end, current);
+ if (currentMatch < 0)
+ return false;
+ }
+ tCurPos= currentMatch + current.length();
+ }
+
+ /* process final segment */
+ if (!fHasTrailingStar && tCurPos != end) {
+ int clen= current.length();
+ return regExpRegionMatches(text, end - clen, current, 0, clen);
+ }
+ return i == segCount;
+ }
+
+ /**
+ * This method parses the given pattern into segments seperated by wildcard '*' characters.
+ * Since wildcards are not being used in this case, the pattern consists of a single segment.
+ */
+ private void parseNoWildCards() {
+ fSegments= new String[1];
+ fSegments[0]= fPattern;
+ fBound= fLength;
+ }
+
+ /**
+ * This method parses the given pattern into segments seperated by wildcard '*' characters.
+ * @param p, a String object that is a simple regular expression with ‘*’ and/or ‘?’
+ */
+ private void parseWildCards() {
+ if (fPattern.startsWith("*"))
+ fHasLeadingStar= true;
+ if (fPattern.endsWith("*")) {
+ /* make sure it's not an escaped wildcard */
+ if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') {
+ fHasTrailingStar= true;
+ }
+ }
+
+ List temp= new ArrayList();
+
+ int pos= 0;
+ StringBuffer buf= new StringBuffer();
+ while (pos < fLength) {
+ char c= fPattern.charAt(pos++);
+ switch (c) {
+ case '\\' :
+ if (pos >= fLength) {
+ buf.append(c);
+ } else {
+ char next= fPattern.charAt(pos++);
+ /* if it's an escape sequence */
+ if (next == '*' || next == '?' || next == '\\') {
+ buf.append(next);
+ } else {
+ /* not an escape sequence, just insert literally */
+ buf.append(c);
+ buf.append(next);
+ }
+ }
+ break;
+ case '*' :
+ if (buf.length() > 0) {
+ /* new segment */
+ temp.add(buf.toString());
+ fBound += buf.length();
+ buf.setLength(0);
+ }
+ break;
+ case '?' :
+ /* append special character representing single match wildcard */
+ buf.append(fSingleWildCard);
+ break;
+ default :
+ buf.append(c);
+ }
+ }
+
+ /* add last buffer to segment list */
+ if (buf.length() > 0) {
+ temp.add(buf.toString());
+ fBound += buf.length();
+ }
+
+ fSegments= new String[temp.size()];
+ temp.toArray(fSegments);
+ }
+
+ /**
+ * @param <code>text</code>, a string which contains no wildcard
+ * @param <code>start</code>, the starting index in the text for search, inclusive
+ * @param <code>end</code>, the stopping point of search, exclusive
+ * @return the starting index in the text of the pattern , or -1 if not found
+ */
+ protected int posIn(String text, int start, int end) { //no wild card in pattern
+ int max= end - fLength;
+
+ if (!fIgnoreCase) {
+ int i= text.indexOf(fPattern, start);
+ if (i == -1 || i > max)
+ return -1;
+ return i;
+ }
+
+ for (int i= start; i <= max; ++i) {
+ if (text.regionMatches(true, i, fPattern, 0, fLength))
+ return i;
+ }
+
+ return -1;
+ }
+
+ /**
+ * @param <code>text</code>, a simple regular expression that may only contain '?'(s)
+ * @param <code>start</code>, the starting index in the text for search, inclusive
+ * @param <code>end</code>, the stopping point of search, exclusive
+ * @param <code>p</code>, a simple regular expression that may contains '?'
+ * @param <code>caseIgnored</code>, wether the pattern is not casesensitive
+ * @return the starting index in the text of the pattern , or -1 if not found
+ */
+ protected int regExpPosIn(String text, int start, int end, String p) {
+ int plen= p.length();
+
+ int max= end - plen;
+ for (int i= start; i <= max; ++i) {
+ if (regExpRegionMatches(text, i, p, 0, plen))
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ *
+ * @return boolean
+ * @param <code>text</code>, a String to match
+ * @param <code>start</code>, int that indicates the starting index of match, inclusive
+ * @param <code>end</code> int that indicates the ending index of match, exclusive
+ * @param <code>p</code>, String, String, a simple regular expression that may contain '?'
+ * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
+ */
+ protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen) {
+ while (plen-- > 0) {
+ char tchar= text.charAt(tStart++);
+ char pchar= p.charAt(pStart++);
+
+ /* process wild cards */
+ if (!fIgnoreWildCards) {
+ /* skip single wild cards */
+ if (pchar == fSingleWildCard) {
+ continue;
+ }
+ }
+ if (pchar == tchar)
+ continue;
+ if (fIgnoreCase) {
+ char tc= Character.toUpperCase(tchar);
+ if (tc == pchar)
+ continue;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @param <code>text</code>, the string to match
+ * @param <code>start</code>, the starting index in the text for search, inclusive
+ * @param <code>end</code>, the stopping point of search, exclusive
+ * @param code>p</code>, a string that has no wildcard
+ * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
+ * @return the starting index in the text of the pattern , or -1 if not found
+ */
+ protected int textPosIn(String text, int start, int end, String p) {
+
+ int plen= p.length();
+ int max= end - plen;
+
+ if (!fIgnoreCase) {
+ int i= text.indexOf(p, start);
+ if (i == -1 || i > max)
+ return -1;
+ return i;
+ }
+
+ for (int i= 0; i <= max; ++i) {
+ if (text.regionMatches(true, i, p, 0, plen))
+ return i;
+ }
+
+ return -1;
+ }
+
+}
+
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SuspendActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SuspendActionDelegate.java
new file mode 100644
index 000000000..1b98cb9b8
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SuspendActionDelegate.java
@@ -0,0 +1,50 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.ISuspendResume;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+public class SuspendActionDelegate extends ControlActionDelegate {
+
+ private static final String PREFIX= "suspend_action.";
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected void doAction(Object element) throws DebugException {
+ if (element instanceof ISuspendResume) {
+ ((ISuspendResume) element).suspend();
+ }
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ public boolean isEnabledFor(Object element) {
+ return element instanceof ISuspendResume && ((ISuspendResume)element).canSuspend();
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ public boolean getEnableStateForSelection(IStructuredSelection selection) {
+ if (selection.size() == 1) {
+ return isEnabledFor(selection.getFirstElement());
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected String getPrefix() {
+ return PREFIX;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateActionDelegate.java
new file mode 100644
index 000000000..396a292d8
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateActionDelegate.java
@@ -0,0 +1,38 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.ITerminate;
+
+public class TerminateActionDelegate extends ControlActionDelegate {
+
+ private static final String PREFIX= "terminate_action.";
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected void doAction(Object element) throws DebugException {
+ if (element instanceof ITerminate) {
+ ((ITerminate)element).terminate();
+ }
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ public boolean isEnabledFor(Object element) {
+ return element instanceof ITerminate && ((ITerminate)element).canTerminate();
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected String getPrefix() {
+ return PREFIX;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAllAction.java
new file mode 100644
index 000000000..ae6f1ba96
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAllAction.java
@@ -0,0 +1,66 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.debug.core.*;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.texteditor.IUpdate;
+
+/**
+ * Terminates all launches.
+ */
+public class TerminateAllAction extends Action implements IUpdate {
+
+ private static final String PREFIX= "terminate_all_action.";
+ private static final String STATUS= "status";
+ private static final String ERROR= "error.";
+
+ public TerminateAllAction() {
+ super(DebugUIUtils.getResourceString(PREFIX + TEXT));
+ }
+
+ /**
+ * @see Action
+ */
+ public void run() {
+ ILaunchManager lManager= DebugPlugin.getDefault().getLaunchManager();
+ ILaunch[] launches= lManager.getLaunches();
+ MultiStatus ms = new MultiStatus(DebugPlugin.getDefault().getDescriptor().getUniqueIdentifier(),
+ IDebugStatusConstants.REQUEST_FAILED, DebugUIUtils.getResourceString(PREFIX + STATUS), null);
+ for (int i= 0; i < launches.length; i++) {
+ ILaunch launch= (ILaunch) launches[i];
+ if (!launch.isTerminated()) {
+ try {
+ launch.terminate();
+ } catch (DebugException de) {
+ ms.merge(de.getStatus());
+ }
+ }
+ }
+ if (!ms.isOK()) {
+ DebugUIUtils.errorDialog(DebugUIPlugin.getActiveWorkbenchWindow().getShell(), PREFIX + ERROR, ms);
+ }
+ }
+
+ /**
+ * @see IUpdate
+ */
+ public void update() {
+ ILaunchManager lManager= DebugPlugin.getDefault().getLaunchManager();
+ ILaunch[] launches= lManager.getLaunches();
+ for (int i= 0; i< launches.length; i++) {
+ ILaunch launch= launches[i];
+ if (!launch.isTerminated()) {
+ setEnabled(true);
+ return;
+ }
+ }
+ setEnabled(false);
+ }
+}
+
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
new file mode 100644
index 000000000..3f2676505
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/TerminateAndRemoveActionDelegate.java
@@ -0,0 +1,59 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.ITerminate;
+
+public class TerminateAndRemoveActionDelegate extends ControlActionDelegate {
+
+ private static final String PREFIX= "terminate_and_remove_action.";
+
+ /**
+ * @see ControlActionDelegate
+ */
+ public void initializeForOwner(ControlAction controlAction) {
+ controlAction.setEnabled(!controlAction.getStructuredSelection().isEmpty());
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ protected void doAction(Object element) throws DebugException {
+ ITerminate terminate= (ITerminate)element;
+ if (!terminate.isTerminated()) {
+ terminate.terminate();
+ }
+
+ ILaunch launch= null;
+ if (element instanceof ILaunch) {
+ launch= (ILaunch) element;
+ } else if (element instanceof IDebugElement) {
+ IDebugElement de= (IDebugElement) element;
+ launch= de.getProcess().getLaunch();
+ } else if (element instanceof IProcess) {
+ launch= ((IProcess) element).getLaunch();
+ }
+ ILaunchManager lManager= DebugPlugin.getDefault().getLaunchManager();
+ lManager.deregisterLaunch(launch);
+ }
+
+ /**
+ * @see ControlActionDelegate
+ */
+ public boolean isEnabledFor(Object element) {
+ return element instanceof ITerminate;
+ }
+ /**
+ * @see ControlActionDelegate
+ */
+ protected String getPrefix() {
+ return PREFIX;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesContentProvider.java
new file mode 100644
index 000000000..32abf4512
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesContentProvider.java
@@ -0,0 +1,98 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.*;
+import org.eclipse.debug.core.model.*;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+
+/**
+ * Provide the contents for a Variables Viewer</code>
+ */
+public class VariablesContentProvider extends BasicContentProvider implements IDebugEventListener, ITreeContentProvider {
+ /**
+ * Constructs a new provider
+ */
+ public VariablesContentProvider() {
+ DebugPlugin.getDefault().addDebugEventListener(this);
+ }
+
+ /**
+ * @see BasicContentProvider#doGetChildren(Object)
+ */
+ protected Object[] doGetChildren(Object parent) {
+ try {
+ if (parent instanceof IStackFrame || parent instanceof IValue) {
+ return ((IDebugElement) parent).getChildren();
+ } else if (parent instanceof IVariable) {
+ return ((IVariable)parent).getValue().getChildren();
+ }
+ } catch (DebugException de) {
+ DebugUIUtils.logError(de);
+ }
+ return new Object[0];
+ }
+
+ /**
+ * Returns the <code>IVariable</code>s for the given <code>IDebugElement</code>.
+ */
+ public Object[] getElements(Object parent) {
+ return getChildren(parent);
+ }
+
+ /**
+ * @see ITreeContentProvider
+ */
+ public Object getParent(Object item) {
+ Object parent = null;
+ if (item instanceof IVariable) {
+ parent = ((IVariable) item).getParent();
+ }
+ if (parent instanceof IValue) {
+ parent = ((IValue)parent).getVariable();
+ }
+ return parent;
+ }
+
+ /**
+ * @see BasicContentProvider#doHandleDebug(Event)
+ */
+ protected void doHandleDebugEvent(DebugEvent event) {
+ switch (event.getKind()) {
+ case DebugEvent.SUSPEND:
+ refresh();
+ break;
+ case DebugEvent.CHANGE:
+ refresh(event.getSource());
+ break;
+ }
+ }
+
+ /**
+ * @see ITreeContentProvider
+ */
+ public boolean hasChildren(Object item) {
+ try {
+ if (item instanceof IVariable) {
+ return ((IVariable)item).getValue().hasChildren();
+ } else {
+ return ((IDebugElement) item).hasChildren();
+ }
+ } catch (DebugException de) {
+ return false;
+ }
+ }
+
+ /**
+ * Unregisters this content provider from the debug plugin so that
+ * this object can be garbage-collected.
+ */
+ public void dispose() {
+ DebugPlugin.getDefault().removeDebugEventListener(this);
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesView.java
new file mode 100644
index 000000000..7a99b4c68
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariablesView.java
@@ -0,0 +1,162 @@
+package org.eclipse.debug.internal.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jface.action.*; import org.eclipse.jface.viewers.*; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.*; import org.eclipse.ui.part.DrillDownAdapter;
+
+/**
+ * This view shows variables and their values for a particular stack frame
+ */
+public class VariablesView extends AbstractDebugView implements ISelectionListener {
+
+ protected final static String PREFIX= "variables_view.";
+
+ protected ShowQualifiedAction fShowQualifiedAction;
+ protected ShowTypesAction fShowTypesAction;
+ protected ChangeVariableValueAction fChangeVariableAction;
+ protected AddToInspectorAction fAddToInspectorAction;
+
+ protected DrillDownAdapter fDrillPart;
+ /**
+ * Remove myself as a selection listener to the <code>LaunchesView</code> in this perspective.
+ *
+ * @see IWorkbenchPart
+ */
+ public void dispose() {
+ DebugUIPlugin.getDefault().removeSelectionListener(this);
+ super.dispose();
+ }
+
+ /**
+ * The <code>VariablesView</code> listens for selection changes in the <code>LaunchesView</code>
+ *
+ * @see ISelectionListener
+ */
+ public void selectionChanged(IWorkbenchPart part, ISelection sel) {
+ if (!(part instanceof DebugView)) {
+ return;
+ }
+ if (!(sel instanceof IStructuredSelection)) {
+ return;
+ }
+
+ setViewerInput((IStructuredSelection)sel);
+ }
+
+ protected void setViewerInput(IStructuredSelection ssel) {
+ IDebugElement de= null;
+ if (ssel.size() == 1) {
+ Object input= ssel.getFirstElement();
+ if (input != null && input instanceof IDebugElement) {
+ de= ((IDebugElement) input).getStackFrame();
+ }
+ }
+
+ Object current= fViewer.getInput();
+ if (current == null && de == null) {
+ return;
+ }
+
+ if (current != null && current.equals(de)) {
+ return;
+ }
+
+ fViewer.setInput(de);
+ }
+ /**
+ * @see IWorkbenchPart
+ */
+ public void createPartControl(Composite parent) {
+ DebugUIPlugin.getDefault().addSelectionListener(this);
+ TreeViewer vv = new TreeViewer(parent, SWT.MULTI);
+ fViewer= vv;
+ fViewer.setContentProvider(new VariablesContentProvider());
+ fViewer.setLabelProvider(new DelegatingModelPresentation());
+ fViewer.setUseHashlookup(true);
+ fDrillPart = new DrillDownAdapter(vv);
+ // add a context menu
+ createContextMenu(vv.getTree());
+
+ initializeActions();
+ initializeToolBar();
+
+ setInitialContent();
+ setTitleToolTip(getTitleToolTipText(PREFIX));
+ }
+
+ protected void setInitialContent() {
+ IWorkbenchWindow window= DebugUIPlugin.getActiveWorkbenchWindow();
+ if (window == null) {
+ return;
+ }
+ IWorkbenchPage p= window.getActivePage();
+ if (p == null) {
+ return;
+ }
+ DebugView view= (DebugView) p.findView(IDebugUIConstants.ID_DEBUG_VIEW);
+ if (view != null) {
+ ISelectionProvider provider= view.getSite().getSelectionProvider();
+ if (provider != null) {
+ provider.getSelection();
+ ISelection selection= provider.getSelection();
+ if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
+ setViewerInput((IStructuredSelection) selection);
+ }
+ }
+ }
+ }
+
+ /**
+ * Initializes the actions of this view.
+ */
+ protected void initializeActions() {
+ fShowTypesAction= new ShowTypesAction(fViewer);
+ fShowTypesAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_TYPE_NAMES));
+ fShowTypesAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TYPE_NAMES));
+ fShowTypesAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_TYPE_NAMES));
+ fShowTypesAction.setChecked(false);
+
+ fShowQualifiedAction= new ShowQualifiedAction(fViewer);
+ fShowQualifiedAction.setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_QUALIFIED_NAMES));
+ fShowQualifiedAction.setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_QUALIFIED_NAMES));
+ fShowQualifiedAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_QUALIFIED_NAMES));
+ fShowQualifiedAction.setChecked(false);
+
+ fAddToInspectorAction= new AddToInspectorAction(fViewer);
+
+ fChangeVariableAction= new ChangeVariableValueAction(fViewer);
+ fChangeVariableAction.setEnabled(false);
+ }
+
+ /**
+ * Configures the toolBar
+ */
+ protected void configureToolBar(IToolBarManager tbm) {
+ fDrillPart.addNavigationActions(tbm);
+ tbm.add(new Separator(this.getClass().getName()));
+ tbm.add(fShowTypesAction);
+ tbm.add(fShowQualifiedAction);
+ }
+
+ /**
+ * Adds items to the context menu including any extension defined actions.
+ */
+ protected void fillContextMenu(IMenuManager menu) {
+
+ menu.add(new Separator(IDebugUIConstants.EMPTY_VARIABLE_GROUP));
+ menu.add(new Separator(IDebugUIConstants.VARIABLE_GROUP));
+ menu.add(fAddToInspectorAction);
+ menu.add(fChangeVariableAction);
+ menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
+ menu.add(new Separator(IDebugUIConstants.RENDER_GROUP));
+ menu.add(fShowTypesAction);
+ menu.add(fShowQualifiedAction);
+
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
new file mode 100644
index 000000000..04676cfd7
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
@@ -0,0 +1,116 @@
+package org.eclipse.debug.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.internal.ui.*;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * This class provides utilities for clients of the debug UI.
+ * <p>
+ * Images retrieved from this facility should not be disposed.
+ * The images will be disposed when this plugin is shutdown.
+ * </p>
+ * <p>
+ * This class is not intended to be subclassed or instantiated.
+ * </p>
+ * <p>
+ * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
+ * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
+ * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
+ * (repeatedly) as the API evolves.
+ * </p>
+ */
+public class DebugUITools {
+
+ /**
+ * Shows and selects the given value in an inspector view with the specified label.
+ * If an inspector view is not in the current workbench page, an inspector view
+ * is created. This method must be called in the UI thread.
+ *
+ * @param label a localized label to associate with the value in the inspector view
+ * @param value the value to display
+ */
+ public static void inspect(String label, IValue value) {
+ IWorkbenchPage p= DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
+ InspectorView view= (InspectorView) p.findView(IDebugUIConstants.ID_INSPECTOR_VIEW);
+ if (view == null) {
+ // open a new view
+ try {
+ view= (InspectorView) p.showView(IDebugUIConstants.ID_INSPECTOR_VIEW);
+ } catch (PartInitException e) {
+ DebugUIUtils.logError(e);
+ return;
+ }
+ }
+ InspectItem item = new InspectItem(label, value);
+ view.addToInspector(item);
+ p.activate(view);
+ }
+
+ /**
+ * Returns the shared image managed under the given key. If there isn't any image
+ * associated with the given key, <code>null</code> is returned. <p>
+ * Note that clients <br>MUST NOT</br> dispose the image returned by this method.
+ * <p>
+ * See <code>IDebugUIConstants</code> for available images.
+ * </p>
+ *
+ * @param key the image key
+ * @return the image, or <code>null</code> if none
+ * @see IDebugUIConstants
+ */
+ public static Image getImage(String key) {
+ return DebugPluginImages.getImage(key);
+ }
+
+ /**
+ * Returns the shared image descriptor managed under the given key. If there isn't any image
+ * descriptor associated with the given key, <code>null</code> is returned. <p>
+ * <p>
+ * See <code>IDebugUIConstants</code> for available image descriptors.
+ * </p>
+ *
+ * @param key the image descriptor key
+ * @return the image descriptor, or <code>null</code> if none
+ * @see IDebugUIConstants
+ */
+ public static ImageDescriptor getImageDescriptor(String key) {
+ return DebugPluginImages.getImageDescriptor(key);
+ }
+
+ /**
+ * Returns the preference store for the debug UI plugin.
+ *
+ * @return preference store
+ */
+ public static IPreferenceStore getPreferenceStore() {
+ return DebugUIPlugin.getDefault().getPreferenceStore();
+ }
+
+ /**
+ * Adds the given filter to the list of registered filters. Has
+ * no effect if an identical filter is already registered.
+ */
+ public static void addEventFilter(IDebugUIEventFilter filter) {
+ DebugUIPlugin.getDefault().addEventFilter(filter);
+ }
+
+ /**
+ * Removes the given filter from the list of registered filters. Has
+ * no effect if an identical filter is not already registered.
+ */
+ public static void removeEventFilter(IDebugUIEventFilter filter) {
+ DebugUIPlugin.getDefault().removeEventFilter(filter);
+ }
+}
+
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugModelPresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugModelPresentation.java
new file mode 100644
index 000000000..585f9aa66
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugModelPresentation.java
@@ -0,0 +1,161 @@
+package org.eclipse.debug.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * A debug model presentation is responsible for providing labels, images,
+ * and editors associated with debug elements in a specific debug model.
+ * Extensions of type <code>org.eclipse.debug.ui.debugModelPresentations</code> implement
+ * this interface. Generally, a debug model implementation will also provide a
+ * debug model presentation extension to render and display its elements. A debug
+ * model presentation is registered for a specific debug model, and is responsible
+ * for the presentation of the following kinds of elements defined by that model:
+ * <ul>
+ * <li>debug targets</li>
+ * <li>threads</li>
+ * <li>stack frames</li>
+ * <li>variables</li>
+ * <li>values</li>
+ * <li>breakpoint markers</li>
+ * </ul>
+ * <p>
+ * A debug model presentation extension is defined in <code>plugin.xml</code>.
+ * Following is an example definition of a debug model presentation extension.
+ * <pre>
+ * &lt;extension point="org.eclipse.debug.ui.debugModelPresentations"&gt;
+ * &lt;debugModelPresentation
+ * id="com.example.debugModelIdentifier"
+ * class="com.example.ExmaplePresentation"
+ * &lt;/debugModelPresentation&gt;
+ * &lt;/extension&gt;
+ * </pre>
+ * The attributes are specified as follows:
+ * <ul>
+ * <li><code>id</code> specifies the identifier of the debug model this presentation
+ * is responsible for. Corresponds to the model identifier returned from a debug
+ * element - see <code>IDebugElement.getModelIndentifier</code></li>
+ * <li><code>class</code> specifies the fully qualified name of the java class
+ * that implements this interface.</li>
+ * </ul>
+ * </p>
+ * <p>
+ * To allow for an extensible configuation, this interface defines
+ * a <code>setAttribute</code> method. The debug UI plug-in defines
+ * two presentation attributes:
+ * <ul>
+ * <li><code>DISPLAY_QUALIFIED_NAMES</code> - This is a boolean attribute
+ * indicating whether elements should be rendered with fully qualified names.
+ * For example, a java debug model presentation would include package names
+ * when this attribute is true.</li>
+ * <li><code>DISPLAY_VARIABLE_TYPE_NAMES</code> - This is a boolean attribute
+ * indicating whether variable elements should be rendered with the declared
+ * type of a variable. For example, a java debug model presentation would render
+ * an integer as <code>"int x = 3"</code> when true, and <code>"x = 3"</code>
+ * when false.</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Clients may define new presentation attributes. For example, a client may wish
+ * to define a "hexidecimal" property to display numeric values in hexidecimal. Implementations
+ * should honor the presentation attributes defined by this interface where possible,
+ * but do not need to honor presentation attributes defined by other clients.
+ * To access the debug model presentation for a debug view, clients should use the
+ * <code>IDebugViewAdapter</code>.
+ * </p>
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * <p>
+ * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
+ * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
+ * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
+ * (repeatedly) as the API evolves.
+ * </p>
+ * @see org.eclipse.debug.core.model.IDebugElement
+ * @see ILabelProvider
+ * @see IDebugViewAdapter
+ */
+
+public interface IDebugModelPresentation extends ILabelProvider {
+ /**
+ * Qualified names presentation property (value <code>"org.eclipse.debug.ui.displayQualifiedNames"</code>).
+ * When <code>DISPLAY_QUALIFIED_NAMES</code> is set to <code>True</code>,
+ * this label provider should use fully qualified type names when rendering elements.
+ * When set to <code>False</code>,this label provider should use simple names
+ * when rendering elements.
+ * @see setAttribute(String, Object)
+ */
+ public final static String DISPLAY_QUALIFIED_NAMES= IDebugUIConstants.PLUGIN_ID + ".displayQualifiedNames";
+ /**
+ * Variable type names presentation property (value <code>"org.eclipse.debug.ui.displayVariableTypeNames"</code>).
+ * When <code>DISPLAY_VARIABLE_TYPE_NAMES</code> is set to <code>True</code>,
+ * this label provider should include the reference type of a variable when rendering
+ * variables. When set to <code>False</code>, this label provider
+ * should not include the reference type of a variable when rendering
+ * variables.
+ * @see setAttribute(String, Object)
+ */
+ public final static String DISPLAY_VARIABLE_TYPE_NAMES= IDebugUIConstants.PLUGIN_ID + ".displayVariableTypeNames";
+ /**
+ * Sets a presentation attribute of this label provider. For example,
+ * see the presentation attribute <code>DISPLAY_QUALIFIED_NAMES</code>
+ * defined by this interface.
+ *
+ * @param attribute the presentation attribute identifier
+ * @param value the value of the attribute
+ */
+ void setAttribute(String attribute, Object value);
+ /**
+ * Returns the image for the label of the given element. If an implementation
+ * of <code>IDebugModelPresentation</code> returns <code>null</code>, the debug
+ * UI will provide a default image for the given element.
+ *
+ * @param element the debug model element
+ * @return an image for the element, or <code>null</code> if a default
+ * image should be used
+ * @see ILabelProvider
+ */
+ public Image getImage(Object element);
+ /**
+ * Returns the text for the label of the given element. If an implementation
+ * of <code>IDebugModelPresentation</code> returns <code>null</code>, the debug
+ * UI will provide a default text for the given element.
+ *
+ * @param element the debug model element
+ * @return a label for the element, or <code>null</code> if a default
+ * label should be used
+ * @see ILabelProvider
+ */
+ public String getText(Object element);
+ /**
+ * Returns an editor input that should be used to display the given object
+ * in an editor or <code>null</code> if unable to provide an editor input
+ * for the given object.
+ *
+ * @param element a debug model object
+ * @return an editor input, or <code>null</code> if none
+ */
+ IEditorInput getEditorInput(Object element);
+
+ /**
+ * Returns the id of the editor to use to display the
+ * given editor input and object, or <code>null</code> if
+ * unable to provide an editor id.
+ *
+ * @param input an editor input that was previously retrieved from this
+ * debug model presentation's <code>getEditorInput</code> method
+ * @param element the debug model object that was used in the call to
+ * <code>getEditorInput</code>, that corresponds to the given input
+ * @return an editor id, or <code>null</code> if none
+ */
+ String getEditorId(IEditorInput input, Object element);
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
new file mode 100644
index 000000000..e13254517
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
@@ -0,0 +1,387 @@
+package org.eclipse.debug.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+/**
+ * Constant definitions for debug UI plug-in.
+ * <p>
+ * Popup menus in the debug UI support action contribution via the
+ * <code>org.eclipse.ui.popupMenus</code> extension. Actions may be
+ * contributed to any group on the menu. To facilitate insertion of actions
+ * inbetween existing groups, empty groups have been defined
+ * in the menu. Each group prefixed by "empty" indicates an empty group.
+ * </p>
+ * <h3>Debug View Popup Menu</h3>
+ * <ul>
+ * <li>Empty edit group</li>
+ * <li>Edit group</li>
+ * <li>Copy Stack action</li>
+ * <li>Empty Step group</li>
+ * <li>Step group</li>
+ * <li>Step Into action</li>
+ * <li>Step Over action</li>
+ * <li>Run to return action</li>
+ * <li>Empty thread group</li>
+ * <li>Thread group</li>
+ * <li>Suspend action</li>
+ * <li>Resume action</li>
+ * <li>Terminate action</li>
+ * <li>Empty launch group</li>
+ * <li>Launch group</li>
+ * <li>Terminate and Remove action</li>
+ * <li>Terminate All action</li>
+ * <li>Remove All Terminated action</li>
+ * <li>Relaunch action</li>
+ * <li>Empty render group</li>
+ * <li>Render group</li>
+ * <li>Show qualified names action</li>
+ * <li>Property group</li>
+ * <li>Property dialog action</li>
+ * <li>Additions group</li>
+ * </ul>
+ * <h3>Process View Popup Menu</h3>
+ * <ul>
+ * <li>Empty launch group</li>
+ * <li>Launch group</li>
+ * <li>Relaunch action</li>
+ * <li>Terminate action</li>
+ * <li>Terminate and Remove action</li>
+ * <li>Terminate All action</li>
+ * <li>Remove All Terminated action</li>
+ * <li>Property group</li>
+ * <li>Property dialog action</li>
+ * <li>Additions group</li>
+ * </ul>
+ * <h3>Variable View Popup Menu</h3>
+ * <ul>
+ * <li>Empty variable group</li>
+ * <li>Variable group</li>
+ * <li>Add to Watch List action</li>
+ * <li>Change value action</li>
+ * <li>Empty render group</li>
+ * <li>Render group</li>
+ * <li>Show qualified names action</li>
+ * <li>Additions group</li>
+ * </ul>
+ * <h3>Breakpoint View Popup Menu</h3>
+ * <ul>
+ * <li>Empty Navigation group</li>
+ * <li>Navigation group</li>
+ * <li>Open action</li>
+ * <li>Empty Breakpoint goup</li>
+ * <li>Breakpoint group</li>
+ * <li>Enable/Disable action</li>
+ * <li>Remove action</li>
+ * <li>Remove all action</li>
+ * <li>Empty render group</li>
+ * <li>Render group</li>
+ * <li>Show qualified names action</li>
+ * <li>Additions group</li>
+ * </ul>
+ * <h3>Inspector View Popup Menu</h3>
+ * <ul>
+ * <li>Empty Expression group</li>
+ * <li>Expression group</li>
+ * <li>Remove action</li>
+ * <li>Remove all action</li>
+ * <li>Empty Render group</li>
+ * <li>Render group</li>
+ * <li>Show qualified names action</li>
+ * <li>Additions group</li>
+ * </ul>
+ * <p>
+ * Constants only; not intended to be implemented or extended.
+ * </p>
+ * <p>
+ * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
+ * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
+ * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
+ * (repeatedly) as the API evolves.
+ * </p>
+ */
+
+public interface IDebugUIConstants {
+
+ /**
+ * Debug UI plug-in identifier (value <code>"org.eclipse.debug.ui"</code>).
+ */
+ public static final String PLUGIN_ID = "org.eclipse.debug.ui";
+
+ /**
+ * Debug perspective identifier (value <code>"org.eclipse.debug.ui.DebugPerspective"</code>).
+ */
+ public static final String ID_DEBUG_PERSPECTIVE = PLUGIN_ID + ".DebugPerspective";
+
+ /**
+ * Debug model presentation extension point identifier (value <code>"debugModelPresentations"</code>).
+ */
+ public static final String ID_DEBUG_MODEL_PRESENTATION= "debugModelPresentations";
+
+ // Preferences
+ /**
+ * Boolean preference controlling automatic change to debug perspective when
+ * a debug session is launched, or when a debug session suspends
+ * (value <code>"org.eclipse.debug.ui.auto_show_debug_view"</code>). When this
+ * preference is <code>true</code> and a debug session is launched or suspends,
+ * and a debug view is not present in the current perspective, a debug perspective
+ * of the appropriate kind is created (or switched to if already created).
+ */
+ public static final String PREF_AUTO_SHOW_DEBUG_VIEW= PLUGIN_ID + ".auto_show_debug_view";
+
+ /**
+ * Boolean preference controlling automatic change to debug perspective when
+ * a program is launched in run mode (value <code>"org.eclipse.debug.ui.auto_show_process_view"</code>).
+ * When this preference is <code>true</code>
+ * and a program is launched, and a process view is not present in the current
+ * perspective, a debug perspective of the appropriate kind is created (or switched
+ * to if already created).
+ */
+ public static final String PREF_AUTO_SHOW_PROCESS_VIEW= PLUGIN_ID + ".auto_show_process_view";
+
+ // Debug views
+
+ /**
+ * Debug view identifier (value <code>"org.eclipse.debug.ui.DebugView"</code>).
+ */
+ public static final String ID_DEBUG_VIEW= "org.eclipse.debug.ui.DebugView";
+
+ /**
+ * Process view identifier (value <code>"org.eclipse.debug.ui.ProcessView"</code>).
+ */
+ public static final String ID_PROCESS_VIEW= "org.eclipse.debug.ui.ProcessView";
+
+ /**
+ * Breakpoint view identifier (value <code>"org.eclipse.debug.ui.BreakpointView"</code>).
+ */
+ public static final String ID_BREAKPOINT_VIEW= "org.eclipse.debug.ui.BreakpointView";
+
+ /**
+ * Variable view identifier (value <code>"org.eclipse.debug.ui.VariableView"</code>).
+ */
+ public static final String ID_VARIABLE_VIEW= "org.eclipse.debug.ui.VariableView";
+
+ /**
+ * Inspector view identifier (value <code>"org.eclipse.debug.ui.InspectorView"</code>).
+ */
+ public static final String ID_INSPECTOR_VIEW= "org.eclipse.debug.ui.InspectorView";
+
+ /**
+ * Console view identifier (value <code>"org.eclipse.debug.ui.ConsoleView"</code>).
+ */
+ public static final String ID_CONSOLE_VIEW= "org.eclipse.debug.ui.ConsoleView";
+
+ // Debug Action images
+
+ /**
+ * Debug action image identifier.
+ */
+ public static final String IMG_ACT_DEBUG= "IMG_ACT_DEBUG";
+
+ /**
+ * Run action image identifier.
+ */
+ public static final String IMG_ACT_RUN= "IMG_ACT_RUN";
+
+ /** Resume action image identifier. */
+ public static final String IMG_LCL_RESUME= "IMG_LCL_RESUME";
+
+ /** Suspend action image identifier. */
+ public static final String IMG_LCL_SUSPEND= "IMG_LCL_SUSPEND";
+
+ /** Terminate action image identifier. */
+ public static final String IMG_LCL_TERMINATE= "IMG_LCL_TERMINATE";
+
+ /** Disconnect action image identifier. */
+ public static final String IMG_LCL_DISCONNECT= "IMG_LCL_DISCONNECT";
+
+ /** Step into action image identifier. */
+ public static final String IMG_LCL_STEPINTO= "IMG_LCL_STEPINTO";
+
+ /** Step over action image identifier. */
+ public static final String IMG_LCL_STEPOVER= "IMG_LCL_STEPOVER";
+
+ /** Step return action image identifier. */
+ public static final String IMG_LCL_STEPRETURN= "IMG_LCL_STEPRETURN";
+
+ /** Clear action image identifier. */
+ public static final String IMG_LCL_CLEAR= "IMG_LCL_CLEAR";
+
+ /** Remove all terminated action image identifier. */
+ public static final String IMG_LCL_REMOVE_TERMINATED= "IMG_LCL_REMOVE_TERMINATED";
+
+ /** Display qualififed names action image identifier. */
+ public static final String IMG_LCL_QUALIFIED_NAMES= "IMG_LCL_QUALIFIED_NAMES";
+
+ /** Display variable type names action image identifier. */
+ public static final String IMG_LCL_TYPE_NAMES= "IMG_LCL_TYPE_NAMES";
+
+ /** Remove action image identifier. */
+ public static final String IMG_LCL_REMOVE= "IMG_LCL_REMOVE";
+
+ /** Remove all action image identifier. */
+ public static final String IMG_LCL_REMOVE_ALL= "IMG_LCL_REMOVE_ALL";
+
+
+ // Debug element images
+
+ /** Debug mode launch image identifier. */
+ public static final String IMG_OBJS_LAUNCH_DEBUG= "IMG_OBJS_LAUNCH_DEBUG";
+
+ /** Run mode launch image identifier. */
+ public static final String IMG_OBJS_LAUNCH_RUN= "IMG_OBJS_LAUNCH_RUN";
+
+ /** Running debug target image identifier. */
+ public static final String IMG_OBJS_DEBUG_TARGET= "IMG_OBJS_DEBUG_TARGET";
+
+ /** Terminated debug target image identifier. */
+ public static final String IMG_OBJS_DEBUG_TARGET_TERMINATED= "IMG_OBJS_DEBUG_TARGET_TERMINATED";
+
+ /** Running thread image identifier. */
+ public static final String IMG_OBJS_THREAD_RUNNING= "IMG_OBJS_THREAD_RUNNING";
+
+ /** Suspended thread image identifier. */
+ public static final String IMG_OBJS_THREAD_SUSPENDED= "IMG_OBJS_THREAD_SUSPENDED";
+
+ /** Terminated thread image identifier. */
+ public static final String IMG_OBJS_THREAD_TERMINATED= "IMG_OBJS_THREAD_TERMINATED";
+
+ /** Stack frame image identifier. */
+ public static final String IMG_OBJS_STACKFRAME= "IMG_OBJS_STACKFRAME";
+
+ /** Enabled breakpoint image identifier. */
+ public static final String IMG_OBJS_BREAKPOINT= "IMG_OBJS_BREAKPOINT";
+
+ /** Disabled breakpoint image identifier. */
+ public static final String IMG_OBJS_BREAKPOINT_DISABLED= "IMG_OBJS_BREAKPOINT_DISABLED";
+
+ /** Running system process image identifier. */
+ public static final String IMG_OBJS_OS_PROCESS= "IMG_OBJS_OS_PROCESS";
+
+ /** Terminated system process image identifier. */
+ public static final String IMG_OBJS_OS_PROCESS_TERMINATED= "IMG_OBJS_OS_PROCESS_TERMINATED";
+
+ /** Expression image identifier. */
+ public static final String IMG_OBJS_EXPRESSION= "IMG_OBJS_EXPRESSION";
+
+ // wizard banners
+ /** Debug wizard banner image identifier. */
+ public static final String IMG_WIZBAN_DEBUG= "IMG_WIZBAN_DEBUG";
+
+ /** Run wizard banner image identifier. */
+ public static final String IMG_WIZBAN_RUN= "IMG_WIZBAN_RUN";
+
+ /**
+ * Debug action set identifier (value <code>"org.eclipse.debug.ui.debugActionSet"</code>).
+ */
+ public static final String DEBUG_ACTION_SET= PLUGIN_ID + ".debugActionSet";
+
+ // menus
+
+ /**
+ * Identifier for an empty group preceeding an
+ * edit group in a menu (value <code>"emptyEditGroup"</code>).
+ */
+ public static final String EMPTY_EDIT_GROUP = "emptyEditGroup";
+
+ /**
+ * Identifier for an edit group in a menu (value <code>"editGroup"</code>).
+ */
+ public static final String EDIT_GROUP = "editGroup";
+
+ /**
+ * Identifier for an empty group preceeding a
+ * step group in a menu (value <code>"emptyStepGroup"</code>).
+ */
+ public static final String EMPTY_STEP_GROUP = "emptyStepGroup";
+
+ /**
+ * Identifier for a step group in a menu (value <code>"stepGroup"</code>).
+ */
+ public static final String STEP_GROUP = "stepGroup";
+
+ /**
+ * Identifier for an empty group preceeding a
+ * thread group in a menu (value <code>"emptyThreadGroup"</code>).
+ */
+ public static final String EMPTY_THREAD_GROUP = "emptyThreadGroup";
+
+ /**
+ * Identifier for a thread group in a menu (value <code>"threadGroup"</code>).
+ */
+ public static final String THREAD_GROUP = "threadGroup";
+
+ /**
+ * Identifier for an empty group preceeding a
+ * launch group in a menu (value <code>"emptyLaunchGroup"</code>).
+ */
+ public static final String EMPTY_LAUNCH_GROUP = "emptyLaunchGroup";
+
+ /**
+ * Identifier for a launch group in a menu (value <code>"launchGroup"</code>).
+ */
+ public static final String LAUNCH_GROUP = "launchGroup";
+
+ /**
+ * Identifier for an empty group preceeding a
+ * variable group in a menu (value <code>"emptyVariableGroup"</code>).
+ */
+ public static final String EMPTY_VARIABLE_GROUP = "emptyVariableGroup";
+
+ /**
+ * Identifier for a variable group in a menu (value <code>"variableGroup"</code>).
+ */
+ public static final String VARIABLE_GROUP = "variableGroup";
+
+ /**
+ * Identifier for an empty group preceeding a
+ * navigation group in a menu (value <code>"emptyNavigationGroup"</code>).
+ */
+ public static final String EMPTY_NAVIGATION_GROUP = "emptyNavigationGroup";
+
+ /**
+ * Identifier for a navigation group in a menu (value <code>"navigationGroup"</code>).
+ */
+ public static final String NAVIGATION_GROUP = "navigationGroup";
+
+ /**
+ * Identifier for an empty group preceeding a
+ * breakpoint group in a menu (value <code>"emptyBreakpointGroup"</code>).
+ */
+ public static final String EMPTY_BREAKPOINT_GROUP = "emptyBreakpointGroup";
+
+ /**
+ * Identifier for a breakpoint group in a menu (value <code>"breakpointGroup"</code>).
+ */
+ public static final String BREAKPOINT_GROUP = "breakpointGroup";
+
+ /**
+ * Identifier for an empty group preceeding an
+ * expression group in a menu (value <code>"emptyExpressionGroup"</code>).
+ */
+ public static final String EMPTY_EXPRESSION_GROUP = "emptyExpressionGroup";
+
+ /**
+ * Identifier for an expression group in a menu (value <code>"expressionGroup"</code>).
+ */
+
+ public static final String EXPRESSION_GROUP = "expressionGroup";
+ /**
+ * Identifier for an empty group preceeding a
+ * render group in a menu (value <code>"emptyRenderGroup"</code>).
+ */
+ public static final String EMPTY_RENDER_GROUP = "emptyRenderGroup";
+
+ /**
+ * Identifier for a render group in a menu (value <code>"renderGroup"</code>).
+ */
+ public static final String RENDER_GROUP = "renderGroup";
+
+ /**
+ * Identifier for a property group in a menu (value <code>"propertyGroup"</code>).
+ */
+ public static final String PROPERTY_GROUP = "propertyGroup";
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIEventFilter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIEventFilter.java
new file mode 100644
index 000000000..a2e11d4b5
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIEventFilter.java
@@ -0,0 +1,56 @@
+package org.eclipse.debug.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.ILaunch;
+
+/**
+ * An event filter allows clients to selectively suppress events that
+ * cause the debug UI to automatically display the debug/process view when
+ * a launch is registered or when a debug session suspends.
+ * <p>
+ * For example, a client that programatically launches a debug session may
+ * not want the default behavior of switching to the debug perspective as
+ * a result of registering a launch. In this case the client could add a filter
+ * to the debug UI to selectively suppress switch to the debug perspective.
+ * </p>
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * <p>
+ * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
+ * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
+ * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
+ * (repeatedly) as the API evolves.
+ * </p>
+ */
+public interface IDebugUIEventFilter {
+
+ /**
+ * Returns whether the given launch should cause the debug UI to
+ * show the debug/process view. This method is only called when the
+ * <code>PREF_AUTO_SHOW_DEBUG_VIEW</code> preference is <code>true</code>.
+ *
+ * @param the launch that has just been registered
+ * @return whether to automatically display the launch
+ */
+ public boolean showLaunch(ILaunch launch);
+
+ /**
+ * Returns whether the given event should cause the debug UI to
+ * show the associated debug element. This method is only called when the
+ * <code>PREF_AUTO_SHOW_DEBUG_VIEW</code> preference is <code>true</code>,
+ * and the debug event is of kind <code>SUSPEND</code>.
+ *
+ * @param the launch that has just been registered
+ * @return whether to automatically display the launch
+ * @see DebugEvent
+ */
+ public boolean showDebugEvent(DebugEvent event);
+
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugViewAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugViewAdapter.java
new file mode 100644
index 000000000..3b346965e
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugViewAdapter.java
@@ -0,0 +1,57 @@
+package org.eclipse.debug.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2000
+ */
+
+import org.eclipse.jface.viewers.StructuredViewer;
+
+/**
+ * An adapter that debug views containing a structured viewer implement.
+ * Provides access to enclosed viewer and debug model presentation being
+ * used by a viewer. This allows clients to do such things as add and
+ * remove filters to a viewer, and configure a debug model presentation.
+ * The following debug views support this adapter:
+ * <ul>
+ * <li>Debug view</li>
+ * <li>Process view</li>
+ * <li>Breakpoint view</li>
+ * <li>Variable view</li>
+ * <li>Inspector view</li>
+ * </ul>
+ * <p>
+ * Clients are not intended to implement this interface.
+ * </p>
+ * <p>
+ * <b>NOTE:</b> This class/interface is part of an interim API that is still under development and expected to
+ * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
+ * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
+ * (repeatedly) as the API evolves.
+ * </p>
+ * @see IAdaptable
+ * @see IDebugModelPresentation
+ */
+
+public interface IDebugViewAdapter {
+
+ /**
+ * Returns the structured viewer contained in this debug view.
+ *
+ * @return viewer
+ */
+ public StructuredViewer getViewer();
+
+ /**
+ * Returns the debug model presentation for this view specified
+ * by the debug model identifier.
+ *
+ * @param id the debug model identifier that corresponds to the <code>id</code>
+ * attribute of a debug model presentation extension
+ * @return the debug model presentation, or <code>null</code> if no
+ * presentation is registered for the specified id
+ */
+ public IDebugModelPresentation getPresentation(String id);
+
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchWizard.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchWizard.java
new file mode 100644
index 000000000..a25a4b66e
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchWizard.java
@@ -0,0 +1,61 @@
+package org.eclipse.debug.ui;
+
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+
+import org.eclipse.debug.core.ILauncher;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizard;
+
+/**
+ * A launch wizard provides a UI for a launcher. It allows users
+ * to configure launch specific attributes. A launch wizard is
+ * is contributed by a launcher extension, via the <code>"wizard"</code>
+ * attribute, which specifies the fully qualified name of the class that
+ * implements this interface.
+ * <p>
+ * A launch wizard can be instantiated in two ways:
+ * <ul>
+ * <li>When the run or debug button is pressed and a default launcher can
+ * not be determined for the current selection of active editor, the
+ * debug UI presents a composite wizard that allows the user to select a launcher
+ * to use. When the next button is pressed, the wizard specified for that
+ * launcher is instantiated and displayed.</li>
+ * </ul>When a launcher delegate is invoked, it has the option of displaying its
+ * wizard if the launcher delegate requires user interaction to configure a launch.</li>
+ * </p>
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * <p>
+ * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
+ * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
+ * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
+ * (repeatedly) as the API evolves.
+ * </p>
+ * @see org.eclipse.debug.core.ILauncher
+ * @see org.eclipse.debug.core.model.ILauncherDelegate
+ */
+
+public interface ILaunchWizard extends IWizard {
+ /**
+ * This lifecycle method is called by the debug UI plug-in after instantiating
+ * and before displaying a launch wizard, to allow the wizard to configure itself
+ * based on the mode in which it should launch, and the selection of elements
+ * which provide context on what should be launched.
+ *
+ * @param launcher the launcher being used - corresponds to the launcher delegate
+ * that contributed this launch wizard
+ * @param mode run or debug
+ * @param selection the current selection in the workbench, from which this wizard
+ * can obtain context on what may be launched
+ *
+ * @see org.eclipse.debug.core.ILaunchManager
+ * @see org.eclipse.debug.core.ILauncher
+ * @see org.eclipse.debug.core.model.ILauncherDelegate
+ */
+ void init(ILauncher launcher, String mode, IStructuredSelection selection);
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/package.html b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/package.html
new file mode 100644
index 000000000..8f5023fa7
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/package.html
@@ -0,0 +1,87 @@
+<html>
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
+<title>Eclipse Debug Tools</title>
+</head>
+
+<body bgcolor="#FFFFFF">
+
+<p>Provides a generic debugger user interface that clients may customize via standard
+workbench extension points.</p>
+
+<h2>Package Specification</h2>
+
+<p><strong>Note</strong>: this package is part of an interim API that is still under
+development and expected to change significantly before reaching stability. It is being
+made available at this early stage to soloicit feedback from pioneering adopters on the
+understanding that any code that uses this API will almost certainly be broken
+(repeatedly) as the API evolves.</p>
+
+<p>Eclipse Debug Tools UI (debug UI plug-in) provides a set of classes and interfaces to
+support a debugger user interface. A generic debug perspective is provided with a common
+set of views. Clients are allowed to contribute actions to the debug views via the
+standard workbench <font face="Courier New">viewAction</font> extension point, and can
+contribute to popup menus in the debug views via the standard <font face="Courier New">popupMenu</font>
+extension point.</p>
+
+<h4>The Debug View</h4>
+
+<p>The debug view presents a tree of launched debug sessions. The view provides support
+for standard debug interactions such as terminating, stepping, suspending, and resuming
+threads and debug targets. The debug view is linked to an editor view, variable view, and
+console. The editor view is used to display source code for stack frames. A selection in
+the debug view causes the line of code being executed to be highlighted in the editor
+view. The variable view shows the visible variables in the selected stack frame, and the
+console view handles I/O for the debuggable process.</p>
+
+<h4>The Process View</h4>
+
+<p>The process view presents a tree of launched programs in normal (non-debug) mode. The
+view provides support for terminating processes, and is linked to the console view to
+support I/O.</p>
+
+<h4>The Variable View</h4>
+
+<p>The variable view presents a tree of variables for the currently selected stack frame.</p>
+
+<h4>The Breakpoint View</h4>
+
+<p>The breakpoint view presents a list of all breakpoints currently defined in the
+workspace. It supports enabling/disabling and breakpoint removal.</p>
+
+<h4>The Inspector View</h4>
+
+<p>The inspector view presents a tree of expressions that have been evaluated.</p>
+
+<h4>Debug Model Presentation</h4>
+
+<p>The debug UI plug-in defines an extension (<font face="Courier New">org.eclipse.debug.ui.debugModelPresentations</font>)
+point to allow implementations of debug models to provide custom rendering and
+presentation of its debug elements. Extensions are be registered for a specific debug
+model. It is intended that an implementation of a debug model will also provide an
+implementation of a debug model presentation. The presentation provides:
+
+<ul>
+ <li>an image for a debug element or breakpoint</li>
+ <li>a label for a debug element or breakpoint</li>
+ <li>an editor input and editor id used to display the debug element or breakpoint</li>
+</ul>
+
+<h4>Launch Wizard</h4>
+
+<p>The debug UI plug-in defines an interface that launch wizards must implement - <font
+face="Courier New">org.eclipse.debug.ui.ILaunchWizard</font>. Launch wizards are defined
+in <font face="Courier New">launcher</font> extensions (defined by <font
+face="Courier New">org.eclipse.debug.core</font>), and are instantiated by the debug UI
+plug-in.</p>
+
+<h4>Debug Perspective</h4>
+
+<p>By default, when a program is run or debug, the debug UI automatically switches to the
+default debug perspective. To circumvent automatic perspective switching, a user
+preference is available. Launcher extensions may also define an alternate perspective to
+use.</p>
+</body>
+</html>

Back to the top