This commit was manufactured by cvs2svn to create tag 'v20020530'.

Sprout from master 2002-05-30 13:26:19 UTC Darin Wright <darin> 'unused imports'
Cherrypick from master 2002-05-31 01:35:47 UTC Darin Swanson <darins> '*** empty log message ***':
    org.eclipse.debug.core/buildnotes_platform-debug.html
    org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
    org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
    org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
    org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTUtil.java
    org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ExecutionAction.java
    org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchLastAction.java
    org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java
    org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
    org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchHistoryPreferenceTab.java
    org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
diff --git a/org.eclipse.debug.core/buildnotes_platform-debug.html b/org.eclipse.debug.core/buildnotes_platform-debug.html
index ce2be99..ecdd6cf 100644
--- a/org.eclipse.debug.core/buildnotes_platform-debug.html
+++ b/org.eclipse.debug.core/buildnotes_platform-debug.html
@@ -11,6 +11,22 @@
 <h1>

 Eclipse Platform Build Notes&nbsp;<br>

 Platform Debug</h1>

+May 31, 2002

+<h3>

+What's new in this drop</h3>

+

+<h3>

+Problem Reports Fixed</h3>

+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=15671">15671</a>: Strange behavior of the console view<br>

+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=17017">17017</a>: Not always prompted to find source location<br>

+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=18334">18334</a>: Launch view holding onto Objects longer than necessary<br>

+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=18153">18153</a>: launch last and run/debug buttons<br>

+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=18385">18385</a>: NPE during launching after removing the launch info<br>

+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=16946">16946</a>: several Eclipse buttons are too short<br>

+

+<h1>

+Eclipse Platform Build Notes&nbsp;<br>

+Platform Debug</h1>

 May 30, 2002

 <h3>

 What's new in this drop</h3>

diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
index bd9dc65..76adffa 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
@@ -182,6 +182,19 @@
 	public boolean isExistingLaunchConfigurationName(String name) throws CoreException;

 

 	/**

+	 * Return a String that can be used as the name of a launch configuration.  The name

+	 * is guaranteed to be unique (no existing launch configurations will have this name).

+	 * The name that is returned uses the <code>namePrefix</code> as a starting point.  If 

+	 * there is no existing launch configuration with this name, then <code>namePrefix</code>

+	 * is returned.  Otherwise, the value returned consists of the specified prefix plus

+	 * some suffix that guarantees uniqueness.

+	 * 

+	 * @param namePrefix the String that the returned name must begin with

+	 * @since 2.0

+	 */

+	public String generateUniqueLaunchConfigurationNameFrom(String namePrefix);

+

+	/**

 	 * Creates and returns a new source locator of the specified

 	 * type.

 	 * 

diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
index ed7ccfe..c7af1d4 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
@@ -671,6 +671,37 @@
 	}

 	

 	/**

+	 * @see org.eclipse.debug.core.ILaunchManager#generateUniqueLaunchConfigurationNameFrom(String)

+	 */

+	public String generateUniqueLaunchConfigurationNameFrom(String namePrefix) {

+		int index = 1;

+		String baseName = namePrefix;

+		int copyIndex = baseName.lastIndexOf(" (");

+		if (copyIndex > -1) {

+			String trailer = baseName.substring(copyIndex + 1);

+			try {

+				index = Integer.parseInt(trailer);

+				baseName = namePrefix.substring(0, copyIndex);

+			} catch (NumberFormatException nfe) {

+			}

+		} 

+		String newName = baseName;

+		try {

+			while (isExistingLaunchConfigurationName(newName)) {

+				StringBuffer buffer = new StringBuffer(baseName);

+				buffer.append(" (");

+				buffer.append(String.valueOf(index));

+				index++;

+				buffer.append(')');

+				newName = buffer.toString();		

+			}		

+		} catch (CoreException e) {

+			DebugPlugin.log(e);

+		}

+		return newName;

+	}

+	

