Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Rennie2006-09-22 17:31:26 +0000
committerMichael Rennie2006-09-22 17:31:26 +0000
commiteb0f535ef9b70cf5bee02f709a00a9cbf8289ced (patch)
tree8ca381353de7d62d33011c2ec0f1adc768a524af
parent578a376e6ccabf6e07716778198f7fdceacf9543 (diff)
downloadeclipse.platform.debug-eb0f535ef9b70cf5bee02f709a00a9cbf8289ced.tar.gz
eclipse.platform.debug-eb0f535ef9b70cf5bee02f709a00a9cbf8289ced.tar.xz
eclipse.platform.debug-eb0f535ef9b70cf5bee02f709a00a9cbf8289ced.zip
Bug 154400
[WorkingSets] Select Default Breakpoint Working Set dialog is confusing and can clear default setting accidentally
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java1
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointGroupMessages.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/BreakpointGroupMessages.properties2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java164
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SetDefaultBreakpointGroupAction.java24
5 files changed, 178 insertions, 17 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
index 7ffef92d3..d9fb414cb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java
@@ -95,6 +95,7 @@ public interface IDebugHelpContextIds {
public static final String GROUP_BREAKPOINTS_DIALOG = PREFIX + "group_breakpoints_dialog_context"; //$NON-NLS-1$
public static final String ORGANIZE_FAVORITES_DIALOG = PREFIX + "organize_favorites_dialog_context"; //$NON-NLS-1$
public static final String MAX_DETAILS_LENGTH_DIALOG = PREFIX + "max_details_length_dialog_context"; //$NON-NLS-1$
+ public static final String SELECT_DEFAULT_WORKINGSET_DIALOG = PREFIX + "select_breakpoint_workingset_dialog"; //$NON-NLS-1$
// Property pages
public static final String PROCESS_PROPERTY_PAGE = PREFIX + "process_property_page_context"; //$NON-NLS-1$
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
index 44c0044a1..5467edbfc 100644
--- 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
@@ -42,6 +42,10 @@ public class BreakpointGroupMessages extends NLS {
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
index fece96fa7..88eb6c424 100644
--- 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
@@ -26,3 +26,5 @@ CopyBreakpointsAction_3=There was a problem when accessing the system clipboard.
PasteBreakpointsAction_0=&Paste
PasteBreakpointsAction_1=Paste Breakpoints
RemoveFromWorkingSetAction_0=Remove from &Working Set
+SetDefaultBreakpointGroupAction_0=Select Default Workingset
+SelectBreakpointWorkingsetDialog_0=Select &default workingset:
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
new file mode 100644
index 000000000..74dbdf93c
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.SWTUtil;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.SelectionDialog;
+import org.eclipse.ui.model.AdaptableList;
+
+/**
+ * Dialog to allow the selection of workingsets without all of the overhead of the
+ * platform UI working set dialog
+ *
+ * @since 3.3
+ */
+public class SelectBreakpointWorkingsetDialog extends SelectionDialog {
+
+ /**
+ * Provides the content to the workingset viewer
+ */
+ class WorkingsetContent implements IStructuredContentProvider {
+
+ public Object[] getElements(Object inputElement) {
+ IWorkingSet[] ws = PlatformUI.getWorkbench().getWorkingSetManager().getAllWorkingSets();
+ ArrayList list = new ArrayList();
+ for(int i = 0; i < ws.length; i++) {
+ if(IInternalDebugUIConstants.ID_BREAKPOINT_WORKINGSET.equals(ws[i].getId())) {
+ list.add(ws[i]);
+ }
+ }
+ return list.toArray();
+ }
+
+ public void dispose() {}
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+
+ }
+
+ private static final String SETTINGS_ID = DebugUIPlugin.getUniqueIdentifier() + ".DELETE_ASSOCIATED_CONFIGS_DIALOG"; //$NON-NLS-1$
+ private Object fInitialSelection = null;
+ private Object[] fResult = null;
+ private CheckboxTableViewer fViewer = null;
+
+ /**
+ * Constructor
+ * @param parentShell the parent to open this dialog on
+ * @param selection the initial selection
+ * @param multi if the dialog should allow multi selection or not
+ */
+ protected SelectBreakpointWorkingsetDialog(Shell parentShell, Object selection) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ fInitialSelection = selection;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea(Composite parent) {
+ initializeDialogUnits(parent);
+ Composite comp = (Composite) super.createDialogArea(parent);
+ SWTUtil.createLabel(comp, BreakpointGroupMessages.SelectBreakpointWorkingsetDialog_0, 2);
+ Table table = new Table(comp, SWT.BORDER | SWT.CHECK | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
+ fViewer = new CheckboxTableViewer(table);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan = 2;
+ table.setLayoutData(gd);
+ fViewer.setContentProvider(new WorkingsetContent());
+ fViewer.setInput(new AdaptableList(PlatformUI.getWorkbench().getWorkingSetManager().getAllWorkingSets()));
+ fViewer.setLabelProvider(DebugUITools.newDebugModelPresentation());
+ fViewer.setChecked(fInitialSelection, true);
+ fViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ Object o = event.getElement();
+ fViewer.setAllChecked(false);
+ fViewer.setChecked(o, true);
+ }
+
+ });
+ Dialog.applyDialogFont(comp);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IDebugHelpContextIds.SELECT_DEFAULT_WORKINGSET_DIALOG);
+ return comp;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionDialog#getDialogBoundsSettings()
+ */
+ protected IDialogSettings getDialogBoundsSettings() {
+ IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = settings.getSection(SETTINGS_ID);
+ if (section == null) {
+ section = settings.addNewSection(SETTINGS_ID);
+ }
+ return section;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#getInitialSize()
+ */
+ protected Point getInitialSize() {
+ IDialogSettings settings = getDialogBoundsSettings();
+ if(settings != null) {
+ try {
+ int width = settings.getInt("DIALOG_WIDTH"); //$NON-NLS-1$
+ int height = settings.getInt("DIALOG_HEIGHT"); //$NON-NLS-1$
+ if(width > 0 & height > 0) {
+ return new Point(width, height);
+ }
+ }
+ catch (NumberFormatException nfe) {
+ return new Point(350, 400);
+ }
+ }
+ return new Point(350, 400);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionDialog#getResult()
+ */
+ public Object[] getResult() {
+ return fResult;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.ListDialog#okPressed()
+ */
+ protected void okPressed() {
+ fResult = fViewer.getCheckedElements();
+ //set pref if selected
+ super.okPressed();
+ }
+
+}
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
index b6eb694ee..905a742a7 100644
--- 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
@@ -11,41 +11,31 @@
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.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;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
/**
* 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) {
- IWorkingSet workingSet = BreakpointSetOrganizer.getDefaultWorkingSet();
- IWorkingSetSelectionDialog selectionDialog = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(DebugUIPlugin.getShell(), false, new String[]{IInternalDebugUIConstants.ID_BREAKPOINT_WORKINGSET});
- if (workingSet != null) {
- selectionDialog.setSelection(new IWorkingSet[]{workingSet});
- }
- if (selectionDialog.open() == Window.OK) {
- IWorkingSet[] sets = selectionDialog.getSelection();
- if (sets.length == 1) {
- BreakpointSetOrganizer.setDefaultWorkingSet(sets[0]);
- }
- }
+ SelectBreakpointWorkingsetDialog sbwsd = new SelectBreakpointWorkingsetDialog(DebugUIPlugin.getShell(), BreakpointSetOrganizer.getDefaultWorkingSet());
+ sbwsd.setTitle(BreakpointGroupMessages.SetDefaultBreakpointGroupAction_0);
+ 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) {
- }
+ public void selectionChanged(IAction action, ISelection selection) {}
}

Back to the top