diff options
author | Darin Wright | 2005-01-19 22:48:09 +0000 |
---|---|---|
committer | Darin Wright | 2005-01-19 22:48:09 +0000 |
commit | 2c7b38815cefe9b9b33b8970d608f3a0faa2491e (patch) | |
tree | 31092ea5106023756b45381700b686f69cd0b194 | |
parent | 53fdd180a2f683bd7aa3eb097e7c193dee672b1c (diff) | |
download | eclipse.platform.debug-2c7b38815cefe9b9b33b8970d608f3a0faa2491e.tar.gz eclipse.platform.debug-2c7b38815cefe9b9b33b8970d608f3a0faa2491e.tar.xz eclipse.platform.debug-2c7b38815cefe9b9b33b8970d608f3a0faa2491e.zip |
Bug 83237 - [Breakpoint Groups] Breakpoint working set actions
3 files changed, 108 insertions, 34 deletions
diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties index 29dd5e4b8..1cfbed6d8 100644 --- a/org.eclipse.debug.ui/plugin.properties +++ b/org.eclipse.debug.ui/plugin.properties @@ -305,6 +305,7 @@ clearDefaultGroup.tooltip=Deselect Default Working Set addToGroup.label=&Add to Working Set... editGroup.label=&Edit Working Set... +ToggleDefault.label=Defaul&t Working Set Project.label=Projects Project.others=Others (no project) diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index e27b18361..1c233d55f 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -1133,6 +1133,45 @@ <!-- Contributions to Breakpoints View Popup Menu --> <viewerContribution targetID="org.eclipse.debug.ui.BreakpointView" + id="org.eclipse.debug.ui.breakpointview.breakpointGroupActions"> + <visibility> + <objectClass + name="org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer"> + </objectClass> + </visibility> + <action + label="%editGroup.label" + class="org.eclipse.debug.internal.ui.actions.breakpointGroups.EditBreakpointGroupAction" + menubarPath="breakpointGroupGroup" + enablesFor="1" + id="org.eclipse.debug.ui.actions.editBreakpointGroup"> + </action> + <action + label="%ToggleDefault.label" + class="org.eclipse.debug.internal.ui.actions.breakpointGroups.ToggleDefaultGroupAction" + menubarPath="breakpointGroupGroup" + id="org.eclipse.debug.ui.actions.toggleDefaultGroup"/> + </viewerContribution> + <viewerContribution + targetID="org.eclipse.debug.ui.BreakpointView" + id="org.eclipse.debug.ui.breakpointview.breakpointActions"> + <visibility> + <objectClass + name="org.eclipse.debug.core.model.IBreakpoint"> + </objectClass> + </visibility> + <action + label="%addToGroup.label" + icon="icons/full/obj16/brkp_grp.gif" + helpContextId="add_breakpoint_to_group_action_context" + class="org.eclipse.debug.internal.ui.actions.breakpointGroups.AddBreakpointToGroupAction" + menubarPath="breakpointGroupGroup" + enablesFor="1+" + id="org.eclipse.debug.ui.actions.AddBreakpointToGroup"> + </action> + </viewerContribution> + <viewerContribution + targetID="org.eclipse.debug.ui.BreakpointView" id="org.eclipse.debug.ui.breakpointview.popupMenu"> <action label="%SelectAll.label" @@ -1186,41 +1225,7 @@ </action> </viewerContribution> <!-- Breakpoint actions --> - <viewerContribution - targetID="org.eclipse.debug.ui.BreakpointView" - id="org.eclipse.debug.ui.breakpointview.breakpointActions"> - <visibility> - <objectClass - name="org.eclipse.debug.core.model.IBreakpoint"> - </objectClass> - </visibility> - <action - label="%addToGroup.label" - icon="icons/full/obj16/brkp_grp.gif" - helpContextId="add_breakpoint_to_group_action_context" - class="org.eclipse.debug.internal.ui.actions.breakpointGroups.AddBreakpointToGroupAction" - menubarPath="breakpointGroupGroup" - enablesFor="1+" - id="org.eclipse.debug.ui.actions.AddBreakpointToGroup"> - </action> - </viewerContribution> <!-- Breakpoint group actions --> - <viewerContribution - targetID="org.eclipse.debug.ui.BreakpointView" - id="org.eclipse.debug.ui.breakpointview.breakpointGroupActions"> - <visibility> - <objectClass - name="org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer"> - </objectClass> - </visibility> - <action - label="%editGroup.label" - class="org.eclipse.debug.internal.ui.actions.breakpointGroups.EditBreakpointGroupAction" - menubarPath="breakpointGroupGroup" - enablesFor="1" - id="org.eclipse.debug.ui.actions.editBreakpointGroup"> - </action> - </viewerContribution> <!-- Contributions to Variables View Popup Menu --> <viewerContribution targetID="org.eclipse.debug.ui.VariableView" diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java new file mode 100644 index 000000000..aa69866f8 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.actions.breakpointGroups; + +import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; +import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer; +import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointSetOrganizer; +import org.eclipse.debug.internal.ui.views.breakpoints.WorkingSetCategory; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IWorkingSet; + +/** + * Toggles the default breakpoint group based on selection. + */ +public class ToggleDefaultGroupAction extends AbstractBreakpointsViewAction { + + private IWorkingSet fSelectedSet; + + /* (non-Javadoc) + * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) + */ + public void run(IAction action) { + IWorkingSet defaultWorkingSet = BreakpointSetOrganizer.getDefaultWorkingSet(); + IWorkingSet set = null; + if (!fSelectedSet.equals(defaultWorkingSet)) { + set = fSelectedSet; + } + BreakpointSetOrganizer.setDefaultWorkingSet(set); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) + */ + public void selectionChanged(IAction action, ISelection sel) { + fSelectedSet = null; + if (sel instanceof IStructuredSelection) { + IStructuredSelection selection = (IStructuredSelection) sel; + Object firstElement = selection.getFirstElement(); + if (firstElement instanceof BreakpointContainer) { + BreakpointContainer container = (BreakpointContainer) firstElement; + if (container.getCategory() instanceof WorkingSetCategory) { + WorkingSetCategory category = (WorkingSetCategory)container.getCategory(); + if (IInternalDebugUIConstants.ID_BREAKPOINT_WORKINGSET.equals(category.getWorkingSet().getId())) { + IWorkingSet set = category.getWorkingSet(); + action.setEnabled(true); + boolean isDefault = set == BreakpointSetOrganizer.getDefaultWorkingSet(); + action.setChecked(isDefault); + fSelectedSet = set; + return; + } + } + } + } + action.setEnabled(false); + action.setChecked(false); + } + +} |