You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/02/25 18:38:36 UTC

[GitHub] [netbeans] errael opened a new pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation

errael opened a new pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation
URL: https://github.com/apache/netbeans/pull/1980
 
 
   NOTE: this PR only addresses the problem caused by the first changeset listed. I'm filing a 2nd issue for the spurious directory creation which is the 2nd changeset. But I'm including it here for reference/completeness since it is in the issue report.
   
   NETBEANS-2446 problem comes from two commits (seen in main-silver)
   ```
       changeset:   244321:021157efa98e
       parent:      244318:5036dc46020f
       user:        Milos Kleint <mk...@netbeans.org>
       date:        Thu Jan 24 15:12:37 2013 +0100
       summary:     #217087 new wizard able to pick up the parent directory from Action's properties as initial value
   ```
   and
   ```
       changeset:   301468:76d9cafcee35
       branch:      ArchetypesUI268677
       parent:      299970:0c5aa5cdb86a
       user:        Jaroslav Tulach <jt...@netbeans.org>
       date:        Tue Oct 25 21:52:49 2016 +0200
       summary:     #268677: Recognizing .archetype template files and using them to instantiate projects via mvn archetype
   ```
   The first change took out these two lines near the start of java/maven/.../BasicPanelVisual.read(WizardDescriptor settings)
   ```
           } else {
               projectLocation = projectLocation.getParentFile();
   ```
   This is really unrelated to the overall changeset, except that PROJECT_PARENT_FOLDER is nearby.
   
   Without these two lines, in NewProject > JavaWithMaven > JavaApplication, if you alternately click "next"/"back" you'll see
   >    F:\tmp\proj1\proj1\proj1\proj1\
   
   adding another "proj1" with each "next". Putting back these two lines fixes it.
   
   The 2nd changeset problem (not addressed by this PR), "Recognizing .archetype template ...", causes spurious directory creation and makes the overall problem highly visible. This problem creates this deep directory tree even though finish is not pushed. Pushing cancel still creates directories.
   
   The directory creation comes from java/maven/.../BasicPanelVisual.store(WizardDescriptor d)
   ```
       void store(WizardDescriptor d) {
           ...
           d.putProperty(CommonProjectActions.PROJECT_PARENT_FOLDER, parentFolder);
           if (d instanceof TemplateWizard) {
               parentFolder.mkdirs();
               ((TemplateWizard) d).setTargetFolder(DataFolder.findFolder(FileUtil.toFileObject(parentFolder)));
           }
   ```
   The store method is called to save panel settings; it could be for cancel, finish, back, next.
   
   I don't know if this code is for convenience, to avoid later calculations, or if it's required. I'll file a 2nd issue for this.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] matthiasblaesing commented on a change in pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on a change in pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation
URL: https://github.com/apache/netbeans/pull/1980#discussion_r386612463
 
 

 ##########
 File path: java/maven/src/org/netbeans/modules/maven/newproject/BasicPanelVisual.java
 ##########
 @@ -562,7 +562,9 @@ void read(WizardDescriptor settings) {
         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();
 
 Review comment:
   Answering myself, yes this is broken (in `BasicPanelVisual#store`):
   
   ```java
           String name = projectNameTextField.getText().trim();
           String folder = createdFolderTextField.getText().trim();
           final File parentFolder = new File(folder);
           
           d.putProperty(CommonProjectActions.PROJECT_PARENT_FOLDER, parentFolder);
   ```
   
   I would rename `parentFolder` to `targetFolder` and change the last line to `d.putProperty(CommonProjectActions.PROJECT_PARENT_FOLDER, targetFolder.getParentFile());`. But that is untested.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] errael commented on a change in pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation

