Committed Deepak's patch to fix bug 262050: Unclear directions in New Java Project wizard
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java
index 3bdcac2..0e8fd5f 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -211,11 +211,9 @@
 	public static String NewJavaProjectWizardPageOne_LayoutGroup_option_separateFolders;
 	public static String NewJavaProjectWizardPageOne_LayoutGroup_title;
 	public static String NewJavaProjectWizardPageOne_WorkingSets_group;
-	public static String NewJavaProjectWizardPageOne_LocationGroup_title;
-	public static String NewJavaProjectWizardPageOne_LocationGroup_external_desc;
+	public static String NewJavaProjectWizardPageOne_LocationGroup_location_desc;
 	public static String NewJavaProjectWizardPageOne_LocationGroup_browseButton_desc;
 	public static String NewJavaProjectWizardPageOne_LocationGroup_locationLabel_desc;
-	public static String NewJavaProjectWizardPageOne_LocationGroup_workspace_desc;
 	public static String NewJavaProjectWizardPageOne_NameGroup_label_text;
 	public static String NewJavaProjectWizardPageOne_DetectGroup_jre_message;
 	public static String NewJavaProjectWizardPageOne_DetectGroup_message;
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties
index 62a0af9..e6374da 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties
@@ -859,11 +859,9 @@
 ClasspathModifierQueries_confirm_remove_linked_folder_message=Are you sure you want to remove folder ''{0}'' from the build path?
 
 NewJavaProjectWizardPageOne_NameGroup_label_text=&Project name:
-NewJavaProjectWizardPageOne_LocationGroup_title=Contents
-NewJavaProjectWizardPageOne_LocationGroup_external_desc=Create project from e&xisting source
+NewJavaProjectWizardPageOne_LocationGroup_location_desc=Use &default location
 NewJavaProjectWizardPageOne_JREGroup_default_compliance=Use def&ault JRE (currently ''{0}'')
