Permalink
Browse files

added new template action, and slightly better template default defin…

…ition
  • Loading branch information...
1 parent b47ec9e commit 6b5149bca1e4193f6aa678c35edcfadfe13a555c @sfultongv sfultongv committed Jan 31, 2012
@@ -30,11 +30,17 @@
description="create a cq5 component">
<add-to-group group-id="NewGroup" anchor="last"/>
</action>
+ <action id="velir.intellij.cq5.actions.content.NewTemplate" class="velir.intellij.cq5.actions.content.NewTemplate"
+ text="New Template"
+ description="create a cq5 template">
+ <add-to-group group-id="NewGroup" anchor="after"
+ relative-to-action="velir.intellij.cq5.actions.content.NewComponent"/>
+ </action>
<action id="velir.intellij.cq5.actions.content.NewNode" class="velir.intellij.cq5.actions.content.NewNode"
text="New Node"
description="create a cq5 node">
<add-to-group group-id="NewGroup" anchor="after"
- relative-to-action="velir.intellij.cq5.actions.content.NewComponent"/>
+ relative-to-action="velir.intellij.cq5.actions.content.NewTemplate"/>
</action>
<action id="velir.intellij.cq5.actions.content.EditNode" class="velir.intellij.cq5.actions.content.EditNode"
text="Edit Node"
@@ -0,0 +1,11 @@
+package velir.intellij.cq5.actions.content;
+
+import velir.intellij.cq5.jcr.model.VNode;
+import velir.intellij.cq5.jcr.model.VNodeDefinition;
+
+public class NewTemplate extends ANewNode {
+ @Override
+ public VNode getNode() {
+ return new VNode("newTemplate", VNodeDefinition.CQ_TEMPLATE);
+ }
+}
@@ -22,6 +22,7 @@
public static final String CQ_ISCONTAINER = "cq:isContainer";
public static final String CQ_DIALOG = "cq:Dialog";
public static final String CQ_TABPANEL = "cq:TabPanel";
+ public static final String CQ_TEMPLATE = "cq:Template";
public static final String CQ_WIDGET = "cq:Widget";
public static final String CQ_WIDGETCOLLECTION = "cq:WidgetCollection";
public static final String JCR_TITLE = "jcr:title";
@@ -175,6 +176,14 @@ public Object getDefaultValue() {
vNodeDefinition.childSuggestions.put("items", CQ_TABPANEL);
}
+ else if (CQ_TEMPLATE.equals(name)) {
+ vNodeDefinition.properties.put("allowedPaths", new VPropertyDefinitionI() {
+ public Object getDefaultValue() {
+ return "/content/.*";
+ }
+ });
+ }
+
else if (CQ_WIDGETCOLLECTION.equals(name)) {
vNodeDefinition.childSuggestions.put("widget", CQ_WIDGET);
}

0 comments on commit 6b5149b

Please sign in to comment.