[hg] main-silver: #217087 new wizard able to pick up the parent ...

  • From: Milos Kleint < >
  • To: , , , ,
  • Subject: [hg] main-silver: #217087 new wizard able to pick up the parent ...
  • Date: Thu, 24 Jan 2013 14:03:24 -0800

changeset 021157efa98e in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/021157efa98e
description:
        #217087 new wizard able to pick up the parent directory from Action's 
properties as initial value

diffstat:

 maven.apisupport/manifest.mf                                                 
     |   2 +-
 maven.apisupport/nbproject/project.xml                                       
     |   2 +-
 
maven.apisupport/src/org/netbeans/modules/maven/apisupport/NbmWizardIterator.java
 |   3 +-
 maven.j2ee/manifest.mf                                                       
     |   2 +-
 maven.j2ee/nbproject/project.xml                                             
     |   2 +-
 
maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/BaseWizardIterator.java
 |   1 -
 maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EAVisualPanel.java 
     |   3 +-
 
maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EAWizardIterator.java
   |   3 +-
 
maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EEWizardIterator.java
   |   3 +-
 maven/manifest.mf                                                            
     |   2 +-
 maven/nbproject/project.xml                                                  
     |   2 +-
 maven/src/org/netbeans/modules/maven/newproject/ArchetypeWizardUtils.java    
     |   3 +-
 maven/src/org/netbeans/modules/maven/newproject/BasicPanelVisual.java        
     |   8 ++--
 maven/src/org/netbeans/modules/maven/newproject/MavenWizardIterator.java     
     |   3 +-
 maven/src/org/netbeans/modules/maven/nodes/ModulesNode.java                  
     |  18 ++++++++++
 projectui/nbproject/project.properties                                       
     |   2 +-
 projectui/src/org/netbeans/modules/project/ui/actions/NewProject.java        
     |   4 ++
 projectuiapi/apichanges.xml                                                  
     |  16 ++++++++
 projectuiapi/nbproject/project.properties                                    
     |   2 +-
 
projectuiapi/src/org/netbeans/spi/project/ui/support/CommonProjectActions.java
    |   8 ++++
 20 files changed, 70 insertions(+), 19 deletions(-)

diffs (360 lines):

diff --git a/maven.apisupport/manifest.mf b/maven.apisupport/manifest.mf
--- a/maven.apisupport/manifest.mf
+++ b/maven.apisupport/manifest.mf
@@ -2,5 +2,5 @@
 OpenIDE-Module: org.netbeans.modules.maven.apisupport/1
 OpenIDE-Module-Localizing-Bundle: 
org/netbeans/modules/maven/apisupport/Bundle.properties
 AutoUpdate-Show-In-Client: false
-OpenIDE-Module-Specification-Version: 1.38
+OpenIDE-Module-Specification-Version: 1.39
 
diff --git a/maven.apisupport/nbproject/project.xml 
b/maven.apisupport/nbproject/project.xml
--- a/maven.apisupport/nbproject/project.xml
+++ b/maven.apisupport/nbproject/project.xml
@@ -181,7 +181,7 @@
                     <compile-dependency/>
                     <run-dependency>
                         <release-version>1</release-version>
-                        <specification-version>1.31</specification-version>
+                        <specification-version>1.67</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
diff --git 
a/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NbmWizardIterator.java
 
b/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NbmWizardIterator.java
--- 
a/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NbmWizardIterator.java
+++ 
b/maven.apisupport/src/org/netbeans/modules/maven/apisupport/NbmWizardIterator.java
@@ -75,6 +75,7 @@
 import org.netbeans.api.templates.TemplateRegistration;
 import org.openide.util.NbBundle.Messages;
 import static org.netbeans.modules.maven.apisupport.Bundle.*;
+import org.netbeans.spi.project.ui.support.CommonProjectActions;
 
 public class NbmWizardIterator implements 
