Bug 15797 IllegalArg exception when canceling Java project creation
20020508+ 1) New 2) Java> Project 3) cancel ->get an IllegalArgumentException. Problem does not occur for a Simple project. !STACK java.lang.IllegalArgumentException: Path for project must have only one segment. at org.eclipse.core.internal.utils.Assert.isLegal(Assert.java:50) at org.eclipse.core.internal.resources.WorkspaceRoot.getProject (WorkspaceRoot.java:96) at org.eclipse.ui.dialogs.WizardNewProjectCreationPage.getProjectHandle (WizardNewProjectCreationPage.java:251) at org.eclipse.jdt.internal.ui.wizards.NewProjectCreationWizardPage.doesProjectExis t(NewProjectCreationWizardPage.java:125) at org.eclipse.jdt.internal.ui.wizards.NewProjectCreationWizardPage.performCancel (NewProjectCreationWizardPage.java:262) at org.eclipse.jdt.internal.ui.wizards.NewProjectCreationWizard.performCancel (NewProjectCreationWizard.java:83) at org.eclipse.jface.wizard.WizardDialog.okToClose (WizardDialog.java:676) at org.eclipse.jface.wizard.WizardDialog.close(WizardDialog.java:361) at org.eclipse.jface.wizard.WizardDialog.cancelPressed (WizardDialog.java:352) at org.eclipse.jface.wizard.WizardDialog$1.widgetSelected (WizardDialog.java:231) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:75) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:637) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1432) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1221) at org.eclipse.jface.window.Window.runEventLoop(Window.java:548) at org.eclipse.jface.window.Window.open(Window.java:535) at org.eclipse.ui.actions.NewWizardAction.run(NewWizardAction.java:86) at org.eclipse.ui.internal.NewWizardDropDownAction.run (NewWizardDropDownAction.java:88) at org.eclipse.jface.action.Action.runWithEvent(Action.java:590) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:407) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:361) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:352) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:47) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:75) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:637) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1432) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1221) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1062) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1045) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:739) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:420) at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:16)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewProjectCreationWizardPage.java
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageDeclaration;
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.preferences.JavaBasePreferencePage;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
import org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathsBlock;
/**
 * As addition to the JavaCapabilityConfigurationPage, the wizard checks if an existing external
 * location was specified and offers to do an early project creation so that classpath can be detected.
 */
public class NewProjectCreationWizardPage extends JavaCapabilityConfigurationPage {
	private WizardNewProjectCreationPage fMainPage;
	private IPath fCurrProjectLocation;
	/**
	 * Constructor for ProjectWizardPage.