Bug 164695 [Workbench] Project copy doesn't validate location and uses invalid location as default
Build: I2006114 1) Create a new project whose location is outside the workspace (say c:\temp\p1). 2) Select the project in the Navigator, and Hit Ctrl+C, Ctrl+V. 3) The project copy dialog opens. Accept the default and hit Ok. -> An error occurs because the location overlaps the location of the project being copied. There are two problems here: a) If the project is not in the default location, it should populate the dialog with a new location that is different from the original location (such as c:\temp\Copy of P1). I.e., it should provide reasonable defaults that don't cause the copy to fail. b) The location provided in the dialog should be validated using IWorkspace#validateProjectLocation. The Ok button should be greyed out until a valid location is supplied.
bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/ProjectLocationSelectionDialog.java
package org.eclipse.ui.dialogs;
import java.util.ArrayList;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
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.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
import org.eclipse.ui.internal.ide.IIDEHelpContextIds;
import org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea;
import org.eclipse.ui.internal.ide.dialogs.ProjectContentsLocationArea.IErrorMessageReporter;
/**
 * The ProjectLocationSelectionDialog is the dialog used to select the name and
 * location of a project for copying.
 */
public class ProjectLocationSelectionDialog extends SelectionStatusDialog {