WizardDescriptor.BackgroundInstantiatingIterator<WizardDescriptor> {
 
@@ -143,7 +144,7 @@
         ArchetypeWizards.logUsage(archetype.getGroupId(), 
archetype.getArtifactId(), archetype.getVersion());
 
             String nbm_artifactId = (String) wiz.getProperty(NBM_ARTIFACTID);
-            File projFile = FileUtil.normalizeFile((File) 
wiz.getProperty("projdir")); // NOI18N
+            File projFile = FileUtil.normalizeFile((File) 
wiz.getProperty(CommonProjectActions.PROJECT_PARENT_FOLDER)); // NOI18N
             String version = (String) wiz.getProperty(NB_VERSION);
             Map<String,String> additional = version != null ? 
Collections.singletonMap("netbeansVersion", version) : null; // NOI18N
             ArchetypeWizards.createFromArchetype(projFile, vi, archetype, 
additional, true);
diff --git a/maven.j2ee/manifest.mf b/maven.j2ee/manifest.mf
--- a/maven.j2ee/manifest.mf
+++ b/maven.j2ee/manifest.mf
@@ -3,4 +3,4 @@
 OpenIDE-Module-Localizing-Bundle: 
org/netbeans/modules/maven/j2ee/Bundle.properties
 OpenIDE-Module-Layer: org/netbeans/modules/maven/j2ee/layer.xml
 AutoUpdate-Show-In-Client: false
-OpenIDE-Module-Specification-Version: 1.31
+OpenIDE-Module-Specification-Version: 1.32
diff --git a/maven.j2ee/nbproject/project.xml 
b/maven.j2ee/nbproject/project.xml
--- a/maven.j2ee/nbproject/project.xml
+++ b/maven.j2ee/nbproject/project.xml
@@ -290,7 +290,7 @@
                     <compile-dependency/>
                     <run-dependency>
                         <release-version>1</release-version>
-                        <specification-version>1.31</specification-version>
+                        <specification-version>1.67</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
diff --git 
a/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/BaseWizardIterator.java
 
b/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/BaseWizardIterator.java
--- 
a/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/BaseWizardIterator.java
+++ 
b/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/BaseWizardIterator.java
@@ -110,7 +110,6 @@
     
     @Override
     public void uninitialize(WizardDescriptor wiz) {
-        this.wiz.putProperty("projdir",null); //NOI18N
         this.wiz.putProperty("name",null); //NOI18N
         this.wiz = null;
         panels = null;
diff --git 
a/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EAVisualPanel.java
 
b/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EAVisualPanel.java
--- 
a/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EAVisualPanel.java
+++ 
b/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EAVisualPanel.java
@@ -52,6 +52,7 @@
 import org.netbeans.modules.maven.api.archetype.ProjectInfo;
 import 
org.netbeans.modules.maven.j2ee.newproject.archetype.J2eeArchetypeFactory;
 import static org.netbeans.modules.maven.j2ee.newproject.Bundle.*;
+import org.netbeans.spi.project.ui.support.CommonProjectActions;
 import org.netbeans.validation.api.ValidatorUtils;
 import org.netbeans.validation.api.builtin.stringvalidation.StringValidators;
 import org.netbeans.validation.api.ui.ValidationGroup;
@@ -109,7 +110,7 @@
     }
 
     void storeSettings(WizardDescriptor d) {
-        File parent = (File) d.getProperty("projdir");
+        File parent = (File) 
d.getProperty(CommonProjectActions.PROJECT_PARENT_FOLDER);
         Profile profile = helper.getSelectedProfile();
         
         if (profile == null) {
diff --git 
a/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EAWizardIterator.java
 
b/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EAWizardIterator.java
--- 
a/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EAWizardIterator.java
+++ 
b/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EAWizardIterator.java
@@ -65,6 +65,7 @@
 import org.openide.filesystems.FileUtil;
 import org.openide.util.NbBundle.Messages;
 import static org.netbeans.modules.maven.j2ee.newproject.Bundle.*;
+import org.netbeans.spi.project.ui.support.CommonProjectActions;
 
 /**
  * This class is responsible for creating new EAR projects
@@ -85,7 +86,7 @@
         ProjectInfo web_vi = (ProjectInfo) 
wiz.getProperty("web_versionInfo"); //NOI18N
         ProjectInfo ejb_vi = (ProjectInfo) 
wiz.getProperty("ejb_versionInfo"); //NOI18N
         ProjectInfo vi = new ProjectInfo((String) 
wiz.getProperty("groupId"), (String) wiz.getProperty("artifactId"), (String) 
wiz.getProperty("version"), (String) wiz.getProperty("package")); //NOI18N
-        File rootFile = FileUtil.normalizeFile((File) 
wiz.getProperty("projdir")); // NOI18N
+        File rootFile = FileUtil.normalizeFile((File) 
wiz.getProperty(CommonProjectActions.PROJECT_PARENT_FOLDER)); // NOI18N
         File earFile = FileUtil.normalizeFile((File) 
wiz.getProperty("ear_projdir")); // NOI18N
         
         ArchetypeWizards.createFromArchetype(rootFile, vi, 
J2eeArchetypeFactory.getInstance().getAnyArchetypeFor(J2eeModule.Type.RAR), 
null, true);
diff --git 
a/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EEWizardIterator.java
 
b/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EEWizardIterator.java
--- 
a/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EEWizardIterator.java
+++ 
b/maven.j2ee/src/org/netbeans/modules/maven/j2ee/newproject/EEWizardIterator.java
@@ -61,6 +61,7 @@
 import org.openide.filesystems.FileUtil;
 import org.openide.util.NbBundle.Messages;
 import static org.netbeans.modules.maven.j2ee.newproject.Bundle.*;
+import org.netbeans.spi.project.ui.support.CommonProjectActions;
 
 /**
  * This class is responsible for creating Ejb, Web and App client projects
@@ -107,7 +108,7 @@
         Archetype archetype = 
J2eeArchetypeFactory.getInstance().findArchetypeFor(projectType, profile);
         ArchetypeWizards.logUsage(archetype.getGroupId(), 
archetype.getArtifactId(), archetype.getVersion());
 
-        File rootFile = FileUtil.normalizeFile((File) 
wiz.getProperty("projdir")); // NOI18N
+        File rootFile = FileUtil.normalizeFile((File) 
wiz.getProperty(CommonProjectActions.PROJECT_PARENT_FOLDER)); // NOI18N
         ArchetypeWizards.createFromArchetype(rootFile, vi, archetype, null, 
true);
         
         Set<FileObject> projects = ArchetypeWizards.openProjects(rootFile, 
rootFile);
diff --git a/maven/manifest.mf b/maven/manifest.mf
--- a/maven/manifest.mf
+++ b/maven/manifest.mf
@@ -1,6 +1,6 @@
 Manifest-Version: 1.0
 OpenIDE-Module: org.netbeans.modules.maven/2
-OpenIDE-Module-Specification-Version: 2.68
+OpenIDE-Module-Specification-Version: 2.69
 OpenIDE-Module-Localizing-Bundle: 
org/netbeans/modules/maven/Bundle.properties
 OpenIDE-Module-Layer: org/netbeans/modules/maven/layer.xml
 AutoUpdate-Show-In-Client: false
diff --git a/maven/nbproject/project.xml b/maven/nbproject/project.xml
--- a/maven/nbproject/project.xml
+++ b/maven/nbproject/project.xml
@@ -258,7 +258,7 @@
                     <compile-dependency/>
                     <run-dependency>
                         <release-version>1</release-version>
-                        <specification-version>1.43</specification-version>
+                        <specification-version>1.67</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
diff --git 
a/maven/src/org/netbeans/modules/maven/newproject/ArchetypeWizardUtils.java 
b/maven/src/org/netbeans/modules/maven/newproject/ArchetypeWizardUtils.java
--- 
a/maven/src/org/netbeans/modules/maven/newproject/ArchetypeWizardUtils.java
+++ 
b/maven/src/org/netbeans/modules/maven/newproject/ArchetypeWizardUtils.java
@@ -74,6 +74,7 @@
 import org.netbeans.modules.maven.model.pom.POMModel;
 import static org.netbeans.modules.maven.newproject.Bundle.*;
 import org.netbeans.modules.maven.options.MavenCommandSettings;
+import org.netbeans.spi.project.ui.support.CommonProjectActions;
 import org.netbeans.spi.project.ui.support.ProjectChooser;
 import org.openide.WizardDescriptor;
 import org.openide.execution.ExecutorTask;
@@ -209,7 +210,7 @@
         @SuppressWarnings("unchecked")
         Map<String,String> additional = (Map<String,String>) 
wiz.getProperty(ADDITIONAL_PROPS);
 
-        File projFile = FileUtil.normalizeFile((File) 
wiz.getProperty("projdir")); // NOI18N
+        File projFile = FileUtil.normalizeFile((File) 
wiz.getProperty(CommonProjectActions.PROJECT_PARENT_FOLDER)); // NOI18N
         createFromArchetype(projFile, vi, arch, additional, true);
         Set<FileObject> projects = openProjects(projFile, null);
         return projects;
diff --git 
a/maven/src/org/netbeans/modules/maven/newproject/BasicPanelVisual.java 
b/maven/src/org/netbeans/modules/maven/newproject/BasicPanelVisual.java
--- a/maven/src/org/netbeans/modules/maven/newproject/BasicPanelVisual.java
+++ b/maven/src/org/netbeans/modules/maven/newproject/BasicPanelVisual.java
@@ -73,6 +73,7 @@
 import org.netbeans.api.progress.aggregate.AggregateProgressFactory;
 import org.netbeans.api.progress.aggregate.AggregateProgressHandle;
 import org.netbeans.api.progress.aggregate.ProgressContributor;
+import org.netbeans.modules.java.api.common.util.CommonProjectUtils;
 import org.netbeans.modules.maven.api.MavenValidators;
 import org.netbeans.modules.maven.api.archetype.Archetype;
 import org.netbeans.modules.maven.embedder.EmbedderFactory;
@@ -85,6 +86,7 @@
 import org.netbeans.modules.maven.options.MavenOptionController;
 import org.netbeans.modules.maven.options.MavenSettings;
 import org.netbeans.modules.options.java.api.JavaOptions;
+import org.netbeans.spi.project.ui.support.CommonProjectActions;
 import org.netbeans.spi.project.ui.support.ProjectChooser;
 import org.netbeans.validation.api.AbstractValidator;
 import org.netbeans.validation.api.Problems;
@@ -531,7 +533,7 @@
         String name = projectNameTextField.getText().trim();
         String folder = createdFolderTextField.getText().trim();
         
-        d.putProperty("projdir", new File(folder)); //NOI18N
+        d.putProperty(CommonProjectActions.PROJECT_PARENT_FOLDER, new 
File(folder)); //NOI18N
         d.putProperty("name", name); //NOI18N
         d.putProperty("artifactId", txtArtifactId.getText().trim()); //NOI18N
         d.putProperty("groupId", txtGroupId.getText().trim()); //NOI18N
@@ -571,11 +573,9 @@
                 handle = null;
             }
         }        
-        File projectLocation = (File) settings.getProperty("projdir"); 
//NOI18N
+        File projectLocation = (File) 
settings.getProperty(CommonProjectActions.PROJECT_PARENT_FOLDER); //NOI18N
         if (projectLocation == null || projectLocation.getParentFile() == 
null || !projectLocation.getParentFile().isDirectory()) {
             projectLocation = ProjectChooser.getProjectsFolder();
-        } else {
-            projectLocation = projectLocation.getParentFile();
         }
         
this.projectLocationTextField.setText(projectLocation.getAbsolutePath());
         
diff --git 
a/maven/src/org/netbeans/modules/maven/newproject/MavenWizardIterator.java 
b/maven/src/org/netbeans/modules/maven/newproject/MavenWizardIterator.java
--- a/maven/src/org/netbeans/modules/maven/newproject/MavenWizardIterator.java
+++ b/maven/src/org/netbeans/modules/maven/newproject/MavenWizardIterator.java
@@ -56,6 +56,7 @@
 import org.netbeans.modules.maven.api.archetype.Archetype;
 import org.netbeans.modules.maven.api.archetype.ArchetypeWizards;
 import static org.netbeans.modules.maven.newproject.Bundle.*;
+import org.netbeans.spi.project.ui.support.CommonProjectActions;
 import org.netbeans.validation.api.ui.ValidationGroup;
 import org.openide.WizardDescriptor;
 import org.openide.filesystems.FileObject;
@@ -132,7 +133,7 @@
     
     @Override
     public void uninitialize(WizardDescriptor wiz) {
-        wiz.putProperty("projdir",null); //NOI18N
+//        wiz.putProperty(CommonProjectActions.PROJECT_PARENT_FOLDER, null); 
//NOI18N
         wiz.putProperty("name",null); //NOI18N
         this.wiz = null;
         panels = null;
diff --git a/maven/src/org/netbeans/modules/maven/nodes/ModulesNode.java 
b/maven/src/org/netbeans/modules/maven/nodes/ModulesNode.java
--- a/maven/src/org/netbeans/modules/maven/nodes/ModulesNode.java
+++ b/maven/src/org/netbeans/modules/maven/nodes/ModulesNode.java
@@ -68,6 +68,7 @@
 import static org.netbeans.modules.maven.nodes.Bundle.*;
 import org.netbeans.modules.maven.spi.nodes.NodeUtils;
 import org.netbeans.spi.project.ui.LogicalViewProvider;
+import org.netbeans.spi.project.ui.support.CommonProjectActions;
 import org.netbeans.spi.project.ui.support.ProjectChooser;
 import org.openide.DialogDisplayer;
 import org.openide.NotifyDescriptor;
@@ -104,6 +105,7 @@
     public Action[] getActions(boolean bool) {
         return new Action[] {
             new AddModuleAction(),
+            new CreateModuleAction()
         };
     }
 
@@ -314,4 +316,20 @@
 
     }
 
+    private class CreateModuleAction extends AbstractAction {
+
+        @Messages("BTN_create_module=Create New Module...")
+        CreateModuleAction() {
+            super(BTN_create_module());
 }
+
+        @Override public void actionPerformed(ActionEvent e) {
+            Action act = CommonProjectActions.newProjectAction();
+            act.putValue("PRESELECT_CATEGORY" 
/*ProjectTemplates.PRESELECT_CATEGORY */, "Maven2");
+            act.putValue(CommonProjectActions.PROJECT_PARENT_FOLDER, 
proj.getPOMFile().getParentFile());
+            act.actionPerformed(new ActionEvent(this, 
ActionEvent.ACTION_PERFORMED, "actionPerformed"));
+        }
+
+    }
+
+}
diff --git a/projectui/nbproject/project.properties 
b/projectui/nbproject/project.properties
--- a/projectui/nbproject/project.properties
+++ b/projectui/nbproject/project.properties
@@ -42,7 +42,7 @@
 
 javac.compilerargs=-Xlint:unchecked
 javac.source=1.6