-NewJavaProjectWizardPageOne_LocationGroup_workspace_desc=Create new project in &workspace
-NewJavaProjectWizardPageOne_LocationGroup_locationLabel_desc=&Directory:
+NewJavaProjectWizardPageOne_LocationGroup_locationLabel_desc=&Location:
 NewJavaProjectWizardPageOne_LocationGroup_browseButton_desc=B&rowse...
 NewJavaProjectWizardPageOne_LayoutGroup_title=Project layout
 NewJavaProjectWizardPageOne_LayoutGroup_option_separateFolders=&Create separate folders for sources and class files
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPageOne.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPageOne.java
index 4ab8f39..477dc51 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPageOne.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPageOne.java
@@ -129,7 +129,7 @@
 		public Control createControl(Composite composite) {
 			Composite nameComposite= new Composite(composite, SWT.NONE);
 			nameComposite.setFont(composite.getFont());
-			nameComposite.setLayout(initGridLayout(new GridLayout(2, false), false));
+			nameComposite.setLayout(new GridLayout(2, false));
 
 			fNameField.doFillIntoGrid(nameComposite, 2);
 			LayoutUtil.setHorizontalGrabbing(fNameField.getTextControl(null));
@@ -169,8 +169,7 @@
 	 */
 	private final class LocationGroup extends Observable implements Observer, IStringButtonAdapter, IDialogFieldListener {
 
-		protected final SelectionButtonDialogField fWorkspaceRadio;
-		protected final SelectionButtonDialogField fExternalRadio;
+		protected final SelectionButtonDialogField fUseDefaults;
 		protected final StringButtonDialogField fLocation;
 
 		private String fPreviousExternalLocation;
@@ -178,39 +177,31 @@
 		private static final String DIALOGSTORE_LAST_EXTERNAL_LOC= JavaUI.ID_PLUGIN + ".last.external.project"; //$NON-NLS-1$
 
 		public LocationGroup() {
-			fWorkspaceRadio= new SelectionButtonDialogField(SWT.RADIO);
-			fWorkspaceRadio.setDialogFieldListener(this);
-			fWorkspaceRadio.setLabelText(NewWizardMessages.NewJavaProjectWizardPageOne_LocationGroup_workspace_desc);
-
-			fExternalRadio= new SelectionButtonDialogField(SWT.RADIO);
-			fExternalRadio.setLabelText(NewWizardMessages.NewJavaProjectWizardPageOne_LocationGroup_external_desc);
+			fUseDefaults= new SelectionButtonDialogField(SWT.CHECK);
+			fUseDefaults.setDialogFieldListener(this);
+			fUseDefaults.setLabelText(NewWizardMessages.NewJavaProjectWizardPageOne_LocationGroup_location_desc);
 
 			fLocation= new StringButtonDialogField(this);
 			fLocation.setDialogFieldListener(this);
 			fLocation.setLabelText(NewWizardMessages.NewJavaProjectWizardPageOne_LocationGroup_locationLabel_desc);
 			fLocation.setButtonLabel(NewWizardMessages.NewJavaProjectWizardPageOne_LocationGroup_browseButton_desc);
 
-			fExternalRadio.attachDialogField(fLocation);
-
-			fWorkspaceRadio.setSelection(true);
-			fExternalRadio.setSelection(false);
+			fUseDefaults.setSelection(true);
 
 			fPreviousExternalLocation= ""; //$NON-NLS-1$
 		}
 
 		public Control createControl(Composite composite) {
-			final int numColumns= 3;
+			final int numColumns= 4;
 
-			final Group group= new Group(composite, SWT.NONE);
-			group.setLayout(initGridLayout(new GridLayout(numColumns, false), true));
-			group.setText(NewWizardMessages.NewJavaProjectWizardPageOne_LocationGroup_title);
+			final Composite locationComposite= new Composite(composite, SWT.NONE);
+			locationComposite.setLayout(new GridLayout(numColumns, false));
 
-			fWorkspaceRadio.doFillIntoGrid(group, numColumns);
-			fExternalRadio.doFillIntoGrid(group, numColumns);
-			fLocation.doFillIntoGrid(group, numColumns);
+			fUseDefaults.doFillIntoGrid(locationComposite, numColumns);
+			fLocation.doFillIntoGrid(locationComposite, numColumns);
 			LayoutUtil.setHorizontalGrabbing(fLocation.getTextControl(null));
 
-			return group;
+			return locationComposite;
 		}
 
 		protected void fireEvent() {
@@ -227,21 +218,21 @@
 		 * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
 		 */
 		public void update(Observable o, Object arg) {
-			if (isWorkspaceRadioSelected()) {
+			if (isUseDefaultSelected()) {
 				fLocation.setText(getDefaultPath(fNameGroup.getName()));
 			}
 			fireEvent();
 		}
 
 		public IPath getLocation() {
-			if (isWorkspaceRadioSelected()) {
+			if (isUseDefaultSelected()) {
 				return Platform.getLocation();
 			}
 			return Path.fromOSString(fLocation.getText().trim());
 		}
 
-		public boolean isWorkspaceRadioSelected() {
-			return fWorkspaceRadio.isSelected();
+		public boolean isUseDefaultSelected() {
+			return fUseDefaults.isSelected();
 		}
 
 		/**
@@ -257,7 +248,7 @@
 
 
 		public void setLocation(IPath path) {
-			fWorkspaceRadio.setSelection(path == null);
+			fUseDefaults.setSelection(path == null);
 			if (path != null) {
 				fLocation.setText(path.toOSString());
 			} else {
@@ -301,13 +292,15 @@
 		 * @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener#dialogFieldChanged(org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField)
 		 */
 		public void dialogFieldChanged(DialogField field) {
-			if (field == fWorkspaceRadio) {
-				final boolean checked= fWorkspaceRadio.isSelected();
+			if (field == fUseDefaults) {
+				final boolean checked= fUseDefaults.isSelected();
 				if (checked) {
 					fPreviousExternalLocation= fLocation.getText();
 					fLocation.setText(getDefaultPath(fNameGroup.getName()));
+					fLocation.setEnabled(false);
 				} else {
 					fLocation.setText(fPreviousExternalLocation);
+					fLocation.setEnabled(true);
 				}
 			}
 			fireEvent();
@@ -897,7 +890,7 @@
 		}
 
 		private boolean computeDetectState() {
-			if (fLocationGroup.isWorkspaceRadioSelected()) {
+			if (fLocationGroup.isUseDefaultSelected()) {
 				String name= fNameGroup.getName();
 				if (name.length() == 0 || JavaPlugin.getWorkspace().getRoot().findMember(name) != null) {
 					return false;
@@ -1033,7 +1026,7 @@
 
 			IPath projectPath= Path.fromOSString(location);
 
-			if (fLocationGroup.isWorkspaceRadioSelected())
+			if (fLocationGroup.isUseDefaultSelected())
 				projectPath= projectPath.append(fNameGroup.getName());
 
 			if (projectPath.toFile().exists()) {//create from existing source
@@ -1050,7 +1043,7 @@
 						return;
 					}
 				}
-			} else if (!fLocationGroup.isWorkspaceRadioSelected()) {//create at non existing external location
+			} else if (!fLocationGroup.isUseDefaultSelected()) {//create at non existing external location
 				if (!canCreate(projectPath.toFile())) {
 					setErrorMessage(NewWizardMessages.NewJavaProjectWizardPageOne_Message_cannotCreateAtExternalLocation);
 					setPageComplete(false);