diff options
author | Tor Norbye <tnorbye@google.com> | 2013-05-01 12:55:43 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2013-05-01 12:55:43 -0700 |
commit | 8fb0021093e7d978cc06043ba4c06b0a47778294 (patch) | |
tree | b95f5f920574415ae49b26ad6abac86eb6d7b38d /java/idea-ui | |
parent | b17587c84879dd2ea42495f1fbdadbc806b9475b (diff) | |
download | idea-8fb0021093e7d978cc06043ba4c06b0a47778294.tar.gz |
Snapshot dddb119296e7ee16fa8180784610b89b89112ebb from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: I5fe892d3e4d06009445cc2270aa90bb57dea9d39
Diffstat (limited to 'java/idea-ui')
-rw-r--r-- | java/idea-ui/src/com/intellij/ide/util/projectWizard/JavaSettingsStep.form | 2 | ||||
-rw-r--r-- | java/idea-ui/src/com/intellij/ide/util/projectWizard/JavaSettingsStep.java | 18 |
2 files changed, 14 insertions, 6 deletions
diff --git a/java/idea-ui/src/com/intellij/ide/util/projectWizard/JavaSettingsStep.form b/java/idea-ui/src/com/intellij/ide/util/projectWizard/JavaSettingsStep.form index b69bc2f54d38..a3ebd27f19b8 100644 --- a/java/idea-ui/src/com/intellij/ide/util/projectWizard/JavaSettingsStep.form +++ b/java/idea-ui/src/com/intellij/ide/util/projectWizard/JavaSettingsStep.form @@ -13,7 +13,7 @@ <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> </constraints> <properties> - <text value="src"/> + <text value=""/> </properties> </component> <component id="445f5" class="com.intellij.ui.components.JBCheckBox" binding="myCreateSourceRoot" default-binding="true"> diff --git a/java/idea-ui/src/com/intellij/ide/util/projectWizard/JavaSettingsStep.java b/java/idea-ui/src/com/intellij/ide/util/projectWizard/JavaSettingsStep.java index 5f09d45bd01b..8c6f0dca6cc0 100644 --- a/java/idea-ui/src/com/intellij/ide/util/projectWizard/JavaSettingsStep.java +++ b/java/idea-ui/src/com/intellij/ide/util/projectWizard/JavaSettingsStep.java @@ -17,6 +17,7 @@ package com.intellij.ide.util.projectWizard; import com.intellij.ide.IdeBundle; import com.intellij.ide.util.BrowseFilesListener; +import com.intellij.ide.util.PropertiesComponent; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.SdkTypeId; import com.intellij.openapi.ui.ComponentWithBrowseButton; @@ -27,6 +28,7 @@ import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.components.JBCheckBox; +import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.TestOnly; @@ -42,13 +44,17 @@ import java.util.Collections; */ public class JavaSettingsStep extends SdkSettingsStep { - private final ModuleBuilder myModuleBuilder; - private JBCheckBox myCreateSourceRoot; - private TextFieldWithBrowseButton mySourcePath; - private JPanel myPanel; + @NotNull @NonNls private static final String MODULE_SOURCE_ROOT_KEY = "java.module.default.source.root"; + @NotNull @NonNls private static final String DEFAULT_MODULE_SOURCE_ROOT_PATH = "src"; + + private final ModuleBuilder myModuleBuilder; + private JBCheckBox myCreateSourceRoot; + private TextFieldWithBrowseButton mySourcePath; + private JPanel myPanel; public JavaSettingsStep(SettingsStep settingsStep, ModuleBuilder moduleBuilder, @NotNull Condition<SdkTypeId> sdkFilter) { super(settingsStep, moduleBuilder, sdkFilter); + mySourcePath.setText(PropertiesComponent.getInstance().getValue(MODULE_SOURCE_ROOT_KEY, DEFAULT_MODULE_SOURCE_ROOT_PATH)); myModuleBuilder = moduleBuilder; if (moduleBuilder instanceof JavaModuleBuilder) { @@ -61,7 +67,8 @@ public class JavaSettingsStep extends SdkSettingsStep { ComponentWithBrowseButton.BrowseFolderActionListener<JTextField> listener = new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>( IdeBundle.message("prompt.select.source.directory"), null, mySourcePath, project, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR, - TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) { + TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) + { @Override protected void onFileChoosen(VirtualFile chosenFile) { String contentEntryPath = myModuleBuilder.getContentEntryPath(); @@ -94,6 +101,7 @@ public class JavaSettingsStep extends SdkSettingsStep { String contentEntryPath = myModuleBuilder.getContentEntryPath(); if (contentEntryPath != null) { final String dirName = mySourcePath.getText().trim().replace(File.separatorChar, '/'); + PropertiesComponent.getInstance().setValue(MODULE_SOURCE_ROOT_KEY, dirName); String text = dirName.length() > 0? contentEntryPath + "/" + dirName : contentEntryPath; ((JavaModuleBuilder)myModuleBuilder).setSourcePaths(Collections.singletonList(Pair.create(text, ""))); } |