Author: scabanovich
Date: 2009-05-21 10:33:31 -0400 (Thu, 21 May 2009)
New Revision: 15389
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletTag.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletTagLibrary.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbResourceVisitor.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbXMLStoreConstants.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/XMLScanner.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractAttribute.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/TLDLibrary.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/TLDTag.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java 2009-05-21
14:20:23 UTC (rev 15388)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java 2009-05-21
14:33:31 UTC (rev 15389)
@@ -180,11 +180,15 @@
}
}
XModelObject old = pushModelObject(context);
- XMLStoreHelper.saveMap(element, attributesInfo, "attributes", context);
+ saveAttributesInfo(element, context);
popModelObject(context, old);
return element;
}
+ protected void saveAttributesInfo(Element element, Properties context) {
+ XMLStoreHelper.saveMap(element, attributesInfo, "attributes", context);
+ }
+
public void loadXML(Element element, Properties context) {
String s = element.getAttribute(XMLStoreConstants.ATTR_PATH);
if(s != null && s.length() > 0) {
@@ -204,10 +208,14 @@
}
}
XModelObject old = pushModelObject(context);
- XMLStoreHelper.loadMap(element, attributesInfo, "attributes", context);
+ loadAttributesInfo(element, context);
popModelObject(context, old);
}
+ protected void loadAttributesInfo(Element element, Properties context) {
+ XMLStoreHelper.loadMap(element, attributesInfo, "attributes", context);
+ }
+
protected XModelObject pushModelObject(Properties context) {
XModelObject old = (XModelObject)context.get(XMLStoreConstants.KEY_MODEL_OBJECT);
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2009-05-21
14:20:23 UTC (rev 15388)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2009-05-21
14:33:31 UTC (rev 15389)
@@ -41,6 +41,7 @@
import org.jboss.tools.jst.web.kb.internal.scanner.ClassPathMonitor;
import org.jboss.tools.jst.web.kb.internal.scanner.LoadedDeclarations;
import org.jboss.tools.jst.web.kb.internal.taglib.AbstractTagLib;
+import org.jboss.tools.jst.web.kb.internal.taglib.FaceletTagLibrary;
import org.jboss.tools.jst.web.kb.internal.taglib.TLDLibrary;
import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
import org.w3c.dom.Element;
@@ -360,6 +361,8 @@
AbstractTagLib tagLib = null;
if(KbXMLStoreConstants.CLS_TLD_LIBRARY.equals(cls)) {
tagLib = new TLDLibrary();
+ } else if(KbXMLStoreConstants.CLS_FACELET_LIBRARY.equals(cls)) {
+ tagLib = new FaceletTagLibrary();
} else {
//consider other cases;
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbResourceVisitor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbResourceVisitor.java 2009-05-21
14:20:23 UTC (rev 15388)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbResourceVisitor.java 2009-05-21
14:33:31 UTC (rev 15389)
@@ -100,7 +100,9 @@
}
}
if(webinf != null) {
- if(webinf.isPrefixOf(path) || path.isPrefixOf(webinf)) {
+ if(webinf.isPrefixOf(path) || path.isPrefixOf(webinf)
+ || webinf.removeLastSegments(1).isPrefixOf(path) //Webroot
+ ) {
return true;
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbXMLStoreConstants.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbXMLStoreConstants.java 2009-05-21
14:20:23 UTC (rev 15388)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbXMLStoreConstants.java 2009-05-21
14:33:31 UTC (rev 15389)
@@ -22,6 +22,7 @@
public String TAG_ATTRIBUTE = "attribute"; //$NON-NLS-1$
public String CLS_TLD_LIBRARY = "tld"; //$NON-NLS-1$
+ public String CLS_FACELET_LIBRARY = "facelet"; //$NON-NLS-1$
public String ATTR_URI = "uri"; //$NON-NLS-1$
public String ATTR_SHORT_NAME = "short-name"; //$NON-NLS-1$
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/XMLScanner.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/XMLScanner.java 2009-05-21
14:20:23 UTC (rev 15388)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/XMLScanner.java 2009-05-21
14:33:31 UTC (rev 15389)
@@ -11,32 +11,24 @@
package org.jboss.tools.jst.web.kb.internal.scanner;
import java.util.HashSet;
-import java.util.Map;
import java.util.Set;
-import java.util.StringTokenizer;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.jboss.tools.common.meta.XAttribute;
-import org.jboss.tools.common.meta.XModelEntity;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.FolderImpl;
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.project.ext.store.XMLStoreConstants;
-import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.model.util.NamespaceMapping;
import org.jboss.tools.jst.web.kb.IKbProject;
import org.jboss.tools.jst.web.kb.internal.taglib.AbstractAttribute;
import org.jboss.tools.jst.web.kb.internal.taglib.AbstractComponent;
import org.jboss.tools.jst.web.kb.internal.taglib.AbstractTagLib;
+import org.jboss.tools.jst.web.kb.internal.taglib.FaceletTag;
+import org.jboss.tools.jst.web.kb.internal.taglib.FaceletTagLibrary;
import org.jboss.tools.jst.web.kb.internal.taglib.TLDAttribute;
import org.jboss.tools.jst.web.kb.internal.taglib.TLDLibrary;
import org.jboss.tools.jst.web.kb.internal.taglib.TLDTag;
@@ -47,6 +39,8 @@
* @author Viacheslav Kabanovich
*/
public class XMLScanner implements IFileScanner {
+ public static final String ATTR_TAGCLASS ="tagclass"; //$NON-NLS-1$
+ public static final String ATTR_BODY_CONTENT = "bodycontent"; //$NON-NLS-1$
public XMLScanner() {}
@@ -155,8 +149,8 @@
tag.setName(new XMLValueInfo(t, XMLStoreConstants.ATTR_NAME));
tag.setDescription(new XMLValueInfo(t, AbstractComponent.DESCRIPTION));
- tag.setComponentClass(new XMLValueInfo(t, "tagclass"));
- tag.setCanHaveBody(new XMLValueInfo(t, "bodycontent"));
+ tag.setComponentClass(new XMLValueInfo(t, ATTR_TAGCLASS));
+ tag.setCanHaveBody(new XMLValueInfo(t, ATTR_BODY_CONTENT));
//TODO
// tag.setComponentType(componentType);
@@ -180,8 +174,26 @@
}
private void parseFaceletTaglib(XModelObject o, IPath source, IKbProject sp,
LoadedDeclarations ds) {
+ FaceletTagLibrary library = new FaceletTagLibrary();
+ library.setId(o);
+ library.setURI(new XMLValueInfo(o, AbstractTagLib.URI));
+
+ ds.getLibraries().add(library);
+
XModelObject[] os = o.getChildren();
-
+ for (XModelObject t: os) {
+ String entity = t.getModelEntity().getName();
+ if(entity.startsWith("FaceletTaglibTag")) {
+ FaceletTag tag = new FaceletTag();
+ tag.setId(t);
+ tag.setName(new XMLValueInfo(t, "tag-name"));
+ //what else?
+
+ library.addComponent(tag);
+ } else if(entity.startsWith("FaceletTaglibFunction")) {
+ //TODO
+ }
+ }
}
}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractAttribute.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractAttribute.java 2009-05-21
14:20:23 UTC (rev 15388)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractAttribute.java 2009-05-21
14:33:31 UTC (rev 15389)
@@ -15,6 +15,7 @@
import java.util.Properties;
import org.jboss.tools.common.el.core.resolver.ELResolver;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.project.ext.IValueInfo;
import org.jboss.tools.common.model.project.ext.event.Change;
import org.jboss.tools.common.model.project.ext.store.XMLStoreConstants;
@@ -24,6 +25,7 @@
import org.jboss.tools.jst.web.kb.internal.KbObject;
import org.jboss.tools.jst.web.kb.internal.KbXMLStoreConstants;
import org.jboss.tools.jst.web.kb.taglib.IAttribute;
+import org.jboss.tools.jst.web.model.project.ext.store.XMLValueInfo;
import org.w3c.dom.Element;
/**
@@ -160,4 +162,25 @@
//TODO
}
+ @Override
+ protected void saveAttributesInfo(Element element, Properties context) {
+ if(context.get(XMLStoreConstants.KEY_MODEL_OBJECT) == getId()) {
+
+ } else {
+ super.saveAttributesInfo(element, context);
+ }
+ }
+
+ @Override
+ protected void loadAttributesInfo(Element element, Properties context) {
+ if(context.get(XMLStoreConstants.KEY_MODEL_OBJECT) == getId()) {
+ XModelObject a = (XModelObject)getId();
+ attributesInfo.put(XMLStoreConstants.ATTR_NAME, new XMLValueInfo(a,
XMLStoreConstants.ATTR_NAME));
+ attributesInfo.put(AbstractComponent.DESCRIPTION, new XMLValueInfo(a,
AbstractComponent.DESCRIPTION));
+ attributesInfo.put(REQUIRED, new XMLValueInfo(a, REQUIRED));
+ } else {
+ super.loadAttributesInfo(element, context);
+ }
+ }
+
}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java 2009-05-21
14:20:23 UTC (rev 15388)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java 2009-05-21
14:33:31 UTC (rev 15389)
@@ -327,7 +327,7 @@
}
for (IAttribute c: attributes.values()) {
- ((KbObject)c).toXML(parent, context);
+ ((KbObject)c).toXML(element, context);
}
return element;
@@ -340,6 +340,9 @@
if(name == null && element.hasAttribute(XMLStoreConstants.ATTR_NAME)) {
name = element.getAttribute(XMLStoreConstants.ATTR_NAME);
}
+ setDescription(attributesInfo.get(DESCRIPTION));
+ setComponentClass(attributesInfo.get(COMPONENT_CLASS));
+ setCanHaveBody(attributesInfo.get(BODY_CONTENT));
//TODO
//componentType?
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java 2009-05-21
14:20:23 UTC (rev 15388)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java 2009-05-21
14:33:31 UTC (rev 15389)
@@ -241,7 +241,7 @@
saveAttributeValues(element);
for (IComponent c: components.values()) {
- ((KbObject)c).toXML(parent, context);
+ ((KbObject)c).toXML(element, context);
}
popModelObject(context, old);
@@ -264,6 +264,8 @@
AbstractComponent c = null;
if(KbXMLStoreConstants.CLS_TLD_LIBRARY.equals(cls)) {
c = new TLDTag();
+ } else if(KbXMLStoreConstants.CLS_FACELET_LIBRARY.equals(cls)) {
+ c = new FaceletTag();
} else {
//consider other cases;
}
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletTag.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletTag.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletTag.java 2009-05-21
14:33:31 UTC (rev 15389)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.jst.web.kb.internal.taglib;
+
+import org.jboss.tools.jst.web.kb.internal.KbXMLStoreConstants;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class FaceletTag extends AbstractComponent {
+
+ public String getXMLClass() {
+ return KbXMLStoreConstants.CLS_FACELET_LIBRARY;
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletTag.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletTagLibrary.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletTagLibrary.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletTagLibrary.java 2009-05-21
14:33:31 UTC (rev 15389)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.jst.web.kb.internal.taglib;
+
+import org.jboss.tools.jst.web.kb.internal.KbXMLStoreConstants;
+import org.jboss.tools.jst.web.kb.taglib.IELFunction;
+import org.jboss.tools.jst.web.kb.taglib.IFaceletTagLibrary;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class FaceletTagLibrary extends AbstractTagLib implements
+ IFaceletTagLibrary {
+
+ public FaceletTagLibrary() {
+
+ }
+
+ public IELFunction[] getFunctions() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public FaceletTagLibrary clone() throws CloneNotSupportedException {
+ FaceletTagLibrary copy = (FaceletTagLibrary)super.clone();
+ return copy;
+ }
+
+ public String getXMLClass() {
+ return KbXMLStoreConstants.CLS_FACELET_LIBRARY;
+ }
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletTagLibrary.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/TLDLibrary.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/TLDLibrary.java 2009-05-21
14:20:23 UTC (rev 15388)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/TLDLibrary.java 2009-05-21
14:33:31 UTC (rev 15389)
@@ -62,6 +62,10 @@
}
+ public TLDLibrary clone() throws CloneNotSupportedException {
+ return (TLDLibrary)super.clone();
+ }
+
public String getXMLClass() {
return KbXMLStoreConstants.CLS_TLD_LIBRARY;
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/TLDTag.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/TLDTag.java 2009-05-21
14:20:23 UTC (rev 15388)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/TLDTag.java 2009-05-21
14:33:31 UTC (rev 15389)
@@ -10,7 +10,14 @@
******************************************************************************/
package org.jboss.tools.jst.web.kb.internal.taglib;
+import java.util.Properties;
+
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.project.ext.store.XMLStoreConstants;
import org.jboss.tools.jst.web.kb.internal.KbXMLStoreConstants;
+import org.jboss.tools.jst.web.kb.internal.scanner.XMLScanner;
+import org.jboss.tools.jst.web.model.project.ext.store.XMLValueInfo;
+import org.w3c.dom.Element;
public class TLDTag extends AbstractComponent {
@@ -18,4 +25,27 @@
return KbXMLStoreConstants.CLS_TLD_LIBRARY;
}
+ @Override
+ protected void saveAttributesInfo(Element element, Properties context) {
+ if(context.get(XMLStoreConstants.KEY_MODEL_OBJECT) == getId()) {
+
+ } else {
+ super.saveAttributesInfo(element, context);
+ }
+ }
+
+ @Override
+ protected void loadAttributesInfo(Element element, Properties context) {
+ if(context.get(XMLStoreConstants.KEY_MODEL_OBJECT) == getId()) {
+ XModelObject a = (XModelObject)getId();
+ attributesInfo.put(XMLStoreConstants.ATTR_NAME, new XMLValueInfo(a,
XMLStoreConstants.ATTR_NAME));
+ attributesInfo.put(AbstractComponent.DESCRIPTION, new XMLValueInfo(a,
AbstractComponent.DESCRIPTION));
+ attributesInfo.put(COMPONENT_CLASS, new XMLValueInfo(a, XMLScanner.ATTR_TAGCLASS));
+ attributesInfo.put(BODY_CONTENT, new XMLValueInfo(a, XMLScanner.ATTR_BODY_CONTENT));
+ //TODO other attributes as in XMLScanner
+ } else {
+ super.loadAttributesInfo(element, context);
+ }
+ }
+
}