Author: scabanovich
Date: 2009-04-24 12:26:28 -0400 (Fri, 24 Apr 2009)
New Revision: 14911
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/FaceletTaglibXMLFormLayoutData.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4213
Support for facelet-taglib xml added to XModel
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2009-04-24 16:25:45 UTC (rev
14910)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2009-04-24 16:26:28 UTC (rev
14911)
@@ -34,9 +34,23 @@
<extension id="e" name="XML Editors"
point="org.jboss.tools.common.model.ui.xmlEditor">
- <xmlEditor class="org.jboss.tools.jsf.ui.editor.FacesConfigEditor"
contributorClass="org.jboss.tools.jsf.ui.action.JSFMultiPageContributor"
entities="FacesConfig,FacesConfig11,FacesConfig12"
icon="images/xstudio/editors/jsf.gif" name="%editors.jsf.name">
+ <xmlEditor
+ class="org.jboss.tools.jsf.ui.editor.FacesConfigEditor"
+
contributorClass="org.jboss.tools.jsf.ui.action.JSFMultiPageContributor"
+ entities="FacesConfig,FacesConfig11,FacesConfig12"
+ icon="images/xstudio/editors/jsf.gif"
+ name="%editors.jsf.name">
</xmlEditor>
+
+ <xmlEditor
+ class="org.jboss.tools.jst.web.ui.editors.WebCompoundEditor"
+
contributorClass="org.jboss.tools.common.model.ui.texteditors.MultiPageContributor"
+ entities="FileFaceletTaglib"
+ icon="images/xstudio/editors/jsf.gif"
+ name="FaceletTaglib">
+ </xmlEditor>
</extension>
+
<extension point="org.eclipse.ui.editors">
<editor
contributorClass="org.jboss.tools.jsf.ui.action.JSFMultiPageContributor"
@@ -320,6 +334,9 @@
class="org.jboss.tools.jsf.ui.editor.form.ApplicationConfigForm"/>
<xclass id="org.jboss.tools.jsf.ui.editor.form.LocaleConfigForm"
class="org.jboss.tools.jsf.ui.editor.form.LocaleConfigForm"/>
+
+ <xclass
id="org.jboss.tools.jsf.ui.editor.form.FaceletTaglibXMLFormLayoutData"
+ class="org.jboss.tools.jsf.ui.editor.form.FaceletTaglibXMLFormLayoutData"/>
</extension>
<extension
point="org.eclipse.ui.perspectiveExtensions">
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/FaceletTaglibXMLFormLayoutData.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/FaceletTaglibXMLFormLayoutData.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/FaceletTaglibXMLFormLayoutData.java 2009-04-24
16:26:28 UTC (rev 14911)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.ui.editor.form;
+
+import java.util.*;
+
+import org.jboss.tools.common.meta.XModelEntity;
+import org.jboss.tools.common.meta.impl.XModelMetaDataImpl;
+import org.jboss.tools.common.model.util.ClassLoaderUtil;
+import org.jboss.tools.common.model.ui.forms.*;
+import org.jboss.tools.jsf.facelet.model.FaceletTaglibConstants;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class FaceletTaglibXMLFormLayoutData implements IFormLayoutData,
FaceletTaglibConstants {
+ static {
+ ClassLoaderUtil.init();
+ }
+
+ public static String EMPTY_DESCRIPTION = ""; //$NON-NLS-1$
+
+ private final static IFormData[] FORM_LAYOUT_DEFINITIONS = new IFormData[] {
+
+
+ };
+
+ private static Map<String,IFormData> FORM_LAYOUT_DEFINITION_MAP =
Collections.synchronizedMap(new ArrayToMap(FORM_LAYOUT_DEFINITIONS));
+
+ private static FaceletTaglibXMLFormLayoutData INSTANCE = new
FaceletTaglibXMLFormLayoutData();
+
+ public static IFormLayoutData getInstance() {
+ return INSTANCE;
+ }
+
+ private FaceletTaglibXMLFormLayoutData() {}
+
+ public IFormData getFormData(String entityName) {
+ IFormData data = (IFormData)FORM_LAYOUT_DEFINITION_MAP.get(entityName);
+ if(data == null) {
+ data = generateDefaultFormData(entityName);
+ }
+ return data;
+ }
+
+ private IFormData generateDefaultFormData(String entityName) {
+ IFormData data = null;
+ XModelEntity entity = XModelMetaDataImpl.getInstance().getEntity(entityName);
+ if(entity != null) {
+ data = generateDefaultFormData(entity);
+ }
+ if(data != null) {
+ FORM_LAYOUT_DEFINITION_MAP.put(entityName, data);
+ }
+ return data;
+ }
+
+ private IFormData generateDefaultFormData(XModelEntity entity) {
+ String entityName = entity.getName();
+ List<IFormData> list = new ArrayList<IFormData>();
+ IFormData g = ModelFormLayoutData.createGeneralFormData(entity);
+ if(g != null) list.add(g);
+// if(entityName.startsWith(PREACTION_PREFIX)) {
+// if(entity.getChild(ENT_ESB_ROUTE_TO) != null) {
+// list.add(ESBListsFormLayoutData.ESB_ROUTE_LIST_DEFINITION);
+// }
+// //do nothing; when specific children exist use specific forms
+// } else if(entity.getChild(ENT_ESB_PROPERTY) != null) {
+// list.add(ESBListsFormLayoutData.ESB_PROPERTY_LIST_DEFINITION);
+// }
+ IFormData a = ModelFormLayoutData.createAdvancedFormData(entityName);
+ if(a != null) list.add(a);
+ IFormData[] ds = list.toArray(new IFormData[0]);
+ IFormData data = new FormData(entityName, new String[]{null}, ds);
+ return data;
+ }
+
+}