Author: scabanovich
Date: 2010-09-28 10:23:37 -0400 (Tue, 28 Sep 2010)
New Revision: 25273
Modified:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/WebFlowTabbedPreferencesPage.java
Log:
JBIDE-6256
https://jira.jboss.org/browse/JBIDE-6256
Modified:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/WebFlowTabbedPreferencesPage.java
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/WebFlowTabbedPreferencesPage.java 2010-09-28
14:22:14 UTC (rev 25272)
+++
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/WebFlowTabbedPreferencesPage.java 2010-09-28
14:23:37 UTC (rev 25273)
@@ -10,8 +10,15 @@
******************************************************************************/
package org.jboss.tools.struts.ui.preferences;
+import java.util.Map;
+import java.util.TreeMap;
+
import org.jboss.tools.common.model.options.Preference;
import org.jboss.tools.common.model.ui.preferences.*;
+import org.eclipse.jface.text.templates.Template;
+import org.eclipse.jface.text.templates.persistence.TemplateStore;
+import org.eclipse.jst.jsp.ui.internal.JSPUIPlugin;
+import org.eclipse.jst.jsp.ui.internal.templates.TemplateContextTypeIdsJSP;
import org.eclipse.ui.*;
import org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintAList;
import org.jboss.tools.common.model.*;
@@ -44,12 +51,15 @@
}
void initTemplateList(XModelObject addView) {
- try {
- XAttributeConstraintAList l =
(XAttributeConstraintAList)addView.getModelEntity().getAttribute("Page
Template").getConstraint();
- l.setValues(new String[0]); //TODO compute !
- } catch (Exception e) {
- StrutsUIPlugin.getPluginLog().logError(e);
- }
+ if(addView == null) return;
+ TemplateStore store = JSPUIPlugin.getInstance().getTemplateStore();
+ Map<String, Template> templates = new TreeMap<String, Template>();
+ Template[] ts = store.getTemplates(TemplateContextTypeIdsJSP.NEW);
+ for (Template t: ts) {
+ templates.put(t.getName(), t);
+ }
+ XAttributeConstraintAList l =
(XAttributeConstraintAList)addView.getModelEntity().getAttribute("Page
Template").getConstraint(); //$NON-NLS-1$
+ l.setValues(templates.keySet().toArray(new String[0]));
}
}