Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-103

Cannot open Maven and node.js projects after New Project wizard

    XMLWordPrintableJSON

Details

    Description

      I have a wizard that creates two projects - one Maven and inside of it a node.js
      ready folder with `packages.json` file. I'd like the New Project wizard to open both projects.

      Currently only the Maven project is opened. Only if I patch NetBeans as:

      netbeans$ hg diff
      diff -r fcaaa60addf7 maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java
      --- a/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java      Tue Oct 17 16:38:27 2017 +0200
      +++ b/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java      Thu Oct 26 16:43:23 2017 +0200
      @@ -912,11 +912,17 @@
                   if (obj instanceof NbMavenProjectImpl) {
                       impl = ((NbMavenProjectImpl) obj);
                   } else {
      -                impl = ((Project) obj).getLookup().lookup(NbMavenProjectImpl.class);
      +                NbMavenProjectImpl realMaven = ((Project) obj).getLookup().lookup(NbMavenProjectImpl.class);
      +                if (realMaven != null && realMaven.getProjectDirectory().equals(((Project) obj).getProjectDirectory())) {
      +                    impl = realMaven;
      +                } else {
      +                    impl = null;
      +                }
                   }
                   if (impl != null) {
                       return getPOMFile().equals(impl.getPOMFile());
                   }
      +
               }
               return false;
           }
      diff -r fcaaa60addf7 projectui/src/org/netbeans/modules/project/ui/actions/NewProject.java
      --- a/projectui/src/org/netbeans/modules/project/ui/actions/NewProject.java     Tue Oct 17 16:38:27 2017 +0200
      +++ b/projectui/src/org/netbeans/modules/project/ui/actions/NewProject.java     Thu Oct 26 16:43:23 2017 +0200
      @@ -198,7 +198,7 @@
                                   if (newFo.isFolder()) {
                                       try {
                                           Project p = ProjectManager.getDefault().findProject(newFo);
      -                                    if (p != null && !ProjectConvertors.isConvertorProject(p)) {
      +                                    if (p != null) {
                                               // It is a project, so schedule it to open:
                                               projectsToOpen.add(p);
                                           } else {
      

      I am sure my patch isn't 100% correct and I am ready to adjust it according to here in provided suggestions.

      Attachments

        Activity

          People

            tzezula Tomas Zezula
            jtulach Jaroslav Tulach
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: