Author: vrubezhny
Date: 2011-03-17 19:31:54 -0400 (Thu, 17 Mar 2011)
New Revision: 29898
Added:
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/WebContent/resources/stylesheet/
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/WebContent/resources/stylesheet/style.css
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/JSF2CSSStylesheetOpenOnTest.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/META-INF/MANIFEST.MF
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/pom.xml
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/pom.xml
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/WebContent/pages/inputname.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/JsfTextExtAllTests.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.text.ext/pom.xml
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web.kb/pom.xml
trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/include.exsd
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextDefinition.java
Log:
JBIDE-8216
jsf-tags breaks wtp-capibilites
Issue is fixed
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/META-INF/MANIFEST.MF
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/META-INF/MANIFEST.MF 2011-03-17
23:02:50 UTC (rev 29897)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/META-INF/MANIFEST.MF 2011-03-17
23:31:54 UTC (rev 29898)
@@ -14,5 +14,5 @@
org.jboss.tools.jsf.text.ext
Export-Package: org.jboss.tools.jsf.text.ext.facelets,
org.jboss.tools.jsf.text.ext.facelets.hyperlink
-Bundle-Version: 3.2.0.qualifier
+Bundle-Version: 3.3.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/plugin.xml 2011-03-17 23:02:50
UTC (rev 29897)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/plugin.xml 2011-03-17 23:31:54
UTC (rev 29898)
@@ -324,5 +324,10 @@
<attribute name="src" />
</tag>
</include>
+ <jsf2cssholder
uri="http://java.sun.com/jsf/html">
+ <tag name="outputStylesheet">
+ <attribute name="name" />
+ </tag>
+ </jsf2cssholder>
</extension>
</plugin>
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/pom.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/pom.xml 2011-03-17 23:02:50
UTC (rev 29897)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/pom.xml 2011-03-17 23:31:54
UTC (rev 29898)
@@ -8,6 +8,6 @@
</parent>
<groupId>org.jboss.tools.jsf.plugins</groupId>
<artifactId>org.jboss.tools.jsf.text.ext.facelets</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.3.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/META-INF/MANIFEST.MF 2011-03-17
23:02:50 UTC (rev 29897)
+++ trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/META-INF/MANIFEST.MF 2011-03-17
23:31:54 UTC (rev 29898)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.jboss.tools.jsf.text.ext.test
-Bundle-Version: 3.2.0.qualifier
+Bundle-Version: 3.3.0.qualifier
Require-Bundle: org.junit,
org.jboss.tools.jsf.text.ext,
org.eclipse.ui.workbench.texteditor,
@@ -11,18 +11,18 @@
org.jboss.tools.common.text.ext,
org.jboss.tools.common.model,
org.jboss.tools.tests,
- org.jboss.tools.common.model.ui;bundle-version="3.1.0",
- org.eclipse.core.commands;bundle-version="3.5.0",
- org.eclipse.jface;bundle-version="3.5.2",
- org.jboss.tools.jst.jsp;bundle-version="3.1.0",
- org.jboss.tools.vpe;bundle-version="3.1.0",
- org.jboss.tools.jst.web.ui;bundle-version="3.1.0",
- org.jboss.tools.jst.css;bundle-version="3.1.0",
- org.jboss.tools.common.el.core;bundle-version="3.1.0",
- org.jboss.tools.jst.text.ext;bundle-version="3.1.0",
- org.jboss.tools.jsf.text.ext.facelets;bundle-version="3.1.0",
- org.jboss.tools.jsf.text.ext.richfaces;bundle-version="3.1.0",
- org.jboss.tools.jsf.ui;bundle-version="3.1.0",
+ org.jboss.tools.common.model.ui,
+ org.eclipse.core.commands,
+ org.eclipse.jface,
+ org.jboss.tools.jst.jsp,
+ org.jboss.tools.vpe,
+ org.jboss.tools.jst.web.ui,
+ org.jboss.tools.jst.css,
+ org.jboss.tools.common.el.core,
+ org.jboss.tools.jst.text.ext,
+ org.jboss.tools.jsf.text.ext.facelets,
+ org.jboss.tools.jsf.text.ext.richfaces,
+ org.jboss.tools.jsf.ui,
org.eclipse.jst.standard.schemas
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor.0
Modified: trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/pom.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/pom.xml 2011-03-17 23:02:50 UTC (rev
29897)
+++ trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/pom.xml 2011-03-17 23:31:54 UTC (rev
29898)
@@ -10,7 +10,7 @@
</parent>
<groupId>org.jboss.tools.jsf.tests</groupId>
<artifactId>org.jboss.tools.jsf.text.ext.test</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.3.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/WebContent/pages/inputname.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/WebContent/pages/inputname.xhtml 2011-03-17
23:02:50 UTC (rev 29897)
+++
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/WebContent/pages/inputname.xhtml 2011-03-17
23:31:54 UTC (rev 29898)
@@ -12,6 +12,8 @@
xmlns:jar="http://java.sun.com/jsf/composite/jarPage"
xmlns:jar1="http://java.sun.com/jsf/composite/jarPage1">
+ <h:outputStylesheet name="stylesheet/style.css"
type="text/css"/>
+
<ui:define name="pageTitle">Input User Name</ui:define>
<ui:define name="pageHeader">Facelets Hello
Application</ui:define>
@@ -21,13 +23,14 @@
<h:outputText
value="${registeredMsgs['demo.long.named.property']}" />
<h:outputText value="${pageMsgs.prompt}" />
<h:outputText value="${pageMsgs['demo.long.named.property']}"
/>
+ <div class="info">
<form>
<jar:echo1 echo="Hello" />
<jar:echo echo="Hello" />
<jar:echo anknownAttr="1" echo="Hello" />
<jar1:echo echo="Hello" />
</form>
-
+ </div>
</ui:define>
</ui:composition>
</html>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/WebContent/resources/stylesheet/style.css
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/WebContent/resources/stylesheet/style.css
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/WebContent/resources/stylesheet/style.css 2011-03-17
23:31:54 UTC (rev 29898)
@@ -0,0 +1,29 @@
+html {
+ overflow-y: scroll;
+}
+
+body {
+ font-size: 12px;
+ margin: 0px;
+}
+
+a img {
+ border: none;
+}
+
+h1 {
+ font-size: 1.6em;
+ margin-top: 0;
+}
+
+div.info {
+ font-size: 1.2em;
+}
+
+ul.bullets {
+ list-style: square;
+}
+
+ul.bullets li {
+ padding-bottom: 2px;
+}
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/projects/JSF2CompositeOpenOn/WebContent/resources/stylesheet/style.css
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/JSF2CSSStylesheetOpenOnTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/JSF2CSSStylesheetOpenOnTest.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/JSF2CSSStylesheetOpenOnTest.java 2011-03-17
23:31:54 UTC (rev 29898)
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.text.ext.test;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.FindReplaceDocumentAdapter;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.common.text.ext.hyperlink.HyperlinkDetector;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.WorkbenchUtils;
+
+/**
+ *
+ * @author jeremy
+ *
+ */
+public class JSF2CSSStylesheetOpenOnTest extends TestCase {
+ private static final String PROJECT_NAME = "JSF2CompositeOpenOn";
+ private static final String PAGE_NAME =
PROJECT_NAME+"/WebContent/pages/inputname.xhtml";
+
+ public IProject project = null;
+
+ protected void setUp() {
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ PROJECT_NAME);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
+ JobUtils.waitForIdle();
+ }
+
+ protected void tearDown() {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
+ }
+
+ public JSF2CSSStylesheetOpenOnTest() {
+ super("JSF2 OpenOn on CSS Stylesheets test");
+ }
+
+ public void testJSF2CSSStylesheetOpenOn() throws PartInitException, BadLocationException
{
+ final String editorName = "style.css";
+ final String tagName = "outputStylesheet";
+ final String valueToFind = "style.css";
+ IEditorPart editor = WorkbenchUtils.openEditor(PAGE_NAME);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JobUtils.waitForIdle();
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IDocument document = viewer.getDocument();
+ IRegion reg = new FindReplaceDocumentAdapter(document).find(0,
+ tagName, true, true, false, false);
+ assertNotNull("Tag:"+tagName+" not found",reg);
+
+ reg = new FindReplaceDocumentAdapter(document).find(reg.getOffset(),
+ valueToFind, true, true, false, false);
+ assertNotNull("Value to find:"+valueToFind+" not found",reg);
+
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg,
true); // new Region(reg.getOffset() + reg.getLength(), 0)
+
+ assertNotNull("Hyperlinks for value:"+valueToFind+" are not
found",links);
+
+ assertTrue("Hyperlinks for value:"+valueToFind+" are not
found",links.length!=0);
+
+ boolean found = false;
+ for(IHyperlink link : links){
+ assertNotNull(link.toString());
+
+ link.open();
+ JobUtils.waitForIdle(2000);
+
+ IEditorPart resultEditor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if(editorName.equals(resultEditor.getTitle())){
+ found = true;
+ return;
+ }
+ }
+ assertTrue("OpenOn have not opened "+editorName+" editor",found);
+ }
+
+ public void testJSF2CSSClassOpenOn() throws PartInitException, BadLocationException {
+ final String editorName = "style.css";
+ final String tagName = "div";
+ final String valueToFind = "info";
+ IEditorPart editor = WorkbenchUtils.openEditor(PAGE_NAME);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JobUtils.waitForIdle();
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IDocument document = viewer.getDocument();
+ IRegion reg = new FindReplaceDocumentAdapter(document).find(0,
+ tagName, true, true, false, false);
+ assertNotNull("Tag:"+tagName+" not found",reg);
+
+ reg = new FindReplaceDocumentAdapter(document).find(reg.getOffset(),
+ valueToFind, true, true, false, false);
+ assertNotNull("Value to find:"+valueToFind+" not found",reg);
+
+ IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg,
true); // new Region(reg.getOffset() + reg.getLength(), 0)
+
+ assertNotNull("Hyperlinks for value:"+valueToFind+" are not
found",links);
+
+ assertTrue("Hyperlinks for value:"+valueToFind+" are not
found",links.length!=0);
+
+ boolean found = false;
+ for(IHyperlink link : links){
+ assertNotNull(link.toString());
+
+ link.open();
+ JobUtils.waitForIdle(2000);
+
+ IEditorPart resultEditor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if(editorName.equals(resultEditor.getTitle())){
+ found = true;
+ return;
+ }
+ }
+ assertTrue("OpenOn have not opened "+editorName+" editor",found);
+ }
+
+}
\ No newline at end of file
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/JSF2CSSStylesheetOpenOnTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/JsfTextExtAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/JsfTextExtAllTests.java 2011-03-17
23:02:50 UTC (rev 29897)
+++
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/JsfTextExtAllTests.java 2011-03-17
23:31:54 UTC (rev 29898)
@@ -31,6 +31,10 @@
"org.jboss.tools.jsf.text.ext.test",
new String[]{"projects/JSF2CompositeOpenOn"},
new String[]{"JSF2CompositeOpenOn"}));
+ suite.addTest(new ProjectImportTestSetup(new
TestSuite(JSF2CSSStylesheetOpenOnTest.class),
+ "org.jboss.tools.jsf.text.ext.test",
+ new String[]{"projects/JSF2CompositeOpenOn"},
+ new String[]{"JSF2CompositeOpenOn"}));
return suite;
}
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/META-INF/MANIFEST.MF 2011-03-17
23:02:50 UTC (rev 29897)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/META-INF/MANIFEST.MF 2011-03-17
23:31:54 UTC (rev 29898)
@@ -5,7 +5,7 @@
org.jboss.tools.jst.text.ext.hyperlink,
org.jboss.tools.jst.text.ext.hyperlink.jsp,
org.jboss.tools.jst.text.ext.util
-Bundle-Version: 3.2.0.qualifier
+Bundle-Version: 3.3.0.qualifier
Bundle-Name: %Bundle-Name.0
Bundle-ManifestVersion: 2
Bundle-Vendor: %providerName
@@ -25,8 +25,8 @@
org.eclipse.jst.jsp.core;visibility:=reexport,
org.eclipse.wst.common.modulecore;visibility:=reexport,
org.eclipse.pde.ui,
- org.jboss.tools.common.el.core;bundle-version="2.0.0",
- org.eclipse.emf.ecore;bundle-version="2.5.0",
+ org.jboss.tools.common.el.core,
+ org.eclipse.emf.ecore,
org.eclipse.wst.css.core,
org.eclipse.wst.html.core,
org.jboss.tools.jst.web.kb
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/pom.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/pom.xml 2011-03-17 23:02:50 UTC (rev
29897)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/pom.xml 2011-03-17 23:31:54 UTC (rev
29898)
@@ -8,6 +8,6 @@
</parent>
<groupId>org.jboss.tools.jst.plugins</groupId>
<artifactId>org.jboss.tools.jst.text.ext</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.3.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java 2011-03-17
23:02:50 UTC (rev 29897)
+++
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java 2011-03-17
23:31:54 UTC (rev 29898)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2011 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink;
@@ -76,7 +76,7 @@
for (int r = 0; rules != null && r < rules.getLength(); r++) {
if (isRuleMatch(rules.item(r), getStyleName(region))) {
CSSRule rule = rules.item(r);
- IFile file = findFileForCSSStyleSheet(descr.source);
+ IFile file = findFileForCSSStyleSheet(descr.getFilePath());
if (file != null) {
int startOffset = 0;
if (descr.sheet.getOwnerNode() != null) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2011-03-17 23:02:50
UTC (rev 29897)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2011-03-17 23:31:54
UTC (rev 29898)
@@ -3,7 +3,7 @@
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.jboss.tools.jst.web.kb;singleton:=true
Bundle-Localization: plugin
-Bundle-Version: 3.2.0.qualifier
+Bundle-Version: 3.3.0.qualifier
Bundle-Activator: org.jboss.tools.jst.web.kb.WebKbPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/pom.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/pom.xml 2011-03-17 23:02:50 UTC (rev
29897)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/pom.xml 2011-03-17 23:31:54 UTC (rev
29898)
@@ -8,6 +8,6 @@
</parent>
<groupId>org.jboss.tools.jst.tests</groupId>
<artifactId>org.jboss.tools.jst.web.kb</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.3.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/include.exsd
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/include.exsd 2011-03-17 23:02:50
UTC (rev 29897)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/include.exsd 2011-03-17 23:31:54
UTC (rev 29898)
@@ -166,6 +166,27 @@
</complexType>
</element>
+ <element name="jsf2cssholder">
+ <annotation>
+ <documentation>
+ Defines a CSS holder item.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="tag" minOccurs="0"
maxOccurs="unbounded"/>
+ <element ref="attribute" minOccurs="0"
maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="uri" type="string"
use="required">
+ <annotation>
+ <documentation>
+ An URI for this element.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
<annotation>
<appInfo>
<meta.section type="since"/>
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2011-03-17
23:02:50 UTC (rev 29897)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2011-03-17
23:31:54 UTC (rev 29898)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
+ * Copyright (c) 2011 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,
@@ -631,14 +631,23 @@
}
if (context instanceof ICSSContainerSupport) {
if(IncludeContextBuilder.isCSSStyleSheetContainer(uri, tagName)) {
- fillCSSStyleSheetFromElement(node, (ICSSContainerSupport)context);
+ fillCSSStyleSheetFromElement(node, (ICSSContainerSupport)context, false);
+ } else if(IncludeContextBuilder.isJSF2CSSStyleSheetContainer(uri, tagName)) {
+ fillCSSStyleSheetFromElement(node, (ICSSContainerSupport)context, true);
} else {
String[] cssAttributes = IncludeContextBuilder.getCSSStyleSheetAttributes(uri,
tagName);
if (cssAttributes != null) {
for (String attr : cssAttributes) {
- fillCSSStyleSheetFromAttribute(node, attr, (ICSSContainerSupport)context);
+ fillCSSStyleSheetFromAttribute(node, attr, (ICSSContainerSupport)context,
false);
}
}
+ cssAttributes = IncludeContextBuilder.getJSF2CSSStyleSheetAttributes(uri,
tagName);
+ if (cssAttributes != null) {
+ for (String attr : cssAttributes) {
+ fillCSSStyleSheetFromAttribute(node, attr, (ICSSContainerSupport)context, true);
+ }
+ }
+
}
}
}
@@ -744,27 +753,62 @@
}
private void fillCSSStyleSheetFromAttribute(IDOMElement node,
- String attribute, ICSSContainerSupport context) {
- CSSStyleSheetDescriptor descr = getSheetForTagAttribute(node, attribute);
+ String attribute, ICSSContainerSupport context, boolean jsf2Source) {
+ CSSStyleSheetDescriptor descr = getSheetForTagAttribute(node, attribute, jsf2Source);
if (descr != null)
context.addCSSStyleSheetDescriptor(descr);
}
private void fillCSSStyleSheetFromElement(IDOMElement node,
- ICSSContainerSupport context) {
+ ICSSContainerSupport context, boolean jsf2Source) {
CSSStyleSheet sheet = getSheetForTag(node);
- if (sheet != null)
- context.addCSSStyleSheetDescriptor(new
CSSStyleSheetDescriptor(context.getResource().getFullPath().toString(), sheet));
+ if (sheet != null) {
+ String library = null;
+ if (jsf2Source) {
+ Attr libraryAttr = node.getAttributeNode("library"); //$NON-NLS-1$
+ if (libraryAttr != null && libraryAttr.getNodeValue() != null) {
+ library = libraryAttr.getNodeValue().trim();
+ library = library.length() == 0 ? null : library;
+ }
+ }
+
+ context.addCSSStyleSheetDescriptor(new
CSSStyleSheetDescriptor(context.getResource().getFullPath().toString(), sheet, jsf2Source,
library));
+ }
}
+ private static final String JSF2_RESOURCES_FOLDER = "/resources";
//$NON-NLS-1$
+
public static class CSSStyleSheetDescriptor {
public CSSStyleSheet sheet;
public String source;
+ public boolean jsf2Source;
+ public String jsf2Library;
+ /*
CSSStyleSheetDescriptor (String source, CSSStyleSheet sheet) {
+ this(source, sheet, false);
+ }
+ */
+
+ CSSStyleSheetDescriptor (String source, CSSStyleSheet sheet, boolean jsf2Source, String
jsf2Library) {
this.source = source;
this.sheet = sheet;
+ this.jsf2Source = jsf2Source;
+ this.jsf2Library = jsf2Library;
}
+
+ public String getFilePath() {
+ if (!jsf2Source)
+ return source;
+
+ if (jsf2Library != null) {
+ String library = jsf2Library.trim();
+ if (library.length() != 0) {
+ return JSF2_RESOURCES_FOLDER + '/' + library + '/' + source;
+ }
+ }
+ return JSF2_RESOURCES_FOLDER + '/' + source;
+ }
}
/**
@@ -772,7 +816,7 @@
* @param stylesContainer
* @return
*/
- private CSSStyleSheetDescriptor getSheetForTagAttribute(final Node stylesContainer,
String attribute) {
+ private CSSStyleSheetDescriptor getSheetForTagAttribute(final Node stylesContainer,
String attribute, boolean jsf2Source) {
INodeNotifier notifier = (INodeNotifier) stylesContainer;
CSSStyleSheet sheet = null;
String source = null;
@@ -783,7 +827,7 @@
if (!(adapter instanceof ExtendedLinkElementAdapter)) {
notifier.removeAdapter(adapter);
adapter = new ExtendedLinkElementAdapter(
- (Element) stylesContainer, attribute);
+ (Element) stylesContainer, attribute, jsf2Source);
sheet = (CSSStyleSheet) adapter.getSheet();
source = ((ExtendedLinkElementAdapter)adapter).getSource();
if (sheet != null && source != null) {
@@ -798,7 +842,16 @@
}
- return sheet == null || source == null ? null : new CSSStyleSheetDescriptor(source,
sheet);
+ String library = null;
+ if (jsf2Source && stylesContainer instanceof Element) {
+ Attr libraryAttr = ((Element)stylesContainer).getAttributeNode("library");
//$NON-NLS-1$
+ if (libraryAttr != null && libraryAttr.getNodeValue() != null) {
+ library = libraryAttr.getNodeValue().trim();
+ library = library.length() == 0 ? null : library;
+ }
+ }
+
+ return sheet == null || source == null ? null : new CSSStyleSheetDescriptor(source,
sheet, jsf2Source, library);
}
/**
@@ -1018,10 +1071,13 @@
private Element element;
private String hrefAttrName;
private String source = null;
+ private boolean jsf2Source;
+ private String prefix = null;
- public ExtendedLinkElementAdapter(Element element, String hrefAttrName) {
+ public ExtendedLinkElementAdapter(Element element, String hrefAttrName, boolean
jsf2Source) {
this.element = element;
this.hrefAttrName = hrefAttrName;
+ this.jsf2Source = jsf2Source;
}
@Override
@@ -1051,6 +1107,19 @@
if (super.isValidAttribute()) {
source = getSourceFromAttribute("href"); //$NON-NLS-1$
} else if (isValidAttribute()) {
+ if (jsf2Source) {
+ String library = null;
+ Attr libraryAttr = element.getAttributeNode("library"); //$NON-NLS-1$
+ if (libraryAttr != null && libraryAttr.getNodeValue() != null) {
+ library = libraryAttr.getNodeValue().trim();
+ library = library.length() == 0 ? null : library;
+ }
+ if (library != null) {
+ prefix = JSF2_RESOURCES_FOLDER + '/' + library + '/';
+ } else {
+ prefix = JSF2_RESOURCES_FOLDER + '/';
+ }
+ }
source = getSourceFromAttribute(hrefAttrName);
} else {
return null;
@@ -1091,7 +1160,7 @@
URLModelProvider provider = new URLModelProvider();
try {
IStructuredModel newModel = provider.getModelForRead(baseModel,
- source);
+ prefix == null ? source : prefix + source);
if (newModel == null)
return null;
if (!(newModel instanceof ICSSModel)) {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java 2011-03-17
23:02:50 UTC (rev 29897)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextBuilder.java 2011-03-17
23:31:54 UTC (rev 29898)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
+ * Copyright (c) 2011 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,
@@ -36,6 +36,7 @@
public static final String TAG_CONTEXTTYPE = "contexttype"; //$NON-NLS-1$
public static final String TAG_CONTENTTYPE = "contenttype"; //$NON-NLS-1$
public static final String TAG_CSSHOLDER = "cssholder"; //$NON-NLS-1$
+ public static final String TAG_JSF2CSSHOLDER = "jsf2cssholder"; //$NON-NLS-1$
public static final String ATT_ID = "id"; //$NON-NLS-1$
public static final String ATT_URI = "uri"; //$NON-NLS-1$
@@ -205,7 +206,7 @@
protected boolean readElement(IConfigurationElement element) {
String tag = element.getName();
- if (tag.equals(TAG_INCLUDE) || tag.equals(TAG_CSSHOLDER)) {
+ if (tag.equals(TAG_INCLUDE) || tag.equals(TAG_CSSHOLDER) ||
tag.equals(TAG_JSF2CSSHOLDER)) {
processIncludeContextElement(element);
// make sure processing of current open on tag resulted in a current definition
@@ -364,6 +365,43 @@
}
/**
+ * Checks if the specified tag is a JSF2 CSS Style Sheet container
+ *
+ * @param uri
+ * @param tagName
+ * @return
+ */
+ public static boolean isJSF2CSSStyleSheetContainer(String uri, String tagName) {
+ if (uri == null)
+ return false;
+
+ List<IncludeContextDefinition> defs =
IncludeContextBuilder.getInstance().getIncludeContextDefinitions();
+ if (defs == null)
+ return false;
+
+ boolean isHolder = false;
+ for (IncludeContextDefinition def : defs) {
+ if (uri.equals(def.getUri())) {
+ String[] defTags = def.getJSF2CSSTags();
+ if (defTags != null) {
+ for (String tag : defTags) {
+ if (tagName.equals(tag) || ("".equals(uri) &&
tagName.equalsIgnoreCase(tag))) { //$NON-NLS-1$
+ isHolder = true;
+ // Check that the tag have no attributes defined
+ // If so - the tag itself is used to define the CSS
+ // But if the tag has at least one attribute defined - it's not the holder
+ String[] attrs = def.getJSF2CSSTagAttributes(tagName);
+ isHolder ^= (attrs != null && attrs.length > 0);
+ }
+ }
+ }
+ }
+ }
+
+ return isHolder;
+ }
+
+ /**
* Returns the CSS Style Sheet attributes that represent a CSS Style Sheet container
*
* @param uri
@@ -392,4 +430,34 @@
return attrs.size() == 0 ? null : attrs.toArray(new String[attrs.size()]);
}
+
+ /**
+ * Returns the JSF2 CSS Style Sheet attributes that represent a CSS Style Sheet
container
+ *
+ * @param uri
+ * @param tagName
+ * @return
+ */
+ public static String[] getJSF2CSSStyleSheetAttributes(String uri, String tagName) {
+ if (uri == null)
+ return null;
+
+ List<IncludeContextDefinition> defs =
IncludeContextBuilder.getInstance().getIncludeContextDefinitions();
+ if (defs == null)
+ return null;
+
+ List<String> attrs = new ArrayList<String>();
+
+ for (IncludeContextDefinition def : defs) {
+ if (uri.equals(def.getUri())) {
+ String[] defAttrs = def.getJSF2CSSTagAttributes(tagName);
+ if (defAttrs != null) {
+ for (String attr : defAttrs) attrs.add(attr);
+ }
+ }
+ }
+
+ return attrs.size() == 0 ? null : attrs.toArray(new String[attrs.size()]);
+
+ }
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextDefinition.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextDefinition.java 2011-03-17
23:02:50 UTC (rev 29897)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/include/IncludeContextDefinition.java 2011-03-17
23:31:54 UTC (rev 29898)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
+ * Copyright (c) 2011 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,
@@ -27,6 +27,7 @@
private String fUri;
private Map<String, Set<String>> fIncludeTags; // Map<TagName,
Set<AttributeName>>
private Map<String, Set<String>> fCSSTags; // Map<TagName,
Set<AttributeName>>
+ private Map<String, Set<String>> fJSF2CSSTags; // Map<TagName,
Set<AttributeName>>
private Map<String, Set<String>> fContexts; // Map<ContextType,
Set<ContentType>>
/**
@@ -72,6 +73,9 @@
} else if (isInParentElements(element, IncludeContextBuilder.TAG_CSSHOLDER)) {
addCSSTag(tagName, element);
return true;
+ } else if (isInParentElements(element, IncludeContextBuilder.TAG_JSF2CSSHOLDER)) {
+ addJSF2CSSTag(tagName, element);
+ return true;
}
return false;
}
@@ -109,6 +113,23 @@
fCSSTags.put(tagName, tagSet);
}
}
+
+ /**
+ * Adds a CSS Style Sheet holder to the Definition
+ *
+ * @param tagName
+ * @param element
+ */
+ private void addJSF2CSSTag(String tagName, IConfigurationElement element) {
+ if (fJSF2CSSTags == null) {
+ fJSF2CSSTags = new HashMap<String, Set<String>>();
+ }
+ Set<String> tagSet = fJSF2CSSTags.get(tagName);
+ if (tagSet == null) {
+ tagSet = new HashSet<String>();
+ fJSF2CSSTags.put(tagName, tagSet);
+ }
+ }
/**
* Adds a Tag Attribute to the Definition
@@ -145,6 +166,12 @@
}
fCSSTags.get(parentTagName).add(attributeName);
+ } else if (isInParentElements(element, IncludeContextBuilder.TAG_JSF2CSSHOLDER)) {
+ if (fJSF2CSSTags.get(parentTagName) == null) {
+ addJSF2CSSTag(parentTagName, parentTagElement);
+ }
+
+ fJSF2CSSTags.get(parentTagName).add(attributeName);
}
}
@@ -235,6 +262,15 @@
return fCSSTags == null ? EMPTY_CHILDREN :
(String[])fCSSTags.keySet().toArray(new String[fCSSTags.size()]);
}
+ /**
+ * Returns the JSF2 CSS Style Sheet holder Tags stored in the Definition
+ *
+ * @return
+ */
+ public String[] getJSF2CSSTags() {
+ return fJSF2CSSTags == null ? EMPTY_CHILDREN :
+ (String[])fJSF2CSSTags.keySet().toArray(new String[fJSF2CSSTags.size()]);
+ }
/**
* Returns the Attributes for the Include Tag with the specified Name
@@ -243,13 +279,17 @@
* @return
*/
public String[] getIncludeTagAttributes(String tagName) {
- if ("".equals(fUri)) //$NON-NLS-1$
- tagName = tagName.toLowerCase();
+ return getTagAttributes(fIncludeTags, tagName);
+ }
- Set<String> attrSet = fIncludeTags == null ? null : fIncludeTags.get(tagName);
-
- return attrSet == null ? EMPTY_CHILDREN :
- (String[])attrSet.toArray(new String[attrSet.size()]);
+ /**
+ * Returns the Attributes for the CSS Style Sheet Holder Tag with the specified Name
+ *
+ * @param tagName
+ * @return
+ */
+ public String[] getCSSTagAttributes(String tagName) {
+ return getTagAttributes(fCSSTags, tagName);
}
/**
@@ -258,11 +298,15 @@
* @param tagName
* @return
*/
- public String[] getCSSTagAttributes(String tagName) {
+ public String[] getJSF2CSSTagAttributes(String tagName) {
+ return getTagAttributes(fJSF2CSSTags, tagName);
+ }
+
+ private String[] getTagAttributes (Map<String, Set<String>> tags, String
tagName) {
if ("".equals(fUri)) //$NON-NLS-1$
tagName = tagName.toLowerCase();
- Set<String> attrSet = fCSSTags == null ? null : fCSSTags.get(tagName);
+ Set<String> attrSet = tags == null ? null : tags.get(tagName);
return attrSet == null ? EMPTY_CHILDREN :
(String[])attrSet.toArray(new String[attrSet.size()]);