-spec.version.base=1.41.0
+spec.version.base=1.42.0
 
 javadoc.arch=${basedir}/arch.xml
 javadoc.apichanges=${basedir}/apichanges.xml
diff --git 
a/projectui/src/org/netbeans/modules/project/ui/actions/NewProject.java 
b/projectui/src/org/netbeans/modules/project/ui/actions/NewProject.java
--- a/projectui/src/org/netbeans/modules/project/ui/actions/NewProject.java
+++ b/projectui/src/org/netbeans/modules/project/ui/actions/NewProject.java
@@ -122,6 +122,10 @@
         if (folder != null) {
             wizard.putProperty(CommonProjectActions.EXISTING_SOURCES_FOLDER, 
folder);
         }
+        File f = (File) getValue(CommonProjectActions.PROJECT_PARENT_FOLDER);
+        if (f != null) {
+            wizard.putProperty(CommonProjectActions.PROJECT_PARENT_FOLDER, 
f);
+        }
         return wizard;
     }
     
diff --git a/projectuiapi/apichanges.xml b/projectuiapi/apichanges.xml
--- a/projectuiapi/apichanges.xml
+++ b/projectuiapi/apichanges.xml
@@ -107,6 +107,22 @@
     <!-- ACTUAL CHANGES BEGIN HERE: -->
 
     <changes>