+	/**

 	 * Return a sorted array of the names of all <code>ILaunchConfiguration</code>s in 

 	 * the workspace.  These are cached, and cache is cleared when a new config is added,

 	 * deleted or changed.

diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
index 2aec4ef..8ea2e6e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
Binary files differ
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTUtil.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTUtil.java
index 1ad3bba..3393089 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTUtil.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTUtil.java
@@ -113,6 +113,7 @@
 	 */
 	public static Button createPushButton(Composite parent, String label, Image image) {
 		Button button = new Button(parent, SWT.PUSH);
+		button.setFont(parent.getFont());
 		if (image != null) {
 			button.setImage(image);
 		}
@@ -136,6 +137,7 @@
 	 */
 	public static Button createRadioButton(Composite parent, String label) {
 		Button button = new Button(parent, SWT.RADIO);
+		button.setFont(parent.getFont());
 		if (label != null) {
 			button.setText(label);
 		}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ExecutionAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ExecutionAction.java
index 4cd3728..d371912 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ExecutionAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ExecutionAction.java
@@ -8,13 +8,9 @@
 import org.eclipse.debug.internal.ui.DebugUIPlugin;

 import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog;

 import org.eclipse.jface.action.IAction;

-import org.eclipse.jface.viewers.ISelection;

 import org.eclipse.jface.viewers.IStructuredSelection;

-import org.eclipse.jface.viewers.StructuredSelection;

 import org.eclipse.swt.widgets.Event;

 import org.eclipse.ui.IActionDelegateWithEvent;

-import org.eclipse.ui.IEditorPart;

-import org.eclipse.ui.IWorkbenchPage;

 import org.eclipse.ui.IWorkbenchWindow;

 

 /**

@@ -37,45 +33,13 @@
 		if (dwindow == null) {

 			return;

 		}

-		IStructuredSelection selection= resolveSelection(dwindow);

+		IStructuredSelection selection= DebugUIPlugin.resolveSelection(dwindow);

 		LaunchConfigurationDialog dialog = new LaunchConfigurationDialog(DebugUIPlugin.getShell(), selection, getMode());		

 		dialog.setOpenMode(LaunchConfigurationDialog.LAUNCH_CONFIGURATION_DIALOG_LAUNCH_LAST);

 		dialog.open();

 	}

 	

 	/**

-	 * Determines and returns the selection that provides context for the launch,

-	 * or <code>null</code> if there is no selection.

-	 */

-	protected static IStructuredSelection resolveSelection(IWorkbenchWindow window) {

-		if (window == null) {

-			return null;

-		}

-		ISelection selection= window.getSelectionService().getSelection();

-		if (selection == null || selection.isEmpty() || !(selection instanceof IStructuredSelection)) {

-			// there is no obvious selection - go fishing

-			selection= null;

-			IWorkbenchPage page= window.getActivePage();

-			if (page == null) {

-				//workspace is closed

-				return null;

-			}

-

-			// first, see if there is an active editor, and try its input element

-			IEditorPart editor= page.getActiveEditor();

-			Object element= null;

-			if (editor != null) {

-				element= editor.getEditorInput();

-			}

-

-			if (selection == null && element != null) {

-				selection= new StructuredSelection(element);

-			}

-		}

-		return (IStructuredSelection)selection;

-	}

-	

-	/**

 	 * Returns the mode of a launcher to use for this action

 	 */

 	protected abstract String getMode();

diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchLastAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchLastAction.java
index cc23bb4..8dc0193 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchLastAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RelaunchLastAction.java
@@ -10,11 +10,13 @@
 import org.eclipse.core.runtime.CoreException;

 import org.eclipse.debug.core.ILaunchConfiguration;

 import org.eclipse.debug.internal.ui.DebugUIPlugin;

+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog;

 import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationHistoryElement;

 import org.eclipse.debug.ui.DebugUITools;

 import org.eclipse.jface.action.IAction;

 import org.eclipse.jface.dialogs.MessageDialog;

 import org.eclipse.jface.viewers.ISelection;

+import org.eclipse.jface.viewers.IStructuredSelection;

 import org.eclipse.swt.custom.BusyIndicator;

 import org.eclipse.swt.widgets.Display;

 import org.eclipse.swt.widgets.Shell;

@@ -65,7 +67,8 @@
 					MessageDialog.openError(getShell(), title, message);				

 				}

 			} else {

-				Display.getCurrent().beep();

+				// If the history is empty, just open the launch config dialog

+				openLaunchConfigurationDialog();

 			}

 		} catch (CoreException ce) {

 			DebugUIPlugin.errorDialog(getShell(), ActionMessages.getString("RelaunchLastAction.Error_relaunching_3"), ActionMessages.getString("RelaunchLastAction.Error_encountered_attempting_to_relaunch_4"), ce); //$NON-NLS-1$ //$NON-NLS-2$

@@ -73,6 +76,20 @@
 	}

 	

 	/**

+	 * Open the launch configuration dialog, passing in the current workbench selection.

+	 */

