This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 214254 - New folder in root of favorites folder - unable to proceed step
Summary: New folder in root of favorites folder - unable to proceed step
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Projects UI (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on: 51978 186943 208919
Blocks:
  Show dependency tree
 
Reported: 2012-06-15 07:13 UTC by jannavratil
Modified: 2013-01-22 15:13 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jannavratil 2012-06-15 07:13:51 UTC
Following test fail, because no such option is shown in menu

1.1 Test suite: Favorites

New folder in root of favorites folder
1    Select a root of mounted folder in Favorites (e.g. your home folder).
2    Perform popup New | Folder on the selected node.
3    The New folder dialog is shown. Type "MyFolder" and then push the OK button. 
EXPECTED RESULT: Folder "MyFolder" is created in the selected folder. 

Test result: fails in step 2 - no "Folder" option is shown


Tested on:
Product Version: NetBeans IDE Dev (Build 201206080001)
Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
Comment 1 Ondrej Vrabec 2012-06-15 10:02:29 UTC
the action should be added in org.netbeans.modules.project.ui.NoProjectNew.getTemplates() - for some reason Templates/Other/file is found but Templates/Other/Folder not. Probably related to bug #20891.
Comment 2 Martin Entlicher 2012-06-15 15:14:12 UTC
I've already found the cause. The problem is, that org.openide.filesystems.Repository.getDefault().getDefaultFileSystem().findResource("Templates/Other/Folder") returns null.
This is caused by http://hg.netbeans.org/main/rev/ecd5369886ab
in particular:
<folder name="Other">
  <file name="Folder_hidden"/>
</folder>

Folder should be generated by NewFileIterator.folderIterator(), but it changes the name.

This fixes this issue:
diff -r 10c265058592 projectui/src/org/netbeans/modules/project/ui/NoProjectNew.java
--- a/projectui/src/org/netbeans/modules/project/ui/NoProjectNew.java	Thu Jun 14 17:12:15 2012 +0200
+++ b/projectui/src/org/netbeans/modules/project/ui/NoProjectNew.java	Fri Jun 15 17:07:27 2012 +0200
@@ -209,7 +209,7 @@
                 tList.add( template );
             }
                         
-            template = findTemplate( "Templates/Other/Folder" ); 
+            template = findTemplate( "Templates/Other/org-netbeans-modules-project-ui-NewFileIterator-folderIterator" ); 
             if ( template != null ) {
                 tList.add( template );
             }

But IMHO the correct fix would be:

diff -r 10c265058592 projectui/src/org/netbeans/modules/project/ui/NewFileIterator.java
--- a/projectui/src/org/netbeans/modules/project/ui/NewFileIterator.java	Thu Jun 14 17:12:15 2012 +0200
+++ b/projectui/src/org/netbeans/modules/project/ui/NewFileIterator.java	Fri Jun 15 17:08:16 2012 +0200
@@ -96,7 +96,8 @@
         displayName="#folderIterator",
         iconBase="org/openide/loaders/defaultFolder.gif",
         description="templatesFolder.html",
-        category="simple-files"
+        category="simple-files",
+        id="Folder"
     )
     @Messages("folderIterator=Folder")
     public static NewFileIterator folderIterator () {

But I do not know, how to reliably replace the original Other/Folder with this one. We hit issue #208919 here.
Comment 3 Martin Entlicher 2012-06-15 15:18:04 UTC
IMHO it would be worth to at least use
Templates/Other/org-netbeans-modules-project-ui-NewFileIterator-folderIterator
in NB 7.2 so that the Folder action is threre and prepare a better fix into 7.3.
Comment 4 Jesse Glick 2012-06-15 16:16:43 UTC
(In reply to comment #2)
> This fixes this issue:

Good enough I think; bug #208919 might not be fixed.
Comment 5 Milos Kleint 2012-06-19 08:22:56 UTC
the first suggested patch of changing the template didn't work for me. even a clean build of the entire netbeans codebase only resulted in "Empty file" on the home folder's popup
Comment 6 Milos Kleint 2012-10-03 07:16:04 UTC
I cannot see other solution then getting rid of the annotation and do the manual registration in projectui again..
Comment 7 Milos Kleint 2012-10-03 10:53:46 UTC
http://hg.netbeans.org/core-main/rev/06e75927b26b

i've fixed the problem by reverting the annotation based registration for Folder
Comment 8 Jesse Glick 2012-10-03 13:42:15 UTC
Probably a fix of bug #51978 would work as well.
Comment 9 Quality Engineering 2012-10-07 02:03:06 UTC
Integrated into 'main-golden', will be available in build *201210070002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/06e75927b26b
User: Milos Kleint <mkleint@netbeans.org>
Log: #214254 revert the template registration annotation for folder which is sort of a special case.