+        <change id="CommonProjectActions.PROJECT_PARENT_FOLDER">
+            <api name="general"/>
+            <summary>Added CommonProjectActions.PROJECT_PARENT_FOLDER 
constant</summary>
+            <version major="1" minor="67"/>
+            <date day="24" month="1" year="2013"/>
+            <author login="psomol"/>
+            <compatibility addition="yes"/>
+            <description>
+                <p>
+                    Added CommonProjectActions.PROJECT_PARENT_FOLDER 
constant that is respected by the 
<code>CommonProjectActions.newProject()</code> action
+                    and the project's parent directory can be set that way.
+                </p>
+            </description>
+            <class package="org.netbeans.spi.project.ui.support" 
name="CommonProjectActions"/>
+            <issue number="217087"/>
+        </change>
         <change id="ProjectCustomizer.Category.CloseListener">
             <api name="general"/>
             <summary>Added Close listener to 
ProjectCustomizer.Category.</summary>
diff --git a/projectuiapi/nbproject/project.properties 
b/projectuiapi/nbproject/project.properties
--- a/projectuiapi/nbproject/project.properties
+++ b/projectuiapi/nbproject/project.properties
@@ -42,7 +42,7 @@
 
 javac.compilerargs=-Xlint -Xlint:-serial
 javac.source=1.6
