Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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/launchConfigurations/LaunchConfigurationPropertiesDialog.java423
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java493
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java23
4 files changed, 342 insertions, 598 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 f95d14ad9..9cdc2c4e7 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
@@ -49,6 +49,7 @@ public interface IDebugHelpContextIds {
// Dialogs
public static final String LAUNCH_CONFIGURATION_DIALOG = PREFIX + "launch_configuration_dialog"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIGURATION_PROPERTIES_DIALOG = PREFIX + "launch_configuration_properties_dialog"; //$NON-NLS-1$
// Launch configuration dialog pages
public static final String LAUNCH_CONFIGURATION_DIALOG_COMMON_TAB = PREFIX + "launch_configuration_dialog_common_tab"; //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java
index f982d8e48..e10d8b3b0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java
@@ -7,26 +7,15 @@ which accompanies this distribution, and is available at
http://www.eclipse.org/legal/cpl-v10.html
**********************************************************************/
-import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
-import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.PixelConverter;
-import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
-import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
@@ -35,71 +24,21 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.help.WorkbenchHelp;
/**
* A dialog used to edit a single launch configuration.
*/
-public class LaunchConfigurationPropertiesDialog extends TitleAreaDialog implements ILaunchConfigurationDialog {
+public class LaunchConfigurationPropertiesDialog extends LaunchConfigurationsDialog {
/**
* The lanuch configuration to display
*/
private ILaunchConfiguration fLaunchConfiguration;
-
- /**
- * Tab edit area
- */
- private LaunchConfigurationTabGroupViewer fTabViewer;
-
- /**
- * True while setting the input to the tab viewer
- */
- private boolean fInitializingTabs;
-
- /**
- * The launch configuration edit area.
- */
- private Composite fEditArea;
-
- /**
- * The launch groupd being displayed
- */
- private LaunchGroupExtension fGroup;
-
- /**
- * Banner image
- */
- private Image fBannerImage;
-
- /**
- * Constant specifying how wide this dialog is allowed to get (as a percentage of
- * total available screen width) as a result of tab labels in the edit area.
- */
- private static final float MAX_DIALOG_WIDTH_PERCENT = 0.75f;
-
- /**
- * Empty array
- */
- protected static final Object[] EMPTY_ARRAY = new Object[0];
-
- /**
- * Size of this dialog if there is no preference specifying a size.
- */
- protected static final Point DEFAULT_INITIAL_DIALOG_SIZE = new Point(620, 560);
/**
- * Status area messages
- */
- protected static final String LAUNCH_STATUS_OK_MESSAGE = LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Ready_to_launch_2"); //$NON-NLS-1$
- protected static final String LAUNCH_STATUS_STARTING_FROM_SCRATCH_MESSAGE
- = LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Select_a_configuration_to_launch_or_a_config_type_to_create_a_new_configuration_3"); //$NON-NLS-1$
-
- /**
* Constructs a new launch configuration dialog on the given
* parent shell.
*
@@ -109,9 +48,7 @@ public class LaunchConfigurationPropertiesDialog extends TitleAreaDialog impleme
* @param group lanuch group
*/
public LaunchConfigurationPropertiesDialog(Shell shell, ILaunchConfiguration launchConfiguration, LaunchGroupExtension group) {
- super(shell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- setLaunchGroup(group);
+ super(shell, group);
setLaunchConfiguration(launchConfiguration);
}
@@ -133,49 +70,26 @@ public class LaunchConfigurationPropertiesDialog extends TitleAreaDialog impleme
return fLaunchConfiguration;
}
- /**
- * @see Dialog#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- Control contents = super.createContents(parent);
- initializeBounds();
- fTabViewer.setInput(getLaunchConfiguration());
+ protected void initializeContent() {
+ getTabViewer().setInput(getLaunchConfiguration());
resize();
- return contents;
- }
-
- /**
- * Write out this dialog's Shell size, location & sash weights to the preference store.
- */
- private void persistShellGeometry() {
- // TODO:
-// Point shellLocation = getShell().getLocation();
-// Point shellSize = getShell().getSize();
-// int[] sashWeights = getSashForm().getWeights();
-// String locationString = serializeCoords(shellLocation);
-// String sizeString = serializeCoords(shellSize);
-// String sashWeightString = serializeCoords(new Point(sashWeights[0], sashWeights[1]));
-// getPreferenceStore().setValue(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_LOCATION, locationString);
-// getPreferenceStore().setValue(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_SIZE, sizeString);
-// getPreferenceStore().setValue(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_SASH_WEIGHTS, sashWeightString);
}
-
+
/**
* @see Window#close()
*/
public boolean close() {
persistShellGeometry();
getBannerImage().dispose();
- fTabViewer.dispose();
+ getTabViewer().dispose();
return super.close();
}
/**
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
+ * Adds content to the dialog area
*/
- protected Control createDialogArea(Composite parent) {
+ protected void addContent(Composite dialogComp) {
GridData gd;
- Composite dialogComp = (Composite)super.createDialogArea(parent);
Composite topComp = new Composite(dialogComp, SWT.NONE);
gd = new GridData(GridData.FILL_BOTH);
topComp.setLayoutData(gd);
@@ -186,8 +100,8 @@ public class LaunchConfigurationPropertiesDialog extends TitleAreaDialog impleme
topComp.setLayout(topLayout);
// Set the things that TitleAreaDialog takes care of
- setTitle(LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Create,_manage,_and_run_launch_configurations_8")); //$NON-NLS-1$
- setMessage(LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Ready_to_launch_2")); //$NON-NLS-1$
+ setTitle("Edit launch configuration properties");
+ setMessage("");
setModeLabelState();
// Build the launch configuration edit area and put it into the composite.
@@ -203,158 +117,22 @@ public class LaunchConfigurationPropertiesDialog extends TitleAreaDialog impleme
separator.setLayoutData(gd);
dialogComp.layout(true);
-
- return dialogComp;
- }
-
- /**
- * Set the title area image based on the mode this dialog was initialized with
- */
- protected void setModeLabelState() {
- setTitleImage(getBannerImage());
- }
-
- /**
- * Update buttons and message.
- */
- protected void refreshStatus() {
- updateMessage();
- updateButtons();
}
- private Display getDisplay() {
- Shell shell = getShell();
- if (shell != null) {
- return shell.getDisplay();
- } else {
- return Display.getDefault();
- }
- }
-
- /**
- * Creates the launch configuration edit area of the dialog.
- * This area displays the name of the launch configuration
- * currently being edited, as well as a tab folder of tabs
- * that are applicable to the launch configuration.
- *
- * @return the composite used for launch configuration editing
- */
- private Composite createLaunchConfigurationEditArea(Composite parent) {
- fTabViewer = new LaunchConfigurationTabGroupViewer(parent, this);
- fTabViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- /**
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- handleTabSelectionChanged(event);
- }
- });
- return (Composite)fTabViewer.getControl();
- }
-
- /**
- * Sets the title for the dialog, and establishes the help context.
- *
- * @see org.eclipse.jface.window.Window#configureShell(Shell);
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- String title = MessageFormat.format("Properties for {0}", new String[]{getLaunchConfiguration().getName()});
- if (title == null) {
- title = LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Launch_Configurations_18"); //$NON-NLS-1$
- }
- shell.setText(title);
- WorkbenchHelp.setHelp(
- shell,
- IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG);
- }
-
- /**
- * @see Window#getInitialLocation(Point)
- */
- protected Point getInitialLocation(Point initialSize) {
- String locationString = getPreferenceStore().getString(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_LOCATION);
- if (locationString.length() > 0) {
- Point locationPoint = parseCoordinates(locationString);
- if (locationPoint != null) {
- return locationPoint;
- }
- }
- return super.getInitialLocation(initialSize);
- }
-
- /**
- * @see Window#getInitialSize()
- */
- protected Point getInitialSize() {
- String sizeString = getPreferenceStore().getString(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_SIZE);
- if (sizeString.length() > 0) {
- Point sizePoint = parseCoordinates(sizeString);
- if (sizePoint != null) {
- return sizePoint;
- }
- }
- return DEFAULT_INITIAL_DIALOG_SIZE;
- }
-
- /**
- * Given a coordinate String of the form "123x456" return a Point object whose
- * X value is 123 and Y value is 456. Return <code>null</code> if the String
- * is not in the specified form.
- */
- private Point parseCoordinates(String coordString) {
- int byIndex = coordString.indexOf('x');
- if (byIndex < 0) {
- return null;
- }
-
- try {
- int x = Integer.parseInt(coordString.substring(0, byIndex));
- int y = Integer.parseInt(coordString.substring(byIndex + 1));
- return new Point(x, y);
- } catch (NumberFormatException nfe) {
- return null;
- }
+ protected void createButtonsForButtonBar(Composite parent) {
+ // create OK and Cancel buttons by default
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}
-
- /**
- * Given a Point object, return a String of the form "XCoordxYCoord".
- */
- private String serializeCoords(Point coords) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(coords.x);
- buffer.append('x');
- buffer.append(coords.y);
- return buffer.toString();
+
+ protected String getShellTitle() {
+ return MessageFormat.format("Properties for {0}", new String[]{getLaunchConfiguration().getName()});
}
- /**
- * Returns the launch manager.
- *
- * @return the launch manager
- */
- private ILaunchManager getLaunchManager() {
- return DebugPlugin.getDefault().getLaunchManager();
+ protected String getHelpContextId() {
+ return IDebugHelpContextIds.LAUNCH_CONFIGURATION_PROPERTIES_DIALOG;
}
-
- /**
- * Returns whether this dialog is currently open
- */
- private boolean isVisible() {
- return fEditArea != null;
- }
- protected boolean isEqual(Object o1, Object o2) {
- if (o1 == o2) {
- return true;
- } else if (o1 == null) {
- return false;
- } else {
- return o1.equals(o2);
- }
- }
-
-
protected void resize() {
// determine the maximum tab dimensions
PixelConverter pixelConverter = new PixelConverter(getEditArea());
@@ -419,64 +197,7 @@ public class LaunchConfigurationPropertiesDialog extends TitleAreaDialog impleme
setShellSize(shellSize.x + hdiff, shellSize.y + vdiff);
}
}
-
- /**
- * Notification that tab selection has changed.
- *
- * @param event selection changed event
- */
- protected void handleTabSelectionChanged(SelectionChangedEvent event) {
- refreshStatus();
- }
-
- private void setInitializingTabs(boolean init) {
- fInitializingTabs = init;
- }
-
- private boolean isInitializingTabs() {
- return fInitializingTabs;
- }
-
- /**
- * Increase the size of this dialog's <code>Shell</code> by the specified amounts.
- * Do not increase the size of the Shell beyond the bounds of the Display.
- */
- private void setShellSize(int width, int height) {
- Rectangle bounds = getShell().getDisplay().getBounds();
- getShell().setSize(Math.min(width, bounds.width), Math.min(height, bounds.height));
- }
-
- /**
- * @see ILaunchConfigurationDialog#getMode()
- */
- public String getMode() {
- return getLaunchGroup().getMode();
- }
-
- /**
- * Returns the current tab group
- *
- * @return the current tab group, or <code>null</code> if none
- */
- public ILaunchConfigurationTabGroup getTabGroup() {
- return fTabViewer.getTabGroup();
- }
-
- /**
- * @see ILaunchConfigurationDialog#getTabs()
- */
- public ILaunchConfigurationTab[] getTabs() {
- if (getTabGroup() == null) {
- return null;
- } else {
- return getTabGroup().getTabs();
- }
- }
-
- private IPreferenceStore getPreferenceStore() {
- return DebugUIPlugin.getDefault().getPreferenceStore();
- }
-
+
/**
* @see ILaunchConfigurationDialog#updateButtons()
*/
@@ -486,17 +207,11 @@ public class LaunchConfigurationPropertiesDialog extends TitleAreaDialog impleme
}
// apply/revert buttons
- fTabViewer.refresh();
- getButton(IDialogConstants.OK_ID).setEnabled(fTabViewer.canSave());
+ getTabViewer().refresh();
+ getButton(IDialogConstants.OK_ID).setEnabled(getTabViewer().canSave());
}
- /**
- * @see ILaunchConfigurationDialog#getActiveTab()
- */
- public ILaunchConfigurationTab getActiveTab() {
- return fTabViewer.getActiveTab();
- }
/**
* @see ILaunchConfigurationDialog#updateMessage()
@@ -505,94 +220,32 @@ public class LaunchConfigurationPropertiesDialog extends TitleAreaDialog impleme
if (isInitializingTabs()) {
return;
}
- setErrorMessage(fTabViewer.getErrorMesssage());
- setMessage(fTabViewer.getMesssage());
+ setErrorMessage(getTabViewer().getErrorMesssage());
+ setMessage(getTabViewer().getMesssage());
}
/**
- * Show the default informational message that explains how to create a new configuration.
- */
- private void setDefaultMessage() {
- setMessage(LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Select_a_type_of_configuration_to_create,_and_press___new__51")); //$NON-NLS-1$
- }
-
- /**
- * Returns the launch configuration edit area control.
- *
- * @return control
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
- private Composite getEditArea() {
- return fEditArea;
+ protected void okPressed() {
+ getTabViewer().handleApplyPressed();
+ super.okPressed();
}
/**
- * Sets the launch configuration edit area control.
- *
- * @param editArea control
+ * @see org.eclipse.jface.window.Window#open()
*/
- private void setEditArea(Composite editArea) {
- fEditArea = editArea;
- }
-
- /**
- * @see ILaunchConfigurationDialog#setName(String)
- */
- public void setName(String name) {
- fTabViewer.setName(name);
- }
-
- /**
- * @see ILaunchConfigurationDialog#generateName(String)
- */
- public String generateName(String name) {
- if (name == null) {
- name = ""; //$NON-NLS-1$
- }
- return getLaunchManager().generateUniqueLaunchConfigurationNameFrom(name);
- }
-
- /**
- * Returns the banner image to display in the title area */
- protected Image getBannerImage() {
- if (fBannerImage == null) {
- ImageDescriptor descriptor = getLaunchGroup().getBannerImageDescriptor();
- if (descriptor != null) {
- fBannerImage = descriptor.createImage();
- }
- }
- return fBannerImage;
- }
-
- /**
- * Sets the launch group to display.
- *
- * @param group launch group
- */
- protected void setLaunchGroup(LaunchGroupExtension group) {
- fGroup = group;
- }
-
- /**
- * Returns the launch group being displayed.
- *
- * @return launch group */
- public LaunchGroupExtension getLaunchGroup() {
- return fGroup;
- }
-
- /**
- * @see org.eclipse.jface.operation.IRunnableContext#run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)
- */
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- // TODO: or do nothing
+ public int open() {
+ setOpenMode(-1);
+ return super.open();
}
/**
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ * Returns the name of the section that this dialog stores its settings in
+ *
+ * @return String
*/
- protected void okPressed() {
- fTabViewer.handleApplyPressed();
- super.okPressed();
+ protected String getDialogSettingsSectionName() {
+ return IDebugUIConstants.PLUGIN_ID + ".LAUNCH_CONFIGURATION_PROPERTIES_DIALOG_SECTION";
}
-
} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
index 6e9e92ad3..dbcce1ca0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
@@ -37,6 +37,7 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ControlEnableState;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.dialogs.TitleAreaDialog;
@@ -68,6 +69,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
@@ -216,7 +218,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* Constant specifying how wide this dialog is allowed to get (as a percentage of
* total available screen width) as a result of tab labels in the edit area.
*/
- private static final float MAX_DIALOG_WIDTH_PERCENT = 0.75f;
+ protected static final float MAX_DIALOG_WIDTH_PERCENT = 0.75f;
/**
* Empty array
@@ -335,38 +337,46 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*/
protected Control createContents(Composite parent) {
Control contents = super.createContents(parent);
- initializeBounds();
- initializeSashForm();
- ensureSelectionAreaWidth();
+ initializeContent();
+ return contents;
+ }
+
+ protected void initializeContent() {
initializeWorkingSet();
doInitialTreeSelection();
- return contents;
}
+
/**
* Initialize the relative weights (widths) of the 2 sides of the sash.
*/
private void initializeSashForm() {
- int[] sashWeights = DEFAULT_SASH_WEIGHTS;
- String sashWeightString = getPreferenceStore().getString(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_SASH_WEIGHTS);
- if (sashWeightString.length() > 0) {
- Point sashWeightPoint = parseCoordinates(sashWeightString);
- if (sashWeightPoint != null) {
- sashWeights[0] = sashWeightPoint.x;
- sashWeights[1] = sashWeightPoint.y;
+ if (getSashForm() != null) {
+ IDialogSettings settings = getDialogSettings();
+ int[] sashWeights;
+ try {
+ int w1, w2;
+ w1 = settings.getInt(IDebugPreferenceConstants.DIALOG_SASH_WEIGHTS_1);
+ w2 = settings.getInt(IDebugPreferenceConstants.DIALOG_SASH_WEIGHTS_2);
+ sashWeights = new int[] {w1, w2};
+ } catch (NumberFormatException e) {
+ sashWeights = DEFAULT_SASH_WEIGHTS;
}
+ getSashForm().setWeights(sashWeights);
}
- getSashForm().setWeights(sashWeights);
}
/**
* Retrieve the last working set in use and apply it to the tree.
*/
private void initializeWorkingSet() {
- String workingSetName = getPreferenceStore().getString(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_WORKING_SET_NAME);
- IWorkingSet workingSet = getWorkingSetManager().getWorkingSet(workingSetName);
- if (workingSet != null) {
- getWorkingSetActionManager().setWorkingSet(workingSet, true);
+ IDialogSettings settings = getDialogSettings();
+ String workingSetName = settings.get(IDebugPreferenceConstants.DIALOG_WORKING_SET);
+ if (workingSetName != null) {
+ IWorkingSet workingSet = getWorkingSetManager().getWorkingSet(workingSetName);
+ if (workingSet != null) {
+ getWorkingSetActionManager().setWorkingSet(workingSet, true);
+ }
}
}
@@ -377,22 +387,24 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* are shown cleanly.
*/
private void ensureSelectionAreaWidth() {
- Button newButton = getButtonActionNew().getButton();
- Button deleteButton = getButtonActionDelete().getButton();
- int requiredWidth = newButton.getBounds().width + deleteButton.getBounds().width;
- int marginWidth = ((GridLayout)getSelectionArea().getLayout()).marginWidth;
- int horizontalSpacing = ((GridLayout)getSelectionArea().getLayout()).horizontalSpacing;
- requiredWidth += (2 * marginWidth) + horizontalSpacing;
- int currentWidth = getSelectionArea().getBounds().width;
-
- if (requiredWidth > currentWidth) {
- int[] newSashWeights = new int[2];
- newSashWeights[0] = requiredWidth;
- newSashWeights[1] = getEditArea().getBounds().width;
- Shell shell= getShell();
- Point shellSize= shell.getSize();
- setShellSize(shellSize.x + (requiredWidth - currentWidth), shellSize.y);
- getSashForm().setWeights(newSashWeights);
+ if (fLaunchConfigurationView != null) {
+ Button newButton = getButtonActionNew().getButton();
+ Button deleteButton = getButtonActionDelete().getButton();
+ int requiredWidth = newButton.getBounds().width + deleteButton.getBounds().width;
+ int marginWidth = ((GridLayout)getSelectionArea().getLayout()).marginWidth;
+ int horizontalSpacing = ((GridLayout)getSelectionArea().getLayout()).horizontalSpacing;
+ requiredWidth += (2 * marginWidth) + horizontalSpacing;
+ int currentWidth = getSelectionArea().getBounds().width;
+
+ if (requiredWidth > currentWidth) {
+ int[] newSashWeights = new int[2];
+ newSashWeights[0] = requiredWidth;
+ newSashWeights[1] = getEditArea().getBounds().width;
+ Shell shell= getShell();
+ Point shellSize= shell.getSize();
+ setShellSize(shellSize.x + (requiredWidth - currentWidth), shellSize.y);
+ getSashForm().setWeights(newSashWeights);
+ }
}
}
@@ -406,27 +418,38 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
/**
* Write out this dialog's Shell size, location & sash weights to the preference store.
*/
- private void persistShellGeometry() {
+ protected void persistShellGeometry() {
Point shellLocation = getShell().getLocation();
Point shellSize = getShell().getSize();
- int[] sashWeights = getSashForm().getWeights();
- String locationString = serializeCoords(shellLocation);
- String sizeString = serializeCoords(shellSize);
- String sashWeightString = serializeCoords(new Point(sashWeights[0], sashWeights[1]));
- getPreferenceStore().setValue(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_LOCATION, locationString);
- getPreferenceStore().setValue(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_SIZE, sizeString);
- getPreferenceStore().setValue(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_SASH_WEIGHTS, sashWeightString);
+ IDialogSettings settings = getDialogSettings();
+ settings.put(IDebugPreferenceConstants.DIALOG_ORIGIN_X, shellLocation.x);
+ settings.put(IDebugPreferenceConstants.DIALOG_ORIGIN_Y, shellLocation.y);
+ settings.put(IDebugPreferenceConstants.DIALOG_WIDTH, shellSize.x);
+ settings.put(IDebugPreferenceConstants.DIALOG_HEIGHT, shellSize.y);
+ }
+
+ protected void persistSashWeights() {
+ IDialogSettings settings = getDialogSettings();
+ SashForm sashForm = getSashForm();
+ if (sashForm != null) {
+ int[] sashWeights = getSashForm().getWeights();
+ settings.put(IDebugPreferenceConstants.DIALOG_SASH_WEIGHTS_1, sashWeights[0]);
+ settings.put(IDebugPreferenceConstants.DIALOG_SASH_WEIGHTS_2, sashWeights[1]);
+ }
}
/**
* Store the current working set.
*/
private void persistWorkingSet() {
- IWorkingSet workingSet = getWorkingSetActionManager().getWorkingSet();
- if (workingSet != null) {
- getPreferenceStore().setValue(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_WORKING_SET_NAME, workingSet.getName());
- } else {
- getPreferenceStore().setToDefault(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_WORKING_SET_NAME);
+ if (getWorkingSetActionManager() != null) {
+ IDialogSettings settings = getDialogSettings();
+ IWorkingSet workingSet = getWorkingSetActionManager().getWorkingSet();
+ String name = "";
+ if (workingSet != null) {
+ name = workingSet.getName();
+ }
+ settings.put(IDebugPreferenceConstants.DIALOG_WORKING_SET, name);
}
}
@@ -435,11 +458,14 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*/
public boolean close() {
persistShellGeometry();
+ persistSashWeights();
persistWorkingSet();
setCurrentlyVisibleLaunchConfigurationDialog(null);
getBannerImage().dispose();
- fTabViewer.dispose();
- fLaunchConfigurationView.dispose();
+ getTabViewer().dispose();
+ if (fLaunchConfigurationView != null) {
+ fLaunchConfigurationView.dispose();
+ }
return super.close();
}
@@ -519,8 +545,18 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
*/
protected Control createDialogArea(Composite parent) {
- GridData gd;
Composite dialogComp = (Composite)super.createDialogArea(parent);
+ addContent(dialogComp);
+ return dialogComp;
+ }
+
+ /**
+ * Adds content to the dialog area
+ *
+ * @param dialogComp
+ */
+ protected void addContent(Composite dialogComp) {
+ GridData gd;
Composite topComp = new Composite(dialogComp, SWT.NONE);
gd = new GridData(GridData.FILL_BOTH);
topComp.setLayoutData(gd);
@@ -529,12 +565,12 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
topLayout.marginHeight = 5;
topLayout.marginWidth = 0;
topComp.setLayout(topLayout);
-
+
// Set the things that TitleAreaDialog takes care of
setTitle(LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Create,_manage,_and_run_launch_configurations_8")); //$NON-NLS-1$
setMessage(LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Ready_to_launch_2")); //$NON-NLS-1$
setModeLabelState();
-
+
// Create the SashForm that contains the selection area on the left,
// and the edit area on the right
setSashForm(new SashForm(topComp, SWT.NONE));
@@ -547,7 +583,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
Control launchConfigSelectionArea = createLaunchConfigurationSelectionArea(getSashForm());
gd = new GridData(GridData.FILL_VERTICAL);
launchConfigSelectionArea.setLayoutData(gd);
-
+
// Build the launch configuration edit area and put it into the composite.
Composite editAreaComp = createLaunchConfigurationEditArea(getSashForm());
setEditArea(editAreaComp);
@@ -561,8 +597,6 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
separator.setLayoutData(gd);
dialogComp.layout(true);
-
- return dialogComp;
}
/**
@@ -580,7 +614,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
updateButtons();
}
- private Display getDisplay() {
+ protected Display getDisplay() {
Shell shell = getShell();
if (shell != null) {
return shell.getDisplay();
@@ -597,7 +631,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*
* @return the composite used for launch configuration selection area
*/
- private Control createLaunchConfigurationSelectionArea(Composite parent) {
+ protected Control createLaunchConfigurationSelectionArea(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
setSelectionArea(comp);
GridLayout layout = new GridLayout();
@@ -668,9 +702,9 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*
* @return the composite used for launch configuration editing
*/
- private Composite createLaunchConfigurationEditArea(Composite parent) {
- fTabViewer = new LaunchConfigurationTabGroupViewer(parent, this);
- fTabViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ protected Composite createLaunchConfigurationEditArea(Composite parent) {
+ setTabViewer(new LaunchConfigurationTabGroupViewer(parent, this));
+ getTabViewer().addSelectionChangedListener(new ISelectionChangedListener() {
/**
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
*/
@@ -678,7 +712,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
handleTabSelectionChanged(event);
}
});
- return (Composite)fTabViewer.getControl();
+ return (Composite)getTabViewer().getControl();
}
/**
@@ -716,26 +750,35 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*/
protected void configureShell(Shell shell) {
super.configureShell(shell);
+ shell.setText(getShellTitle());
+ WorkbenchHelp.setHelp(
+ shell,
+ getHelpContextId());
+ }
+
+ protected String getHelpContextId() {
+ return IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG;
+ }
+
+ protected String getShellTitle() {
String title = getLaunchGroup().getLabel();
if (title == null) {
title = LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Launch_Configurations_18"); //$NON-NLS-1$
}
- shell.setText(title);
- WorkbenchHelp.setHelp(
- shell,
- IDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG);
+ return title;
}
/**
* @see Window#getInitialLocation(Point)
*/
- protected Point getInitialLocation(Point initialSize) {
- String locationString = getPreferenceStore().getString(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_LOCATION);
- if (locationString.length() > 0) {
- Point locationPoint = parseCoordinates(locationString);
- if (locationPoint != null) {
- return locationPoint;
- }
+ protected Point getInitialLocation(Point initialSize) {
+ IDialogSettings settings = getDialogSettings();
+ try {
+ int x, y;
+ x = settings.getInt(IDebugPreferenceConstants.DIALOG_ORIGIN_X);
+ y = settings.getInt(IDebugPreferenceConstants.DIALOG_ORIGIN_Y);
+ return new Point(x,y);
+ } catch (NumberFormatException e) {
}
return super.getInitialLocation(initialSize);
}
@@ -743,48 +786,18 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
/**
* @see Window#getInitialSize()
*/
- protected Point getInitialSize() {
- String sizeString = getPreferenceStore().getString(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_SIZE);
- if (sizeString.length() > 0) {
- Point sizePoint = parseCoordinates(sizeString);
- if (sizePoint != null) {
- return sizePoint;
- }
- }
- return DEFAULT_INITIAL_DIALOG_SIZE;
- }
-
- /**
- * Given a coordinate String of the form "123x456" return a Point object whose
- * X value is 123 and Y value is 456. Return <code>null</code> if the String
- * is not in the specified form.
- */
- private Point parseCoordinates(String coordString) {
- int byIndex = coordString.indexOf('x');
- if (byIndex < 0) {
- return null;
- }
-
+ protected Point getInitialSize() {
+ IDialogSettings settings = getDialogSettings();
try {
- int x = Integer.parseInt(coordString.substring(0, byIndex));
- int y = Integer.parseInt(coordString.substring(byIndex + 1));
+ int x, y;
+ x = settings.getInt(IDebugPreferenceConstants.DIALOG_WIDTH);
+ y = settings.getInt(IDebugPreferenceConstants.DIALOG_HEIGHT);
return new Point(x, y);
- } catch (NumberFormatException nfe) {
- return null;
+ } catch (NumberFormatException e) {
}
+ return DEFAULT_INITIAL_DIALOG_SIZE;
}
-
- /**
- * Given a Point object, return a String of the form "XCoordxYCoord".
- */
- private String serializeCoords(Point coords) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(coords.x);
- buffer.append('x');
- buffer.append(coords.y);
- return buffer.toString();
- }
-
+
private void setSashForm(SashForm sashForm) {
fSashForm = sashForm;
}
@@ -824,7 +837,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*/
protected void handleLaunchConfigurationSelectionChanged(SelectionChangedEvent event) {
- Object input = fTabViewer.getInput();
+ Object input = getTabViewer().getInput();
Object newInput = null;
ISelection selection = event.getSelection();
if (!selection.isEmpty()) {
@@ -835,7 +848,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
}
}
}
- ILaunchConfiguration original = fTabViewer.getOriginal();
+ ILaunchConfiguration original = getTabViewer().getOriginal();
if (original != null && newInput == null && getLaunchManager().getMovedTo(original) != null) {
// the current config is about to be deleted ignore this change
return;
@@ -851,23 +864,23 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
ILaunchConfiguration lc = (ILaunchConfiguration)newInput;
renamed = getLaunchManager().getMovedFrom(lc) != null;
}
- if (fTabViewer.isDirty() && !deleted && !renamed) {
+ if (getTabViewer().isDirty() && !deleted && !renamed) {
boolean canReplace = showSaveChangesDialog();
if (!canReplace) {
// restore the original selection
- IStructuredSelection sel = new StructuredSelection(fTabViewer.getOriginal());
+ IStructuredSelection sel = new StructuredSelection(getTabViewer().getOriginal());
fLaunchConfigurationView.getViewer().setSelection(sel);
return;
}
}
}
setInitializingTabs(true);
- fTabViewer.setInput(newInput);
+ getTabViewer().setInput(newInput);
setInitializingTabs(false);
refreshStatus();
// bug 14758 - if the newly selected config is dirty, save its changes
- if (fTabViewer.isDirty()) {
- fTabViewer.handleApplyPressed();
+ if (getTabViewer().isDirty()) {
+ getTabViewer().handleApplyPressed();
}
// bug 14758
ILaunchConfigurationTabGroup newGroup = getTabGroup();
@@ -889,80 +902,80 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
protected void resize() {
- // determine the maximum tab dimensions
- PixelConverter pixelConverter = new PixelConverter(getEditArea());
- int runningTabWidth = 0;
- ILaunchConfigurationTabGroup group = getTabGroup();
- if (group == null) {
- return;
- }
- ILaunchConfigurationTab[] tabs = group.getTabs();
- Point contentSize = new Point(0, 0);
- for (int i = 0; i < tabs.length; i++) {
- String name = tabs[i].getName();
- Image image = tabs[i].getImage();
- runningTabWidth += pixelConverter.convertWidthInCharsToPixels(name.length() + 5);
- if (image != null) {
- runningTabWidth += image.getBounds().width;
- }
- Control control = tabs[i].getControl();
- if (control != null) {
- Point size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- if (size.x > contentSize.x) {
- contentSize.x = size.x;
- }
- if (size.y > contentSize.y) {
- contentSize.y = size.y;
- }
- }
- }
-
- // Determine if more space is needed to show all tab labels across the top of the
- // tab folder. If so, only increase size of dialog to some percent of the available
- // screen real estate.
- if (runningTabWidth > contentSize.x) {
- int maxAllowedWidth = (int) (getDisplay().getBounds().width * MAX_DIALOG_WIDTH_PERCENT);
- int otherWidth = getSashForm().SASH_WIDTH + getSelectionArea().getBounds().width;
- int totalWidth = runningTabWidth + otherWidth;
- if (totalWidth > maxAllowedWidth) {
- contentSize.x = maxAllowedWidth - otherWidth;
- } else {
- contentSize.x = runningTabWidth;
- }
- }
-
- // Adjust the maximum tab dimensions to account for the extra space required for the tab labels
- Rectangle tabFolderBoundingBox = getEditArea().computeTrim(0, 0, contentSize.x, contentSize.y);
- contentSize.x = tabFolderBoundingBox.width;
- contentSize.y = tabFolderBoundingBox.height;
-
- // Force recalculation of sizes
- getEditArea().layout(true);
-
- // Calculate difference between required space for tab folder and current size,
- // then increase size of this dialog's Shell by that amount
- Rectangle rect = getEditArea().getClientArea();
- Point containerSize= new Point(rect.width, rect.height);
- int hdiff= contentSize.x - containerSize.x;
- int vdiff= contentSize.y - containerSize.y;
- // Only increase size of dialog, never shrink it
- if (hdiff > 0 || vdiff > 0) {
- int[] newSashWeights = null;
- if (hdiff > 0) {
- newSashWeights = calculateNewSashWeights(hdiff);
- }
- hdiff= Math.max(0, hdiff);
- vdiff= Math.max(0, vdiff);
- Shell shell= getShell();
- Point shellSize= shell.getSize();
- setShellSize(shellSize.x + hdiff, shellSize.y + vdiff);
- // Adjust the sash weights so that all of the increase in width
- // is given to the tab area
- if (newSashWeights != null) {
- getSashForm().setWeights(newSashWeights);
- }
- }
- }
+ // determine the maximum tab dimensions
+ PixelConverter pixelConverter = new PixelConverter(getEditArea());
+ int runningTabWidth = 0;
+ ILaunchConfigurationTabGroup group = getTabGroup();
+ if (group == null) {
+ return;
+ }
+ ILaunchConfigurationTab[] tabs = group.getTabs();
+ Point contentSize = new Point(0, 0);
+ for (int i = 0; i < tabs.length; i++) {
+ String name = tabs[i].getName();
+ Image image = tabs[i].getImage();
+ runningTabWidth += pixelConverter.convertWidthInCharsToPixels(name.length() + 5);
+ if (image != null) {
+ runningTabWidth += image.getBounds().width;
+ }
+ Control control = tabs[i].getControl();
+ if (control != null) {
+ Point size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ if (size.x > contentSize.x) {
+ contentSize.x = size.x;
+ }
+ if (size.y > contentSize.y) {
+ contentSize.y = size.y;
+ }
+ }
+ }
+
+ // Determine if more space is needed to show all tab labels across the top of the
+ // tab folder. If so, only increase size of dialog to some percent of the available
+ // screen real estate.
+ if (runningTabWidth > contentSize.x) {
+ int maxAllowedWidth = (int) (getDisplay().getBounds().width * MAX_DIALOG_WIDTH_PERCENT);
+ int otherWidth = getSashForm().SASH_WIDTH + getSelectionArea().getBounds().width;
+ int totalWidth = runningTabWidth + otherWidth;
+ if (totalWidth > maxAllowedWidth) {
+ contentSize.x = maxAllowedWidth - otherWidth;
+ } else {
+ contentSize.x = runningTabWidth;
+ }
+ }
+
+ // Adjust the maximum tab dimensions to account for the extra space required for the tab labels
+ Rectangle tabFolderBoundingBox = getEditArea().computeTrim(0, 0, contentSize.x, contentSize.y);
+ contentSize.x = tabFolderBoundingBox.width;
+ contentSize.y = tabFolderBoundingBox.height;
+
+ // Force recalculation of sizes
+ getEditArea().layout(true);
+
+ // Calculate difference between required space for tab folder and current size,
+ // then increase size of this dialog's Shell by that amount
+ Rectangle rect = getEditArea().getClientArea();
+ Point containerSize= new Point(rect.width, rect.height);
+ int hdiff= contentSize.x - containerSize.x;
+ int vdiff= contentSize.y - containerSize.y;
+ // Only increase size of dialog, never shrink it
+ if (hdiff > 0 || vdiff > 0) {
+ int[] newSashWeights = null;
+ if (hdiff > 0) {
+ newSashWeights = calculateNewSashWeights(hdiff);
+ }
+ hdiff= Math.max(0, hdiff);
+ vdiff= Math.max(0, vdiff);
+ Shell shell= getShell();
+ Point shellSize= shell.getSize();
+ setShellSize(shellSize.x + hdiff, shellSize.y + vdiff);
+ // Adjust the sash weights so that all of the increase in width
+ // is given to the tab area
+ if (newSashWeights != null) {
+ getSashForm().setWeights(newSashWeights);
+ }
+ }
+ }
/**
* Notification that tab selection has changed.
@@ -977,7 +990,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
fInitializingTabs = init;
}
- private boolean isInitializingTabs() {
+ protected boolean isInitializingTabs() {
return fInitializingTabs;
}
@@ -1016,7 +1029,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* Increase the size of this dialog's <code>Shell</code> by the specified amounts.
* Do not increase the size of the Shell beyond the bounds of the Display.
*/
- private void setShellSize(int width, int height) {
+ protected void setShellSize(int width, int height) {
Rectangle bounds = getShell().getDisplay().getBounds();
getShell().setSize(Math.min(width, bounds.width), Math.min(height, bounds.height));
}
@@ -1034,7 +1047,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* @return the current tab group, or <code>null</code> if none
*/
public ILaunchConfigurationTabGroup getTabGroup() {
- return fTabViewer.getTabGroup();
+ return getTabViewer().getTabGroup();
}
/**
@@ -1053,7 +1066,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* if it is dirty, and if it is, asking the user what to do.
*/
private boolean canDiscardCurrentConfig() {
- if (fTabViewer.isDirty()) {
+ if (getTabViewer().isDirty()) {
return showUnsavedChangesDialog();
} else {
return true;
@@ -1067,7 +1080,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* otherwise.
*/
private boolean showUnsavedChangesDialog() {
- if (fTabViewer.canSave()) {
+ if (getTabViewer().canSave()) {
return showSaveChangesDialog();
} else {
return showDiscardChangesDialog();
@@ -1081,7 +1094,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*/
private boolean showSaveChangesDialog() {
StringBuffer buffer = new StringBuffer(LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.The_configuration___29")); //$NON-NLS-1$
- buffer.append(fTabViewer.getWorkingCopy().getName());
+ buffer.append(getTabViewer().getWorkingCopy().getName());
buffer.append(LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.__has_unsaved_changes.__Do_you_wish_to_save_them__30")); //$NON-NLS-1$
MessageDialog dialog = new MessageDialog(getShell(),
LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Save_changes__31"), //$NON-NLS-1$
@@ -1098,10 +1111,10 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
// If they hit 'Yes', save the working copy
if (selectedButton == 0) {
- fTabViewer.handleApplyPressed();
+ getTabViewer().handleApplyPressed();
} else {
// this will discard the changes
- fTabViewer.inputChanged(fTabViewer.getInput());
+ getTabViewer().inputChanged(getTabViewer().getInput());
}
return true;
@@ -1114,9 +1127,9 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*/
private boolean showDiscardChangesDialog() {
StringBuffer buffer = new StringBuffer(LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.The_configuration___35")); //$NON-NLS-1$
- buffer.append(fTabViewer.getWorkingCopy().getName());
+ buffer.append(getTabViewer().getWorkingCopy().getName());
buffer.append(LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.__has_unsaved_changes_that_CANNOT_be_saved_because_of_the_following_error_36")); //$NON-NLS-1$
- buffer.append(fTabViewer.getErrorMesssage());
+ buffer.append(getTabViewer().getErrorMesssage());
buffer.append(LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Do_you_wish_to_discard_changes_37")); //$NON-NLS-1$
MessageDialog dialog = new MessageDialog(getShell(),
LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Discard_changes__38"), //$NON-NLS-1$
@@ -1138,7 +1151,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*/
protected void handleClosePressed() {
if (canDiscardCurrentConfig()) {
- fTabViewer.dispose();
+ getTabViewer().dispose();
cancelPressed();
}
}
@@ -1149,10 +1162,10 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*/
protected void handleLaunchPressed() {
int result = CANCEL;
- ILaunchConfiguration config = fTabViewer.getOriginal();
+ ILaunchConfiguration config = getTabViewer().getOriginal();
try {
- if (fTabViewer.isDirty()) {
- fTabViewer.handleApplyPressed();
+ if (getTabViewer().isDirty()) {
+ getTabViewer().handleApplyPressed();
}
result = doLaunch(config);
} catch (CoreException e) {
@@ -1449,8 +1462,8 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
getButtonActionDelete().setEnabled(getDeleteAction().isEnabled());
// Launch button
- fTabViewer.refresh();
- getButton(ID_LAUNCH_BUTTON).setEnabled(fTabViewer.canLaunch());
+ getTabViewer().refresh();
+ getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch());
}
@@ -1458,7 +1471,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* @see ILaunchConfigurationDialog#getActiveTab()
*/
public ILaunchConfigurationTab getActiveTab() {
- return fTabViewer.getActiveTab();
+ return getTabViewer().getActiveTab();
}
/**
@@ -1468,8 +1481,8 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
if (isInitializingTabs()) {
return;
}
- setErrorMessage(fTabViewer.getErrorMesssage());
- setMessage(fTabViewer.getMesssage());
+ setErrorMessage(getTabViewer().getErrorMesssage());
+ setMessage(getTabViewer().getMesssage());
}
/**
@@ -1501,7 +1514,10 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* Returns the working set action manager
*/
private LaunchConfigurationWorkingSetActionManager getWorkingSetActionManager() {
- return fLaunchConfigurationView.getWorkingSetActionManager();
+ if (fLaunchConfigurationView != null) {
+ return fLaunchConfigurationView.getWorkingSetActionManager();
+ }
+ return null;
}
/**
@@ -1527,7 +1543,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*
* @return control
*/
- private Composite getEditArea() {
+ protected Composite getEditArea() {
return fEditArea;
}
@@ -1536,7 +1552,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
*
* @param editArea control
*/
- private void setEditArea(Composite editArea) {
+ protected void setEditArea(Composite editArea) {
fEditArea = editArea;
}
@@ -1544,7 +1560,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* @see ILaunchConfigurationDialog#setName(String)
*/
public void setName(String name) {
- fTabViewer.setName(name);
+ getTabViewer().setName(name);
}
/**
@@ -1757,4 +1773,55 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
return (AbstractLaunchConfigurationAction)fLaunchConfigurationView.getAction(DuplicateLaunchConfigurationAction.ID_DUPLICATE_ACTION);
}
+ /**
+ * Returns the dialog settings for this dialog. Subclasses should override
+ * <code>getDialogSettingsKey()</code>.
+ *
+ * @return IDialogSettings
+ */
+ protected IDialogSettings getDialogSettings() {
+ IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
+ if (section == null) {
+ section = settings.addNewSection(getDialogSettingsSectionName());
+ }
+ return section;
+ }
+
+ /**
+ * Returns the name of the section that this dialog stores its settings in
+ *
+ * @return String
+ */
+ protected String getDialogSettingsSectionName() {
+ return IDebugUIConstants.PLUGIN_ID + ".LAUNCH_CONFIGURATIONS_DIALOG_SECTION";
+ }
+
+ /**
+ * Sets the viewer used to display the tabs for a launch configuration.
+ *
+ * @param viewer
+ */
+ protected void setTabViewer(LaunchConfigurationTabGroupViewer viewer) {
+ fTabViewer = viewer;
+ }
+
+ /**
+ * Returns the viewer used to display the tabs for a launch configuration.
+ *
+ * @return LaunchConfigurationTabGroupViewer
+ */
+ protected LaunchConfigurationTabGroupViewer getTabViewer() {
+ return fTabViewer;
+ }
+ /**
+ * @see org.eclipse.jface.window.Window#initializeBounds()
+ */
+ protected void initializeBounds() {
+ super.initializeBounds();
+ initializeSashForm();
+ ensureSelectionAreaWidth();
+ resize();
+ }
+
} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java
index 05496852e..072670062 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java
@@ -82,21 +82,32 @@ public interface IDebugPreferenceConstants {
/**
* Serialized X,Y coordinates of the last location of the launch configuration dialog.
+ *
+ * @deprecated use dialog settings <code>DIALOG_ORIGIN_X</code>,
+ * <code>DIALOG_ORIGIN_Y</code>.
*/
public static final String PREF_LAUNCH_CONFIGURATION_DIALOG_LOCATION = IDebugUIConstants.PLUGIN_ID + "launchConfigurationDialogLocation"; //$NON-NLS-1$
/**
* Serialized width,height values of the launch configuration dialog.
+ *
+ * @deprecated use dialog settings <code>DIALOG_WIDTH</code>,
+ * <code>DIALOG_HEIGHT</code>.
*/
public static final String PREF_LAUNCH_CONFIGURATION_DIALOG_SIZE = IDebugUIConstants.PLUGIN_ID + "launchConfigurationDialogSize"; //$NON-NLS-1$
/**
* Serialized relative weights of the sashed elements of the launch configuration dialog.
+ *
+ * @deprecated use dialog settings <code>SASH_WEIGHTS_1</code>,
+ * <code>SASH_WEIGHTS_2</code>.
*/
public static final String PREF_LAUNCH_CONFIGURATION_DIALOG_SASH_WEIGHTS = IDebugUIConstants.PLUGIN_ID + "launchConfigurationDialogSashWeights"; //$NON-NLS-1$
/**
* The name of the working set applied to the tree viewer in the launch configuration dialog.
+ *
+ * @deprecated use dialog settings <code>DIALOG_WORKING_SET</code>
*/
public static final String PREF_LAUNCH_CONFIGURATION_DIALOG_WORKING_SET_NAME = IDebugUIConstants.PLUGIN_ID + "launchConfigurationDialogWorkingSetName"; //$NON-NLS-1$
@@ -104,6 +115,18 @@ public interface IDebugPreferenceConstants {
* The maximum size of the launch history list
*/
public static int MAX_LAUNCH_HISTORY_SIZE= 20;
+
+ /**
+ * Common dialog settings
+ */
+ public static final String DIALOG_ORIGIN_X = IDebugUIConstants.PLUGIN_ID + ".DIALOG_ORIGIN_X";
+ public static final String DIALOG_ORIGIN_Y = IDebugUIConstants.PLUGIN_ID + ".DIALOG_ORIGIN_Y";
+ public static final String DIALOG_WIDTH = IDebugUIConstants.PLUGIN_ID + ".DIALOG_WIDTH";
+ public static final String DIALOG_HEIGHT = IDebugUIConstants.PLUGIN_ID + ".DIALOG_HEIGHT";
+ public static final String DIALOG_SASH_WEIGHTS_1 = IDebugUIConstants.PLUGIN_ID + ".DIALOG_SASH_WEIGHTS_1";
+ public static final String DIALOG_SASH_WEIGHTS_2 = IDebugUIConstants.PLUGIN_ID + ".DIALOG_SASH_WEIGHTS_2";
+ public static final String DIALOG_WORKING_SET = IDebugUIConstants.PLUGIN_ID + ".DIALOG_WORKING_SET";
+
}

Back to the top