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.
Double click on the template file done from the Tools | Options | Source Creation and Management should _open_ the template rather than trying to create a new file based on that template.
Actually, all templates behave like this, so it is probably a core issue rather than java-specific one.
Dafe, I am not sure you are responsible, feel free to reassigne. This behaviour is there long time (3.3, ... ). Each template has action Open - that open template file in Source Editor, but default action for these nodes is "Create new".
OS/Platform independent issue.
I have changed version from 4.0 dev to S1S 4.2 (Nevada).
The current behavior is intentional; see DataNode.getDefaultAction. TBD whether it is *desirable* of course. I also tend to find it annoying.
Jesse, should the default action be changed? If found annoying ...
Well, it has been the way it is since long ago, as far as I know. Personally I don't like it. May be good to ask the opinion of someone from HIE.
Jano, could you look at it please and let us know what should be the default (if any)? I'm going to help David S with this issue.
No action should be the default on a template node. By the way what is the name of the current default action which invokes the wizard. I can't find the action in the contextual menu of a template.
Thanx. The default action is o.o.a.InstantiateAction and it is not shown in the popup menu. I'm going to remove it.
Could probably @deprecate InstantiateAction.java, too. The action situation re. NewAction, NewTemplateAction (& NewTemplateCallableAction?), and InstantiateAction is confusing enough for someone reading the API docs that it may be helpful to deprecate some just to reduce the number of choices of what to look at! :-)
The issue can be easily fixed by modifing DataNode.getDefaultAction to return null in case the DO is template. But JavaDoc for this methods says that *it will* return InstanceAction when DO is template, so from this point of view it is API contract which I will break? Or UI API contract? :-) I agree with Jesse. I will deprecate the InstantiateAction action. I grepped the sources and it is not used anywhere (it is in html/HtmlDataNode and in properties/FileEntryNode, but it is copy&paste from DataNode). The behaviour of DataNode will be incompatibly changed and documented. What should I recommend as replacement (just for the sake of properly documented deprecation)? 1.) write your own action which calls TemplateWizard.instantiate(yourDO) 2.) use NewTemplateAction (it is not 100% replacement, but something very similar to InstantiateAction) OK?
IMHO - (1) I guess it is an API change, but not one to worry about; Javadoc should have said e.g. "In the current implementation..." but it did not, that is probably my mistake long ago. :-) (2) No need for any suggested replacement in the @deprecated message I think - just say that it should be avoided.
Implemented in files: Checking in openide/openide-spec-vers.properties; new revision: 1.107; previous revision: 1.106 Checking in openide/api/doc/changes/apichanges.xml; new revision: 1.144; previous revision: 1.143 Checking in openide/src/org/openide/actions/InstantiateAction.java; new revision: 1.30; previous revision: 1.29 Checking in openide/src/org/openide/loaders/DataNode.java; new revision: 1.78; previous revision: 1.77 Checking in html/src/org/netbeans/modules/html/HtmlDataNode.java; new revision: 1.6; previous revision: 1.5 Checking in properties/src/org/netbeans/modules/properties/FileEntryNode.java new revision: 1.16; previous revision: 1.15
verifed in 20030325350