+	private void openLaunchConfigurationDialog() {

+		IWorkbenchWindow dwindow= DebugUIPlugin.getActiveWorkbenchWindow();

+		if (dwindow == null) {

+			return;

+		}

+		IStructuredSelection selection= DebugUIPlugin.resolveSelection(dwindow);

+		LaunchConfigurationDialog dialog = new LaunchConfigurationDialog(DebugUIPlugin.getShell(), selection, getMode());		

+		dialog.setOpenMode(LaunchConfigurationDialog.LAUNCH_CONFIGURATION_DIALOG_OPEN_ON_LAST_LAUNCHED);

+		dialog.open();

+	}

+	

+	/**

 	 * @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/launchConfigurations/LaunchConfigurationDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java
index 7bb823d..ac30384 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java
@@ -30,6 +30,7 @@
 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.SWTUtil;

 import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;

 import org.eclipse.debug.ui.DebugUITools;

@@ -124,7 +125,16 @@
 	 */

 	private SashForm fSashForm;

 	

-	private static final int[] DEFAULT_SASH_WEIGHTS = new int[] {1, 3};

+	/**

+	 * Default weights for the SashForm that specify how wide the selection and

+	 * edit areas aree relative to each other.

+	 */

+	private static final int[] DEFAULT_SASH_WEIGHTS = new int[] {11, 30};

+	

+	/**

+	 * The launch configuration selection area.

+	 */

+	private Composite fSelectionArea;	

 	

 	/**

 	 * The launch configuration edit area.

@@ -276,6 +286,12 @@
 	private static int PROGRESS_INDICATOR_HEIGHT = 18;

 

 	/**

+	 * 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];	

@@ -427,11 +443,11 @@
 	 */

 	protected Control createContents(Composite parent) {

 		Control contents = super.createContents(parent);

+		initializeSashForm();

 		createContextMenu(getTreeViewer().getControl());

 		getLaunchManager().addLaunchConfigurationListener(this);

 		initializeBounds();

 		doInitialTreeSelection();

-		//initializeSashForm();

 		return contents;

 	}

 

@@ -495,13 +511,13 @@
 	protected void persistShellGeometry() {

 		Point shellLocation = getShell().getLocation();

 		Point shellSize = getShell().getSize();

-		//int[] sashWeights = getSashForm().getWeights();

+		int[] sashWeights = getSashForm().getWeights();

 		String locationString = serializeCoords(shellLocation);

 		String sizeString = serializeCoords(shellSize);

-		//String sashWeightString = serializeCoords(new Point(sashWeights[0], sashWeights[1]));

+		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);

+		getPreferenceStore().setValue(IDebugPreferenceConstants.PREF_LAUNCH_CONFIGURATION_DIALOG_SASH_WEIGHTS, sashWeightString);

 	}

 	

 	/**

@@ -626,34 +642,32 @@
 		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));

 		getSashForm().setOrientation(SWT.HORIZONTAL);

 		gd = new GridData(GridData.FILL_BOTH);

 		gd.horizontalSpan = 2;

 		getSashForm().setLayoutData(gd);

-		*/

-

-		// Build the launch configuration selection area

