diff options
author | Pawel Piech | 2009-09-11 18:54:31 +0000 |
---|---|---|
committer | Pawel Piech | 2009-09-11 18:54:31 +0000 |
commit | c4038c98424e7972ac934c397f48eabf6f9222d6 (patch) | |
tree | 8e0ca2c7e562dfba64f66e49a471bd3ef98aa993 /org.eclipse.debug.ui/ui/org | |
parent | b4a5f63c927fcca911789d0a42a6695eb017a5fd (diff) | |
download | eclipse.platform.debug-c4038c98424e7972ac934c397f48eabf6f9222d6.tar.gz eclipse.platform.debug-c4038c98424e7972ac934c397f48eabf6f9222d6.tar.xz eclipse.platform.debug-c4038c98424e7972ac934c397f48eabf6f9222d6.zip |
Bug 286256 - Request to move Restart icon to core debug framework
Diffstat (limited to 'org.eclipse.debug.ui/ui/org')
7 files changed, 139 insertions, 8 deletions
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 index 6c989e50b..20472307e 100644 --- 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 @@ -126,6 +126,7 @@ public class DebugPluginImages { declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_TOGGLE_STEP_FILTERS, DLCL+"stepbystep_co.gif"); //$NON-NLS-1$ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_NEXT_THREAD, DLCL+"next_thread_nav.gif"); //$NON-NLS-1$ declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_PREVIOUS_THREAD, DLCL+"prev_thread_nav.gif"); //$NON-NLS-1$ + declareRegistryImage(IInternalDebugUIConstants.IMG_DLCL_RESTART, DLCL+"restart_co.gif"); //$NON-NLS-1$ // enabled local toolbars declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_DETAIL_PANE, ELCL + "toggledetailpane_co.gif"); //$NON-NLS-1$ @@ -163,6 +164,7 @@ public class DebugPluginImages { declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_STANDARD_ERR, ELCL+"writeerr_co.gif"); //$NON-NLS-1$ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_NEXT_THREAD, ELCL+"next_thread_nav.gif"); //$NON-NLS-1$ declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_PREVIOUS_THREAD, ELCL+"prev_thread_nav.gif"); //$NON-NLS-1$ + declareRegistryImage(IInternalDebugUIConstants.IMG_ELCL_RESTART, ELCL+"restart_co.gif"); //$NON-NLS-1$ //Object declareRegistryImage(IDebugUIConstants.IMG_OBJS_LAUNCH_DEBUG, OBJECT + "ldebug_obj.gif"); //$NON-NLS-1$ 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 index 612177711..ccaf43bf6 100644 --- 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 @@ -74,6 +74,7 @@ public interface IInternalDebugUIConstants { public static final String IMG_DLCL_TOGGLE_STEP_FILTERS = "IMG_DLCL_TOGGLE_STEP_FILTERS"; //$NON-NLS-1$ public static final String IMG_DLCL_NEXT_THREAD = "IMG_DLCL_NEXT_THREAD"; //$NON-NLS-1$ public static final String IMG_DLCL_PREVIOUS_THREAD = "IMG_DLCL_PREVIOUS_THREAD"; //$NON-NLS-1$ + public static final String IMG_DLCL_RESTART = "IMG_DLCL_RESTART"; //$NON-NLS-1$ //TODO: Move this IDebugUIConstants. Created too late in 3.2 cycle to add API. //The enabled icon is already API. @@ -118,6 +119,7 @@ public interface IInternalDebugUIConstants { public static final String IMG_ELCL_STANDARD_ERR = "IMG_ELCL_STANDARD_ERR"; //$NON-NLS-1$ public static final String IMG_ELCL_NEXT_THREAD = "IMG_ELCL_NEXT_THREAD"; //$NON-NLS-1$ public static final String IMG_ELCL_PREVIOUS_THREAD = "IMG_ELCL_PREVIOUS_THREAD"; //$NON-NLS-1$ + public static final String IMG_ELCL_RESTART = "IMG_ELCL_RESTART"; //$NON-NLS-1$ public static final String IMG_OBJS_COMMON_TAB = "IMG_OBJS_COMMON_TAB"; //$NON-NLS-1$ public static final String IMG_OBJS_REFRESH_TAB = "IMG_OBJS_REFRESH_TAB"; //$NON-NLS-1$ diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java index b06bc1da7..56b9aa620 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java @@ -197,7 +197,11 @@ public class ActionMessages extends NLS { public static String LaunchAction_2; - public static String ResumeAction_0; + public static String RestartCommandAction__text; + + public static String RestartCommandAction_tooltip; + + public static String ResumeAction_0; public static String ResumeAction_3; public static String StepIntoAction_0; public static String StepIntoAction_3; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties index 0ad24e7c4..827e59d3e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties @@ -174,6 +174,8 @@ StepOverAction_3=Step Over LaunchAction_0=Remove Configuration LaunchAction_1=Are you sure you want to remove {0} from the launch history? LaunchAction_2=&Do not ask me again. +RestartCommandAction__text=Restart +RestartCommandAction_tooltip=Restart ResumeAction_0=Resu&me ResumeAction_3=Resume DisconnectAction_0=Disconn&ect diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandAction.java new file mode 100644 index 000000000..e03affc91 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandAction.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2009 Wind River Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.commands.actions; + +import org.eclipse.debug.core.commands.IRestartHandler; +import org.eclipse.debug.internal.ui.DebugPluginImages; +import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; +import org.eclipse.debug.internal.ui.actions.ActionMessages; +import org.eclipse.debug.ui.actions.DebugCommandAction; +import org.eclipse.jface.resource.ImageDescriptor; + +/** + * Handler for the + * + * @since 3.6 + */ +public class RestartCommandAction extends DebugCommandAction { + + protected Class getCommandType() { + return IRestartHandler.class; + } + + public ImageDescriptor getDisabledImageDescriptor() { + return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_RESTART); + } + + public String getHelpContextId() { + return "org.eclipse.debug.ui.restart_action_context"; //$NON-NLS-1$ + } + + public ImageDescriptor getHoverImageDescriptor() { + return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESTART); + } + + public String getId() { + return "org.eclipse.debug.ui.actions.Restart"; //$NON-NLS-1$ + } + + public ImageDescriptor getImageDescriptor() { + return DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_RESTART); + } + + public String getText() { + return ActionMessages.RestartCommandAction__text; + } + + public String getToolTipText() { + return ActionMessages.RestartCommandAction_tooltip; + } + + +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandActionDelegate.java new file mode 100644 index 000000000..961b7cd85 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/RestartCommandActionDelegate.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ + +package org.eclipse.debug.internal.ui.commands.actions; + +import org.eclipse.debug.ui.actions.DebugCommandAction; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.widgets.Event; +import org.eclipse.ui.IActionDelegate2; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; + +/** + * Restart action delegate. + * + * @since 3.6 + */ +public class RestartCommandActionDelegate implements IWorkbenchWindowActionDelegate, IActionDelegate2 { + + private DebugCommandAction fDebugAction = new RestartCommandAction(); + + public void dispose() { + fDebugAction.dispose(); + } + + public void init(IWorkbenchWindow window) { + fDebugAction.init(window); + } + + public void run(IAction action) { + fDebugAction.run(); + } + + public void selectionChanged(IAction action, ISelection selection) { + // do nothing + } + + public void init(IAction action) { + fDebugAction.setActionProxy(action); + + } + + public void runWithEvent(IAction action, Event event) { + run(action); + } +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java index 563dbdc8a..fff336567 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java @@ -31,6 +31,7 @@ import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.core.commands.IRestartHandler; import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IProcess; @@ -43,6 +44,7 @@ import org.eclipse.debug.internal.ui.actions.AddToFavoritesAction; import org.eclipse.debug.internal.ui.actions.EditLaunchConfigurationAction; import org.eclipse.debug.internal.ui.commands.actions.DisconnectCommandAction; import org.eclipse.debug.internal.ui.commands.actions.DropToFrameCommandAction; +import org.eclipse.debug.internal.ui.commands.actions.RestartCommandAction; import org.eclipse.debug.internal.ui.commands.actions.ResumeCommandAction; import org.eclipse.debug.internal.ui.commands.actions.StepIntoCommandAction; import org.eclipse.debug.internal.ui.commands.actions.StepOverCommandAction; @@ -155,7 +157,9 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi private static final String TERMINATE_AND_RELAUNCH = "terminate_relaunch"; //$NON-NLS-1$ private static final String TOGGLE_STEP_FILTERS = "toggle_step_filters"; //$NON-NLS-1$ - + + private static final String RESTART = "restart"; //$NON-NLS-1$ + private static final int BREADCRUMB_TRIGGER_RANGE = 5; // pixels private static final int BREADCRUMB_STICKY_RANGE = 20; // pixels @@ -502,6 +506,7 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi addCapabilityAction(new DropToFrameCommandAction(), DROP_TO_FRAME); addCapabilityAction(new TerminateAndRemoveAction(), TERMINATE_AND_REMOVE); addCapabilityAction(new TerminateAndRelaunchAction(), TERMINATE_AND_RELAUNCH); + addCapabilityAction(new RestartCommandAction(), RESTART); addCapabilityAction(new TerminateAllAction(), TERMINATE_ALL); addCapabilityAction(new ToggleStepFiltersAction(), TOGGLE_STEP_FILTERS); } @@ -1019,6 +1024,7 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi disposeCommandAction(DROP_TO_FRAME); disposeCommandAction(TERMINATE_AND_REMOVE); disposeCommandAction(TERMINATE_AND_RELAUNCH); + disposeCommandAction(RESTART); disposeCommandAction(TERMINATE_ALL); } @@ -1103,6 +1109,8 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi * @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(org.eclipse.jface.action.IMenuManager) */ protected void fillContextMenu(IMenuManager menu) { + TreeSelection sel = (TreeSelection) fTreeViewerDebugContextProvider.getActiveContext(); + Object element = sel != null && sel.size() > 0 ? sel.getFirstElement() : null; menu.add(new Separator(IDebugUIConstants.EMPTY_EDIT_GROUP)); menu.add(new Separator(IDebugUIConstants.EDIT_GROUP)); @@ -1129,12 +1137,7 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi /** * TODO hack to get around bug 148424, remove if UI ever fixes the PropertyDialogAction to respect enablesWhen conditions */ - TreeSelection sel = (TreeSelection) fTreeViewerDebugContextProvider.getActiveContext(); - boolean enabled = true; - if(sel != null && sel.size() > 0) { - enabled = !(sel.getFirstElement() instanceof ILaunch); - } - action.setEnabled(action.isApplicableForSelection() && enabled); + action.setEnabled(action.isApplicableForSelection() && !(element instanceof ILaunch)); menu.add(action); menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); @@ -1145,6 +1148,9 @@ public class LaunchView extends AbstractDebugView implements ISelectionChangedLi menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(SUSPEND)); menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(TERMINATE)); menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(TERMINATE_AND_RELAUNCH)); + if (element instanceof IAdaptable && ((IAdaptable)element).getAdapter(IRestartHandler.class) != null) { + menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(RESTART)); + } menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(DISCONNECT)); menu.appendToGroup(IDebugUIConstants.STEP_INTO_GROUP, getAction(STEP_INTO)); |