diff -r b8470e9b3bac cnd/src/org/netbeans/modules/cnd/resources/mf-layer.xml --- a/cnd/src/org/netbeans/modules/cnd/resources/mf-layer.xml Wed Nov 03 16:50:14 2010 +0100 +++ b/cnd/src/org/netbeans/modules/cnd/resources/mf-layer.xml Wed Nov 03 18:03:50 2010 +0100 @@ -122,6 +122,7 @@ + @@ -157,6 +158,7 @@ + @@ -311,6 +313,7 @@ + diff -r b8470e9b3bac favorites/arch.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/favorites/arch.xml Wed Nov 03 18:03:50 2010 +0100 @@ -0,0 +1,1091 @@ + + +]> + + + + &api-questions; + + + + +

+ This module implements Favorites tab and Template Manager. +

+
+ + + + + +

+ XXX no answer for arch-quality +

+
+ + + + + +

+ XXX no answer for arch-time +

+
+ + + + + +

+ XXX no answer for arch-usecases +

+
+ + + + + +

+ XXX no answer for arch-what +

+
+ + + + + + + + + + + + +

+ none. +

+
+ + + + + +

+ Yes. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ Yes. +

+
+ + + + + +

+ XXX no answer for dep-jre +

+
+ + + + + +

+ JRE is enough. +

+
+ + + + + + + + + + + + +

+ Freemarker org.netbeans.libs.freemarker. +

+
+ + + + + +

+ It runs on any platform. +

+
+ + + + + +

+ XXX no answer for deploy-dependencies +

+
+ + + + + +

+ XXX no answer for deploy-jar +

+
+ + + + + +

+ XXX no answer for deploy-nbm +

+
+ + + + + +

+ XXX no answer for deploy-packages +

+
+ + + + + +

+ XXX no answer for deploy-shared +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ Templates Manager reads some file attributes of template files. + They can also be stored in the module layer. Please see filesystems for more + information about this. +

+ + + If set to Boolean.TRUE the template file is allowed to be edited. + If set to Boolean.FALSE the template file is not allowed to be edited. + If not set, the template file is allowed to be edited iff the associated + node provides EditCookie or OpenCookie. + + + + Value of this attribute can be an instance of Editable, + that is used to edit the teplate file. + + +
+ + + + + +

+ XXX no answer for exec-introspection +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ XXX no answer for exec-threading +

+
+ + + + + +

+ None. +

+
+ + + + + +

+ None. +

+
+ + + + + +

+ None. +

+
+ + + + + +

+ To find FileObject, DataObject, EditCookie or OpenCookie from Node. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ Template Manager, Favorites view. Only simple UI controls. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ XXX no answer for perf-mem +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ XXX no answer for perf-scale +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ Yes. Module layer with Favorites view and Templates action. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ Reads Template folder to allow to manage templates. +

+
+ + + + + +

+ No. +

+
+ + + + + +

+ No. +

+
+ +
diff -r b8470e9b3bac favorites/nbproject/project.properties --- a/favorites/nbproject/project.properties Wed Nov 03 16:50:14 2010 +0100 +++ b/favorites/nbproject/project.properties Wed Nov 03 18:03:50 2010 +0100 @@ -43,3 +43,4 @@ javac.source=1.6 test.config.stable.includes=\ gui/core/favorites/BasicsTest.class +javadoc.arch=${basedir}/arch.xml diff -r b8470e9b3bac favorites/src/org/netbeans/modules/favorites/templates/TemplatesAction.java --- a/favorites/src/org/netbeans/modules/favorites/templates/TemplatesAction.java Wed Nov 03 16:50:14 2010 +0100 +++ b/favorites/src/org/netbeans/modules/favorites/templates/TemplatesAction.java Wed Nov 03 18:03:50 2010 +0100 @@ -56,6 +56,7 @@ import java.util.Iterator; import java.util.Set; import javax.swing.JButton; +import org.netbeans.api.actions.Editable; import org.openide.awt.Mnemonics; import org.openide.cookies.EditCookie; import org.openide.cookies.OpenCookie; @@ -77,6 +78,10 @@ */ public class TemplatesAction extends CallableSystemAction { + private static final String CAN_EDIT_TEMPLATE = "templateCanEdit"; // NOI18N + + private static final String EDITABLE_TEMPLATE = "templateEditable"; // NOI18N + /** Weak reference to the dialog showing singleton Template Manager. */ private Reference dialogWRef = new WeakReference (null); @@ -166,6 +171,14 @@ Iterator/**/ it = nodes2open.iterator (); while (it.hasNext ()) { Node n = (Node) it.next (); + DataObject dobj = n.getLookup().lookup(DataObject.class); + assert dobj != null : "DataObject for node " + n; + FileObject fo = dobj.getPrimaryFile (); + Object editableObj = fo.getAttribute(EDITABLE_TEMPLATE); + if (editableObj instanceof Editable) { + ((Editable) editableObj).edit(); + continue; + } EditCookie ec = n.getLookup ().lookup (EditCookie.class); if (ec != null) { ec.edit (); @@ -185,23 +198,32 @@ if (ExplorerManager.PROP_SELECTED_NODES.equals (evt.getPropertyName ())) { Node [] nodes = (Node []) evt.getNewValue (); boolean res = nodes != null && nodes.length > 0; - int i = 0; - while (res && i < nodes.length) { + for (int i = 0; res && i < nodes.length; i++) { Node n = nodes [i]; + DataObject dobj = n.getLookup().lookup(DataObject.class); + assert dobj != null : "DataObject for node " + n; + FileObject fo = dobj.getPrimaryFile (); + Object canEdit = fo.getAttribute(CAN_EDIT_TEMPLATE); + if (Boolean.TRUE.equals(canEdit)) { + res = true; + continue; + } + if (Boolean.FALSE.equals(canEdit)) { + res = false; + continue; + } EditCookie ec = n.getLookup().lookup(EditCookie.class); - OpenCookie oc = n.getLookup().lookup(OpenCookie.class); - res = ec != null || oc != null; + res = ec != null; + if (!res) { + OpenCookie oc = n.getLookup().lookup(OpenCookie.class); + res = oc != null; + } // 65037: Template Manager should not offer to Open in Editor an empty pseudotemplate if (res) { - DataObject dobj = n.getLookup().lookup(DataObject.class); - assert dobj != null : "DataObject for node " + n; - FileObject fo = dobj.getPrimaryFile (); File f = FileUtil.toFile (fo); res = f != null || fo.getSize () > 0; } - - i++; } b.setEnabled (res); }