-		// and put it into the composite.

-		//Composite launchConfigSelectionArea = createLaunchConfigurationSelectionArea(getSashForm());

-		Composite launchConfigSelectionArea = createLaunchConfigurationSelectionArea(topComp);

+		

+		// Build the launch configuration selection area and put it into the composite.

+		Composite 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());

-		Composite editAreaComp = createLaunchConfigurationEditArea(topComp);

+		// Build the launch configuration edit area and put it into the composite.

+		Composite editAreaComp = createLaunchConfigurationEditArea(getSashForm());

 		gd = new GridData(GridData.FILL_BOTH);

 		editAreaComp.setLayoutData(gd);

 			

-		// Build the separator line

+		// Build the separator line that demarcates the button bar

 		Label separator = new Label(topComp, SWT.HORIZONTAL | SWT.SEPARATOR);

 		gd = new GridData(GridData.FILL_HORIZONTAL);

 		gd.horizontalSpan = 2;

 		separator.setLayoutData(gd);

 		

+		dialogComp.layout(true);

+		

 		return dialogComp;

 	}

 	

@@ -666,7 +680,7 @@
 	protected ILaunchConfiguration createConfigOfType(ILaunchConfigurationType configType) {		

 		ILaunchConfigurationWorkingCopy workingCopy = null;

 		try {

-			workingCopy = configType.newInstance(null, generateUniqueNameFrom(DEFAULT_NEW_CONFIG_NAME));

+			workingCopy = configType.newInstance(null, getLaunchManager().generateUniqueLaunchConfigurationNameFrom(DEFAULT_NEW_CONFIG_NAME));

 		} catch (CoreException ce) {

 			DebugUIPlugin.log(ce);

 			return null;

@@ -875,8 +889,9 @@
 	 */ 

 	protected Composite createLaunchConfigurationSelectionArea(Composite parent) {

 		Composite comp = new Composite(parent, SWT.NONE);

+		setSelectionArea(comp);

 		GridLayout layout = new GridLayout();

-		layout.numColumns = 2;

+		layout.numColumns = 3;

 		layout.marginHeight = 0;

 		layout.marginWidth = 5;

 		comp.setLayout(layout);

@@ -884,12 +899,12 @@
 		Label treeLabel = new Label(comp, SWT.NONE);

 		treeLabel.setText("Launch Con&figurations:");

 		GridData gd = new GridData();

-		gd.horizontalSpan = 2;

+		gd.horizontalSpan = 3;

 		treeLabel.setLayoutData(gd);

 		

 		TreeViewer tree = new TreeViewer(comp);

 		gd = new GridData(GridData.FILL_BOTH);

-		gd.horizontalSpan = 2;

+		gd.horizontalSpan = 3;

 		// Set width hint to 0 to force tree to only be as wide as the combined

 		// width of the 'New' & 'Delete' buttons.  Otherwise tree wants to be much wider.

 		gd.widthHint = 0;

@@ -910,11 +925,9 @@
 		

 		Button newButton = SWTUtil.createPushButton(comp, LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Ne&w_13"), null); //$NON-NLS-1$

 		setButtonActionNew(new ButtonActionNew(newButton.getText(), newButton));

-		((GridData)newButton.getLayoutData()).grabExcessHorizontalSpace = true;

 		

 		Button deleteButton = SWTUtil.createPushButton(comp, LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Dele&te_14"), null); //$NON-NLS-1$

 		setButtonActionDelete(new ButtonActionDelete(deleteButton.getText(), deleteButton));

-		((GridData)deleteButton.getLayoutData()).grabExcessHorizontalSpace = true;

 		

 		setButtonActionDuplicate(new ButtonActionDuplicate(LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.Duplicate_1"), null)); //$NON-NLS-1$

 		

@@ -930,15 +943,22 @@
 	 * @return the composite used for launch configuration editing

 	 */ 

 	protected Composite createLaunchConfigurationEditArea(Composite parent) {

-		Composite comp = new Composite(parent, SWT.NONE);

+		Composite outerComp = new Composite(parent, SWT.NONE);

+		GridLayout outerCompLayout = new GridLayout();

+		outerCompLayout.numColumns = 1;

+		outerCompLayout.marginHeight = 0;

+		outerCompLayout.marginWidth = 0;

+		outerComp.setLayout(outerCompLayout);

+		

+		Composite comp = new Composite(outerComp, SWT.NONE);

 		setEditArea(comp);

 		GridLayout layout = new GridLayout();

 		layout.numColumns = 2;

 		layout.marginHeight = 0;

 		layout.marginWidth = 5;

-		comp.setLayout(layout);

-		

-		GridData gd;

+		comp.setLayout(layout);		

+		GridData gd = new GridData(GridData.FILL_BOTH);

+		comp.setLayoutData(gd);

 		

 		Label nameLabel = new Label(comp, SWT.HORIZONTAL | SWT.LEFT);

 		nameLabel.setText(LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.&Name__16")); //$NON-NLS-1$

@@ -1012,7 +1032,7 @@
 			}

 		});

 		

-		return comp;

+		return outerComp;

 	}	

 	

 	/**

@@ -1432,17 +1452,19 @@
  	 * launch configuration type.

  	 */

  	protected void showTabsForConfigType(ILaunchConfigurationType configType) {		

+ 		

+ 		// Don't do any work if the current tabs are for the current config type

  		if (getTabType() != null && getTabType().equals(configType)) {

  			return;

  		}

  		

- 		// avoid flicker

+ 		// Avoid flicker

  		getEditArea().setVisible(false);

  		

-		// dispose the current tabs

+		// Dispose the current tabs

 		disposeExistingTabs();

 

-		// build the new tabs

+		// Build the new tabs

  		ILaunchConfigurationTabGroup group = null;

  		try {

 	 		group = createGroup(configType);

@@ -1452,6 +1474,8 @@
  		}

  		

  		// Create the Control for each tab, and determine the maximum tab dimensions

+ 		PixelConverter pixelConverter = new PixelConverter(getTabFolder());

+ 		int runningTabWidth = 0;

  		ILaunchConfigurationTab[] tabs = group.getTabs();

  		Point contentSize = new Point(0, 0);

  		for (int i = 0; i < tabs.length; i++) {

@@ -1461,7 +1485,12 @@
  				name = LaunchConfigurationsMessages.getString("LaunchConfigurationDialog.unspecified_28"); //$NON-NLS-1$

  			}

  			tab.setText(name);

- 			tab.setImage(tabs[i].getImage());

+ 			Image image = tabs[i].getImage();

+ 			tab.setImage(image);

+ 			runningTabWidth += pixelConverter.convertWidthInCharsToPixels(name.length() + 5);

+ 			if (image != null) {

+	 			runningTabWidth += image.getBounds().width;

+ 			}

  			tabs[i].createControl(tab.getParent());

  			Control control = tabs[i].getControl();

  			if (control != null) {

@@ -1476,6 +1505,20 @@
  			}

  		}

  		

+ 		// 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 = getTabFolder().computeTrim(0, 0, contentSize.x, contentSize.y);

 		contentSize.x = tabFolderBoundingBox.width;

@@ -1492,13 +1535,20 @@
 		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);

-		} else if (hdiff < 0 || vdiff < 0) {

-			getTabFolder().setSize(containerSize);

+			// Adjust the sash weights so that all of the increase in width

+			// is given to the tab area

+			if (newSashWeights != null) {

+				getSashForm().setWeights(newSashWeights);

+			}

 		}

 

  		setTabGroup(group);

@@ -1507,6 +1557,21 @@
  	}

  	

  	/**

+ 	 * Calculate & return a 2 element integer array that specifies the relative 

+ 	 * weights of the selection area and the edit area, based on the specified

+ 	 * increase in width of the owning shell.  The point of this method is calculate 

+ 	 * sash weights such that when the shell gets wider, all of the increase in width

+ 	 * is given to the edit area (tab folder), and the selection area (tree) stays

+ 	 * the same width.

+ 	 */

+	protected int[] calculateNewSashWeights(int widthIncrease) {

+		int[] newWeights = new int[2];

+		newWeights[0] = getSelectionArea().getBounds().width;

+		newWeights[1] = getEditArea().getBounds().width + widthIncrease;

+		return newWeights;

+	}

+

+ 	/**

  	 * 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.

  	 */

@@ -1514,7 +1579,7 @@
 		Rectangle bounds = getShell().getDisplay().getBounds();

 		getShell().setSize(Math.min(width, bounds.width), Math.min(height, bounds.height));

 	}

-

+	

  	protected void disposeExistingTabs() {

 		TabItem[] oldTabs = getTabFolder().getItems();

 		if (getTabGroup() != null) {

@@ -1889,7 +1954,7 @@
 		

 		// Duplicate the selected config and select the dupe in the tree

 		ILaunchConfiguration copyFromConfig = (ILaunchConfiguration) selectedElement;

-		String newName = generateUniqueNameFrom(copyFromConfig.getName());

+		String newName = getLaunchManager().generateUniqueLaunchConfigurationNameFrom(copyFromConfig.getName());

 		try {

 			ILaunchConfigurationWorkingCopy newWorkingCopy = copyFromConfig.copy(newName);

 			setLaunchConfiguration(newWorkingCopy, false);

@@ -1912,7 +1977,7 @@
 	 * Make a copy of the specified configuration and select it in the tree.

 	 */

 	protected void doHandleCopyConfiguration(ILaunchConfiguration copyFromConfig) {

-		String newName = generateUniqueNameFrom(copyFromConfig.getName());

+		String newName = getLaunchManager().generateUniqueLaunchConfigurationNameFrom(copyFromConfig.getName());

 		try {

 			ILaunchConfigurationWorkingCopy newWorkingCopy = copyFromConfig.copy(newName);

 			setLaunchConfiguration(newWorkingCopy, false);

@@ -1931,7 +1996,7 @@
 	 */

 	protected void constructNewConfig(ILaunchConfigurationType configType) {	

 		try {

-			ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, generateUniqueNameFrom(DEFAULT_NEW_CONFIG_NAME));

+			ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, getLaunchManager().generateUniqueLaunchConfigurationNameFrom(DEFAULT_NEW_CONFIG_NAME));

 			setLastSavedName(null);

 			setLaunchConfiguration(wc, true);

 			doSave();

@@ -2017,38 +2082,6 @@
 	}	

 	

 	/**

-	 * Construct a new config name using the name of the given config as a starting point.

-	 * The new name is guaranteed not to collide with any existing config name.

-	 */

-	protected String generateUniqueNameFrom(String startingName) {

-		int index = 1;

-		String baseName = startingName;

-		int copyIndex = baseName.lastIndexOf(" (");

-		if (copyIndex > -1) {

-			String trailer = baseName.substring(copyIndex + 1);

-			try {

-				index = Integer.parseInt(trailer);

-				baseName = startingName.substring(0, copyIndex);

-			} catch (NumberFormatException nfe) {

-			}

-		} 

-		String newName = baseName;

-		try {

-			while (getLaunchManager().isExistingLaunchConfigurationName(newName)) {

-				StringBuffer buffer = new StringBuffer(baseName);

-				buffer.append(" (");

-				buffer.append(String.valueOf(index));

-				index++;

-				buffer.append(')');

-				newName = buffer.toString();		

-			}		

-		} catch (CoreException e) {

-			DebugUIPlugin.log(e);

-		}

-		return newName;

-	}

-	

-	/**

 	 * Notification the 'Close' button has been pressed.

 	 */

 	protected void handleClosePressed() {

@@ -2694,6 +2727,24 @@
 	}

 

 	/**

+	 * Returns the launch configuration selection area control.

+	 * 

+	 * @return control

+	 */

+	protected Composite getSelectionArea() {

+		return fSelectionArea;

+	}

+

+	/**

+	 * Sets the launch configuration selection area control.

+	 * 

+	 * @param editArea control

+	 */

+	private void setSelectionArea(Composite selectionArea) {

+		fSelectionArea = selectionArea;

+	}

+

+	/**

 	 * Returns the launch configuration edit area control.

 	 * 

 	 * @return control

@@ -2759,7 +2810,7 @@
 		if (name == null) {

 			name = ""; //$NON-NLS-1$

 		}

-		return generateUniqueNameFrom(name);

+		return getLaunchManager().generateUniqueLaunchConfigurationNameFrom(name);

 	}

 

 	/**

diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
index 1da89a4..00f1d79 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java
@@ -586,8 +586,11 @@
 	protected int findConfigInHistoryList(List list, ILaunchConfiguration config) {
 		for (int i = 0; i < list.size(); i++) {
 			LaunchConfigurationHistoryElement historyElement = (LaunchConfigurationHistoryElement) list.get(i);
-			if (historyElement.getLaunchConfiguration().equals(config)) {
-				return i;
+			if (historyElement != null) {
+				ILaunchConfiguration historyConfig = historyElement.getLaunchConfiguration();
+				if ((historyConfig != null) && historyConfig.equals(config)) {
+					return i;
+				}
 			}
 		}
 		
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchHistoryPreferenceTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchHistoryPreferenceTab.java
index 879f244..83ef9c7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchHistoryPreferenceTab.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchHistoryPreferenceTab.java
@@ -105,8 +105,7 @@
 		layout.numColumns = 1;
 		buttonComp.setLayout(layout);
 		
-		Button addFav = new Button(buttonComp, SWT.PUSH);
-		addFav.setText(DebugPreferencesMessages.getString("LaunchHistoryPreferenceTab.Add_&Config_1")); //$NON-NLS-1$
+		Button addFav = SWTUtil.createPushButton(buttonComp,DebugPreferencesMessages.getString("LaunchHistoryPreferenceTab.Add_&Config_1"), null); //$NON-NLS-1$
 		addFav.addSelectionListener(new SelectionAdapter() {
 			public void widgetSelected(SelectionEvent evt) {
 				handleAddConfigButtonSelected();
@@ -116,8 +115,7 @@
 		addFav.setLayoutData(gd);		
 		SWTUtil.setButtonDimensionHint(addFav);
 		
-		fRemoveFavoritesButton = new Button(buttonComp, SWT.PUSH);
-		fRemoveFavoritesButton.setText(DebugPreferencesMessages.getString("LaunchHistoryPreferenceTab.Re&move_2")); //$NON-NLS-1$
+		fRemoveFavoritesButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.getString("LaunchHistoryPreferenceTab.Re&move_2"), null); //$NON-NLS-1$
 		fRemoveFavoritesButton.addSelectionListener(new SelectionAdapter() {
 			public void widgetSelected(SelectionEvent evt) {
 				handleRemoveFavoriteButtonSelected();
@@ -128,8 +126,7 @@
 		SWTUtil.setButtonDimensionHint(fRemoveFavoritesButton);
 		fRemoveFavoritesButton.setEnabled(false);
 		
-		fMoveUpButton = new Button(buttonComp, SWT.PUSH);
-		fMoveUpButton.setText(DebugPreferencesMessages.getString("LaunchHistoryPreferenceTab.U&p_3")); //$NON-NLS-1$
+		fMoveUpButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.getString("LaunchHistoryPreferenceTab.U&p_3"), null); //$NON-NLS-1$
 		fMoveUpButton.addSelectionListener(new SelectionAdapter() {
 			public void widgetSelected(SelectionEvent evt) {
 				handleMoveUpButtonSelected();
@@ -140,8 +137,7 @@
 		SWTUtil.setButtonDimensionHint(fMoveUpButton);
 		fMoveUpButton.setEnabled(false);
 		
-		fMoveDownButton = new Button(buttonComp, SWT.PUSH);
-		fMoveDownButton.setText(DebugPreferencesMessages.getString("LaunchHistoryPreferenceTab.Do&wn_4")); //$NON-NLS-1$
+		fMoveDownButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.getString("LaunchHistoryPreferenceTab.Do&wn_4"), null); //$NON-NLS-1$
 		fMoveDownButton.addSelectionListener(new SelectionAdapter() {
 			public void widgetSelected(SelectionEvent evt) {
 				handleMoveDownButtonSelected();
@@ -179,8 +175,7 @@
 		layout.numColumns = 1;
 		buttonComp.setLayout(layout);
 		
-		fAddToFavoritesButton = new Button(buttonComp, SWT.PUSH);
-		fAddToFavoritesButton.setText(DebugPreferencesMessages.getString("LaunchHistoryPreferenceTab.Make_&Favorite_5")); //$NON-NLS-1$
+		fAddToFavoritesButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.getString("LaunchHistoryPreferenceTab.Make_&Favorite_5"), null); //$NON-NLS-1$
 		fAddToFavoritesButton.addSelectionListener(new SelectionAdapter() {
 			public void widgetSelected(SelectionEvent evt) {
 				handleMakeFavoriteButtonSelected();
@@ -191,8 +186,7 @@
 		SWTUtil.setButtonDimensionHint(fAddToFavoritesButton);
 		fAddToFavoritesButton.setEnabled(false);
 		
-		fRemoveRecentButton = new Button(buttonComp, SWT.PUSH);
-		fRemoveRecentButton.setText(DebugPreferencesMessages.getString("LaunchHistoryPreferenceTab.Remo&ve_6")); //$NON-NLS-1$
+		fRemoveRecentButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.getString("LaunchHistoryPreferenceTab.Remo&ve_6"), null); //$NON-NLS-1$
 		fRemoveRecentButton.addSelectionListener(new SelectionAdapter() {
 			public void widgetSelected(SelectionEvent evt) {
 				handleRemoveRecentButtonSelected();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
index 13e9748..397dd1f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
@@ -284,18 +284,28 @@
 		if (getViewer() != null) {
 			getViewer().removeSelectionChangedListener(this);
 		}
+		
 		getSite().getPage().removePartListener(this);
 		getSite().getWorkbenchWindow().removePerspectiveListener(this);
 		getSite().getWorkbenchWindow().removePageListener(this);
-		setEditorId(null);
-		setEditorInput(null);
-		setStackFrame(null);
+		
+		cleanup();
+		
 		DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
 		ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
 		super.dispose();
 	}
 	
 	/**
+	 * Disposes of cached information
+	 */
+	protected void cleanup() {
+		setEditorId(null);
+		setEditorInput(null);
+		setStackFrame(null);
+	}
+	
+	/**
 	 * Creates and returns the content provider to use for
 	 * the viewer of this view.
 	 */
@@ -437,7 +447,6 @@
 	
 	/**
 	 * Opens a marker for the current selection if it is a stack frame.
-	 * If the current selection is a thread, deselection occurs.
 	 * Otherwise, nothing will happen.
 	 */
 	protected void showMarkerForCurrentSelection() {
@@ -458,7 +467,11 @@
 				}
 				
 				IStackFrame stackFrame= (IStackFrame) obj;
-				if (!stackFrame.equals(getStackFrame())) {
+				if (stackFrame.equals(getStackFrame())) {
+					if (getEditorInput() == null || getEditorId() == null) {
+						lookupEditorInput();
+					}
+				} else {
 					setStackFrame(stackFrame);
 					lookupEditorInput();
 				}
@@ -622,6 +635,9 @@
 	 * the debugger.
 	 */
 	public void clearSourceSelection() {		
+		
+		cleanup();
+		
 		// Get the active editor
 		IEditorPart editor= getSite().getPage().getActiveEditor();
 		if (!(editor instanceof ITextEditor)) {
@@ -949,9 +965,7 @@
 					IProject project = (IProject)resource;
 					if (!project.isOpen()) {
 						// clear
-					    setStackFrame(null);
-					    setEditorId(null);
-					    setEditorInput(null);
+					    cleanup();
 					}
 				}
 				return false;