Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcvs2svn2006-10-19 21:37:54 +0000
committercvs2svn2006-10-19 21:37:54 +0000
commitd4c02421186dcb1c3227846c0d13f32e9a8edfb5 (patch)
treeda4cb57695ebcd5a76a6028d5daa5d660b91abc4 /org.eclipse.debug.ui
parentc728c2c259cfe9939d02c7652ee61371afe4ddd0 (diff)
downloadeclipse.platform.debug-d4c02421186dcb1c3227846c0d13f32e9a8edfb5.tar.gz
eclipse.platform.debug-d4c02421186dcb1c3227846c0d13f32e9a8edfb5.tar.xz
eclipse.platform.debug-d4c02421186dcb1c3227846c0d13f32e9a8edfb5.zip
This commit was manufactured by cvs2svn to create branch
'viewer_rework_3_3'. Cherrypick from master 2006-10-19 21:37:53 UTC Darin Wright <darin> 'Bug 157059 [launching] extensible launch options': org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchModesDialog.java org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchModeConfigurationTab.java
Diffstat (limited to 'org.eclipse.debug.ui')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchModesDialog.java165
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchModeConfigurationTab.java90
2 files changed, 255 insertions, 0 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchModesDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchModesDialog.java
new file mode 100644
index 000000000..b21102257
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchModesDialog.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * 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.launchConfigurations;
+
+import java.util.Set;
+
+import org.eclipse.debug.internal.core.LaunchDelegate;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
+import org.eclipse.debug.internal.ui.SWTUtil;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+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.PlatformUI;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+/**
+ * This class provides a dialog to present the user with a list of of viable launch options in the event
+ * the plug-in that provides either a launch option or a contributed launch delegate is no longer available.
+ * The user can select one of the launch mode/option configuration from this dialog and repair the option
+ * configuration state of the the current launch configuration
+ *
+ * @since 3.3
+ *
+ * EXPERIMENTAL
+ */
+public class SelectLaunchModesDialog extends SelectionDialog {
+
+ /**
+ * Builds labels for list control of the form: Mode + (no options) | [options list]
+ */
+ class OptionsLabelProvider implements ILabelProvider {
+ public Image getImage(Object element) {return null;}
+ public String getText(Object element) {
+ LaunchDelegate del = (LaunchDelegate) element;
+ Set set = del.getOptions();
+ // TODO: illegal NLS
+ return del.getName() + LaunchConfigurationsMessages.SelectLaunchOptionsDialog_5 + fMode + (set.isEmpty() ? LaunchConfigurationsMessages.SelectLaunchOptionsDialog_0 : LaunchConfigurationsMessages.SelectLaunchOptionsDialog_1 + set);
+ }
+ public void addListener(ILabelProviderListener listener) {}
+ public void dispose() {}
+ public boolean isLabelProperty(Object element, String property) {return false;}
+ public void removeListener(ILabelProviderListener listener) {}
+ }
+
+ private static final String SETTINGS_ID = IDebugUIConstants.PLUGIN_ID + ".SELECT_LAUNCH_OPTIONS_DIALOG"; //$NON-NLS-1$
+
+ private LaunchDelegate[] fDelegates = null;
+ private String fMode = null;
+ private Object[] fResult = null;
+ private CheckboxTableViewer fTableViewer = null;
+ private Table fTable = null;
+
+ /**
+ * Constructor
+ * @param parentShell the parent shell
+ * @param message the message for the dialog
+ * @param options the listing of arrays of options (each entry in the list must be an <code>Set</code> of options)
+ */
+ public SelectLaunchModesDialog(Shell parentShell, String mode, LaunchDelegate[] delegates) {
+ super(parentShell);
+ super.setMessage(LaunchConfigurationsMessages.SelectLaunchOptionsDialog_2);
+ super.setTitle(LaunchConfigurationsMessages.SelectLaunchOptionsDialog_3);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ fDelegates = delegates;
+ fMode = mode;
+ }
+
+ /**
+ * @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, LaunchConfigurationsMessages.SelectLaunchOptionsDialog_4, 1);
+ fTable = new Table(comp, SWT.BORDER | SWT.SINGLE | SWT.CHECK);
+ fTable.setLayoutData(new GridData(GridData.FILL_BOTH));
+ fTableViewer = new CheckboxTableViewer(fTable);
+ fTableViewer.setLabelProvider(new OptionsLabelProvider());
+ fTableViewer.setContentProvider(new ArrayContentProvider());
+ fTableViewer.setInput(fDelegates);
+ fTableViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ fTableViewer.setAllChecked(false);
+ fTableViewer.setChecked(event.getElement(), true);
+ }
+ });
+ Dialog.applyDialogFont(comp);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IDebugHelpContextIds.SELECT_LAUNCH_OPTIONS_DIALOG);
+ return comp;
+ }
+
+ /**
+ * @see org.eclipse.ui.dialogs.SelectionDialog#getResult()
+ */
+ public Object[] getResult() {
+ return fResult;
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ protected void okPressed() {
+ Object[] o = fTableViewer.getCheckedElements();
+ if(o.length > 0) {
+ fResult = ((LaunchDelegate)o[0]).getOptions().toArray();
+ }
+ super.okPressed();
+ }
+
+ /* (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);
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchModeConfigurationTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchModeConfigurationTab.java
new file mode 100644
index 000000000..f7a031183
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchModeConfigurationTab.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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.ui;
+
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationListener;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Common function for a launch tab that edits a launch mode.
+ * <p>
+ * This class is intended to be subclassed by clients contributing launch tabs
+ * that modify launch modes on a launch configuration.
+ * </p>
+ * @since 3.3
+ *
+ * <p>
+ * <strong>EXPERIMENTAL</strong>. This class has been added as
+ * part of a work in progress. There is no guarantee that this API will
+ * remain unchanged during the 3.3 release cycle. Please do not use this API
+ * without consulting with the Platform/Debug team.
+ * </p>
+ */
+public abstract class AbstractLaunchModeConfigurationTab extends AbstractLaunchConfigurationTab implements ILaunchConfigurationListener {
+
+ /**
+ * Returns the set of the modes this tab modifies.
+ *
+ * @return set of the modes this tab modifies
+ */
+ public abstract Set getModes();
+
+ /**
+ * Updates the controls associated with this tab's launch modes.
+ * Called when a launch configuration has changed, which can occur when a tab
+ * is de-activated. Launch modes may have been modified outside of this tab's control.
+ *
+ * @param modes the current set of modes specified by the working copy being edited
+ */
+ public abstract void updateLaunchModeControls(Set modes);
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(this);
+ }
+
+ /**
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
+ */
+ public void dispose() {
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchConfigurationListener(this);
+ super.dispose();
+ }
+
+ /**
+ * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void launchConfigurationAdded(ILaunchConfiguration configuration) {}
+
+ /**
+ * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void launchConfigurationRemoved(ILaunchConfiguration configuration) {}
+
+ /**
+ * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void launchConfigurationChanged(ILaunchConfiguration configuration) {
+ try {
+ updateLaunchModeControls(configuration.getModes());
+ }
+ catch (CoreException e) {DebugUIPlugin.log(e);}
+ }
+
+}

Back to the top