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 12040 - Do not display nontemplates files in the New.
Summary: Do not display nontemplates files in the New.
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards (show other bugs)
Version: 3.x
Hardware: Sun Solaris
: P4 blocker (vote)
Assignee: Pavel Flaska
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-05-09 15:15 UTC by Jan Zajicek
Modified: 2008-12-22 23:57 UTC (History)
0 users

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 Jan Zajicek 2001-05-09 15:15:40 UTC
Files that are not templates and are located in Templates folder structure
should not be displayed in the new from template.
Comment 1 Jesse Glick 2001-05-09 15:44:24 UTC
I have not seen such a problem. E.g. apisupport has tons of files which are
under Templates/ which are not marked as templates, only for use in .group's.
They do not appear. [3.2 release]
Comment 2 Jan Zajicek 2001-05-10 08:30:28 UTC
Create under userdirectory folder system/Templates/Other and copy to this folder
a java source file. Then invoke in the explorer context menu on some directory
and expand New | Other. Now in this submenu there will be one item, the java
source you added above and when selecting it, nothing happens. Note, in the new
from template dialog isn't the java source displayed.
Comment 3 Jesse Glick 2001-05-10 12:27:15 UTC
Yes, quite true--just the popup menu is broken.
Comment 4 Pavel Flaska 2001-09-05 12:50:08 UTC
Taking this.
Comment 5 Pavel Flaska 2001-09-07 09:58:26 UTC
Suggested fix: Changes in NewTemplateAction.java: Overload createNodes method in inner class TemplateChildren, filter 
non-templates instances. Remove copyNode method, there is no need of this method.

Index: NewTemplateAction.java
===================================================================
RCS file: /usr/local/tigris/data/helm/cvs/repository/openide/src/org/openide/actions/NewTemplateAction.java,v
retrieving revision 1.48
diff -u -r1.48 NewTemplateAction.java
--- NewTemplateAction.java	2001/08/02 08:02:50	1.48
+++ NewTemplateAction.java	2001/09/07 08:41:48
@@ -421,17 +421,27 @@
         public TemplateChildren (Node or) {
             super (or);
         }
-
-        protected Node copyNode (Node n) {
-            DataFolder df = (DataFolder)n.getCookie (DataFolder.class);
-            if (df == null || df.isTemplate ()) {
-                // on normal nodes stop recursion
-                return new FilterNode (n, LEAF);
-            } else {
-                // on folders use normal filtering
-                return new FilterNode (n, new TemplateChildren (n));
+        
+        /** Creates nodes for nodes.
+         */
+        protected Node[] createNodes (Object key) {
+            Node n = (Node)key;
+            
+            DataObject obj = (DataObject)n.getCookie (DataObject.class);
+            if (obj != null) {
+                if (obj.isTemplate ()) {
+                    // on normal nodes stop recursion
+                    return new Node[] { new FilterNode (n, LEAF) };
+                }
+            
+                if (acceptObj (obj)) {
+                    // on folders use normal filtering
+                    return new Node[] { new FilterNode (n, new TemplateChildren (n)) };
+                }
             }
+            return new Node[] {};
         }
+
     }
 
 }
Comment 6 David Strupl 2001-09-07 12:49:44 UTC
Fixed in NewTemplateAction 1.49.
Comment 7 Jan Zajicek 2001-09-10 15:51:10 UTC
verified dev#20010910
Comment 8 Quality Engineering 2003-07-01 16:35:23 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.