-spec.version.base=1.66.0
+spec.version.base=1.67.0
 is.autoload=true
 javadoc.arch=${basedir}/arch.xml
 javadoc.apichanges=${basedir}/apichanges.xml
diff --git 
a/projectuiapi/src/org/netbeans/spi/project/ui/support/CommonProjectActions.java
 
b/projectuiapi/src/org/netbeans/spi/project/ui/support/CommonProjectActions.java
--- 
a/projectuiapi/src/org/netbeans/spi/project/ui/support/CommonProjectActions.java
+++ 
b/projectuiapi/src/org/netbeans/spi/project/ui/support/CommonProjectActions.java
@@ -63,6 +63,14 @@
      */
     public static final String EXISTING_SOURCES_FOLDER = 
"existingSourcesFolder";
     
+    /**
+     * {@link java.applet.File} value honored by {@link #newProjectAction}
+     * that defines initial value for parent folder
+     *
+     * @since 1.67
+     */
+    public static final String PROJECT_PARENT_FOLDER = "projdir";
+    
     private CommonProjectActions() {}
         
     /**

[hg] main-silver: #217087 new wizard able to pick up the parent ...

Milos Kleint 01/24/2013

Project Features

About this Project

APIsupport was started in November 2009, is owned by Antonin Nebuzelsky, and has 43 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close