diff options
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups')
18 files changed, 0 insertions, 1707 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AbstractBreakpointsViewAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AbstractBreakpointsViewAction.java deleted file mode 100644 index b396f7922..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AbstractBreakpointsViewAction.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 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: - * IBM Corporation - initial implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView; -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.IViewActionDelegate; -import org.eclipse.ui.IViewPart; - -/** - * Abstract implementation of an action contributed to the breakpoints view. - */ -public abstract class AbstractBreakpointsViewAction implements IViewActionDelegate, IActionDelegate2 { - - /** - * The breakpoints view that this action has been contributed to. - */ - protected BreakpointsView fView; - - /* (non-Javadoc) - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - public void init(IViewPart view) { - fView= (BreakpointsView) view; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate2#dispose() - */ - public void dispose() { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) - */ - public void init(IAction action) { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event) - */ - public void runWithEvent(IAction action, Event event) { - run(action); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AdvancedGroupBreakpointsByAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AdvancedGroupBreakpointsByAction.java deleted file mode 100644 index 243c140bb..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/AdvancedGroupBreakpointsByAction.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.window.Window; - -/** - * Action that opens a dialog to select which breakpoint - * container factories should be applies to the breakpoints - * view. - */ -public class AdvancedGroupBreakpointsByAction extends Action { - - private BreakpointsView fView; - - public AdvancedGroupBreakpointsByAction(BreakpointsView view) { - super(IInternalDebugCoreConstants.EMPTY_STRING, IAction.AS_RADIO_BUTTON); - fView= view; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.IAction#run() - */ - public void run() { - if (isChecked()) { - GroupBreakpointsByDialog dialog = new GroupBreakpointsByDialog(fView); - if (dialog.open() == Window.OK) { - fView.setBreakpointOrganizers(dialog.getOrganizers()); - } - } - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointGroupMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointGroupMessages.java deleted file mode 100644 index a9e8955d3..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointGroupMessages.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import org.eclipse.osgi.util.NLS; - -public class BreakpointGroupMessages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.actions.breakpointGroups.BreakpointGroupMessages";//$NON-NLS-1$ - // - // Copyright (c) 2004, 2005 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: - // IBM Corporation - initial API and implementation - // - - public static String GroupBreakpointsByAction_0; - public static String GroupBreakpointsByAction_1; - public static String GroupBreakpointsByDialog_0; - public static String GroupBreakpointsByDialog_1; - public static String GroupBreakpointsByDialog_2; - public static String GroupBreakpointsByDialog_3; - public static String GroupBreakpointsByDialog_4; - public static String GroupBreakpointsByDialog_5; - public static String GroupBreakpointsByDialog_6; - public static String GroupBreakpointsByDialog_7; - public static String CopyBreakpointsAction_0; - public static String CopyBreakpointsAction_1; - public static String CopyBreakpointsAction_2; - public static String CopyBreakpointsAction_3; - public static String PasteBreakpointsAction_0; - public static String PasteBreakpointsAction_1; - public static String RemoveFromWorkingSetAction_0; - - public static String SelectBreakpointWorkingsetDialog_0; - - public static String SetDefaultBreakpointGroupAction_0; - - static { - // load message values from bundle file - NLS.initializeMessages(BUNDLE_NAME, BreakpointGroupMessages.class); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointGroupMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointGroupMessages.properties deleted file mode 100644 index 4fa9d6cfd..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointGroupMessages.properties +++ /dev/null @@ -1,30 +0,0 @@ -############################################################################### -# Copyright (c) 2004, 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: -# IBM Corporation - initial API and implementation -############################################################################### - -GroupBreakpointsByAction_0=Breakpoints -GroupBreakpointsByAction_1=Advanced... -GroupBreakpointsByDialog_0=Specify nested groupings for the Breakpoints view. -GroupBreakpointsByDialog_1=A&vailable Groups: -GroupBreakpointsByDialog_2=&Add --> -GroupBreakpointsByDialog_3=&Selected Groups: -GroupBreakpointsByDialog_4=<-- &Remove -GroupBreakpointsByDialog_5=Move &Up -GroupBreakpointsByDialog_6=Move &Down -GroupBreakpointsByDialog_7=Group Breakpoints -CopyBreakpointsAction_0=&Copy -CopyBreakpointsAction_1=Copy Breakpoints -CopyBreakpointsAction_2=Problem Copying to Clipboard -CopyBreakpointsAction_3=There was a problem when accessing the system clipboard. Retry? -PasteBreakpointsAction_0=&Paste -PasteBreakpointsAction_1=Paste Breakpoints -RemoveFromWorkingSetAction_0=Remove from &Working Set -SetDefaultBreakpointGroupAction_0=Select Default Working Set -SelectBreakpointWorkingsetDialog_0=Select &default working set: diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointSelectionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointSelectionAction.java deleted file mode 100644 index a1c90fb6f..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointSelectionAction.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView; -import org.eclipse.ui.actions.SelectionListenerAction; - -/** - * A selection listener action for the breakpoints view. - */ -public abstract class BreakpointSelectionAction extends SelectionListenerAction { - - private BreakpointsView fView; - - /** - * Constructs an action for the breakpoints view. - * - * @param text action name - * @param view breakpoints view - */ - public BreakpointSelectionAction(String text, BreakpointsView view) { - super(text); - fView = view; - } - - /** - * Returns the breakpoints view. - * - * @return breakpoints view - */ - protected BreakpointsView getBreakpointsView() { - return fView; - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointWorkingSetAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointWorkingSetAction.java deleted file mode 100644 index 1ed2fff7b..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointWorkingSetAction.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 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: - * IBM Corporation - initial implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IViewPart; - -/** - * An action which clears (sets the null) the default breakpoint group. - * @see org.eclipse.debug.core.IBreakpointManager#setAutoGroup(String) - */ -public abstract class BreakpointWorkingSetAction extends AbstractBreakpointsViewAction implements IPropertyChangeListener { - - protected IAction fAction; - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) { - update(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - public void init(IViewPart view) { - super.init(view); - DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate2#dispose() - */ - public void dispose() { - DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); - super.dispose(); - } - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) - */ - public void init(IAction action) { - fAction = action; - super.init(action); - update(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - if (event.getProperty().equals(IInternalDebugUIConstants.MEMENTO_BREAKPOINT_WORKING_SET_NAME)) { - update(); - } - - } - protected abstract void update(); -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ClearDefaultBreakpointGroupAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ClearDefaultBreakpointGroupAction.java deleted file mode 100644 index f6d50a804..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ClearDefaultBreakpointGroupAction.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 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: - * IBM Corporation - initial implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointSetOrganizer; -import org.eclipse.jface.action.IAction; - -/** - * An action which clears (sets the null) the default breakpoint group. - * @see org.eclipse.debug.core.IBreakpointManager#setAutoGroup(String) - */ -public class ClearDefaultBreakpointGroupAction extends BreakpointWorkingSetAction { - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - BreakpointSetOrganizer.setDefaultWorkingSet(null); - } - - protected void update() { - fAction.setEnabled(BreakpointSetOrganizer.getDefaultWorkingSet() != null); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsAction.java deleted file mode 100644 index 3ee9a6476..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsAction.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import java.util.Iterator; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.swt.SWTError; -import org.eclipse.swt.dnd.Clipboard; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.TextTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.navigator.LocalSelectionTransfer; - -/** - * Action for copying the currently selected breakpoints to the clipboard. - */ -public class CopyBreakpointsAction extends BreakpointSelectionAction { - - /** - * System clipboard - */ - private Clipboard clipboard; - - /** - * Associated paste action. May be <code>null</code> - */ - private PasteBreakpointsAction pasteAction; - - /** - * Creates a new action. - * - * @param shell the shell for any dialogs - * @param clipboard a platform clipboard - */ - public CopyBreakpointsAction(BreakpointsView view, Clipboard clipboard) { - super(BreakpointGroupMessages.CopyBreakpointsAction_0, view); - Assert.isNotNull(clipboard); - this.clipboard = clipboard; - setToolTipText(BreakpointGroupMessages.CopyBreakpointsAction_1); - PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.COPY_BREAKPOINTS_ACTION); - } - - /** - * Creates a new action. - * - * @param shell the shell for any dialogs - * @param clipboard a platform clipboard - * @param pasteAction a paste action - */ - public CopyBreakpointsAction(BreakpointsView view, Clipboard clipboard, PasteBreakpointsAction pasteAction) { - this(view, clipboard); - this.pasteAction = pasteAction; - } - - /** - * The <code>CopyAction</code> implementation of this method defined - * on <code>IAction</code> copies the selected resources to the - * clipboard. - */ - public void run() { - IStructuredSelection selection = getStructuredSelection(); - Object[] objects = selection.toArray(); - StringBuffer buffer = new StringBuffer(); - ILabelProvider labelProvider = (ILabelProvider) ((StructuredViewer)getBreakpointsView().getViewer()).getLabelProvider(); - for (int i = 0; i < objects.length; i++) { - Object object = objects[i]; - if (i > 0) { - buffer.append("\n"); //$NON-NLS-1$ - } - buffer.append(labelProvider.getText(object)); - } - setClipboard(selection, buffer.toString()); - - // update the enablement of the paste action - // workaround since the clipboard does not suppot callbacks - if (pasteAction != null && pasteAction.getStructuredSelection() != null) - pasteAction.selectionChanged(pasteAction.getStructuredSelection()); - } - - /** - * Set the clipboard contents. Prompt to retry if clipboard is busy. - * - * @param selection the selection to copy to the clipboard - */ - private void setClipboard(ISelection selection, String text) { - try { - LocalSelectionTransfer.getInstance().setSelection(selection); - LocalSelectionTransfer.getInstance().setSelectionSetTime(System.currentTimeMillis()); - clipboard.setContents(new Object[] {selection, text}, new Transfer[] {LocalSelectionTransfer.getInstance(), TextTransfer.getInstance()}); - } catch (SWTError e) { - if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) - throw e; - if (MessageDialog.openQuestion( - getBreakpointsView().getSite().getShell(), BreakpointGroupMessages.CopyBreakpointsAction_2, - BreakpointGroupMessages.CopyBreakpointsAction_3)) { - setClipboard(selection, text); - } - } - } - - /** - * Enables if one or more breakpoints are selected. - */ - protected boolean updateSelection(IStructuredSelection selection) { - if (selection.isEmpty()) { - return false; - } - Iterator iterator = selection.iterator(); - while (iterator.hasNext()) { - if (!(iterator.next() instanceof IBreakpoint)) { - return false; - } - } - return true; - } - -} - diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/EditBreakpointGroupAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/EditBreakpointGroupAction.java deleted file mode 100644 index d8225fcff..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/EditBreakpointGroupAction.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 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: - * IBM Corporation - initial implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer; -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.jface.wizard.WizardDialog; -import org.eclipse.ui.IWorkingSet; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.IWorkingSetEditWizard; - -/** - * An action to edit a breakpoint working set. - */ -public class EditBreakpointGroupAction extends AbstractBreakpointsViewAction { - - /** - * The currently selected breakpoints - */ - private IWorkingSet fSet = null; - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - IWorkingSetEditWizard editWizard = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetEditWizard(fSet); - WizardDialog dialog = new WizardDialog(DebugUIPlugin.getShell(), editWizard); - dialog.open(); - } - - /* (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) { - IStructuredSelection selection= (IStructuredSelection) sel; - fSet = null; - if (selection.size() == 1) { - Object element = selection.getFirstElement(); - if (element instanceof BreakpointContainer) { - BreakpointContainer container = (BreakpointContainer)element; - IAdaptable category = container.getCategory(); - if (category instanceof WorkingSetCategory) { - IWorkingSet set = ((WorkingSetCategory)category).getWorkingSet(); - action.setEnabled(true); - fSet = set; - return; - } - } - } - action.setEnabled(false); - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsAction.java deleted file mode 100644 index c53ab9ab8..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsAction.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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: - * IBM Corporation - initial implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView; -import org.eclipse.debug.internal.ui.views.breakpoints.IBreakpointOrganizer; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; - -/** - * An action which sets the breakpoint factory on a breakpoint view, - * effectively telling the view to group breakpoints according to - * some criteria (as determined by the factory). - */ -public class GroupBreakpointsAction extends Action { - - private IBreakpointOrganizer fOrganzier; - private BreakpointsView fView; - - /** - * Creates a new action which will group breakpoints in the given - * breakpoint view using the given breakpoint container factory - * @param factory the factory that will be applied to the given view - * when this action is run - * @param view the breakpoints view - */ - public GroupBreakpointsAction(IBreakpointOrganizer organizer, BreakpointsView view) { - super(IInternalDebugCoreConstants.EMPTY_STRING, IAction.AS_RADIO_BUTTON); - fOrganzier= organizer; - fView= view; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.IAction#run() - */ - public void run() { - if (isChecked()) { - if (fOrganzier == null) { - fView.setBreakpointOrganizers(null); - } else { - fView.setBreakpointOrganizers(new IBreakpointOrganizer[]{fOrganzier}); - } - } - } - - /** - * Returns this action's organizer. - * - * @return breakpoint organizer - */ - public IBreakpointOrganizer getOrganizer() { - return fOrganzier; - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java deleted file mode 100644 index 4ebf6be86..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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: - * IBM Corporation - initial implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.debug.internal.ui.DebugPluginImages; -import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointOrganizerManager; -import org.eclipse.debug.internal.ui.views.breakpoints.IBreakpointOrganizer; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuCreator; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.swt.events.MenuAdapter; -import org.eclipse.swt.events.MenuEvent; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; - -/** - * - */ -public class GroupBreakpointsByAction extends AbstractBreakpointsViewAction implements IMenuCreator { - - private IAction fAction= null; - - public GroupBreakpointsByAction() { - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.IMenuCreator#dispose() - */ - public void dispose() { - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control) - */ - public Menu getMenu(Control parent) { - // Never called - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu) - */ - public Menu getMenu(Menu parent) { - Menu menu = new Menu(parent); - menu.addMenuListener(new MenuAdapter() { - public void menuShown(MenuEvent e) { - Menu m = (Menu)e.widget; - MenuItem[] items = m.getItems(); - for (int i=0; i < items.length; i++) { - items[i].dispose(); - } - fillMenu(m); - } - }); - return menu; - } - - /** - * Fill pull down menu with the "group by" options - */ - private void fillMenu(Menu menu) { - // determine which item should be checked - IBreakpointOrganizer[] organizers = fView.getBreakpointOrganizers(); - boolean none = false; - boolean advanced = false; - IBreakpointOrganizer organizer = null; - if (organizers == null || organizers.length == 0) { - none = true; - } else if (organizers.length > 1) { - advanced = true; - } else { - organizer = organizers[0]; - } - - int accel = 1; - // Add hard-coded action for flat breakpoints list - IAction action = new GroupBreakpointsAction(null, fView); - addAccel(accel, action, BreakpointGroupMessages.GroupBreakpointsByAction_0); - accel++; - action.setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_VIEW_BREAKPOINTS)); - action.setChecked(none); - ActionContributionItem item= new ActionContributionItem(action); - item.fill(menu, -1); - - // Add actions for each contributed organizer - List actions = getActions(accel); - accel = accel + actions.size(); - Iterator actionIter = actions.iterator(); - while (actionIter.hasNext()) { - GroupBreakpointsAction bpAction = (GroupBreakpointsAction) actionIter.next(); - bpAction.setChecked(bpAction.getOrganizer().equals(organizer)); - item= new ActionContributionItem(bpAction); - item.fill(menu, -1); - } - - // advanced action - AdvancedGroupBreakpointsByAction advancedAction = new AdvancedGroupBreakpointsByAction(fView); - addAccel(accel, advancedAction,BreakpointGroupMessages.GroupBreakpointsByAction_1); - advancedAction.setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_HIERARCHICAL)); - advancedAction.setChecked(advanced); - item= new ActionContributionItem(advancedAction); - item.fill(menu, -1); - } - - public List getActions(int accel) { - List actions= new ArrayList(); - IBreakpointOrganizer[] organizers = BreakpointOrganizerManager.getDefault().getOrganizers(); - for (int i = 0; i < organizers.length; i++) { - IBreakpointOrganizer organizer = organizers[i]; - IAction action = new GroupBreakpointsAction(organizer, fView); - addAccel(accel, action, organizer.getLabel()); - accel++; - action.setImageDescriptor(organizer.getImageDescriptor()); - actions.add(action); - } - return actions; - } - - private void addAccel(int accel, IAction action, String label) { - StringBuffer actionLabel= new StringBuffer(); - if (accel != 10) { - if (accel < 10) { - // add the numerical accelerators 1 through 9 - actionLabel.append('&'); - } - actionLabel.append(accel); - } else { - actionLabel.append("1&0"); //$NON-NLS-1$ - } - accel++; - actionLabel.append(' '); - actionLabel.append(label); - action.setText(actionLabel.toString()); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) { - if (action != fAction) { - action.setMenuCreator(this); - fAction= action; - } - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java deleted file mode 100644 index a261c78af..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java +++ /dev/null @@ -1,534 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.SWTFactory; -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointOrganizerManager; -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView; -import org.eclipse.debug.internal.ui.views.breakpoints.IBreakpointOrganizer; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.TrayDialog; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -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.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.ui.PlatformUI; - -/** - * Dialog which presents available breakpoint groupings to - * the user and allows them to specify which they'd like - * to use and in what order they should be applied. - */ -public class GroupBreakpointsByDialog extends TrayDialog { - - private BreakpointsView fView; - - // Table viewer that presents available containers - private TableViewer fAvailableViewer; - private AvailableOrganizersProvider fAvailableOrganizersProvider= new AvailableOrganizersProvider(); - - // Tree viewer that presents selected containers - private TreeViewer fSelectedViewer; - private SelectedOrganizerProvider fSelectedOrganizersProvider= new SelectedOrganizerProvider(); - - private List fResult= new ArrayList(); - - private Button fAddButton; - private Button fRemoveButton; - private Button fMoveUpButton; - private Button fMoveDownButton; - - /** - * Selection listener that listens to selection from all buttons in this - * dialog. - */ - private SelectionAdapter fSelectionListener= new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - Object source= e.getSource(); - if (source == fAddButton) { - handleAddPressed(); - } else if (source == fRemoveButton) { - handleRemovePressed(); - } else if (source == fMoveUpButton) { - handleMoveUpPressed(); - } else if (source == fMoveDownButton) { - handleMoveDownPressed(); - } - } - }; - - protected GroupBreakpointsByDialog(BreakpointsView view) { - super(view.getSite().getShell()); - fView= view; - setShellStyle(getShellStyle() | SWT.RESIZE); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) - */ - protected Control createDialogArea(Composite parent) { - ILabelProvider labelProvider= new BreakpointOrganzierLabelProvider(); - - Composite parentComposite= (Composite) super.createDialogArea(parent); - parentComposite.setFont(parent.getFont()); - Composite composite= new Composite(parentComposite, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - composite.setLayout(layout); - GridData data= new GridData(GridData.FILL_BOTH); - data.heightHint= 400; - composite.setLayoutData(data); - composite.setFont(parent.getFont()); - - Label label= new Label(composite, SWT.WRAP); - label.setText(BreakpointGroupMessages.GroupBreakpointsByDialog_0); - GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - gridData.horizontalSpan = 3; - label.setLayoutData(gridData); - - createAvailableViewer(composite, labelProvider); - createButtons(composite); - createSelectedViewer(composite, labelProvider); - - initializeContent(); - updateViewers(); - Dialog.applyDialogFont(parentComposite); - return parentComposite; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite) - */ - protected Control createContents(Composite parent) { - Control contents = super.createContents(parent); - PlatformUI.getWorkbench().getHelpSystem().setHelp(getDialogArea(), IDebugHelpContextIds.GROUP_BREAKPOINTS_DIALOG); - return contents; - } - - /** - * Divides the available breakpoint container factories into the - * appropriate viewers ("available" or "selected"). - */ - private void initializeContent() { - IBreakpointOrganizer[] organizers= BreakpointOrganizerManager.getDefault().getOrganizers(); - for (int i = 0; i < organizers.length; i++) { - fAvailableOrganizersProvider.addAvailable(organizers[i]); - } - organizers = fView.getBreakpointOrganizers(); - if (organizers != null) { - for (int i = 0; i < organizers.length; i++) { - fSelectedOrganizersProvider.addSelected(organizers[i]); - } - } - } - - /** - * Creates and configured the viewer that shows the available (not currently selected) - * breakpoint container factories. - */ - private void createAvailableViewer(Composite parent, ILabelProvider labelProvider) { - Composite availableComposite= new Composite(parent, SWT.NONE); - availableComposite.setFont(parent.getFont()); - GridLayout layout = new GridLayout(); - layout.marginHeight=0; - layout.marginWidth=0; - availableComposite.setLayout(layout); - GridData gridData= new GridData(GridData.FILL_BOTH); - gridData.widthHint= 225; - availableComposite.setLayoutData(gridData); - - Label label= new Label(availableComposite, SWT.WRAP); - label.setText(BreakpointGroupMessages.GroupBreakpointsByDialog_1); - gridData = new GridData(GridData.FILL_HORIZONTAL); - label.setLayoutData(gridData); - - fAvailableViewer= new TableViewer(availableComposite); - fAvailableViewer.setContentProvider(fAvailableOrganizersProvider); - fAvailableViewer.setLabelProvider(labelProvider); - fAvailableViewer.setInput(new Object()); - Table table = fAvailableViewer.getTable(); - table.setLayoutData(new GridData(GridData.FILL_BOTH)); - table.setFont(parent.getFont()); - fAvailableViewer.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { - handleAddPressed(); - } - }); - fAvailableViewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - updateAddButton(); - } - }); - } - - /** - * Creates and configures the viewer that shows the currently selected - * breakpoint container factories. - */ - private void createSelectedViewer(Composite parent, ILabelProvider labelProvider) { - Composite selectedComposite= new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight=0; - layout.marginWidth=0; - layout.numColumns= 2; - selectedComposite.setLayout(layout); - GridData gridData= new GridData(GridData.FILL_BOTH); - gridData.widthHint= 225; - selectedComposite.setLayoutData(gridData); - selectedComposite.setFont(parent.getFont()); - - Label label= new Label(selectedComposite, SWT.WRAP); - label.setText(BreakpointGroupMessages.GroupBreakpointsByDialog_3); - gridData = new GridData(); - gridData.horizontalSpan = 2; - label.setLayoutData(gridData); - - fSelectedViewer= new TreeViewer(selectedComposite); - fSelectedViewer.setContentProvider(fSelectedOrganizersProvider); - fSelectedViewer.setLabelProvider(labelProvider); - fSelectedViewer.setInput(new Object()); - Tree tree = fSelectedViewer.getTree(); - tree.setLayoutData(new GridData(GridData.FILL_BOTH)); - tree.setFont(parent.getFont()); - fSelectedViewer.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { - handleRemovePressed(); - } - }); - fSelectedViewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - updateSelectedButtons(); - } - }); - } - - public void createButtons(Composite parent) { - Composite buttonComposite= new Composite(parent, SWT.NONE); - buttonComposite.setLayout(new GridLayout()); - buttonComposite.setLayoutData(new GridData()); - buttonComposite.setFont(parent.getFont()); - - fAddButton= SWTFactory.createPushButton(buttonComposite, BreakpointGroupMessages.GroupBreakpointsByDialog_2, null); - fAddButton.addSelectionListener(fSelectionListener); - - fRemoveButton= SWTFactory.createPushButton(buttonComposite, BreakpointGroupMessages.GroupBreakpointsByDialog_4, null); - fRemoveButton.addSelectionListener(fSelectionListener); - - fMoveUpButton= SWTFactory.createPushButton(buttonComposite, BreakpointGroupMessages.GroupBreakpointsByDialog_5, null); - fMoveUpButton.addSelectionListener(fSelectionListener); - - fMoveDownButton= SWTFactory.createPushButton(buttonComposite, BreakpointGroupMessages.GroupBreakpointsByDialog_6, null); - fMoveDownButton.addSelectionListener(fSelectionListener); - - } - - /** - * Returns the organizers chosen by the user. The order - * of the list is the order that the organizers should be displayed - * in the breakpoints view. - * @return the breakpoint organizers chosen by the user - */ - public IBreakpointOrganizer[] getOrganizers() { - return (IBreakpointOrganizer[]) fResult.toArray(new IBreakpointOrganizer[fResult.size()]); - } - - /** - * When the user presses OK, convert the tree selection into a list. - */ - protected void okPressed() { - Object[] factories= fSelectedOrganizersProvider.getElements(null); - while (factories.length > 0) { - Object factory= factories[0]; - fResult.add(factory); - factories= fSelectedOrganizersProvider.getChildren(factory); - } - super.okPressed(); - } - - /** - * Moves the selected item from the list of "available" factories - * to the tree of "selected" factories. - */ - public void handleAddPressed() { - IStructuredSelection selection= (IStructuredSelection) fAvailableViewer.getSelection(); - if (selection.size() < 1) { - return; - } - Iterator iter= selection.iterator(); - while (iter.hasNext()) { - fSelectedOrganizersProvider.addSelected((IBreakpointOrganizer) iter.next()); - } - updateViewers(); - } - - /** - * Moves the selected item from the tree of "selected" factories - * to the list of "available" factories. - */ - public void handleRemovePressed() { - IStructuredSelection selection= (IStructuredSelection) fSelectedViewer.getSelection(); - if (selection.size() < 1) { - return; - } - Iterator iter= selection.iterator(); - while (iter.hasNext()) { - fAvailableOrganizersProvider.addAvailable((IBreakpointOrganizer) iter.next()); - } - updateViewers(); - } - - /** - * Moves each selected item up in the tree of selected containers - */ - public void handleMoveUpPressed() { - IStructuredSelection selection = (IStructuredSelection) fSelectedViewer.getSelection(); - Iterator iter = selection.iterator(); - while (iter.hasNext()) { - fSelectedOrganizersProvider.moveUp(iter.next()); - } - updateViewers(); - } - - /** - * Moves each selected item down in the tree of selected containers - */ - public void handleMoveDownPressed() { - IStructuredSelection selection = (IStructuredSelection) fSelectedViewer.getSelection(); - Object[] elements= selection.toArray(); - for (int i= elements.length - 1; i >= 0; i--) { - fSelectedOrganizersProvider.moveDown(elements[i]); - } - updateViewers(); - } - - /** - * Fully refreshes and updates all viewers and buttons. - */ - public void updateViewers() { - fAvailableViewer.refresh(); - fSelectedViewer.refresh(); - fSelectedViewer.expandAll(); - updateAddButton(); - updateSelectedButtons(); - } - - /** - * Updates all buttons associated with the tree of selected containers. - */ - public void updateSelectedButtons() { - updateRemoveButton(); - updateMoveUpButton(); - updateMoveDownButton(); - } - - public void updateAddButton() { - IStructuredSelection selection = (IStructuredSelection) fAvailableViewer.getSelection(); - fAddButton.setEnabled(selection.size() > 0); - } - - public void updateRemoveButton() { - IStructuredSelection selection = (IStructuredSelection) fSelectedViewer.getSelection(); - fRemoveButton.setEnabled(selection.size() > 0); - } - - public void updateMoveUpButton() { - boolean enabled= true; - IStructuredSelection selection = (IStructuredSelection) fSelectedViewer.getSelection(); - if (selection.size() == 0) { - enabled= false; - } else { - Object firstSelected= selection.getFirstElement(); - Object parent= fSelectedOrganizersProvider.getParent(firstSelected); - if (!(parent instanceof IBreakpointOrganizer)) { - enabled= false; - } - } - fMoveUpButton.setEnabled(enabled); - } - - public void updateMoveDownButton() { - boolean enabled= true; - IStructuredSelection selection = (IStructuredSelection) fSelectedViewer.getSelection(); - if (selection.size() == 0) { - enabled= false; - } else { - Object lastSelected= selection.toList().get(selection.size() - 1); - Object[] children= fSelectedOrganizersProvider.getChildren(lastSelected); - if (children.length < 1) { - enabled= false; - } - } - fMoveDownButton.setEnabled(enabled); - } - - /** - * Content provider that provides the list of breakpoint organaisers - * that are available but not currently selected. - */ - private class AvailableOrganizersProvider implements IStructuredContentProvider { - protected List availableOrganziers= new ArrayList(); - - public void addAvailable(IBreakpointOrganizer organizer) { - availableOrganziers.add(organizer); - fSelectedOrganizersProvider.selectedOrganizers.remove(organizer); - } - - public Object[] getElements(Object inputElement) { - return availableOrganziers.toArray(); - } - - public void dispose() { - } - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - } - - /** - * Content provider that returns the selected breakpoint organizers - * as a tree. This tree shows the list of organzizers as they will - * appear in the breakpoints view. - */ - private class SelectedOrganizerProvider implements ITreeContentProvider { - protected List selectedOrganizers= new ArrayList(); - - public void addSelected(IBreakpointOrganizer organizer) { - selectedOrganizers.add(organizer); - fAvailableOrganizersProvider.availableOrganziers.remove(organizer); - } - - public void moveUp(Object object) { - int index = selectedOrganizers.indexOf(object); - if (index > 0) { - selectedOrganizers.remove(object); - selectedOrganizers.add(index - 1, object); - } - } - - public void moveDown(Object object) { - int index = selectedOrganizers.indexOf(object); - if (index < selectedOrganizers.size() - 1) { - selectedOrganizers.remove(object); - selectedOrganizers.add(index + 1, object); - } - } - - public Object[] getChildren(Object parentElement) { - // A factory's "child" is the next factory in the list - int index = selectedOrganizers.indexOf(parentElement); - if (index < selectedOrganizers.size() - 1) { - return new Object[] { selectedOrganizers.get(index + 1) }; - } - return new Object[0]; - } - - public Object getParent(Object element) { - // A factory's "parent" is the factory before it - int index = selectedOrganizers.indexOf(element); - if (index <= 0 || selectedOrganizers.size() <= 1) { - return null; - } - return selectedOrganizers.get(index - 1); - } - - public boolean hasChildren(Object element) { - // A factory has "children" if there are more - // factories after it. - int index = selectedOrganizers.indexOf(element); - return index != -1 && index < selectedOrganizers.size() - 1; - } - - public Object[] getElements(Object inputElement) { - if (selectedOrganizers.size() > 0) { - return new Object[] { selectedOrganizers.get(0) }; - } - return new Object[0]; - } - public void dispose() { - } - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - } - - /** - * Label provider which provides text and images for breakpoint container factories - */ - private class BreakpointOrganzierLabelProvider extends LabelProvider { - private HashMap fImageCache= new HashMap(); - - public String getText(Object element) { - if (element instanceof IBreakpointOrganizer) { - return ((IBreakpointOrganizer) element).getLabel(); - } - return super.getText(element); - } - public Image getImage(Object element) { - if (element instanceof IBreakpointOrganizer) { - ImageDescriptor imageDescriptor = ((IBreakpointOrganizer) element).getImageDescriptor(); - if (imageDescriptor != null) { - Image image = (Image) fImageCache.get(imageDescriptor); - if (image == null) { - image= imageDescriptor.createImage(); - if (image != null) { - fImageCache.put(imageDescriptor, image); - } - } - return image; - } - } - return super.getImage(element); - } - public void dispose() { - Iterator imageIter = fImageCache.values().iterator(); - while (imageIter.hasNext()) { - ((Image) imageIter.next()).dispose(); - } - super.dispose(); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) - */ - protected void configureShell(Shell shell) { - super.configureShell(shell); - shell.setText(BreakpointGroupMessages.GroupBreakpointsByDialog_7); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/PasteBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/PasteBreakpointsAction.java deleted file mode 100644 index db5fca697..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/PasteBreakpointsAction.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import java.util.List; - -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer; -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView; -import org.eclipse.debug.internal.ui.views.breakpoints.OtherBreakpointCategory; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.navigator.LocalSelectionTransfer; - -/** - * Standard action for pasting resources on the clipboard to the selected resource's location. - * <p> - * This class may be instantiated; it is not intended to be subclassed. - * </p> - * - * @since 2.0 - */ -public class PasteBreakpointsAction extends BreakpointSelectionAction { - - /** - * Creates a new action. - * - * @param view the view of this action - */ - public PasteBreakpointsAction(BreakpointsView view) { - super(BreakpointGroupMessages.PasteBreakpointsAction_0, view); - setToolTipText(BreakpointGroupMessages.PasteBreakpointsAction_1); - PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.PASTE_BREAKPOINTS_ACTION); - } - - /** - * Returns the actual target of the paste action. Returns null - * if no valid target is selected. - * - * @return the actual target of the paste action - */ - private Object getTarget() { - List selectedNonResources = getSelectedNonResources(); - if (selectedNonResources.size() == 1) { - Object target = selectedNonResources.get(0); - if (target instanceof BreakpointContainer) { - return target; - } - } - return null; - } - - /** - * Implementation of method defined on <code>IAction</code>. - */ - public void run() { - if (getBreakpointsView().canPaste(getTarget(), LocalSelectionTransfer.getInstance().getSelection())) { - getBreakpointsView().performPaste(getTarget(), LocalSelectionTransfer.getInstance().getSelection()); - } - } - - /** - * Returns whether this action should be enabled based on the selection - * in the clipboard. Only updates when the breakpoints view has focus. - */ - protected boolean updateSelection(IStructuredSelection selection) { - // can't paste into "Others" (only move) - Object target = getTarget(); - if (target instanceof BreakpointContainer) { - BreakpointContainer container = (BreakpointContainer) target; - if (container.getCategory() instanceof OtherBreakpointCategory) { - return false; - } - return true; - } - // don't access clipboard - causes Hang -see bug 84870 - return false; - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java deleted file mode 100644 index 9835ba0c1..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer; -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView; -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsViewer; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Item; - -/** - * Removes a breakpoint from a breakpoint working set. - */ -public class RemoveFromWorkingSetAction extends BreakpointSelectionAction { - - /** - * Constructs action to remove breakpoints from a category. - * - * @param view - */ - public RemoveFromWorkingSetAction(BreakpointsView view) { - super(BreakpointGroupMessages.RemoveFromWorkingSetAction_0, view); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.IAction#run() - */ - public void run() { - BreakpointsViewer viewer = (BreakpointsViewer) getBreakpointsView().getViewer(); - Item[] items = viewer.getSelectedItems(); - IBreakpoint breakpoint = null; - BreakpointContainer container = null; - for(int i = 0; i < items.length; i++) { - if(items[i].getData() instanceof IBreakpoint) { - breakpoint = (IBreakpoint) items[i].getData(); - container = viewer.getRemovableContainer(items[i]); - if(container != null) { - container.getOrganizer().removeBreakpoint(breakpoint, container.getCategory()); - } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.actions.BaseSelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection) - */ - protected boolean updateSelection(IStructuredSelection selection) { - Object element = selection.getFirstElement(); - if(element instanceof BreakpointContainer) { - return ((BreakpointContainer) element).getCategory().equals(IDebugUIConstants.BREAKPOINT_WORKINGSET_ID); - } - return false; - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java deleted file mode 100644 index a0ea4f275..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import java.util.ArrayList; - -import org.eclipse.debug.internal.ui.AbstractDebugCheckboxSelectionDialog; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkingSet; -import org.eclipse.ui.PlatformUI; - -/** - * Dialog to allow the selection of working sets without all of the overhead of the - * platform UI working set dialog - * - * @since 3.3 - */ -public class SelectBreakpointWorkingsetDialog extends AbstractDebugCheckboxSelectionDialog { - - private static final String SETTINGS_ID = DebugUIPlugin.getUniqueIdentifier() + ".DELETE_ASSOCIATED_CONFIGS_DIALOG"; //$NON-NLS-1$ - private IWorkingSet[] fWorkingSetList = null; - - /** - * Constructor - * @param parentShell the parent to open this dialog on - */ - protected SelectBreakpointWorkingsetDialog(Shell parentShell) { - super(parentShell); - fWorkingSetList = getBreakpointWorkingSets(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugCheckboxSelectionDialog#addViewerListeners(org.eclipse.jface.viewers.StructuredViewer) - */ - protected void addViewerListeners(StructuredViewer viewer) { - CheckboxTableViewer checkViewer = getCheckBoxTableViewer(); - if (checkViewer != null){ - checkViewer.addCheckStateListener(new ICheckStateListener(){ - public void checkStateChanged(CheckStateChangedEvent event) { - getCheckBoxTableViewer().setCheckedElements(new Object[] {event.getElement()}); - getButton(IDialogConstants.OK_ID).setEnabled(true); - } - }); - } - } - - /** - * Returns the current listing of breakpoint <code>IWorkingSet</code>s - * @return an array of the current breakpoint <code>IWorkingSet</code>s - */ - private IWorkingSet[] getBreakpointWorkingSets() { - IWorkingSet[] ws = PlatformUI.getWorkbench().getWorkingSetManager().getAllWorkingSets(); - ArrayList list = new ArrayList(); - for(int i = 0; i < ws.length; i++) { - if(IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(ws[i].getId())) { - list.add(ws[i]); - } - } - return (IWorkingSet[]) list.toArray(new IWorkingSet[list.size()]); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getViewerInput() - */ - protected Object getViewerInput() { - return fWorkingSetList; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getDialogSettingsId() - */ - protected String getDialogSettingsId() { - return SETTINGS_ID; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getHelpContextId() - */ - protected String getHelpContextId() { - return IDebugHelpContextIds.SELECT_DEFAULT_WORKINGSET_DIALOG; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getViewerLabel() - */ - protected String getViewerLabel() { - return BreakpointGroupMessages.SelectBreakpointWorkingsetDialog_0; - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SetDefaultBreakpointGroupAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SetDefaultBreakpointGroupAction.java deleted file mode 100644 index f30a8cefb..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SetDefaultBreakpointGroupAction.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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: - * IBM Corporation - initial implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointSetOrganizer; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IWorkingSet; - -/** - * Action which prompts the user to set a default breakpoint group. - */ -public class SetDefaultBreakpointGroupAction extends AbstractBreakpointsViewAction { - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - SelectBreakpointWorkingsetDialog sbwsd = new SelectBreakpointWorkingsetDialog(DebugUIPlugin.getShell()); - sbwsd.setTitle(BreakpointGroupMessages.SetDefaultBreakpointGroupAction_0); - IWorkingSet workingSet = BreakpointSetOrganizer.getDefaultWorkingSet(); - if (workingSet != null){ - sbwsd.setInitialSelections(new Object[]{workingSet}); - } - if(sbwsd.open() == Window.OK) { - BreakpointSetOrganizer.setDefaultWorkingSet((IWorkingSet) sbwsd.getResult()[0]); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection) {} - -} 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 deleted file mode 100644 index 7b777f266..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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: - * IBM Corporation - initial implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -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.debug.ui.IDebugUIConstants; -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; - if (selection.size() == 1) { - Object firstElement = selection.getFirstElement(); - if (firstElement instanceof BreakpointContainer) { - BreakpointContainer container = (BreakpointContainer) firstElement; - if (container.getCategory() instanceof WorkingSetCategory) { - WorkingSetCategory category = (WorkingSetCategory)container.getCategory(); - if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.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); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/WorkingSetsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/WorkingSetsAction.java deleted file mode 100644 index 341770534..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/WorkingSetsAction.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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: - * IBM Corporation - initial implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.actions.breakpointGroups; - -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.action.IAction; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog; - -/** - * Allows the user to manage working sets. - */ -public class WorkingSetsAction extends AbstractBreakpointsViewAction { - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - IWorkingSetSelectionDialog selectionDialog = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog( - DebugUIPlugin.getShell(), - false, - new String[] {IDebugUIConstants.BREAKPOINT_WORKINGSET_ID}); - selectionDialog.open(); - } -} |