diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSettingsStep.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSettingsStep.java index b964013d274d..3c9af05e10c5 100644 --- a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSettingsStep.java +++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSettingsStep.java @@ -88,6 +88,7 @@ public class ProjectSettingsStep extends ModuleWizardStep implements SettingsSte myFormatPanel = new ProjectFormatPanel(); myNamePathComponent = NamePathComponent.initNamePathComponent(context); + myNamePathComponent.setShouldBeAbsolute(true); if (context.isCreatingNewProject()) { mySettingsPanel.add(myNamePathComponent, BorderLayout.NORTH); addExpertPanel(myModulePanel); diff --git a/java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java b/java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java index 66020534bab6..d76fa7437167 100644 --- a/java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java +++ b/java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java @@ -59,6 +59,7 @@ public class NamePathComponent extends JPanel{ private JLabel myNameLabel; private JLabel myPathLabel; private boolean myForceSync; + private boolean myShouldBeAbsolute; public NamePathComponent(String nameLabelText, String pathLabelText, char nameMnemonic, char locationMnemonic, final String pathChooserTitle, final String pathChooserDescription) { this(nameLabelText, pathLabelText, pathChooserTitle, pathChooserDescription, true); @@ -159,7 +160,9 @@ public class NamePathComponent extends JPanel{ if (projectFileDirectory.length() == 0) { throw new ConfigurationException(IdeBundle.message("prompt.enter.project.file.location", context.getPresentationName())); } - + if (myShouldBeAbsolute && !new File(projectFileDirectory).isAbsolute()) { + throw new ConfigurationException(StringUtil.capitalize(IdeBundle.message("file.location.should.be.absolute", context.getPresentationName()))); + } final boolean shouldPromptCreation = isPathChangedByUser(); if (!ProjectWizardUtil .createDirectoryIfNotExists(IdeBundle.message("directory.project.file.directory", context.getPresentationName()), @@ -297,6 +300,10 @@ public class NamePathComponent extends JPanel{ myTfPath.getDocument().addDocumentListener(adapter); } + public void setShouldBeAbsolute(boolean shouldBeAbsolute) { + myShouldBeAbsolute = shouldBeAbsolute; + } + private class NameFieldDocument extends PlainDocument { public NameFieldDocument() { addDocumentListener(new DocumentAdapter() { diff --git a/platform/platform-resources-en/src/messages/IdeBundle.properties b/platform/platform-resources-en/src/messages/IdeBundle.properties index a107fc3bd42c..af0753197a74 100644 --- a/platform/platform-resources-en/src/messages/IdeBundle.properties +++ b/platform/platform-resources-en/src/messages/IdeBundle.properties @@ -764,6 +764,7 @@ progress.searching.for.sources=Searching for sources in {0}. Please wait. prompt.select.source.directory=Select Source Directory prompt.new.project.file.name=Enter a file name to create a new {0} {1} prompt.enter.project.file.location=Enter {0} file location +file.location.should.be.absolute={0} location path should be absolute directory.project.file.directory=The {0} file directory\n prompt.overwrite.project.file=The {1} file \n''{0}''\nalready exists.\nWould you like to overwrite it? prompt.overwrite.project.folder={0} folder already exists in {1}.\nIts content may be overwritten.\nContinue?