Posted by GitBox <gi...@apache.org>.
errael commented on a change in pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation
URL: https://github.com/apache/netbeans/pull/1980#discussion_r386651798
 
 

 ##########
 File path: java/maven/src/org/netbeans/modules/maven/newproject/BasicPanelVisual.java
 ##########
 @@ -562,7 +562,9 @@ void read(WizardDescriptor settings) {
         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();
 
 Review comment:
   The naming caused me considerable confusion. 
   
   Note that your suggestion `d.putProperty("projdir", folder.getParentFile())` produces different and incorrect results. The String value of the property name ...PROJECT_PARENT_FOLDER is "projdir"; and in older areas of code is a literal string rather than a define. Your suggestion, save folder.getParentFile() as property value was actually my first attempt to fix this. Things got weird and changes started radiating; reverted that attempt. The property "projdir" is globally used by the wizard infrastructure and it means the base directory of the new project and not the parent directory of the newly created project directory.
   
   After a circuitous route, I decided to find the the screen for a plain old java project. It is 
   `java/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/wizards/PanelProjectLocationVisual.java`
   and it uses the same names and has similar code to its maven counterpart. (Undoubtedly the prototype for this screen)
   
   So, while it's tempting to rename things so they make sense. I am hesitant to diverge from the original code. BTW, in the code you quote from the store() method, renaming the variable `parentFolder` to `projectDirectory` would be accurate. Then when the two lines are restored it would be like saying `projectLocation = projectDirectory.getParentFile()`. It could have read like that, but the original code was probably avoiding declaring new variables. Note that in the code in read() `projectLocation = ProjectChooser.getProjectsFolder()` retrieves the default value for where to put new projects the other branch of the "if" statement is working with the value of "projdir" and does ["projdir"].getParentFile(). 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] errael commented on issue #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation

Posted by GitBox <gi...@apache.org>.
errael commented on issue #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation
URL: https://github.com/apache/netbeans/pull/1980#issuecomment-592736632
 
 
   I filed a second issue, [NETBEANS-3918], which is about spurious directory creation. I'll check to see which, if any, of those issues might include the problem in [NETBEANS-3875]

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] matthiasblaesing commented on a change in pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on a change in pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation
URL: https://github.com/apache/netbeans/pull/1980#discussion_r387210839
 
 

 ##########
 File path: java/maven/src/org/netbeans/modules/maven/newproject/BasicPanelVisual.java
 ##########
 @@ -562,7 +562,9 @@ void read(WizardDescriptor settings) {
         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();
 
 Review comment:
   Ok - I might be wrong, but this is awfully lot text to say, that the project parent folder is not the project parent folder. We should at least try to get this straight, there might be more people like me, that read variables and think that they hold what they say. Sorry I can't say this without less irony.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] errael commented on a change in pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation

Posted by GitBox <gi...@apache.org>.
errael commented on a change in pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation
URL: https://github.com/apache/netbeans/pull/1980#discussion_r387325342
 
 

 ##########
 File path: java/maven/src/org/netbeans/modules/maven/newproject/BasicPanelVisual.java
 ##########
 @@ -562,7 +562,9 @@ void read(WizardDescriptor settings) {
         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();
 
 Review comment:
   I'm itching to clean this up, glad you brought it up again. Yes, verbose; just saying `123 != 123` seemed inadequate. And I want to record the situation so I don't have to reconstruct it again. It does seem that simply restoring two lines that were mistakenly removed is consistent with a minimal diff philosophy.
   
   PROJECT_PARENT_FOLDER should be renamed, maybe PROJECT_BASE_FOLDER (or just PROJECT_FOLDER); but that's an API change. PARENT could be deprecated in favor of BASE.
   
   How abut this one? (keeping it local)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] matthiasblaesing merged pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation

Posted by GitBox <gi...@apache.org>.
matthiasblaesing merged pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation
URL: https://github.com/apache/netbeans/pull/1980
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] errael commented on issue #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation

Posted by GitBox <gi...@apache.org>.
errael commented on issue #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation
URL: https://github.com/apache/netbeans/pull/1980#issuecomment-591047882
 
 
   Issue [NETBEANS-3918] for 2nd part about spurious directory creation.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] matthiasblaesing commented on a change in pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on a change in pull request #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation
URL: https://github.com/apache/netbeans/pull/1980#discussion_r386608745
 
 

 ##########
 File path: java/maven/src/org/netbeans/modules/maven/newproject/BasicPanelVisual.java
 ##########
 @@ -562,7 +562,9 @@ void read(WizardDescriptor settings) {
         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();
 
 Review comment:
   This looks like a contradiction to the name of the property in line 562. Could it be, that the property is set to the wrong value?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] AlexFalappa commented on issue #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation

Posted by GitBox <gi...@apache.org>.
AlexFalappa commented on issue #1980: [NETBEANS-2446] Use *parent* of saved projectFolder as projectLocation
URL: https://github.com/apache/netbeans/pull/1980#issuecomment-591999756
 
 
   Could this also fix [NETBEANS-3875](https://issues.apache.org/jira/browse/NETBEANS-3875) ?
   
   The issue is related to the New Project from Maven Archetype wizard that creates the folder before invoking maven archetype plugin and the specific archetype failing because of the existing empty folder.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists