### Eclipse Workspace Patch 1.0 #P org.jboss.tools.vpe Index: src/org/jboss/tools/vpe/editor/template/VpeTemplateFileList.java =================================================================== --- src/org/jboss/tools/vpe/editor/template/VpeTemplateFileList.java (revision 33486) +++ src/org/jboss/tools/vpe/editor/template/VpeTemplateFileList.java (working copy) @@ -7,7 +7,7 @@ * * Contributors: * Exadel, Inc. and Red Hat, Inc. - initial API and implementation - ******************************************************************************/ + ******************************************************************************/ package org.jboss.tools.vpe.editor.template; import java.io.IOException; @@ -34,10 +34,9 @@ VpeTemplateFileList() { } - + void load() { - VpeTemplateFile newAutoTemplateFile = new VpeTemplateFile( - VpeTemplateManager.getAutoTemplates(), null); + VpeTemplateFile newAutoTemplateFile = new VpeTemplateFile(VpeTemplateManager.getAutoTemplates(), null); changed = (autoTemplateFile == null) != (newAutoTemplateFile == null); if (!changed && autoTemplateFile != null) { changed = !autoTemplateFile.isEqual(newAutoTemplateFile); @@ -57,51 +56,50 @@ autoTemplateFile = newAutoTemplateFile; templateFiles = newTemplateFiles; } - + VpeTemplateFile getAutoTemplateFile() { return autoTemplateFile; } - + VpeTemplateFile[] getTemplateFiles() { return templateFiles; } - + boolean isChanged() { return changed; } - + private VpeTemplateFile[] createTemplateFileList() { List templateList = createTemplateFileListImpl(); return templateList.toArray(new VpeTemplateFile[templateList.size()]); } - + private List createTemplateFileListImpl() { List templateList = new ArrayList(); - IExtensionRegistry registry = Platform.getExtensionRegistry(); - IExtensionPoint extensionPoint = registry.getExtensionPoint(VpePlugin.EXTESION_POINT_VPE_TEMPLATES); - IExtension[] extensions = extensionPoint.getExtensions(); - for (int i=0;i 0) { if (nameSpaceIdentifyer == null || nameSpaceIdentifyer.length() == 0) { @@ -1055,6 +1069,9 @@ template.init(templateElement, caseSensitive); template = new VpeTemplateSafeWrapper(template); } + if (template != null) { + template.setPriority(Double.parseDouble(priority)); + } return template; } Index: src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java =================================================================== --- src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java (revision 33486) +++ src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java (working copy) @@ -84,6 +84,8 @@ /** The pseudo content creator. */ private VpePseudoContentCreator pseudoContentCreator; + + protected double priority = 0.0; /** The Constant TAG_BREAKER. */ private static final String TAG_BREAKER = VpeTemplateManager.VPE_PREFIX @@ -1430,4 +1432,10 @@ return new Region(offset, 0); } + final public double getPriority() { + return priority; + } + final public void setPriority(double priority) { + this.priority = priority; + } } Index: src/org/jboss/tools/vpe/editor/template/VpeTemplateSet.java =================================================================== --- src/org/jboss/tools/vpe/editor/template/VpeTemplateSet.java (revision 33486) +++ src/org/jboss/tools/vpe/editor/template/VpeTemplateSet.java (working copy) @@ -30,7 +30,7 @@ } void setDefTemplate(VpeTemplate defTemplate) { - if (this.defTemplate == null) { + if (this.defTemplate == null || this.defTemplate.getPriority() < defTemplate.getPriority()) { this.defTemplate = defTemplate; } } Index: src/org/jboss/tools/vpe/editor/template/VpeTemplate.java =================================================================== --- src/org/jboss/tools/vpe/editor/template/VpeTemplate.java (revision 33486) +++ src/org/jboss/tools/vpe/editor/template/VpeTemplate.java (working copy) @@ -466,4 +466,7 @@ */ public IRegion getSourceRegionForOpenOn(VpePageContext pageContext, Node sourceNode,nsIDOMNode domNode); + public double getPriority(); + public void setPriority(double priority); + } \ No newline at end of file