JBoss Tools SVN: r21804 - trunk/hibernatetools/docs/reference/en-US.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2010-04-29 13:23:46 -0400 (Thu, 29 Apr 2010)
New Revision: 21804
Modified:
trunk/hibernatetools/docs/reference/en-US/plugins.xml
Log:
https://jira.jboss.org/jira/browse/TOOLSDOC-18 - New annotations support in Hibernate platform for Dali - 4.13.3. Hibernate Annotations Support Chapter is updated
Modified: trunk/hibernatetools/docs/reference/en-US/plugins.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en-US/plugins.xml 2010-04-29 16:50:52 UTC (rev 21803)
+++ trunk/hibernatetools/docs/reference/en-US/plugins.xml 2010-04-29 17:23:46 UTC (rev 21804)
@@ -24,14 +24,20 @@
<section id="download_base_project">
<title>Download base project</title>
<para>You can download example projects which are used for this chapter.</para>
- <para><property>JPA base project</property> is available on <ulink url="http://docs.jboss.org/tools/resources/">documentation resources page </ulink> together with <ulink url="http://docs.jboss.org/tools/resources/TestHibernateproject_for_hibernate_...">base Java project</ulink>.</para>
- <para>Also you need start <ulink url="http://docs.jboss.org/tools/resources/GSG_database.zip">database</ulink>.</para>
+ <para><property>JPA base project</property> is available on <ulink
+ url="http://docs.jboss.org/tools/resources/">documentation resources page </ulink>
+ together with <ulink
+ url="http://docs.jboss.org/tools/resources/TestHibernateproject_for_hibernate_..."
+ >base Java project</ulink>.</para>
+ <para>Also you need start <ulink url="http://docs.jboss.org/tools/resources/GSG_database.zip"
+ >database</ulink>.</para>
<note>
<title>Note:</title>
- <para>How to run database you can know in <ulink url="http://docs.jboss.org/tools/3.0.1.GA/en/GettingStartedGuide/html/first_se...">Getting Started Guide</ulink>.</para>
+ <para>How to run database you can know in <ulink
+ url="http://docs.jboss.org/tools/3.0.1.GA/en/GettingStartedGuide/html/first_se..."
+ >Getting Started Guide</ulink>.</para>
</note>
</section>
-
</section>
<section id="map_file_wizard">
<title>Creating a Hibernate Mapping File</title>
@@ -45,9 +51,9 @@
<para>At first you'll be asked to select a package or multiple individual classes to map.
It's also possible to create an empty file, don't select any packages or classes and an
empty .hbm will be created in the specified location</para>
- <para id="depth_control">With <property>depth control</property> option you can define dependences depth for
- choosing classes (it means to set level of references which is used to collect linked classes
- to the selection). </para>
+ <para id="depth_control">With <property>depth control</property> option you can define
+ dependences depth for choosing classes (it means to set level of references which is used to
+ collect linked classes to the selection). </para>
<figure>
<title>Hibernate XML Mapping File Wizard</title>
<mediaobject>
@@ -56,7 +62,10 @@
</imageobject>
</mediaobject>
</figure>
- <para>The next wizard page lists the mappings to be generated. As you see <property>Customers</property>, <property>Orders</property>, <property>Productlines</property> and <property>Products</property> classes added under <property>depth control</property> driving. </para>
+ <para>The next wizard page lists the mappings to be generated. As you see <property
+ >Customers</property>, <property>Orders</property>, <property>Productlines</property> and
+ <property>Products</property> classes added under <property>depth control</property>
+ driving. </para>
<figure>
<title>Mappings to be generated</title>
<mediaobject>
@@ -65,7 +74,6 @@
</imageobject>
</mediaobject>
</figure>
-
<para>This wizard page outputs a generated .hbm files preview.</para>
<figure>
<title>Preview Generated Mapping Files</title>
@@ -174,8 +182,8 @@
</figure>
<para>The following table describes the available settings on the <emphasis>
<property>Main</property>
- </emphasis> tab. The wizard can automatically detect the default values for most of them if you
- started the wizard with the relevant java project or resource selected.</para>
+ </emphasis> tab. The wizard can automatically detect the default values for most of them if
+ you started the wizard with the relevant java project or resource selected.</para>
<table>
<title>Hibernate Console Configuration Parameters</title>
<tgroup cols="3">
@@ -275,8 +283,8 @@
<para>Name of the persistence unit to use</para>
</entry>
<entry>
- <para>No default value (let Hibernate Entity Manager find the persistence unit or
- it can be defined manually using Browse button)</para>
+ <para>No default value (let Hibernate Entity Manager find the persistence unit or it
+ can be defined manually using Browse button)</para>
</entry>
</row>
</tbody>
@@ -284,7 +292,7 @@
</table>
<tip>
<title>Tip:</title>
- <para>The two latter settings are usually not required if you specify a project and it has
+ <para>The two latter settings are usually not required if you specify a project and it has
<emphasis>
<property>
<literal> /hibernate.cfg.xml </literal>
@@ -340,8 +348,8 @@
<para>Database dialect</para>
</entry>
<entry>
- <para>Define a database dialect. It's possible either to write your value or choose
- from list. </para>
+ <para>Define a database dialect. It's possible either to write your value or
+ choose from list. </para>
</entry>
<entry>
<para>No default value</para>
@@ -540,7 +548,8 @@
<listitem>
<para>right-click on the configuration in <emphasis>
<property>Hibernate Configurations View->Edit Configuration </property>
- </emphasis> or just double-click on <property>Console Configuration</property> item.</para>
+ </emphasis> or just double-click on <property>Console Configuration</property>
+ item.</para>
<figure>
<title>Opening Edit Configuration Wizard</title>
<mediaobject>
@@ -662,8 +671,8 @@
<entry>
<para>Choose between "CORE", "ANNOTATIONS" and
"JPA" according to the method of relational mapping you want to
- use. Note, the two latter requires running Eclipse IDE with a JDK 5
- runtime, otherwise you will get classloading and/or version errors.</para>
+ use. Note, the two latter requires running Eclipse IDE with a JDK 5 runtime,
+ otherwise you will get classloading and/or version errors.</para>
</entry>
<entry>
<para>True</para>
@@ -675,10 +684,10 @@
</listitem>
</itemizedlist>
</section>
- <section id='closing_conf_config'>
+ <section id="closing_conf_config">
<title>Closing Hibernate Console Configuration</title>
- <para>To close <property>Hibernate Console Configuration</property> you need do right-click your configuration
- and choose <property>Close Configuration</property> option </para>
+ <para>To close <property>Hibernate Console Configuration</property> you need do right-click
+ your configuration and choose <property>Close Configuration</property> option </para>
<figure>
<title>Close Hibernate Console Configuration</title>
<mediaobject>
@@ -2450,10 +2459,11 @@
<title>Enable debug logging in the plugins</title>
<para>It is possible to configure the eclipse plugin to route all logging made by the plugins
and hibernate code it self to the <property>Error Log View</property> in Eclipse.</para>
- <para><property>Error Log View</property> is very useful tool to solve any problem which appears in Hibernate Tools Plugins.
- You can use if there are troubles with setting up <property>Hibernate Console Configuration</property>.</para>
+ <para><property>Error Log View</property> is very useful tool to solve any problem which appears
+ in Hibernate Tools Plugins. You can use if there are troubles with setting up <property
+ >Hibernate Console Configuration</property>.</para>
<para>This is done by editing the <emphasis>
- <property>hibernate-log4j.properties</property>
+ <property>hibernate-log4j.properties</property>
</emphasis> in <emphasis>
<property>org.hibernate.eclipse/ directory/jar</property>
</emphasis>. This file includes a default configuration that only logs WARN and above to a set
@@ -2474,187 +2484,196 @@
JPA development platform.</para>
<section id="jpa_project_with_hibernate">
<title>Creating JPA project with Hibernate support</title>
- <para>When starting a new JPA project from <emphasis>
- <property>New > Other > JPA > JPA Project</property>
- </emphasis> (or simply <emphasis>
- <property>New > JPA Project</property>
- </emphasis> in <property>JPA Perspective</property>), the first wizard page looks as
- follows.</para>
- <figure>
- <title>Starting JPA Project</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration1.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>It's possible here to select a target runtime and change the project configuration,
- or you can leave everything as it is.</para>
- <para>On the JPA Facet page you should choose Hibernate as a target platform. Also select the
- proper database connection, if it is defined, or add a new one by clicking the <emphasis>
- <property>Add connection</property>
- </emphasis> link.</para>
- <para>Hitting <emphasis>
- <property>Finish</property>
- </emphasis> will generate the project.</para>
- <figure>
- <title>Targeting at Hibernate Platform</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration2.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <note>
- <title>Note:</title>
- <para>Please note, if you choose Hibernate as a platform while creating a JPA/Dali project, a
- Hibernate Console Configuration for the project is created automatically when the wizard
- finishes its work. It allows a full usage of <property>Hibernate Tools</property> features
- without additional setup.</para>
- </note>
+ <para>When starting a new JPA project from <emphasis>
+ <property>New > Other > JPA > JPA Project</property>
+ </emphasis> (or simply <emphasis>
+ <property>New > JPA Project</property>
+ </emphasis> in <property>JPA Perspective</property>), the first wizard page looks as
+ follows.</para>
+ <figure>
+ <title>Starting JPA Project</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>It's possible here to select a target runtime and change the project configuration,
+ or you can leave everything as it is.</para>
+ <para>On the JPA Facet page you should choose Hibernate as a target platform. Also select the
+ proper database connection, if it is defined, or add a new one by clicking the <emphasis>
+ <property>Add connection</property>
+ </emphasis> link.</para>
+ <para>Hitting <emphasis>
+ <property>Finish</property>
+ </emphasis> will generate the project.</para>
+ <figure>
+ <title>Targeting at Hibernate Platform</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <note>
+ <title>Note:</title>
+ <para>Please note, if you choose Hibernate as a platform while creating a JPA/Dali project,
+ a Hibernate Console Configuration for the project is created automatically when the wizard
+ finishes its work. It allows a full usage of <property>Hibernate Tools</property> features
+ without additional setup.</para>
+ </note>
</section>
- <section id="generate_ddl_entities_with_hibernate">
- <title>Generating DDL and Entities</title>
- <para>By enabling Hibernate platform specific features you can now generate DDL and Entities.
- For that find <emphasis>
- <property>JPA Tools > Generate Tables from Entities/Generate Entities from Tables</property>
- </emphasis> options in the context menu of your JPA project.</para>
- <figure>
- <title>Generate DDL/Entities</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration3.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <note>
- <title>Note:</title>
- <para>Please, remember to put the proper database driver to the classpath of your
- project.</para>
- </note>
- <para>The <property>Generate Entities wizard</property> first will ask you to choose the
- directory where all output will be written.</para>
- <figure>
- <title>Generate Entities Wizard</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration4.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>To generate entities you can use:</para>
- <itemizedlist>
- <listitem>
- <para>a Hibernate Console Configuration (proposed by default)</para>
- <para>Just make sure that the <emphasis>
- <property>Use Console Configuration</property>
- </emphasis> checkbox is selected and choose a needed configuration from the <emphasis>
- <property>Console configurations</property>
- </emphasis> list box.</para>
- <figure>
- <title>Generate Entities Wizard</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration5.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </listitem>
- </itemizedlist>
- <itemizedlist>
- <listitem>
- <para>or a DTP connection directly</para>
- <para>Just uncheck <emphasis>
- <property>Use Console Configuration</property>
- </emphasis> and adjust database settings.</para>
- </listitem>
- </itemizedlist>
- <para>All the same you do with Generate Entities Wizard you can do with Generate DDL wizard.
- Special feature for Generate DDL wizard is possible automatic execution of Generation DDL in
- the database. </para>
- <figure>
- <title>Generate DDL Wizard</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration6.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- <para>Thus, you can now have the Hibernate runtime support in Eclipse JPA projects.</para>
- </section>
- <section id="hibernate_annotations_support">
+ <section id="generate_ddl_entities_with_hibernate">
+ <title>Generating DDL and Entities</title>
+ <para>By enabling Hibernate platform specific features you can now generate DDL and Entities.
+ For that find <emphasis>
+ <property>JPA Tools > Generate Tables from Entities/Generate Entities from
+ Tables</property>
+ </emphasis> options in the context menu of your JPA project.</para>
+ <figure>
+ <title>Generate DDL/Entities</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration3.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <note>
+ <title>Note:</title>
+ <para>Please, remember to put the proper database driver to the classpath of your
+ project.</para>
+ </note>
+ <para>The <property>Generate Entities wizard</property> first will ask you to choose the
+ directory where all output will be written.</para>
+ <figure>
+ <title>Generate Entities Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration4.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>To generate entities you can use:</para>
+ <itemizedlist>
+ <listitem>
+ <para>a Hibernate Console Configuration (proposed by default)</para>
+ <para>Just make sure that the <emphasis>
+ <property>Use Console Configuration</property>
+ </emphasis> checkbox is selected and choose a needed configuration from the <emphasis>
+ <property>Console configurations</property>
+ </emphasis> list box.</para>
+ <figure>
+ <title>Generate Entities Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration5.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ </itemizedlist>
+ <itemizedlist>
+ <listitem>
+ <para>or a DTP connection directly</para>
+ <para>Just uncheck <emphasis>
+ <property>Use Console Configuration</property>
+ </emphasis> and adjust database settings.</para>
+ </listitem>
+ </itemizedlist>
+ <para>All the same you do with Generate Entities Wizard you can do with Generate DDL wizard.
+ Special feature for Generate DDL wizard is possible automatic execution of Generation DDL in
+ the database. </para>
+ <figure>
+ <title>Generate DDL Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration6.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>Thus, you can now have the Hibernate runtime support in Eclipse JPA projects.</para>
+ </section>
+ <section id="hibernate_annotations_support">
<title>Hibernate Annotations Support</title>
- <para>Also Hibernate Annotations are supported in <property>Dali Java Persistence Tools</property>.
- The next annotations are integrated with <property>JPA Details</property> view:</para>
- <itemizedlist>
- <listitem>
- <para>Id Generator annotations - <property>@GenericGenerator</property> and <property>@GeneratedValue</property></para>
- <figure>
- <title>@GenericGenerator support in Dali</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration7.png"/>
-
+ <para>Also Hibernate Annotations are supported in <property>Dali Java Persistence
+ Tools</property>. The next annotations are integrated with <property>JPA
+ Details</property> view:</para>
+ <itemizedlist>
+ <listitem>
+ <para>Id Generator annotations - <property>@GenericGenerator</property> and <property
+ >@GeneratedValue</property></para>
+ <figure>
+ <title>@GenericGenerator support in Dali</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration7.png"/>
</imageobject>
-
- </mediaobject>
- </figure>
- <figure>
- <title>@GeneratedValue support in Dali</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration8.png"/>
- </imageobject>
-
- </mediaobject>
- </figure>
- </listitem>
- <listitem>
- <para>Property annotations- <property>@DiscriminatorFormula</property>, <property>@Generated Annotation</property>, <property>@Index annotation</property></para>
- <figure>
- <title>@Index support in Dali</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration9.png"/>
- </imageobject>
-
- </mediaobject>
- </figure>
-
- </listitem>
- <listitem>
- <para>Mapping Queries annotations - <property>@NamedQuery</property> and <property>@NamedNativeQuery</property></para>
- <figure>
- <title>Add New Named Query Dialog with Hibernate Support</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration10.png"/>
- </imageobject>
-
- </mediaobject>
- </figure>
-
-
-
- <figure>
- <title>@NamedQuery support in Dali</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/plugins/dali_integration11.png"/>
- </imageobject>
-
- </mediaobject>
- </figure>
- </listitem>
- </itemizedlist>
- <para>More information about Hibernate Annotation you can find in <ulink url="http://docs.jboss.org/hibernate/stable/annotations/reference/en/html/">Hibernate Annotations Reference Guide</ulink>. </para>
-
- </section>
+ </mediaobject>
+ </figure>
+ <figure>
+ <title>@GeneratedValue support in Dali</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration8.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ <listitem>
+ <para>Property annotations- <property>@DiscriminatorFormula</property>, <property
+ >@Generated Annotation</property>, <property>@Index annotation</property></para>
+ <figure>
+ <title>@Index support in Dali</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration9.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ <listitem>
+ <para>Mapping Queries annotations - <property>@NamedQuery</property> and <property
+ >@NamedNativeQuery</property></para>
+ <figure>
+ <title>Add New Named Query Dialog with Hibernate Support</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration10.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <figure>
+ <title>@NamedQuery support in Dali</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration11.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ <listitem>
+ <para>Association annotations in an <property>embeddable</property> object (<property
+ >@OneToOne</property>, <property>@ManyToOne</property>, <property
+ >@OneToMany</property> or <property>@ManyToMany</property>)</para>
+ <figure>
+ <title>Hibernate Support for Embeddable Object</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/plugins/dali_integration12.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </listitem>
+ </itemizedlist>
+ <para>More information about Hibernate Annotation you can find in <ulink
+ url="http://docs.jboss.org/hibernate/stable/annotations/reference/en/html/">Hibernate
+ Annotations Reference Guide</ulink>. </para>
+ </section>
<section>
<title>Relevant Resources Links</title>
- <para>There is full information about native Dali plugin features on <ulink url="http://help.eclipse.org/galileo/index.jsp?nav=/8">Eclipse Documentation page</ulink>.</para>
+ <para>There is full information about native Dali plugin features on <ulink
+ url="http://help.eclipse.org/galileo/index.jsp?nav=/8">Eclipse Documentation
+ page</ulink>.</para>
</section>
-
</section>
-
</chapter>
14 years, 8 months
JBoss Tools SVN: r21803 - trunk/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-29 12:50:52 -0400 (Thu, 29 Apr 2010)
New Revision: 21803
Modified:
trunk/build/build.xml
Log:
tweak output
Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml 2010-04-29 16:50:11 UTC (rev 21802)
+++ trunk/build/build.xml 2010-04-29 16:50:52 UTC (rev 21803)
@@ -5,18 +5,17 @@
<!-- set name of component(s) to build+test, IN ORDER -->
<property name="COMPONENTS"
- value="
-tests,common;
- flow,jbpm;
- jmx,archives,as;
- drools,bpel,smooks,freemarker,profiler,portlet;
- xulrunner,jst,vpe,jsf;
- esb,tptp,ws;
- cdi,struts,hibernatetools,seam;
- examples,birt;
- maven"
+ value="tests,common;
+ flow,jbpm;
+ jmx,archives,as;
+ drools,bpel,smooks,freemarker,profiler,portlet;
+ xulrunner,jst,vpe,jsf;
+ esb,tptp,ws;
+ cdi,struts,hibernatetools,seam;
+ examples,birt;
+ maven"
/>
- <!-- TODO: add modeshape -->
+ <!-- TODO: add modeshape, which reqs JDK6 -->
<!-- svn root, including trunk or branch path -->
<property name="svn.root" value="http://anonsvn.jboss.org/repos/jbosstools/branches/modular_build" />
@@ -49,10 +48,9 @@
</echo>
<for param="COMPONENT" list="${COMPONENTS}" delimiter=";" >
<sequential>
- <echo message=" @{COMPONENT}" />
+ <echo message=" @{COMPONENT}" />
</sequential>
</for>
-
</target>
<target name="run"
14 years, 8 months
JBoss Tools SVN: r21802 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-29 12:50:11 -0400 (Thu, 29 Apr 2010)
New Revision: 21802
Modified:
branches/modular_build/build/build.xml
Log:
tweak output
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-29 16:46:03 UTC (rev 21801)
+++ branches/modular_build/build/build.xml 2010-04-29 16:50:11 UTC (rev 21802)
@@ -5,18 +5,17 @@
<!-- set name of component(s) to build+test, IN ORDER -->
<property name="COMPONENTS"
- value="
-tests,common;
- flow,jbpm;
- jmx,archives,as;
- drools,bpel,smooks,freemarker,profiler,portlet;
- xulrunner,jst,vpe,jsf;
- esb,tptp,ws;
- cdi,struts,hibernatetools,seam;
- examples,birt;
- maven"
+ value="tests,common;
+ flow,jbpm;
+ jmx,archives,as;
+ drools,bpel,smooks,freemarker,profiler,portlet;
+ xulrunner,jst,vpe,jsf;
+ esb,tptp,ws;
+ cdi,struts,hibernatetools,seam;
+ examples,birt;
+ maven"
/>
- <!-- TODO: add modeshape -->
+ <!-- TODO: add modeshape, which reqs JDK6 -->
<!-- svn root, including trunk or branch path -->
<property name="svn.root" value="http://anonsvn.jboss.org/repos/jbosstools/branches/modular_build" />
@@ -49,10 +48,9 @@
</echo>
<for param="COMPONENT" list="${COMPONENTS}" delimiter=";" >
<sequential>
- <echo message=" @{COMPONENT}" />
+ <echo message=" @{COMPONENT}" />
</sequential>
</for>
-
</target>
<target name="run"
14 years, 8 months
JBoss Tools SVN: r21801 - trunk/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-29 12:46:03 -0400 (Thu, 29 Apr 2010)
New Revision: 21801
Modified:
trunk/build/build.xml
Log:
port changes in branch to trunk
Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml 2010-04-29 16:45:03 UTC (rev 21800)
+++ trunk/build/build.xml 2010-04-29 16:46:03 UTC (rev 21801)
@@ -5,40 +5,60 @@
<!-- set name of component(s) to build+test, IN ORDER -->
<property name="COMPONENTS"
- value="tests, common,
- flow, jbpm,
- jmx, archives, as,
- drools, bpel, smooks, freemarker, profiler, portlet,
- xulrunner, jst, vpe, jsf,
- esb, tptp, ws,
- cdi, struts, hibernatetools, seam,
- examples, birt,
- maven"
+ value="
+tests,common;
+ flow,jbpm;
+ jmx,archives,as;
+ drools,bpel,smooks,freemarker,profiler,portlet;
+ xulrunner,jst,vpe,jsf;
+ esb,tptp,ws;
+ cdi,struts,hibernatetools,seam;
+ examples,birt;
+ maven"
/>
+ <!-- TODO: add modeshape -->
<!-- svn root, including trunk or branch path -->
- <property name="svn.root" value="http://anonsvn.jboss.org/repos/jbosstools/trunk" />
+ <property name="svn.root" value="http://anonsvn.jboss.org/repos/jbosstools/branches/modular_build" />
<!-- default maven version -->
<property name="maven.version" value="3.0-beta-1" />
<!-- ****************************** Usage Instructions ****************************** -->
+ <target name="help" description="Usage Instructions" depends="init">
+ <echo>
+To run this script in Eclipse:
+ Run As > Ant Build
- <!-- To run this script in Eclipse:
- Run As > Ant Build
- -->
- <!-- To run this script via commandline (build default modules & run tests):
- cd /home/nboldt/workspace36/jbosstools-modular_build; ant
- or, to build everything but not *run* the tests:
- cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DMAVEN_FLAGS="-Dmaven.test.skip"
- or, to build specific module(s):
- cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common,flow,jbpm
- or, to rebuild even if sources have not changed:
- cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common -Dbuild.if.sources.unchanged=true
- -->
+To run this script via commandline (build default modules + run tests):
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant
- <target name="run" depends="init, get.bootstrap.scripts, get.sources, get.components.to.build, run.build" />
+or, to build everything but not *run* the tests:
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DMAVEN_FLAGS="clean install -Dmaven.test.skip"
+or, to build specific module(s):
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common,flow,jbpm
+
+or, to rebuild even if sources have not changed:
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common -Dbuild.if.sources.unchanged=true
+
+or, to (re-)run tests w/o (re-)building first:
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common,jmx -DMAVEN_FLAGS="osgi-test:test -B -fn"
+
+Here is the order in which components must be built:
+</echo>
+ <for param="COMPONENT" list="${COMPONENTS}" delimiter=";" >
+ <sequential>
+ <echo message=" @{COMPONENT}" />
+ </sequential>
+ </for>
+
+ </target>
+
+ <target name="run"
+ depends="init, get.bootstrap.scripts, get.sources, get.components.to.build, run.build, collect.all.test.results"
+ />
+
<!-- override for local build -->
<condition property="isInHudson" value="true">
<or>
@@ -101,6 +121,16 @@
</target>
<target name="init" depends="local">
+ <macrodef name="now">
+ <sequential>
+ <var name="now" unset="true" />
+ <tstamp>
+ <format property="now" pattern="hh:mm:ss" />
+ </tstamp>
+ <echo>${now}</echo>
+ </sequential>
+ </macrodef>
+
<!-- https://jira.jboss.org/jira/browse/JBQA-3313 Use static, shared space outside workspace, instead of working directly in the workspace -->
<condition property="WORKINGDIR" value="/home/hudson/static_build_env/jbds/tools/sources" else="${basedir}">
<available file="/home/hudson/static_build_env/jbds" type="dir" />
@@ -137,16 +167,10 @@
<available file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvn" type="file" property="maven.exists" />
<antcall target="get.maven" />
-
- <condition property="bootstrap.scripts.exist" value="true">
- <and>
- <available file="${WORKINGDIR}/parent-pom.xml" type="file" />
- <available file="${WORKINGDIR}/genpom.xml" type="file" />
- </and>
- </condition>
</target>
<target name="get.sources" description="if sources not already on disk, fetch them">
+ <property name="clean.sources" value="false" />
<property name="svn.recurse" value="true" />
<!-- = = = = = = = = = = = = = = = = =
@@ -154,23 +178,24 @@
op: up (update) or co (checkout)
= = = = = = = = = = = = = = = = = -->
<macrodef name="svn.fetch">
- <attribute name="COMPONENT" />
+ <attribute name="component" />
<attribute name="op" />
<sequential>
<!-- check out or update -->
+ <now />
<if>
<equals arg1="@{op}" arg2="up" />
<then>
<svn javahl="false" svnkit="true" failonerror="false">
- <update recurse="${svn.recurse}" dir="@{COMPONENT}" />
+ <update recurse="${svn.recurse}" dir="@{component}" />
</svn>
</then>
<else>
- <echo level="info">Fetch sources from ${svn.root}/@{COMPONENT} into ${WORKINGDIR}/@{COMPONENT}</echo>
+ <echo level="info">Fetch sources from ${svn.root}/@{component} into ${WORKINGDIR}/@{component}</echo>
<svn javahl="false" svnkit="true" failonerror="true">
<checkout recurse="${svn.recurse}"
- url="${svn.root}/@{COMPONENT}"
- destpath="${WORKINGDIR}/@{COMPONENT}"
+ url="${svn.root}/@{component}"
+ destpath="${WORKINGDIR}/@{component}"
/>
</svn>
</else>
@@ -178,27 +203,31 @@
<!-- Store svn info so we can compare it later and thus not need to update or checkout every time -->
<svn javahl="false" svnkit="true" failonerror="false">
- <info target="${WORKINGDIR}/@{COMPONENT}" propprefix="svn.info.@{COMPONENT}" verbose="true" />
+ <info target="${WORKINGDIR}/@{component}" propprefix="svn.info.@{component}" verbose="false" />
</svn>
<if>
- <isset property="svn.info.(a){COMPONENT}.rev" />
+ <isset property="svn.info.(a){component}.rev" />
<then>
- <echo file="${WORKINGDIR}/svn.info-(a){COMPONENT}.txt">svn.info.(a){COMPONENT}.rev = ${svn.info.(a){COMPONENT}.rev}
+ <echo file="${WORKINGDIR}/svn.info-(a){component}.txt">svn.info.(a){component}.rev = ${svn.info.(a){component}.rev}
</echo>
</then>
</if>
- <echo file="build.cfg" message="@{COMPONENT}," append="true" />
+ <echo file="build.cfg" message="@{component}," append="true" />
</sequential>
</macrodef>
<!-- check for each component dir in ${WORKINGDIR}; if not found, fetch -->
<echo file="build.cfg" message="COMPONENTS.to.build = " />
- <for param="COMPONENT" list="${COMPONENTS}" delimiter=",
+ <for param="COMPONENT" list="${COMPONENTS}" delimiter=",;
">
<sequential>
- <!-- TODO: add timestamps / elapsed time -->
- <echo level="info">Fetch @{COMPONENT} sources into ${WORKINGDIR}/</echo>
<if>
+ <equals arg1="${clean.sources}" arg2="true" />
+ <then>
+ <delete dir="${WORKINGDIR}/@{COMPONENT}" includeemptydirs="true" quiet="true" />
+ </then>
+ </if>
+ <if>
<not>
<available file="${WORKINGDIR}/@{COMPONENT}" type="dir" />
</not>
@@ -214,7 +243,7 @@
<svn javahl="false" svnkit="true" failonerror="false">
<info target="${WORKINGDIR}/@{COMPONENT}"
propprefix="svn.info.(a){COMPONENT}.check"
- verbose="true"
+ verbose="false"
/>
</svn>
<if>
@@ -258,7 +287,7 @@
</target>
- <target name="get.bootstrap.scripts" unless="bootstrap.scripts.exist">
+ <target name="get.bootstrap.scripts">
<!-- also get files required to bootstrap the build -->
<get src="${svn.root}/parent-pom.xml" dest="${WORKINGDIR}/parent-pom.xml" usetimestamp="true" />
<get src="${svn.root}/genpom.xml" dest="${WORKINGDIR}/genpom.xml" usetimestamp="true" />
@@ -271,23 +300,33 @@
<then>
<echo level="info">All components up to date: nothing to do!
To force a build of unchanged components, use -Dbuild.if.sources.unchanged=true</echo>
+
+ <!-- create fake test result file to avoid Hudson failure -->
+ <delete dir="${basedir}/surefire-reports/NoTestsRun" includeemptydirs="true" />
+ <mkdir dir="${basedir}/surefire-reports/NoTestsRun" />
+ <echo file="${basedir}/surefire-reports/NoTestsRun/TEST-org.jboss.tools.NoTestsRun.xml"><?xml version="1.0" encoding="UTF-8" ?>
+<testsuite failures="0" time="0.001" errors="0" skipped="0" tests="1" name="org.jboss.tools.NoTestsRun">
+ <testcase time="0.001" classname="org.jboss.tools.NoTestsRun" name="NoTestsRun"/>
+</testsuite>
+</echo>
</then>
</if>
</target>
<target name="run.build">
- <!-- could set -Dmaven.test.skip to skip tests, etc. -->
- <property name="MAVEN_FLAGS" value="" />
+ <!-- could set -Dmaven.test.skip to skip tests, or use osgi-test:test to just (re-)run tests w/o first building -->
+ <property name="MAVEN_FLAGS" value="clean install -B -fn -q" />
<for param="COMPONENT" list="${COMPONENTS.to.build}" delimiter=",
">
<sequential>
- <!-- TODO: add timestamps / elapsed time -->
+ <now />
<!-- If poms already exist, DO NOT OVERWRITE unless overwrite.existing.pom.xml=true -->
<ant antfile="genpom.xml" target="run" dir="${WORKINGDIR}">
<property name="COMPONENT" value="@{COMPONENT}" />
</ant>
<echo level="verbose">Exe: ${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvn</echo>
<echo level="verbose">Pom: ${WORKINGDIR}/(a){COMPONENT}/pom.xml</echo>
+ <!-- 3 hr timeout = 10800000ms -->
<exec executable="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvn"
dir="${WORKINGDIR}/@{COMPONENT}"
failifexecutionfails="true"
@@ -298,12 +337,85 @@
<env key="MAVEN_OPTS" value="-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m" />
<!-- more debug output with <env key="MAVEN_OPTS" value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/> -->
<!-- <arg line="-o -Dmaven.test.skip" /> -->
- <arg line="${MAVEN_FLAGS} -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository clean install" />
+ <arg line="${MAVEN_FLAGS} -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository" />
</exec>
+ <antcall target="collect.test.results">
+ <param name="COMPONENT" value="@{COMPONENT}" />
+ </antcall>
</sequential>
</for>
+ <now />
</target>
+ <target name="collect.test.results">
+ <delete dir="${basedir}/surefire-reports/NoTestsRun" includeemptydirs="true" />
+ <property name="COMPONENT" value="" />
+ <!-- collect test results by copying ${WORKINGDIR}/${COMPONENT}/**/target/surefire-reports/*.xml into ${basedir}/surefire-reports/${COMPONENT} -->
+ <delete dir="${basedir}/surefire-reports/${COMPONENT}" includeemptydirs="true" />
+ <mkdir dir="${basedir}/surefire-reports/${COMPONENT}" />
+ <copy todir="${basedir}/surefire-reports/${COMPONENT}"
+ flatten="true"
+ preservelastmodified="true"
+ overwrite="true"
+ >
+ <fileset dir="${WORKINGDIR}/${COMPONENT}" includes="**/target/surefire-reports/*.xml" />
+ </copy>
+ </target>
+
+ <target name="collect.all.test.results">
+ <!-- Parse this: <testsuite errors="0" skipped="0" tests="10" time="0.042" failures="0" name="org.jboss.tools.jmx.ui.JMXUIAllTests"> -->
+ <for param="testresultfile" delimiter=",
+ ">
+ <path>
+ <fileset dir="${basedir}/surefire-reports/" includes="**/*.xml" />
+ </path>
+ <sequential>
+ <var name="testsuite.name" unset="true" />
+ <var name="testsuite.tests" unset="true" />
+ <var name="testsuite.time" unset="true" />
+ <var name="testsuite.skipped" unset="true" />
+ <var name="testsuite.errors" unset="true" />
+ <var name="testsuite.failures" unset="true" />
+ <xmlproperty file="@{testresultfile}" keepRoot="true" collapseAttributes="true" />
+ <for param="ts" list="testsuite.skipped, testsuite.errors, testsuite.failures" delimiter=", ">
+ <sequential>
+ <propertyregex override="true"
+ property="ts.label"
+ defaultvalue="@{ts}"
+ input="@{ts}"
+ regexp="testsuite\.(.+)"
+ replace="\1"
+ />
+ <if>
+ <isset property="@{ts}" />
+ <then>
+ <if>
+ <equals arg1="${@{ts}}" arg2="0" />
+ <then>
+ <var name="@{ts}" value="" />
+ </then>
+ <else>
+ <var name="@{ts}" value="; ${@{ts}} ${ts.label}" />
+ </else>
+ </if>
+ </then>
+ </if>
+
+ </sequential>
+ </for>
+ <echo level="info">${testsuite.name} ran ${testsuite.tests} tests in ${testsuite.time}s${testsuite.skipped}${testsuite.errors}${testsuite.failures}
+</echo>
+ <var name="testsuite.name" unset="true" />
+ <var name="testsuite.tests" unset="true" />
+ <var name="testsuite.time" unset="true" />
+ <var name="testsuite.skipped" unset="true" />
+ <var name="testsuite.errors" unset="true" />
+ <var name="testsuite.failures" unset="true" />
+ </sequential>
+ </for>
+ </target>
+
+
<!-- TODO: generate site.xml files for components: gensite.xml script called by build.xml -->
<!-- TODO: zip up update site zips for each component; publish to download.jboss.org as part of deploy task -->
<target name="zip.sites">
@@ -479,7 +591,7 @@
<for param="expected.dir" list="${get.sources.expected.dirs}" delimiter=",
">
<sequential>
- <assert failonerror="false" message="Dir @{expected.dir} not found!">
+ <assert failonerror="true" message="Dir @{expected.dir} not found!">
<bool>
<available file="@{expected.dir}" type="dir" />
</bool>
@@ -489,7 +601,7 @@
<for param="expected.file" list="${get.sources.expected.files}" delimiter=",
">
<sequential>
- <assert failonerror="false" message="Dir @{expected.file} not found!">
+ <assert failonerror="true" message="Dir @{expected.file} not found!">
<bool>
<available file="@{expected.file}" type="file" />
</bool>
@@ -502,7 +614,7 @@
2/6: Test build.cfg</echo>
<var name="COMPONENTS.to.build" unset="true" />
<antcallback target="get.components.to.build" return="COMPONENTS.to.build" />
- <assert failonerror="false"
+ <assert failonerror="true"
message="expected: [${get.components.to.build.expected.2}] but got: [${COMPONENTS.to.build}]"
>
<bool>
@@ -515,11 +627,12 @@
3/6: Test update</echo>
<delete file="${WORKINGDIR}/svn.info-tests.txt" />
<delete file="${WORKINGDIR}/svn.info-xulrunner.txt" />
+ <touch file="${WORKINGDIR}/common/pom.xml" />
<antcall target="get.sources" />
<for param="expected.dir" list="${get.sources.expected.dirs}" delimiter=",
">
<sequential>
- <assert failonerror="false" message="Dir @{expected.dir} not found!">
+ <assert failonerror="true" message="Dir @{expected.dir} not found!">
<bool>
<available file="@{expected.dir}" type="dir" />
</bool>
@@ -529,7 +642,7 @@
<for param="expected.file" list="${get.sources.expected.files}" delimiter=",
">
<sequential>
- <assert failonerror="false" message="Dir @{expected.file} not found!">
+ <assert failonerror="true" message="Dir @{expected.file} not found!">
<bool>
<available file="@{expected.file}" type="file" />
</bool>
@@ -542,7 +655,7 @@
4/6: Test build.cfg</echo>
<var name="COMPONENTS.to.build" unset="true" />
<antcallback target="get.components.to.build" return="COMPONENTS.to.build" />
- <assert failonerror="false"
+ <assert failonerror="true"
message="expected: [${get.components.to.build.expected.4}] but got: [${COMPONENTS.to.build}]"
>
<bool>
@@ -557,7 +670,7 @@
<for param="expected.dir" list="${get.sources.expected.dirs}" delimiter=",
">
<sequential>
- <assert failonerror="false" message="Dir @{expected.dir} not found!">
+ <assert failonerror="true" message="Dir @{expected.dir} not found!">
<bool>
<available file="@{expected.dir}" type="dir" />
</bool>
@@ -567,7 +680,7 @@
<for param="expected.file" list="${get.sources.expected.files}" delimiter=",
">
<sequential>
- <assert failonerror="false" message="Dir @{expected.file} not found!">
+ <assert failonerror="true" message="Dir @{expected.file} not found!">
<bool>
<available file="@{expected.file}" type="file" />
</bool>
@@ -580,7 +693,7 @@
6/6: Test build.cfg</echo>
<var name="COMPONENTS.to.build" unset="true" />
<antcallback target="get.components.to.build" return="COMPONENTS.to.build" />
- <assert failonerror="false"
+ <assert failonerror="true"
message="expected: [${get.components.to.build.expected.6}] but got: [${COMPONENTS.to.build}]"
>
<bool>
14 years, 8 months
JBoss Tools SVN: r21800 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-29 12:45:03 -0400 (Thu, 29 Apr 2010)
New Revision: 21800
Modified:
branches/modular_build/build/build.xml
Log:
add help target
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-29 16:20:09 UTC (rev 21799)
+++ branches/modular_build/build/build.xml 2010-04-29 16:45:03 UTC (rev 21800)
@@ -5,16 +5,18 @@
<!-- set name of component(s) to build+test, IN ORDER -->
<property name="COMPONENTS"
- value="tests, common,
- flow, jbpm,
- jmx, archives, as,
- drools, bpel, smooks, freemarker, profiler, portlet, modeshape,
- xulrunner, jst, vpe, jsf,
- esb, tptp, ws,
- cdi, struts, hibernatetools, seam,
- examples, birt,
- maven"
+ value="
+tests,common;
+ flow,jbpm;
+ jmx,archives,as;
+ drools,bpel,smooks,freemarker,profiler,portlet;
+ xulrunner,jst,vpe,jsf;
+ esb,tptp,ws;
+ cdi,struts,hibernatetools,seam;
+ examples,birt;
+ maven"
/>
+ <!-- TODO: add modeshape -->
<!-- svn root, including trunk or branch path -->
<property name="svn.root" value="http://anonsvn.jboss.org/repos/jbosstools/branches/modular_build" />
@@ -23,22 +25,36 @@
<property name="maven.version" value="3.0-beta-1" />
<!-- ****************************** Usage Instructions ****************************** -->
+ <target name="help" description="Usage Instructions" depends="init">
+ <echo>
+To run this script in Eclipse:
+ Run As > Ant Build
- <!-- To run this script in Eclipse:
- Run As > Ant Build
- -->
- <!-- To run this script via commandline (build default modules & run tests):
- cd /home/nboldt/workspace36/jbosstools-modular_build; ant
- or, to build everything but not *run* the tests:
- cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DMAVEN_FLAGS="clean install -Dmaven.test.skip"
- or, to build specific module(s):
- cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common,flow,jbpm
- or, to rebuild even if sources have not changed:
- cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common -Dbuild.if.sources.unchanged=true
- or, to (re-)run tests w/o (re-)building first:
- cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common,jmx -DMAVEN_FLAGS="osgi-test:test -B -fn"
- -->
+To run this script via commandline (build default modules + run tests):
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant
+or, to build everything but not *run* the tests:
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DMAVEN_FLAGS="clean install -Dmaven.test.skip"
+
+or, to build specific module(s):
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common,flow,jbpm
+
+or, to rebuild even if sources have not changed:
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common -Dbuild.if.sources.unchanged=true
+
+or, to (re-)run tests w/o (re-)building first:
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common,jmx -DMAVEN_FLAGS="osgi-test:test -B -fn"
+
+Here is the order in which components must be built:
+</echo>
+ <for param="COMPONENT" list="${COMPONENTS}" delimiter=";" >
+ <sequential>
+ <echo message=" @{COMPONENT}" />
+ </sequential>
+ </for>
+
+ </target>
+
<target name="run"
depends="init, get.bootstrap.scripts, get.sources, get.components.to.build, run.build, collect.all.test.results"
/>
@@ -202,7 +218,7 @@
<!-- check for each component dir in ${WORKINGDIR}; if not found, fetch -->
<echo file="build.cfg" message="COMPONENTS.to.build = " />
- <for param="COMPONENT" list="${COMPONENTS}" delimiter=",
+ <for param="COMPONENT" list="${COMPONENTS}" delimiter=",;
">
<sequential>
<if>
14 years, 8 months
JBoss Tools SVN: r21799 - in trunk/jsf/plugins/org.jboss.tools.jsf: META-INF and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: yzhishko
Date: 2010-04-29 12:20:09 -0400 (Thu, 29 Apr 2010)
New Revision: 21799
Added:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2SourceValidator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2XMLValidator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2CompositeAttrs.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2CompositeComponent.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2ResourcesFolder.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/IJSF2ValidationComponent.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2AttrTempComponent.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2ComponentFactory.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2CompositeTempComponent.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2URITempComponent.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentModelManager.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentRecognizer.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentUtil.java
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2Validator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2MarkerResolution.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentParams.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentsUtil.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf/resources/templates/composite.xhtml
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/JSFUIMessages.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/messages.properties
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2ComponentsValidator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2ValidationInfo.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ComponentResolutionGenerator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ResourceUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2TemplateManager.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5930 - a part of fix
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/META-INF/MANIFEST.MF 2010-04-29 16:20:09 UTC (rev 21799)
@@ -49,3 +49,4 @@
Bundle-Version: 3.1.0.qualifier
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.eclipse.wst.sse.ui.internal.reconcile.validator
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2010-04-29 16:20:09 UTC (rev 21799)
@@ -550,5 +550,30 @@
<persistent
value="true">
</persistent>
+ <attribute
+ name="problemType">
+ </attribute>
+ <super
+ type="org.eclipse.core.resources.textmarker">
+ </super>
+ <attribute
+ name="baseElement">
+ </attribute>
</extension>
+ <extension
+ point="org.eclipse.wst.sse.ui.sourcevalidation">
+ <validator
+ class="org.jboss.tools.jsf.web.validation.jsf2.JSF2SourceValidator"
+ id="org.jboss.tools.jsf.jsf2sourcevalidator"
+ scope="total">
+ <contentTypeIdentifier
+ id="org.eclipse.wst.html.core.htmlsource">
+ <partitionType id="org.eclipse.wst.html.HTML_DEFAULT"/>
+ </contentTypeIdentifier>
+ <contentTypeIdentifier
+ id="org.eclipse.jst.jsp.core.jspsource">
+ <partitionType id="org.eclipse.jst.jsp.DEFAULT_JSP"/>
+ </contentTypeIdentifier>
+ </validator>
+ </extension>
</plugin>
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/resources/templates/composite.xhtml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/resources/templates/composite.xhtml 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/resources/templates/composite.xhtml 2010-04-29 16:20:09 UTC (rev 21799)
@@ -7,7 +7,6 @@
<!-- INTERFACE -->
<composite:interface>
- <composite:attribute name=""/>
</composite:interface>
<!-- IMPLEMENTATION -->
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/JSFUIMessages.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/JSFUIMessages.java 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/JSFUIMessages.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -118,13 +118,17 @@
public static String DeleteFacesConfigHandler_DeleteReferenceFromWebXML;
public static String DeleteGroupHandler_Delete;
public static String DeleteGroupHandler_DeleteFileFromDisk;
-
public static String DeleteManagedBeanHandler_CannotDeleteFile;
public static String DeleteManagedBeanHandler_Failure;
public static String DeleteManagedPropertyHandler_Delete;
public static String DeleteManagedPropertyHandler_DeleteJavaProperty;
- public static String Create_JSF_2_Composition_Component;
-
+ public static String Create_JSF_2_Composite_Component;
+ public static String Missing_JSF_2_Composite_Component;
+ public static String Missing_JSF_2_Component_Attr;
+ public static String Create_JSF_2_Interface_Attr;
+ public static String Missing_JSF_2_Resources_Folder;
+ public static String Create_JSF_2_Resources_Folder;
+
static {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, JSFUIMessages.class);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/messages.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/messages.properties 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/messages.properties 2010-04-29 16:20:09 UTC (rev 21799)
@@ -99,4 +99,9 @@
DeleteManagedBeanHandler_Failure=Failure
DeleteManagedPropertyHandler_Delete=Delete {0}
DeleteManagedPropertyHandler_DeleteJavaProperty=Delete java property
-Create_JSF_2_Composition_Component=Create JSF 2 composition component in a project resources folder
+Create_JSF_2_Composite_Component=Create JSF 2 composite component in a project resources folder
+Missing_JSF_2_Composite_Component=Composite component "{0}" was not found in a project resources directory
+Missing_JSF_2_Component_Attr=Attribute "{0}" is not defined for "{1}" composite component
+Create_JSF_2_Interface_Attr=Create attribute in an interface declaration of a composite component
+Missing_JSF_2_Resources_Folder=Resources folder "{0}" is missing in a project root directory
+Create_JSF_2_Resources_Folder=Create a folder container for JSF 2 resources
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2ComponentsValidator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2ComponentsValidator.java 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2ComponentsValidator.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -1,19 +1,18 @@
- /*******************************************************************************
- * Copyright (c) 2007-2010 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
- ******************************************************************************/
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2;
import java.io.InputStream;
import java.util.Scanner;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -27,7 +26,10 @@
import org.eclipse.wst.xml.core.internal.validation.core.ValidationReport;
import org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;
import org.jboss.tools.jsf.JSFModelPlugin;
-import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ComponentParams;
+import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.components.JSF2AttrTempComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.components.JSF2CompositeTempComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.components.JSF2URITempComponent;
import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ResourceUtil;
import org.jboss.tools.jst.web.kb.IKbProject;
import org.jboss.tools.jst.web.kb.KbProjectFactory;
@@ -35,7 +37,7 @@
/**
*
* @author yzhishko
- *
+ *
*/
@SuppressWarnings("restriction")
@@ -53,12 +55,8 @@
if (!isValidate(file)) {
return result;
}
- IProject project = file.getProject();
- kbProject = KbProjectFactory.getKbProject(project, false);
- if (kbProject != null) {
- this.file = file;
- return super.validate(resource, kind, state, monitor);
- }
+ this.file = file;
+ return super.validate(resource, kind, state, monitor);
}
return result;
}
@@ -66,18 +64,22 @@
@Override
public ValidationReport validate(String uri, InputStream inputstream,
NestedValidatorContext context, ValidationResult result) {
- JSF2Validator validator = JSF2Validator.getInstance();
+ JSF2XMLValidator validator = JSF2XMLValidator.getInstance();
return validator.validate(file, uri);
}
protected boolean isValidate(IFile file) {
boolean isValidate = false;
+ if (file.getProject() == null
+ || file.getProject().isAccessible() == false) {
+ return false;
+ }
try {
InputStream is = file.getContents();
Scanner scanner = new Scanner(is);
while (scanner.hasNextLine()) {
- if (scanner.nextLine().indexOf(
- JSF2ResourceUtil.JSF2_URI_PREFIX) != -1) {
+ if (scanner.nextLine()
+ .indexOf(JSF2ResourceUtil.JSF2_URI_PREFIX) != -1) {
isValidate = true;
scanner.close();
break;
@@ -85,7 +87,13 @@
}
} catch (CoreException e) {
JSFModelPlugin.getPluginLog().logError(e);
+ return isValidate;
}
+ IProject project = file.getProject();
+ kbProject = KbProjectFactory.getKbProject(project, false);
+ if (kbProject == null) {
+ isValidate = false;
+ }
return isValidate;
}
@@ -96,16 +104,39 @@
if (args == null) {
return;
}
- for (int i = 0; i < args.length; i++) {
- if (args[i] instanceof JSF2ComponentParams) {
- message
- .setAttribute(
- JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY,
- ((JSF2ComponentParams) args[i])
- .getRelativateLocation());
- break;
+ if (args[0] instanceof JSF2CompositeTempComponent) {
+ JSF2CompositeTempComponent component = (JSF2CompositeTempComponent) args[0];
+ message.setAttribute(IJSF2ValidationComponent.JSF2_TYPE_KEY,
+ component.getType());
+ message.setAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY,
+ component.getComponentResourceLocation());
+ String[] attrNames = component.getAttrNames();
+ if (attrNames != null) {
+ for (int i = 0; i < attrNames.length; i++) {
+ message.setAttribute(
+ IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY
+ + String.valueOf(i), attrNames[i]);
+ }
}
+ return;
}
+ if (args[0] instanceof JSF2AttrTempComponent) {
+ JSF2AttrTempComponent component = (JSF2AttrTempComponent) args[0];
+ message.setAttribute(IJSF2ValidationComponent.JSF2_TYPE_KEY,
+ component.getType());
+ message.setAttribute(IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY,
+ component.getName());
+ message.setAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY,
+ component.getComponentResourceLocation());
+ return;
+ }
+ if (args[0] instanceof JSF2URITempComponent) {
+ JSF2URITempComponent component = (JSF2URITempComponent) args[0];
+ message.setAttribute(IJSF2ValidationComponent.JSF2_TYPE_KEY,
+ IJSF2ValidationComponent.JSF2_URI_TYPE);
+ message.setAttribute(IJSF2ValidationComponent.JSF2_URI_NAME_KEY,
+ component.getURI());
+ }
}
}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2SourceValidator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2SourceValidator.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2SourceValidator.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2;
+
+import java.util.Locale;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.ui.internal.reconcile.validator.ISourceValidator;
+import org.eclipse.wst.sse.ui.internal.reconcile.validator.IncrementalHelper;
+import org.eclipse.wst.validation.internal.core.Message;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
+import org.eclipse.wst.validation.internal.provisional.core.IValidator;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class JSF2SourceValidator implements IValidator, ISourceValidator {
+
+ private IDOMDocument document;
+
+ public void cleanup(IReporter reporter) {
+ }
+
+ public void validate(IValidationContext helper, IReporter reporter)
+ throws ValidationException {
+ if (document != null) {
+ if (helper instanceof IncrementalHelper) {
+ IncrementalHelper incrementalHelper = (IncrementalHelper) helper;
+ IProject project = incrementalHelper.getProject();
+ if (project == null) {
+ return;
+ }
+ String filePath = helper.getURIs()[0];
+ if (filePath == null) {
+ return;
+ }
+ filePath = filePath.substring(filePath.indexOf('/') + 1);
+ IResource resource = project.findMember(filePath
+ .substring(filePath.indexOf('/') + 1));
+ if (resource instanceof IFile) {
+ reportProblems(reporter,
+ JSF2XMLValidator.getValidationComponents(document,
+ (IFile) resource));
+ }
+ }
+ }
+ }
+
+ public void connect(IDocument document) {
+ if (document instanceof IStructuredDocument) {
+ IStructuredModel model = StructuredModelManager.getModelManager()
+ .getExistingModelForRead(document);
+ if (model instanceof IDOMModel) {
+ this.document = ((IDOMModel) model).getDocument();
+ }
+ }
+ }
+
+ public void disconnect(IDocument document) {
+ document = null;
+ }
+
+ public void validate(IRegion dirtyRegion, IValidationContext helper,
+ IReporter reporter) {
+ if (document != null) {
+ Element element = findNodeFromRegion(dirtyRegion);
+ if (element == null) {
+ return;
+ }
+ if (helper instanceof IncrementalHelper) {
+ IncrementalHelper incrementalHelper = (IncrementalHelper) helper;
+ IProject project = incrementalHelper.getProject();
+ if (project == null) {
+ return;
+ }
+ String filePath = helper.getURIs()[0];
+ if (filePath == null) {
+ return;
+ }
+ filePath = filePath.substring(filePath.indexOf('/') + 1);
+ IResource resource = project.findMember(filePath
+ .substring(filePath.indexOf('/') + 1));
+ if (resource instanceof IFile) {
+ reportProblems(reporter, JSF2XMLValidator
+ .getValidationComponents(element, (IFile) resource));
+ }
+ }
+ }
+ }
+
+ private void reportProblems(IReporter reporter,
+ IJSF2ValidationComponent[] validationComponents) {
+ for (int i = 0; i < validationComponents.length; i++) {
+ reporter.addMessage(this, new LocalizedMessage(
+ validationComponents[i]));
+ }
+ }
+
+ private static class LocalizedMessage extends Message {
+
+ private IJSF2ValidationComponent component;
+
+ public LocalizedMessage(IJSF2ValidationComponent component) {
+ this.component = component;
+ }
+
+ @Override
+ public int getLineNumber() {
+ return component.getLine();
+ }
+
+ @Override
+ public int getLength() {
+ return component.getLength();
+ }
+
+ @Override
+ public int getOffset() {
+ return component.getStartOffSet();
+ }
+
+ @Override
+ public String getText() {
+ return component.getValidationMessage();
+ }
+
+ @Override
+ public String getText(Locale locale) {
+ return component.getValidationMessage();
+ }
+
+ @Override
+ public String getText(Locale locale, ClassLoader classLoader) {
+ return component.getValidationMessage();
+ }
+
+ @Override
+ public String getText(ClassLoader classLoader) {
+ return component.getValidationMessage();
+ }
+
+ @Override
+ public int getSeverity() {
+ return IMessage.NORMAL_SEVERITY;
+ }
+
+ }
+
+ private Element findNodeFromRegion(IRegion region) {
+ int offset = region.getOffset();
+ Element[] elements = new Element[1];
+ findElementAttOffSet(offset, document.getDocumentElement(), elements);
+ return elements[0];
+ }
+
+ private void findElementAttOffSet(int offSet, Node scanEl,
+ Element[] returnEl) {
+ if (scanEl instanceof IDOMElement) {
+ if (isElementAttOffset(offSet, (IDOMElement) scanEl)) {
+ returnEl[0] = (IDOMElement) scanEl;
+ return;
+ }
+ NodeList childNodes = scanEl.getChildNodes();
+ if (childNodes != null) {
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ findElementAttOffSet(offSet, childNodes.item(i), returnEl);
+ }
+ }
+ }
+ }
+
+ private boolean isElementAttOffset(int offSet, IDOMElement element) {
+ return element.getStartOffset() == offSet;
+ }
+
+}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2ValidationInfo.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2ValidationInfo.java 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2ValidationInfo.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -1,13 +1,13 @@
- /*******************************************************************************
- * Copyright (c) 2007-2010 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
- ******************************************************************************/
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2;
@@ -16,11 +16,11 @@
/**
*
* @author yzhishko
- *
+ *
*/
@SuppressWarnings("restriction")
-public class JSF2ValidationInfo extends XMLValidationInfo{
+public class JSF2ValidationInfo extends XMLValidationInfo {
public JSF2ValidationInfo(String uri) {
super(uri);
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2Validator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2Validator.java 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2Validator.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -1,155 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007-2010 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.web.validation.jsf2;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.validation.core.ValidationReport;
-import org.jboss.tools.common.el.core.resolver.ELContext;
-import org.jboss.tools.jsf.JSFModelPlugin;
-import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ComponentParams;
-import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ComponentsUtil;
-import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ResourceUtil;
-import org.jboss.tools.jst.web.kb.IPageContext;
-import org.jboss.tools.jst.web.kb.PageContextFactory;
-import org.jboss.tools.jst.web.kb.internal.XmlContextImpl;
-import org.w3c.dom.Element;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-@SuppressWarnings("restriction")
-public class JSF2Validator {
-
- public static String JSF2_PROBLEM_ID = JSFModelPlugin.PLUGIN_ID
- + ".jsf2problemmarker"; //$NON-NLS-1$
-
- private JSF2ValidationInfo validationInfo;
- private IFile file;
-
- private static JSF2Validator instance = new JSF2Validator();
-
- public ValidationReport validate(IFile file, String uri) {
- validationInfo = new JSF2ValidationInfo(uri);
- this.file = file;
- validate(file);
- return validationInfo;
- }
-
- private JSF2Validator() {
-
- }
-
- public static JSF2Validator getInstance() {
- return instance;
- }
-
- private void validate(IFile file) {
- ELContext elContext = PageContextFactory.createPageContext(file);
- if (elContext instanceof IPageContext) {
- validateAsDOM(file);
- } else if (elContext instanceof XmlContextImpl) {
- if ("xhtml".equals(file.getFileExtension())) { //$NON-NLS-1$
- validateAsDOM(file);
- }
- }
- }
-
- private void validateAsDOM(IFile file) {
- IDOMDocument document = getDocumentForFile(file);
- if (document != null) {
- Map<String, List<Element>> jsf2Components = JSF2ComponentsUtil
- .findJSF2CompositeComponents(document);
- createMarkers(jsf2Components);
- }
- }
-
- private void createMarkers(Map<String, List<Element>> jsf2Components) {
- Set<String> elementsNameSet = new HashSet<String>(0);
- Collection<List<Element>> elementsCollection = jsf2Components.values();
- for (List<Element> list : elementsCollection) {
- if (list != null) {
- for (Element element : list) {
- if (!elementsNameSet.contains(element.getNodeName())) {
- IDOMElement domElement = (IDOMElement) element;
- createMarkerForElement(domElement);
- elementsNameSet.add(element.getNodeName());
- }
- }
- }
- }
- }
-
- private void createMarkerForElement(IDOMElement domElement) {
- if (!JSF2ResourceUtil.isJSF2CompositeComponentExists(file.getProject(),
- domElement)) {
- int line = ((IDOMDocument) domElement.getOwnerDocument())
- .getStructuredDocument().getLineOfOffset(
- domElement.getStartOffset());
- validationInfo.addWarning(createWarningMessage(domElement),
- line + 1, 0, validationInfo.getFileURI(), null,
- new Object[] { JSF2ComponentParams.create(domElement) });
- }
- }
-
- private String createWarningMessage(IDOMElement element) {
- StringBuilder builder = new StringBuilder("Composite component "); //$NON-NLS-1$
- String nodeName = element.getNodeName();
- if (nodeName.lastIndexOf(':') != -1) {
- nodeName = nodeName.substring(nodeName.lastIndexOf(':') + 1);
- }
- builder.append("\"" + nodeName + "\" "); //$NON-NLS-1$ //$NON-NLS-2$
- builder.append("was not found in a project resources folder"); //$NON-NLS-1$
- return builder.toString();
- }
-
- private IDOMDocument getDocumentForFile(IFile file) {
- IDOMDocument document = null;
- IModelManager manager = StructuredModelManager.getModelManager();
- if (manager == null) {
- return document;
- }
- IStructuredModel model = null;
- try {
- model = manager.getModelForRead(file);
- if (model instanceof IDOMModel) {
- IDOMModel domModel = (IDOMModel) model;
- document = domModel.getDocument();
- }
- } catch (CoreException e) {
- JSFModelPlugin.getPluginLog().logError(e);
- } catch (IOException e) {
- JSFModelPlugin.getPluginLog().logError(e);
- } finally {
- if (model != null) {
- model.releaseFromRead();
- }
- }
- return document;
- }
-
-}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2XMLValidator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2XMLValidator.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2XMLValidator.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.core.internal.validation.core.ValidationReport;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.jsf.JSFModelPlugin;
+import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ComponentRecognizer;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ComponentUtil;
+import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.jboss.tools.jst.web.kb.internal.XmlContextImpl;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class JSF2XMLValidator {
+
+ public static String JSF2_PROBLEM_ID = JSFModelPlugin.PLUGIN_ID
+ + ".jsf2problemmarker"; //$NON-NLS-1$
+
+ private JSF2ValidationInfo validationInfo;
+
+ private static JSF2XMLValidator instance = new JSF2XMLValidator();
+
+ public ValidationReport validate(IFile file, String uri) {
+ validationInfo = new JSF2ValidationInfo(uri);
+ validate(file);
+ return validationInfo;
+ }
+
+ private JSF2XMLValidator() {
+
+ }
+
+ public static JSF2XMLValidator getInstance() {
+ return instance;
+ }
+
+ private void validate(IFile file) {
+ ELContext elContext = PageContextFactory.createPageContext(file);
+ if (elContext instanceof IPageContext) {
+ validateAsDOM(file);
+ } else if (elContext instanceof XmlContextImpl) {
+ if ("xhtml".equals(file.getFileExtension())) { //$NON-NLS-1$
+ validateAsDOM(file);
+ }
+ }
+ }
+
+ private void validateAsDOM(IFile file) {
+ IDOMDocument document = JSF2ComponentUtil
+ .getReadableDocumentForFile(file);
+ IJSF2ValidationComponent[] components = getValidationComponents(
+ document, file);
+ if (components != null) {
+ for (int i = 0; i < components.length; i++) {
+ createMarkerForComponent(components[i]);
+ }
+ }
+ }
+
+ private void createMarkerForComponent(
+ IJSF2ValidationComponent jsf2ValidationComponent) {
+ validationInfo.addWarning(jsf2ValidationComponent
+ .getValidationMessage(), jsf2ValidationComponent.getLine(), 0,
+ validationInfo.getFileURI(), null, jsf2ValidationComponent
+ .getMessageParams());
+ }
+
+ public static IJSF2ValidationComponent[] getValidationComponents(Node node,
+ IFile file) {
+ List<IJSF2ValidationComponent> components = new ArrayList<IJSF2ValidationComponent>(
+ 0);
+ Set<String> tagNameSet = new HashSet<String>(0);
+ Map<String, List<Element>> compositeComponentsMap = JSF2ComponentUtil
+ .findCompositeComponents(node);
+ Set<Entry<String, List<Element>>> entries = compositeComponentsMap
+ .entrySet();
+ for (Entry<String, List<Element>> entry : entries) {
+ List<Element> elements = entry.getValue();
+ for (Element element : elements) {
+ if (!(tagNameSet.contains(element.getNodeName()))) {
+ tagNameSet.add(element.getNodeName());
+ IJSF2ValidationComponent[] validationComponents = JSF2ComponentRecognizer
+ .recognizeCompositeValidationComponents(file,
+ (IDOMElement) element);
+ for (int i = 0; i < validationComponents.length; i++) {
+ components.add(validationComponents[i]);
+ }
+ }
+ }
+ }
+ IDOMAttr[] attrs = JSF2ComponentUtil.findURIContainers(node);
+ Set<String> attrValuesSet = new HashSet<String>(0);
+ for (int i = 0; i < attrs.length; i++) {
+ if (!attrValuesSet.contains(attrs[i].getValue())) {
+ attrValuesSet.add(attrs[i].getValue());
+ IJSF2ValidationComponent validationComponent = JSF2ComponentRecognizer
+ .recognizeURIValidationComponent(file.getProject(),
+ attrs[i]);
+ if (validationComponent != null) {
+ components.add(validationComponent);
+ }
+ }
+ }
+ return components.toArray(new IJSF2ValidationComponent[0]);
+ }
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2CompositeAttrs.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2CompositeAttrs.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2CompositeAttrs.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2.action;
+
+import java.util.Map;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.wst.validation.ValidationFramework;
+import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
+import org.jboss.tools.jsf.JSFModelPlugin;
+import org.jboss.tools.jsf.messages.JSFUIMessages;
+import org.jboss.tools.jsf.web.validation.jsf2.JSF2XMLValidator;
+import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ResourceUtil;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class CreateJSF2CompositeAttrs implements IMarkerResolution {
+
+ public String getLabel() {
+ return JSFUIMessages.Create_JSF_2_Interface_Attr;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void run(final IMarker marker) {
+ try {
+ Map attrsMap = marker.getAttributes();
+ Object object = attrsMap
+ .get(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
+ final IFile createdFile = JSF2ResourceUtil
+ .createCompositeComponentFile(
+ marker.getResource().getProject(),
+ new Path((String) object),
+ new String[] { (String) marker
+ .getAttribute(IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY) });
+ marker.getResource().getProject().deleteMarkers(
+ JSF2XMLValidator.JSF2_PROBLEM_ID, false, 1);
+ if (createdFile != null) {
+ IDE.openEditor(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage(),
+ createdFile);
+ }
+ Job validateJob = new Job("JSF 2 Components Validator") { //$NON-NLS-1$
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ ValidationFramework.getDefault().validate(
+ new IProject[] { marker.getResource()
+ .getProject() }, false, false,
+ new NullProgressMonitor());
+ } catch (CoreException e) {
+ return new Status(IStatus.CANCEL,
+ JSFModelPlugin.PLUGIN_ID, "Cancel"); //$NON-NLS-1$
+ }
+ return IValidatorJob.OK_STATUS;
+ }
+ };
+ validateJob.schedule(500);
+ } catch (CoreException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ }
+ }
+
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2CompositeComponent.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2CompositeComponent.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2CompositeComponent.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2.action;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.wst.validation.ValidationFramework;
+import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
+import org.jboss.tools.jsf.JSFModelPlugin;
+import org.jboss.tools.jsf.messages.JSFUIMessages;
+import org.jboss.tools.jsf.web.validation.jsf2.JSF2XMLValidator;
+import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ResourceUtil;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class CreateJSF2CompositeComponent implements IMarkerResolution {
+
+ public String getLabel() {
+ return JSFUIMessages.Create_JSF_2_Composite_Component;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void run(final IMarker marker) {
+ try {
+ Map attrsMap = marker.getAttributes();
+ Object object = attrsMap
+ .get(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
+ final IFile createdFile = JSF2ResourceUtil
+ .createCompositeComponentFile(marker.getResource()
+ .getProject(), new Path((String) object),
+ getAttributes(marker));
+ marker.getResource().deleteMarkers(
+ JSF2XMLValidator.JSF2_PROBLEM_ID, false, 1);
+ if (createdFile != null) {
+ IDE.openEditor(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage(),
+ createdFile);
+ }
+ Job validateJob = new Job("JSF 2 Components Validator") { //$NON-NLS-1$
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ ValidationFramework.getDefault().validate(
+ new IProject[] { marker.getResource()
+ .getProject() }, false, false,
+ new NullProgressMonitor());
+ } catch (CoreException e) {
+ return new Status(IStatus.CANCEL,
+ JSFModelPlugin.PLUGIN_ID, "Cancel"); //$NON-NLS-1$
+ }
+ return IValidatorJob.OK_STATUS;
+ }
+ };
+ validateJob.schedule(500);
+ } catch (CoreException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private String[] getAttributes(IMarker marker) throws CoreException {
+ Map attrsMap = marker.getAttributes();
+ if (attrsMap != null) {
+ Set<String> set = new HashSet<String>(0);
+ Set<Entry> entries = attrsMap.entrySet();
+ for (Entry entry : entries) {
+ String key = (String) entry.getKey();
+ if (key.startsWith(IJSF2ValidationComponent.JSF2_ATTR_NAME_KEY)) {
+ set.add((String) entry.getValue());
+ }
+ }
+ return set.toArray(new String[0]);
+ }
+ return null;
+ }
+
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2ResourcesFolder.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2ResourcesFolder.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2ResourcesFolder.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2.action;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.wst.validation.ValidationFramework;
+import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
+import org.jboss.tools.jsf.JSFModelPlugin;
+import org.jboss.tools.jsf.messages.JSFUIMessages;
+import org.jboss.tools.jsf.web.validation.jsf2.JSF2XMLValidator;
+import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ResourceUtil;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class CreateJSF2ResourcesFolder implements IMarkerResolution {
+
+ public String getLabel() {
+ return JSFUIMessages.Create_JSF_2_Resources_Folder;
+ }
+
+ public void run(final IMarker marker) {
+ try {
+ JSF2ResourceUtil.createResourcesFolderByNameSpace(marker
+ .getResource().getProject(), (String) marker
+ .getAttribute(IJSF2ValidationComponent.JSF2_URI_NAME_KEY));
+ marker.getResource().getProject().deleteMarkers(
+ JSF2XMLValidator.JSF2_PROBLEM_ID, false, 1);
+ Job validateJob = new Job("JSF 2 Components Validator") { //$NON-NLS-1$
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ ValidationFramework.getDefault().validate(
+ new IProject[] { marker.getResource()
+ .getProject() }, false, false,
+ new NullProgressMonitor());
+ } catch (CoreException e) {
+ return new Status(IStatus.CANCEL,
+ JSFModelPlugin.PLUGIN_ID, "Cancel"); //$NON-NLS-1$
+ }
+ return IValidatorJob.OK_STATUS;
+ }
+ };
+ validateJob.schedule(500);
+ } catch (CoreException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ }
+ }
+
+}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ComponentResolutionGenerator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ComponentResolutionGenerator.java 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ComponentResolutionGenerator.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -1,13 +1,13 @@
- /*******************************************************************************
- * Copyright (c) 2007-2010 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
- ******************************************************************************/
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2.action;
@@ -16,13 +16,13 @@
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator;
import org.jboss.tools.jsf.JSFModelPlugin;
-import org.jboss.tools.jsf.web.validation.jsf2.JSF2Validator;
-import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ResourceUtil;
+import org.jboss.tools.jsf.web.validation.jsf2.JSF2XMLValidator;
+import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
/**
*
* @author yzhishko
- *
+ *
*/
public class JSF2ComponentResolutionGenerator implements
@@ -32,16 +32,28 @@
try {
String markerType = marker.getType();
if (markerType == null
- || !JSF2Validator.JSF2_PROBLEM_ID.equals(markerType)) {
+ || !JSF2XMLValidator.JSF2_PROBLEM_ID.equals(markerType)) {
return new IMarkerResolution[0];
}
- if (marker.getAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY) == null) {
- return new IMarkerResolution[0];
+ String fixType = (String) marker
+ .getAttribute(IJSF2ValidationComponent.JSF2_TYPE_KEY);
+ if (fixType != null) {
+ if (fixType
+ .equals(IJSF2ValidationComponent.JSF2_COMPOSITE_COMPONENT_TYPE)) {
+ return new IMarkerResolution[] { new CreateJSF2CompositeComponent() };
+ }
+ if (fixType
+ .equals(IJSF2ValidationComponent.JSF2_FIXABLE_ATTR_TYPE)) {
+ return new IMarkerResolution[] { new CreateJSF2CompositeAttrs() };
+ }
+ if (fixType.equals(IJSF2ValidationComponent.JSF2_URI_TYPE)) {
+ return new IMarkerResolution[] { new CreateJSF2ResourcesFolder() };
+ }
}
} catch (CoreException e) {
JSFModelPlugin.getPluginLog().logError(e);
- }
- return new JSF2MarkerResolution[] { new JSF2MarkerResolution() };
+ }
+ return new CreateJSF2CompositeComponent[] { new CreateJSF2CompositeComponent() };
}
}
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2MarkerResolution.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2MarkerResolution.java 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2MarkerResolution.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -1,82 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007-2010 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.web.validation.jsf2.action;
-
-import java.util.Map;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.ui.IMarkerResolution;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.wst.validation.ValidationFramework;
-import org.jboss.tools.jsf.JSFModelPlugin;
-import org.jboss.tools.jsf.messages.JSFUIMessages;
-import org.jboss.tools.jsf.web.validation.jsf2.JSF2Validator;
-import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ResourceUtil;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-public class JSF2MarkerResolution implements IMarkerResolution {
-
- public String getLabel() {
- return JSFUIMessages.Create_JSF_2_Composition_Component;
- }
-
- @SuppressWarnings("unchecked")
- public void run(final IMarker marker) {
- try {
- Map attrsMap = marker.getAttributes();
- Object object = attrsMap
- .get(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
- final IFile createdFile = JSF2ResourceUtil
- .createJSF2CompositeComponent(marker.getResource()
- .getProject(), new Path((String) object));
- marker.getResource().deleteMarkers(JSF2Validator.JSF2_PROBLEM_ID,
- false, 1);
- if (createdFile != null) {
- IDE.openEditor(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage(),
- createdFile);
- }
- new Thread("JSF2 Validator") { //$NON-NLS-1$
- public void run() {
- SafeRunner.run(new SafeRunnable() {
-
- public void run() throws Exception {
- try {
- ValidationFramework.getDefault().validate(
- new IProject[] { marker.getResource()
- .getProject() }, false, false,
- new NullProgressMonitor());
- } catch (CoreException e) {
- JSFModelPlugin.getPluginLog().logError(e);
- }
- }
- });
- };
- }.start();
- } catch (CoreException e) {
- JSFModelPlugin.getPluginLog().logError(e);
- }
- }
-
-}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/IJSF2ValidationComponent.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/IJSF2ValidationComponent.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/IJSF2ValidationComponent.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2.components;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public interface IJSF2ValidationComponent {
+
+ String JSF2_TYPE_KEY = "JSF2_TYPE_KEY"; //$NON-NLS-1$
+
+ String JSF2_COMPONENT_NAME_KEY = "AJSF2_COMPONENT_NAME_KEY"; //$NON-NLS-1$
+
+ String JSF2_ATTR_NAME_KEY = "ATTR_NAME_KEY"; //$NON-NLS-1$
+
+ String JSF2_URI_NAME_KEY = "JSF2_URI_NAME_KEY"; //$NON-NLS-1$
+
+ String JSF2_URI_TYPE_KEY = "JSF2_URI_TYPE_KEY"; //$NON-NLS-1$
+
+ String JSF2_COMPOSITE_COMPONENT_TYPE = "JSF2_COMPOSITE_COMPONENT_TYPE"; //$NON-NLS-1$
+
+ String JSF2_UNFIXABLE_ATTR_TYPE = "JSF2_UNFIXABLE_ATTR_TYPE"; //$NON-NLS-1$
+
+ String JSF2_FIXABLE_ATTR_TYPE = "JSF2_FIXABLE_ATTR_TYPE"; //$NON-NLS-1$
+
+ String JSF2_URI_TYPE = "JSF2_URI_TYPE"; //$NON-NLS-1$
+
+ int getLine();
+
+ int getStartOffSet();
+
+ int getLength();
+
+ String getValidationMessage();
+
+ Object[] getMessageParams();
+
+ String getType();
+
+ String getComponentResourceLocation();
+
+ int getSeverity();
+
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2AttrTempComponent.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2AttrTempComponent.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2AttrTempComponent.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2.components;
+
+import java.text.MessageFormat;
+
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.jboss.tools.jsf.messages.JSFUIMessages;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ResourceUtil;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class JSF2AttrTempComponent implements IJSF2ValidationComponent {
+
+ private int length;
+ private int startOffSet;
+ private int line;
+ private String validationMessage = ""; //$NON-NLS-1$
+ private Object[] messageParams;
+ private String type = JSF2_UNFIXABLE_ATTR_TYPE;
+ private ElementImpl parentEl;
+ private IDOMAttr attr;
+ private String componentResLocation;
+
+ public JSF2AttrTempComponent(IDOMAttr attr, ElementImpl parentEl) {
+ this.attr = attr;
+ this.parentEl = parentEl;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ void setLength(int length) {
+ this.length = length;
+ }
+
+ public int getLine() {
+ return line;
+ }
+
+ void setLine(int lineNumber) {
+ this.line = lineNumber;
+ }
+
+ public int getStartOffSet() {
+ return startOffSet;
+ }
+
+ void setStartOffSet(int startOffSet) {
+ this.startOffSet = startOffSet;
+ }
+
+ void createValidationMessage() {
+ String nodeName = parentEl.getNodeName();
+ if (nodeName.indexOf(':') > -1) {
+ nodeName = nodeName.substring(nodeName.lastIndexOf(':') + 1);
+ }
+ this.validationMessage = MessageFormat.format(
+ JSFUIMessages.Missing_JSF_2_Component_Attr, attr.getName(),
+ nodeName);
+ }
+
+ public String getValidationMessage() {
+ return validationMessage;
+ }
+
+ void createMessageParams() {
+ this.messageParams = new Object[] { this };
+ }
+
+ public Object[] getMessageParams() {
+ return messageParams;
+ }
+
+ void setType(String type) {
+ this.type = type;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getName() {
+ return attr.getName();
+ }
+
+ public String getComponentResourceLocation() {
+ if (componentResLocation == null) {
+ String uriString = parentEl.getNamespaceURI();
+ String relativeLocation = uriString.replaceFirst(
+ JSF2ResourceUtil.JSF2_URI_PREFIX, ""); //$NON-NLS-1$
+ String nodeName = parentEl.getNodeName();
+ if (nodeName.indexOf(':') > -1) {
+ nodeName = nodeName.substring(nodeName.lastIndexOf(':') + 1);
+ }
+ componentResLocation = relativeLocation + "/" + nodeName + ".xhtml"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return componentResLocation;
+ }
+
+ public int getSeverity() {
+ return IMessage.NORMAL_SEVERITY;
+ }
+
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2ComponentFactory.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2ComponentFactory.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2ComponentFactory.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2.components;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ComponentModelManager;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ComponentUtil;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class JSF2ComponentFactory {
+
+ public static IJSF2ValidationComponent createCompositeTempComponent(
+ IDOMElement element) {
+ JSF2CompositeTempComponent component = new JSF2CompositeTempComponent(
+ (ElementImpl) element);
+ component.setStartOffSet(element.getStartOffset());
+ component.setLength(element.getStartEndOffset()
+ - component.getStartOffSet());
+ component.setLine(element.getStructuredDocument().getLineOfOffset(
+ component.getStartOffSet()) + 1);
+ component.createValidationMessage();
+ component.createMessageParams();
+ return component;
+ }
+
+ public static IJSF2ValidationComponent[] createUnfixableAttrTempComponents(
+ ZipEntry zipContainer, IDOMElement elementWithAttrs) {
+ return null;
+ }
+
+ public static IJSF2ValidationComponent[] createFixableAttrTempComponents(
+ IFile compContainerFile, IDOMElement elementWithAttrs) {
+ List<IJSF2ValidationComponent> components = new ArrayList<IJSF2ValidationComponent>(
+ 0);
+ IDOMDocument document = JSF2ComponentUtil
+ .getReadableDocumentForFile(compContainerFile);
+ IDOMElement interfaceElement = JSF2ComponentModelManager.getManager()
+ .checkCompositeInterface(document);
+ List<String> interfaceAttrs = getInterfaceAttrs(interfaceElement);
+ IDOMAttr[] existingAttrs = getExistingAttrs(elementWithAttrs);
+ for (int i = 0; i < existingAttrs.length; i++) {
+ if (!interfaceAttrs.contains(existingAttrs[i].getName())) {
+ IDOMAttr attr = existingAttrs[i];
+ JSF2AttrTempComponent component = new JSF2AttrTempComponent(
+ attr, (ElementImpl) elementWithAttrs);
+ component
+ .setType(IJSF2ValidationComponent.JSF2_FIXABLE_ATTR_TYPE);
+ component.setStartOffSet(attr.getStartOffset());
+ component.setLine(attr.getStructuredDocument().getLineOfOffset(
+ component.getStartOffSet()) + 1);
+ component.setLength(attr.getName().length());
+ component.createValidationMessage();
+ component.createMessageParams();
+ components.add(component);
+ }
+ }
+ return components.toArray(new IJSF2ValidationComponent[0]);
+ }
+
+ public static IJSF2ValidationComponent createURITempComponent(
+ IDOMAttr attrContainer) {
+ JSF2URITempComponent component = new JSF2URITempComponent(attrContainer
+ .getValue());
+ component.setStartOffSet(attrContainer.getStartOffset());
+ component.setLength(attrContainer.getValueRegionStartOffset()
+ - component.getStartOffSet()
+ + attrContainer.getValue().length() + 2);
+ component.setLine(attrContainer.getStructuredDocument()
+ .getLineOfOffset(component.getStartOffSet()) + 1);
+ component.createMessageParams();
+ component.createValidationMessage();
+ return component;
+ }
+
+ private static List<String> getInterfaceAttrs(IDOMElement interfaceElement) {
+ List<String> interfaceAttrs = new ArrayList<String>(0);
+ if (interfaceElement != null) {
+ String prefix = interfaceElement.getPrefix();
+ String nodeName = "attribute"; //$NON-NLS-1$
+ if (prefix != null && !"".equals(prefix)) { //$NON-NLS-1$
+ nodeName = prefix + ":" + nodeName; //$NON-NLS-1$
+ }
+ NodeList attrsElements = interfaceElement
+ .getElementsByTagName(nodeName);
+ if (attrsElements != null) {
+ for (int i = 0; i < attrsElements.getLength(); i++) {
+ Node el = attrsElements.item(i);
+ if (el instanceof IDOMElement) {
+ IDOMElement element = (IDOMElement) el;
+ String attrvalue = element.getAttribute("name"); //$NON-NLS-1$
+ if (attrvalue != null && !"".equals(attrvalue)) { //$NON-NLS-1$
+ interfaceAttrs.add(attrvalue);
+ }
+ }
+ }
+ }
+ }
+ return interfaceAttrs;
+ }
+
+ private static IDOMAttr[] getExistingAttrs(IDOMElement validateElement) {
+ List<IDOMAttr> existingAttrs = new ArrayList<IDOMAttr>(0);
+ NamedNodeMap attrsMap = validateElement.getAttributes();
+ if (attrsMap != null) {
+ for (int i = 0; i < attrsMap.getLength(); i++) {
+ Node node = attrsMap.item(i);
+ if (node instanceof IDOMAttr) {
+ existingAttrs.add((IDOMAttr) node);
+ }
+ }
+ }
+ return existingAttrs.toArray(new IDOMAttr[0]);
+ }
+
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2CompositeTempComponent.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2CompositeTempComponent.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2CompositeTempComponent.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -0,0 +1,106 @@
+package org.jboss.tools.jsf.web.validation.jsf2.components;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.jboss.tools.jsf.messages.JSFUIMessages;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ResourceUtil;
+import org.w3c.dom.NamedNodeMap;
+
+@SuppressWarnings("restriction")
+public class JSF2CompositeTempComponent implements IJSF2ValidationComponent {
+ private int length;
+ private int startOffSet;
+ private int line;
+ private String validationMessage = ""; //$NON-NLS-1$
+ private Object[] messageParams;
+ private List<String> attrNames = new ArrayList<String>(0);
+ private ElementImpl element;
+ private String componentResLoc;
+
+ public JSF2CompositeTempComponent(ElementImpl element) {
+ this.element = element;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ void setLength(int length) {
+ this.length = length;
+ }
+
+ public int getLine() {
+ return line;
+ }
+
+ void setLine(int lineNumber) {
+ this.line = lineNumber;
+ }
+
+ public int getStartOffSet() {
+ return startOffSet;
+ }
+
+ void setStartOffSet(int startOffSet) {
+ this.startOffSet = startOffSet;
+ }
+
+ void createValidationMessage() {
+ String nodeName = element.getNodeName();
+ if (nodeName.indexOf(':') > -1) {
+ nodeName = nodeName.substring(nodeName.lastIndexOf(':') + 1);
+ }
+ this.validationMessage = MessageFormat.format(
+ JSFUIMessages.Missing_JSF_2_Composite_Component, nodeName);
+ }
+
+ public String getValidationMessage() {
+ return validationMessage;
+ }
+
+ void createMessageParams() {
+ NamedNodeMap attrsMap = element.getAttributes();
+ if (attrsMap != null && attrsMap.getLength() != 0) {
+ for (int i = 0; i < attrsMap.getLength(); i++) {
+ IDOMAttr attr = (IDOMAttr) attrsMap.item(i);
+ attrNames.add(attr.getName());
+ }
+ }
+ this.messageParams = new Object[] { this };
+ }
+
+ public Object[] getMessageParams() {
+ return messageParams;
+ }
+
+ public String[] getAttrNames() {
+ return attrNames.toArray(new String[0]);
+ }
+
+ public String getType() {
+ return JSF2_COMPOSITE_COMPONENT_TYPE;
+ }
+
+ public String getComponentResourceLocation() {
+ if (componentResLoc == null) {
+ String uriString = element.getNamespaceURI();
+ String relativeLocation = uriString.replaceFirst(
+ JSF2ResourceUtil.JSF2_URI_PREFIX, ""); //$NON-NLS-1$
+ String nodeName = element.getNodeName();
+ if (nodeName.indexOf(':') > -1) {
+ nodeName = nodeName.substring(nodeName.lastIndexOf(':') + 1);
+ }
+ componentResLoc = relativeLocation + "/" + nodeName + ".xhtml"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return componentResLoc;
+ }
+
+ public int getSeverity() {
+ return IMessage.NORMAL_SEVERITY;
+ }
+
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2URITempComponent.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2URITempComponent.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/components/JSF2URITempComponent.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2.components;
+
+import java.text.MessageFormat;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.jboss.tools.jsf.messages.JSFUIMessages;
+import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ResourceUtil;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class JSF2URITempComponent implements IJSF2ValidationComponent {
+
+ private int length;
+ private int startOffSet;
+ private int line;
+ private String validationMessage = ""; //$NON-NLS-1$
+ private Object[] messageParams;
+ private String URI;
+
+ public JSF2URITempComponent(String URI) {
+ this.URI = URI;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ void setLength(int length) {
+ this.length = length;
+ }
+
+ public int getLine() {
+ return line;
+ }
+
+ void setLine(int lineNumber) {
+ this.line = lineNumber;
+ }
+
+ public int getStartOffSet() {
+ return startOffSet;
+ }
+
+ void setStartOffSet(int startOffSet) {
+ this.startOffSet = startOffSet;
+ }
+
+ void createValidationMessage() {
+ String mesParam = "/resources" + URI.replaceAll(JSF2ResourceUtil.JSF2_URI_PREFIX, ""); //$NON-NLS-1$ //$NON-NLS-2$
+ this.validationMessage = MessageFormat.format(
+ JSFUIMessages.Missing_JSF_2_Resources_Folder, mesParam);
+ }
+
+ public String getValidationMessage() {
+ return validationMessage;
+ }
+
+ public Object[] getMessageParams() {
+ return messageParams;
+ }
+
+ void createMessageParams() {
+ messageParams = new Object[] { this };
+ }
+
+ public String getType() {
+ return JSF2_URI_TYPE;
+ }
+
+ public String getComponentResourceLocation() {
+ return ""; //$NON-NLS-1$
+ }
+
+ public int getSeverity() {
+ return IMessage.NORMAL_SEVERITY;
+ }
+
+ public String getURI() {
+ return URI;
+ }
+
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentModelManager.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentModelManager.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentModelManager.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.format.DocumentNodeFormatter;
+import org.jboss.tools.jsf.JSFModelPlugin;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class JSF2ComponentModelManager {
+
+ private static JSF2ComponentModelManager instance = new JSF2ComponentModelManager();
+
+ private JSF2ComponentModelManager() {
+
+ }
+
+ public static JSF2ComponentModelManager getManager() {
+ return instance;
+ }
+
+ public IFile updateJSF2CompositeComponentFile(
+ IFile componentFileContatiner, String[] attrNames) {
+ IDOMDocument document = null;
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if (manager == null) {
+ return componentFileContatiner;
+ }
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForEdit(componentFileContatiner);
+ if (model instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) model;
+ model.reload(componentFileContatiner.getContents());
+ document = domModel.getDocument();
+ updateJSF2CompositeComponent(document, attrNames);
+ try {
+ componentFileContatiner.setContents(
+ new ByteArrayInputStream(document
+ .getStructuredDocument().getText()
+ .getBytes()), true, false,
+ new NullProgressMonitor());
+ } catch (CoreException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ }
+ }
+ } catch (CoreException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ } catch (IOException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ } finally {
+ if (model != null) {
+ model.releaseFromEdit();
+ }
+ }
+ return componentFileContatiner;
+ }
+
+ public void updateJSF2CompositeComponent(IDOMDocument componentDoc,
+ String[] attrNames) {
+ IDOMElement[] interfaceElement = new IDOMElement[1];
+ findInterfaceComponent(componentDoc, interfaceElement);
+ createCompositeCompInterface(interfaceElement[0], attrNames);
+ }
+
+ private void findInterfaceComponent(Node node,
+ IDOMElement[] interfaceElement) {
+ if (node instanceof IDOMDocument) {
+ IDOMDocument document = (IDOMDocument) node;
+ findInterfaceComponent(document.getDocumentElement(),
+ interfaceElement);
+ }
+ if (node instanceof ElementImpl) {
+ ElementImpl impl = (ElementImpl) node;
+ String nameSpace = impl.getNamespaceURI();
+ if (JSF2ResourceUtil.JSF2_URI_PREFIX.equals(nameSpace)) {
+ String nodeName = impl.getNodeName();
+ String compName = nodeName.substring(
+ nodeName.lastIndexOf(':') + 1).trim();
+ if ("interface".equals(compName)) { //$NON-NLS-1$
+ interfaceElement[0] = impl;
+ return;
+ }
+ } else {
+ NodeList nodeList = node.getChildNodes();
+ if (nodeList != null) {
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ findInterfaceComponent(nodeList.item(i),
+ interfaceElement);
+ }
+ }
+ }
+ }
+ }
+
+ private void createCompositeCompInterface(IDOMElement element,
+ String[] attrNames) {
+ Document document = (Document) element.getOwnerDocument();
+ String prefix = element.getPrefix();
+ if (prefix != null && !"".equals(prefix)) { //$NON-NLS-1$
+ for (int i = 0; i < attrNames.length; i++) {
+ Element attrEl = document
+ .createElementNS(JSF2ResourceUtil.JSF2_URI_PREFIX,
+ prefix + ":attribute"); //$NON-NLS-1$
+ attrEl.setAttribute("name", attrNames[i]); //$NON-NLS-1$
+ element.appendChild(attrEl);
+ }
+ } else {
+ for (int i = 0; i < attrNames.length; i++) {
+ Element attrEl = document.createElementNS(
+ JSF2ResourceUtil.JSF2_URI_PREFIX, "attribute"); //$NON-NLS-1$
+ attrEl.setAttribute("name", attrNames[i]); //$NON-NLS-1$
+ element.appendChild(attrEl);
+ }
+ }
+ DocumentNodeFormatter formatter = new DocumentNodeFormatter();
+ formatter.format(document);
+ }
+
+ public IFile revalidateCompositeComponentFile(IFile file) {
+ IDOMDocument document = JSF2ComponentUtil
+ .getReadableDocumentForFile(file);
+ if (document == null) {
+ return null;
+ }
+ IDOMElement interfaceElement = checkCompositeInterface(document);
+ if (interfaceElement == null) {
+ return null;
+ }
+ return file;
+ }
+
+ public IDOMElement checkCompositeInterface(IDOMDocument document) {
+ if (document == null) {
+ return null;
+ }
+ Element element = document.getDocumentElement();
+ if (element == null) {
+ return null;
+ }
+ if (!"html".equals(element.getNodeName())) { //$NON-NLS-1$
+ return null;
+ }
+ ElementImpl elementImpl = (ElementImpl) element;
+ if (!"http://www.w3.org/1999/xhtml".equals(elementImpl.getNamespaceURI())) { //$NON-NLS-1$
+ return null;
+ }
+ NodeList children = element.getChildNodes();
+ if (children == null) {
+ return null;
+ }
+ for (int i = 0; i < children.getLength(); i++) {
+ if (children.item(i) instanceof Element) {
+ Element el = (Element) children.item(i);
+ String nodeName = el.getNodeName();
+ if (nodeName.indexOf(':') > -1) {
+ nodeName = nodeName
+ .substring(nodeName.lastIndexOf(":") + 1); //$NON-NLS-1$
+ }
+ if ("interface".equals(nodeName)) { //$NON-NLS-1$
+ if (JSF2ResourceUtil.JSF2_URI_PREFIX
+ .equals(((ElementImpl) el).getNamespaceURI())) {
+ return (IDOMElement) el;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+}
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentParams.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentParams.java 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentParams.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -1,62 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007-2010 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.web.validation.jsf2.util;
-
-import org.eclipse.wst.xml.core.internal.document.ElementImpl;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-@SuppressWarnings("restriction")
-public class JSF2ComponentParams {
-
- private String relativeLocation;
-
- private JSF2ComponentParams() {
-
- }
-
- public static JSF2ComponentParams create(IDOMElement element) {
- JSF2ComponentParams componentParams = new JSF2ComponentParams();
- if (element != null) {
- ElementImpl elementImpl = (ElementImpl) element;
- String nameSpaceURI = elementImpl.getNamespaceURI();
- if (nameSpaceURI == null
- || nameSpaceURI.indexOf(JSF2ResourceUtil.JSF2_URI_PREFIX) == -1) {
- return null;
- }
- String nodeName = element.getNodeName();
- if (nodeName.lastIndexOf(':') != -1) {
- nodeName = nodeName.substring(nodeName.lastIndexOf(':') + 1);
- }
- String relativeLocation = nameSpaceURI.replaceFirst(
- JSF2ResourceUtil.JSF2_URI_PREFIX, ""); //$NON-NLS-1$
- componentParams.setRelativateLocation(relativeLocation
- + "/" + nodeName + ".xhtml"); //$NON-NLS-1$ //$NON-NLS-2$
-
- }
- return componentParams;
- }
-
- public void setRelativateLocation(String relativateLocation) {
- this.relativeLocation = relativateLocation;
- }
-
- public String getRelativateLocation() {
- return relativeLocation;
- }
-
-}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentRecognizer.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentRecognizer.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentRecognizer.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.jboss.tools.jsf.web.validation.jsf2.components.IJSF2ValidationComponent;
+import org.jboss.tools.jsf.web.validation.jsf2.components.JSF2ComponentFactory;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class JSF2ComponentRecognizer {
+
+ public static IJSF2ValidationComponent[] recognizeCompositeValidationComponents(
+ IFile file, IDOMElement element) {
+ List<IJSF2ValidationComponent> validationComponents = new ArrayList<IJSF2ValidationComponent>(
+ 0);
+ Object container = JSF2ResourceUtil.findCompositeComponentContainer(
+ file.getProject(), element);
+ if (container == null) {
+ IJSF2ValidationComponent component = JSF2ComponentFactory
+ .createCompositeTempComponent(element);
+ validationComponents.add(component);
+ } else if (container instanceof IFile) {
+ IJSF2ValidationComponent[] components = JSF2ComponentFactory
+ .createFixableAttrTempComponents((IFile) container, element);
+ for (int i = 0; i < components.length; i++) {
+ validationComponents.add(components[i]);
+ }
+ } else if (container instanceof ZipEntry) {
+ IJSF2ValidationComponent[] components = JSF2ComponentFactory
+ .createUnfixableAttrTempComponents((ZipEntry) container,
+ element);
+ for (int i = 0; i < components.length; i++) {
+ validationComponents.add(components[i]);
+ }
+ }
+ return validationComponents.toArray(new IJSF2ValidationComponent[0]);
+ }
+
+ public static IJSF2ValidationComponent recognizeURIValidationComponent(
+ IProject project, IDOMAttr attrContainer) {
+ if (!JSF2ResourceUtil.isResourcesFolderExists(project, attrContainer
+ .getValue())) {
+ return JSF2ComponentFactory.createURITempComponent(attrContainer);
+ }
+ return null;
+ }
+
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentUtil.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentUtil.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2.util;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.jboss.tools.jsf.JSFModelPlugin;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class JSF2ComponentUtil {
+
+ public static Map<String, List<Element>> findCompositeComponents(Node node) {
+ Map<String, List<Element>> elementsMap = new HashMap<String, List<Element>>(
+ 0);
+ findChildCompositeComponents(node, elementsMap);
+ return elementsMap;
+ }
+
+ private static void findChildCompositeComponents(Node node,
+ Map<String, List<Element>> elementsMap) {
+ if (node instanceof IDOMDocument) {
+ node = ((IDOMDocument) node).getDocumentElement();
+ findChildCompositeComponents(node, elementsMap);
+ } else if (node instanceof ElementImpl) {
+ ElementImpl elementImpl = (ElementImpl) node;
+ String namespaceURI = elementImpl.getNamespaceURI();
+ if (namespaceURI != null
+ && namespaceURI
+ .startsWith(JSF2ResourceUtil.JSF2_URI_PREFIX)
+ && !namespaceURI.equals(JSF2ResourceUtil.JSF2_URI_PREFIX)) {
+ List<Element> elements = elementsMap.get(namespaceURI);
+ if (elements == null) {
+ elements = new ArrayList<Element>(0);
+ }
+ elements.add(elementImpl);
+ elementsMap.put(namespaceURI, elements);
+ }
+ NodeList children = node.getChildNodes();
+ if (children != null) {
+ for (int i = 0; i < children.getLength(); i++) {
+ findChildCompositeComponents(children.item(i), elementsMap);
+ }
+ }
+ }
+ }
+
+ public static IDOMDocument getReadableDocumentForFile(IFile file) {
+ IDOMDocument document = null;
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if (manager == null) {
+ return document;
+ }
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForRead(file);
+ if (model instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) model;
+ document = domModel.getDocument();
+ }
+ } catch (CoreException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ } catch (IOException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ } finally {
+ if (model != null) {
+ model.releaseFromRead();
+ }
+ }
+ return document;
+ }
+
+ public static IDOMAttr[] findURIContainers(Node scanNode) {
+ List<IDOMAttr> attrs = new ArrayList<IDOMAttr>(0);
+ findChildURIContainers(scanNode, attrs);
+ return attrs.toArray(new IDOMAttr[0]);
+ }
+
+ private static void findChildURIContainers(Node node,
+ List<IDOMAttr> attrsList) {
+ if (node instanceof IDOMDocument) {
+ node = ((IDOMDocument) node).getDocumentElement();
+ findChildURIContainers(node, attrsList);
+ } else if (node instanceof ElementImpl) {
+ ElementImpl elementImpl = (ElementImpl) node;
+ NamedNodeMap attrsMap = elementImpl.getAttributes();
+ if (attrsMap != null && attrsMap.getLength() != 0) {
+ for (int i = 0; i < attrsMap.getLength(); i++) {
+ IDOMAttr attr = (IDOMAttr) attrsMap.item(i);
+ String attrValue = attr.getValue();
+ if (attrValue != null
+ && attrValue
+ .indexOf(JSF2ResourceUtil.JSF2_URI_PREFIX) > -1) {
+ String compPath = attrValue.replaceFirst(
+ JSF2ResourceUtil.JSF2_URI_PREFIX, ""); //$NON-NLS-1$
+ if (!"".equals(compPath.trim())) { //$NON-NLS-1$
+ if (isCorrectCompositeShemaAttrName(attr.getName())) {
+ attrsList.add(attr);
+ }
+ }
+ }
+ }
+ }
+ NodeList children = node.getChildNodes();
+ if (children != null) {
+ for (int i = 0; i < children.getLength(); i++) {
+ findChildURIContainers((IDOMNode) children.item(i),
+ attrsList);
+ }
+ }
+ }
+ }
+
+ private static boolean isCorrectCompositeShemaAttrName(String attrName) {
+ if (attrName == null) {
+ return false;
+ }
+ if ("xmlns".equals(attrName.trim()) || "uri".equals(attrName.trim())) { //$NON-NLS-1$ //$NON-NLS-2$
+ return true;
+ }
+ if (attrName.indexOf(':') < 0) {
+ return false;
+ }
+ attrName = attrName.substring(0, attrName.indexOf(':')).trim();
+ if ("xmlns".equals(attrName)) { //$NON-NLS-1$
+ return true;
+ }
+ return false;
+ }
+
+}
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentsUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentsUtil.java 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ComponentsUtil.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -1,69 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007-2010 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.web.validation.jsf2.util;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.wst.xml.core.internal.document.ElementImpl;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-@SuppressWarnings("restriction")
-public class JSF2ComponentsUtil {
-
- public static Map<String, List<Element>> findJSF2CompositeComponents(
- IDOMDocument document) {
- Map<String, List<Element>> elementsMap = new HashMap<String, List<Element>>(
- 0);
- findJSF2ChildCompositeComponents(document, elementsMap);
- return elementsMap;
- }
-
- private static void findJSF2ChildCompositeComponents(Node node,
- Map<String, List<Element>> elementsMap) {
- if (node instanceof IDOMDocument) {
- node = ((IDOMDocument) node).getDocumentElement();
- findJSF2ChildCompositeComponents(node, elementsMap);
- } else if (node instanceof ElementImpl) {
- ElementImpl elementImpl = (ElementImpl) node;
- String namespaceURI = elementImpl.getNamespaceURI();
- if (namespaceURI != null
- && namespaceURI
- .startsWith(JSF2ResourceUtil.JSF2_URI_PREFIX)
- && !namespaceURI.equals(JSF2ResourceUtil.JSF2_URI_PREFIX)) {
- List<Element> elements = elementsMap.get(namespaceURI);
- if (elements == null) {
- elements = new ArrayList<Element>(0);
- }
- elements.add(elementImpl);
- elementsMap.put(namespaceURI, elements);
- }
- NodeList children = node.getChildNodes();
- if (children != null) {
- for (int i = 0; i < children.getLength(); i++) {
- findJSF2ChildCompositeComponents(children.item(i), elementsMap);
- }
- }
- }
- }
-
-}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ResourceUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ResourceUtil.java 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2ResourceUtil.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -1,18 +1,17 @@
- /*******************************************************************************
- * Copyright (c) 2007-2010 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
- ******************************************************************************/
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2.util;
import java.util.zip.ZipEntry;
-
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -37,7 +36,7 @@
/**
*
* @author yzhishko
- *
+ *
*/
@SuppressWarnings("restriction")
@@ -47,12 +46,12 @@
public static final String COMPONENT_RESOURCE_PATH_KEY = "component_resource_path_key"; //$NON-NLS-1$
- public static boolean isJSF2CompositeComponentExists(IProject project,
+ public static Object findCompositeComponentContainer(IProject project,
IDOMElement jsf2Element) {
ElementImpl elementImpl = (ElementImpl) jsf2Element;
String nameSpaceURI = elementImpl.getNamespaceURI();
if (nameSpaceURI == null || nameSpaceURI.indexOf(JSF2_URI_PREFIX) == -1) {
- return false;
+ return null;
}
String nodeName = jsf2Element.getNodeName();
if (nodeName.lastIndexOf(':') != -1) {
@@ -69,15 +68,109 @@
"/" + nodeName + ".xhtml"); //$NON-NLS-1$ //$NON-NLS-2$
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
if (file.exists()) {
- return true;
+ return file;
}
}
return searchInClassPath(project, "META-INF" + relativeLocation //$NON-NLS-1$
+ "/" + nodeName + ".xhtml"); //$NON-NLS-1$ //$NON-NLS-2$
}
- public static IFile createJSF2CompositeComponent(IProject project,
+ private static ZipEntry searchInClassPath(IProject project,
+ String classPathResource) {
+ IJavaProject javaProject = JavaCore.create(project);
+ try {
+ for (IPackageFragmentRoot fragmentRoot : javaProject
+ .getAllPackageFragmentRoots()) {
+ if (fragmentRoot instanceof JarPackageFragmentRoot) {
+ JarPackageFragmentRoot jarPackageFragmentRoot = (JarPackageFragmentRoot) fragmentRoot;
+ ZipEntry zipEntry = jarPackageFragmentRoot.getJar()
+ .getEntry(classPathResource);
+ if (zipEntry != null) {
+ return zipEntry;
+ }
+ }
+ }
+ } catch (JavaModelException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ } catch (CoreException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ }
+ return null;
+ }
+
+ public static IPath findResourcesFolderByNameSpace(IProject project,
+ String nameSpaceURI) {
+ if (nameSpaceURI == null || nameSpaceURI.indexOf(JSF2_URI_PREFIX) == -1) {
+ return null;
+ }
+ String relativeLocation = "/resources" + nameSpaceURI.replaceFirst( //$NON-NLS-1$
+ JSF2ResourceUtil.JSF2_URI_PREFIX, ""); //$NON-NLS-1$
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if (component != null) {
+ IVirtualFolder webRootFolder = component.getRootFolder().getFolder(
+ new Path("/")); //$NON-NLS-1$
+ IContainer folder = webRootFolder.getUnderlyingFolder();
+ IPath path = folder.getFullPath().append(relativeLocation);
+ IFolder resFolder = ResourcesPlugin.getWorkspace().getRoot()
+ .getFolder(path);
+ if (resFolder.exists()) {
+ return resFolder.getFullPath();
+ }
+ }
+ return null;
+ }
+
+ public static boolean isResourcesFolderExists(IProject project,
+ String nameSpaceURI) {
+ return findResourcesFolderByNameSpace(project, nameSpaceURI) == null ? false
+ : true;
+ }
+
+ public static IFolder createResourcesFolderByNameSpace(IProject project,
+ String nameSpaceURI) throws CoreException {
+ IFolder compositeCompResFolder = null;
+ String relativeLocation = nameSpaceURI.replaceFirst(
+ JSF2ResourceUtil.JSF2_URI_PREFIX, ""); //$NON-NLS-1$
+ if (!project.exists()) {
+ return null;
+ }
+ if (!project.isAccessible()) {
+ try {
+ project.open(new NullProgressMonitor());
+ } catch (CoreException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ return compositeCompResFolder;
+ }
+ }
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if (component != null) {
+ IVirtualFolder webRootFolder = component.getRootFolder().getFolder(
+ new Path("/")); //$NON-NLS-1$
+ IContainer folder = webRootFolder.getUnderlyingFolder();
+ IFolder webFolder = ResourcesPlugin.getWorkspace().getRoot()
+ .getFolder(folder.getFullPath());
+ IFolder resourcesFolder = webFolder.getFolder("resources"); //$NON-NLS-1$
+ NullProgressMonitor monitor = new NullProgressMonitor();
+ if (!resourcesFolder.exists()) {
+ resourcesFolder.create(true, true, monitor);
+ }
+ String[] segments = new Path(relativeLocation).segments();
+ compositeCompResFolder = resourcesFolder;
+ for (int i = 0; i < segments.length; i++) {
+ compositeCompResFolder = compositeCompResFolder
+ .getFolder(segments[i]);
+ if (!compositeCompResFolder.exists()) {
+ compositeCompResFolder.create(true, true, monitor);
+ }
+ }
+
+ }
+ return compositeCompResFolder;
+ }
+
+ public static IFile createCompositeComponentFile(IProject project,
IPath resourceRelativePath) throws CoreException {
+ IFile compositeCompResFile = null;
if (!project.exists()) {
return null;
}
@@ -86,6 +179,7 @@
project.open(new NullProgressMonitor());
} catch (CoreException e) {
JSFModelPlugin.getPluginLog().logError(e);
+ return compositeCompResFile;
}
}
IVirtualComponent component = ComponentCore.createComponent(project);
@@ -109,39 +203,33 @@
componentPathFolder.create(true, true, monitor);
}
}
- IFile file = componentPathFolder
+ compositeCompResFile = componentPathFolder
.getFile(segments[segments.length - 1]);
- if (!file.exists()) {
- file.create(JSF2TemplateManager.getManager()
+ if (!compositeCompResFile.exists()) {
+ compositeCompResFile.create(JSF2TemplateManager.getManager()
.createStreamFromTemplate("composite.xhtml"), true, //$NON-NLS-1$
monitor);
+ } else {
+ compositeCompResFile = JSF2ComponentModelManager.getManager()
+ .revalidateCompositeComponentFile(compositeCompResFile);
}
- return file;
}
- return null;
+ return compositeCompResFile;
}
- private static boolean searchInClassPath(IProject project,
- String classPathResource) {
- IJavaProject javaProject = JavaCore.create(project);
- try {
- for (IPackageFragmentRoot fragmentRoot : javaProject
- .getAllPackageFragmentRoots()) {
- if (fragmentRoot instanceof JarPackageFragmentRoot) {
- JarPackageFragmentRoot jarPackageFragmentRoot = (JarPackageFragmentRoot) fragmentRoot;
- ZipEntry zipEntry = jarPackageFragmentRoot.getJar()
- .getEntry(classPathResource);
- if (zipEntry != null) {
- return true;
- }
- }
- }
- } catch (JavaModelException e) {
- JSFModelPlugin.getPluginLog().logError(e);
- } catch (CoreException e) {
- JSFModelPlugin.getPluginLog().logError(e);
+ public static IFile createCompositeComponentFile(IProject project,
+ IPath resourceRelativePath, String[] attrNames)
+ throws CoreException {
+ IFile jsf2ResFile = createCompositeComponentFile(project,
+ resourceRelativePath);
+ if (jsf2ResFile == null) {
+ return null;
}
- return false;
+ if (attrNames == null || attrNames.length == 0) {
+ return jsf2ResFile;
+ }
+ return JSF2ComponentModelManager.getManager()
+ .updateJSF2CompositeComponentFile(jsf2ResFile, attrNames);
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2TemplateManager.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2TemplateManager.java 2010-04-29 16:20:08 UTC (rev 21798)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/util/JSF2TemplateManager.java 2010-04-29 16:20:09 UTC (rev 21799)
@@ -1,13 +1,13 @@
- /*******************************************************************************
- * Copyright (c) 2007-2010 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
- ******************************************************************************/
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.web.validation.jsf2.util;
@@ -16,11 +16,13 @@
/**
*
* @author yzhishko
- *
+ *
*/
public class JSF2TemplateManager {
+ public static final String COMPOSITE_COMPONENT_TEMPLATE_NAME = "composite.xhtml"; //$NON-NLS-1$
+
private static JSF2TemplateManager instance = new JSF2TemplateManager();
private JSF2TemplateManager() {
14 years, 8 months
JBoss Tools SVN: r21798 - in trunk/documentation/guides/GettingStartedGuide/en-US: images/first_seam and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2010-04-29 12:20:08 -0400 (Thu, 29 Apr 2010)
New Revision: 21798
Added:
trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam5a.png
Modified:
trunk/documentation/guides/GettingStartedGuide/en-US/first_seam.xml
trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam6.png
trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam7.png
Log:
https://jira.jboss.org/jira/browse/TOOLSDOC-18 - New annotations support in Hibernate platform for Dali - 4.13.3. Hibernate Annotations Support Chapter for Hibernate guide is updated
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/first_seam.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en-US/first_seam.xml 2010-04-29 15:58:02 UTC (rev 21797)
+++ trunk/documentation/guides/GettingStartedGuide/en-US/first_seam.xml 2010-04-29 16:20:08 UTC (rev 21798)
@@ -8,28 +8,21 @@
<keyword>JBoss</keyword>
</keywordset>
</chapterinfo>
-
<title>Write Your First Project with JBoss Developer Studio</title>
-
<para>This chapter is a set of hands-on labs. You get step-by-step information about how the JBoss
Developer Studio can be used during the development process.</para>
-
<section id="create_seam_application">
<title>Create a Seam Application</title>
-
<para>In this section you get to know how to create a Seam project in JBDS, how to start the
server and what a structure your project has after creating.</para>
-
<section id="start_dev_db">
<title>Start Development Database</title>
-
<para>Before opening the JBoss Developer studio you need to download and start <ulink
- url="http://docs.jboss.org/tools/resources/GSG_database.zip"
- >Workshop Database</ulink> .</para>
- <para>To start the database just run <property>./runDBServer.sh</property> or
- <property>runDBServer.bat</property> from the database directory.</para>
+ url="http://docs.jboss.org/tools/resources/GSG_database.zip">Workshop Database</ulink>
+ .</para>
+ <para>To start the database just run <property>./runDBServer.sh</property> or <property
+ >runDBServer.bat</property> from the database directory.</para>
<para>The end result should be a console window that looks like:</para>
-
<figure>
<title>Starting DataBase</title>
<mediaobject>
@@ -38,17 +31,13 @@
</imageobject>
</mediaobject>
</figure>
-
</section>
-
<section id="create_deploy_seam">
<title>Create and deploy Seam Web Project</title>
-
<para>Minimize the terminal window and run the <property>JBoss Developer Studio</property>
from Applications Menu or from the desktop icon.</para>
<para>First of all you get the Workspace Launcher. Change the default workspace location if
it's needed. Click on <property>Ok</property>. </para>
-
<figure>
<title>Workspace Launcher Dialog</title>
<mediaobject>
@@ -57,18 +46,15 @@
</imageobject>
</mediaobject>
</figure>
-
<para>After startup, you see the welcome page. You could read how to work with welcome pages
in <link linkend="Welcome">previous</link> chapter. Now select <property>Create
New...</property> icon and then press on <property>Create Seam Project</property>
link.</para>
-
<para>The <property>New Seam Project wizard</property> is started. You need to enter a name
- (e.g., "workshop") and a location directory for your new project. The
- wizard has an option for selecting the actual Server (and not just WTP runtime) that will be
- used for the project. This allows the wizard to correctly identify where the needed
- datasource and driver libraries need to go.</para>
-
+ (e.g., "workshop") and a location directory for your new project. The wizard has
+ an option for selecting the actual Server (and not just WTP runtime) that will be used for
+ the project. This allows the wizard to correctly identify where the needed datasource and
+ driver libraries need to go.</para>
<figure>
<title>New Seam Project Wizard</title>
<mediaobject>
@@ -77,13 +63,10 @@
</imageobject>
</mediaobject>
</figure>
-
<para>All settings are already specified here, you can just modify the Configuration. Click on
the <emphasis>
<property>Modify...</property>
</emphasis> button to configure your custom facets pattern:</para>
-
-
<figure id="ProjectFacetsSpecifyingScreen">
<title>Project Facets Specifying</title>
<mediaobject>
@@ -92,18 +75,15 @@
</imageobject>
</mediaobject>
</figure>
-
<para>On the whole the dialog allows to select the "features" you want to use in your project.
Doing this <property>JBoss Developer Studio</property> setups the appropriate tooling for
your project. Since JBoss Seam integrates all popular Java EE frameworks, you can select any
combination of technologies from the list. Here, for the default configuration, Dynamic Web
Module, Java, JavaServer Faces (JSF), and Seam Facet are already selected for a typical
database-driven web application. The default project facets should suffice.</para>
-
<para>In the <property>Project Facets</property> form you can also bring up server runtimes
panel by clicking <property> Runtimes</property> tab on the right corner. This panel shows
available server runtimes.</para>
-
<figure>
<title>Runtimes Selecting</title>
<mediaobject>
@@ -112,18 +92,24 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Click on <emphasis>
<property>Ok</property>
</emphasis> and then <emphasis>
<property>Next</property>
</emphasis> to proceed further.</para>
-
- <para>A dynamic web application contains both web pages and Java code. The wizard will ask you
- where you want to put those files. You can just leave the default values or choose another
- folder.</para>
-
+ <para>A dynamic web application contains both web pages and <property>Java</property> code.
+ The next wizard will ask you where you want to store Java files.</para>
<figure>
+ <title>Java Build Path</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam5a.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>Following page provides you <property>Web Module Settings</property> .You can just leave
+ the default values or choose another folder.</para>
+ <figure>
<title>Web Module Settings</title>
<mediaobject>
<imageobject>
@@ -131,17 +117,15 @@
</imageobject>
</mediaobject>
</figure>
-
<para>On the next form, you will be able to select where those library JARs come from. The
easiest is just to select the JARs provided by the JBoss AS runtime associated with this
project. That is why it is important to chose the right JBoss AS 4.2 runtime in the project
setup window.</para>
<itemizedlist>
<listitem>
- <para>Check <emphasis>
- <property>Server Supplied JSF Implementation</property>
- </emphasis>. We will use the JSF
- implementation that comes with JBoss server</para>
+ <para>Select <emphasis>
+ <property>Library Provided by Target Runtime</property>
+ </emphasis> as <property>Type</property> of <property>JSF Implementation Library</property>. We will use the JSF implementation that comes with JBoss server.</para>
</listitem>
<listitem>
<para>Click <emphasis>
@@ -149,7 +133,6 @@
</emphasis></para>
</listitem>
</itemizedlist>
-
<figure>
<title>JSF Capabilities Adding</title>
<mediaobject>
@@ -158,11 +141,9 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Next wizard step needs more settings that previous. Let's start with
- <property>General</property> section.</para>
+ <para>Next wizard step needs more settings that previous. Let's start with <property
+ >General</property> section.</para>
<para>Leave the default Seam runtime and check a WAR deployment.</para>
-
<figure>
<title>Seam Facet Setting</title>
<mediaobject>
@@ -171,14 +152,12 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Next <property>Database</property> section is a little tricky. The <property>Connection
Profile</property> needs to be edited so that the new project works properly with the
external HSQLDB server. By default the project wizard tries to use the JBoss embedded
HSQLDB, but the tutorial uses an external database to replicate a more real world
development scenario. Click on <property>Edit</property> to modify the Connection
Profile.</para>
-
<figure>
<title>DataBase Setting</title>
<mediaobject>
@@ -187,11 +166,10 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Select <property>JDBC Connection Properties</property>. Make sure the URL is set to <emphasis>
+ <para>Select <property>JDBC Connection Properties</property>. Make sure the URL is set to
+ <emphasis>
<property>jdbc:hsqldb:hsql://localhost:1701</property>
</emphasis></para>
-
<figure>
<title>JDBC Connection Properties</title>
<mediaobject>
@@ -200,16 +178,13 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Try click on <property>Test Connection</property> button. It probably won’t work. This
happens if the hsql jdbc driver is not exactly the same. This can be worked around by
- modifying the HSQLDB database driver settings. To modify the settings, click the
- <property>“...”</property> next to the drop-down box.</para>
-
+ modifying the HSQLDB database driver settings. To modify the settings, click the <property
+ >“...”</property> next to the drop-down box.</para>
<para>The proper Driver JAR File should be listed under <property>Driver File(s)</property>.
- Select the hsqldb.jar file found in the database/lib directory and click on
- <property>Ok</property>.</para>
-
+ Select the hsqldb.jar file found in the database/lib directory and click on <property
+ >Ok</property>.</para>
<figure>
<title>Driver Details</title>
<mediaobject>
@@ -218,10 +193,8 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Select <property>Hypersonic DB</property> and click on <property>Ok</property>. Again,
this only happens if the selected hsqldb.jar is different from the running database.</para>
-
<figure>
<title>Hypersonic DB Selecting</title>
<mediaobject>
@@ -230,10 +203,8 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Now, the <property>Test Connection</property> should succeed. After testing the
connection, click on Ok.</para>
-
<figure>
<title>Connection Testing</title>
<mediaobject>
@@ -242,10 +213,8 @@
</imageobject>
</mediaobject>
</figure>
-
<para>You can leave the <property>Code Generation</property> section as is. It refers to Java
packages in which the generated code will be placed.</para>
-
<figure>
<title>Code Generation Setting</title>
<mediaobject>
@@ -254,10 +223,8 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Click on <property>Finish</property> button. Now, there should be a new Seam project
called “workshop” listed in Package Explorer view.</para>
-
<figure>
<title>"worskhop" Project in the Package Explorer</title>
<mediaobject>
@@ -267,31 +234,25 @@
</mediaobject>
</figure>
</section>
-
<section id="start_JBossAS">
<title>Start JBoss Application Server</title>
-
<para>The complete information on how to manage JBoss AS from JBoss Developer Studio you can
read in a <link linkend="manage">corresponding chapter</link>.</para>
- <para>Now you just need to start the server by clicking on the Start the server icon (
- <inlinemediaobject>
+ <para>Now you just need to start the server by clicking on the Start the server icon (
+ <inlinemediaobject>
<imageobject>
<imagedata fileref="images/first_seam/first_seam15.png"/>
</imageobject>
</inlinemediaobject> ) in the <property>Servers</property>.</para>
-
<para>Then run the project by selecting the project and use <emphasis><property>Run As... >
Run on Server</property>.</emphasis></para>
-
<note>
<title>Note:</title>
<para>If the project does not show up, then you can use a normal browser and use <emphasis>
<property>http://localhost:8080/workshop/home.seam</property>
</emphasis> as the url.</para>
</note>
-
<para>Your project looks like this:</para>
-
<figure>
<title>"workshop" Project Started</title>
<mediaobject>
@@ -300,30 +261,26 @@
</imageobject>
</mediaobject>
</figure>
-
</section>
-
<section id="workshop_code_overview">
<title>Workshop Project Code Overview</title>
-
<para>Now let's examine the project and its structure. Go back to the Package Explorer view in
JBoss Developer Studio.</para>
-
<para>It seems like it's not much for project but this shell application contains a login
screen with default login logic, a menu template that can be further modified, and other
layout templates.</para>
-
<para>It's important to note that the business logic will reside in the <emphasis>
<property>src/hot</property>
- </emphasis> folder, by default. And, the package naming conventions that were used in <property>New Seam
- project wizard</property> could have been changed to something different from <emphasis>
- <property>org.domain.workshop.session</property>.
- </emphasis> Also, notice that there is a default <property>Authenticator. java</property>
- file. This is where custom security logic can be added. Seam has a nice declarative security
- model that we will explore in a bit more detail later on. The <emphasis>
+ </emphasis> folder, by default. And, the package naming conventions that were used in
+ <property>New Seam project wizard</property> could have been changed to something
+ different from <emphasis>
+ <property>org.domain.workshop.session</property>. </emphasis> Also, notice that there is a
+ default <property>Authenticator. java</property> file. This is where custom security logic
+ can be added. Seam has a nice declarative security model that we will explore in a bit more
+ detail later on. The <emphasis>
<property>src/main</property>
- </emphasis> folder is a model directory. It stores the project's JPA entity beans.</para>
-
+ </emphasis> folder is a model directory. It stores the project's JPA entity
+ beans.</para>
<figure>
<title>Project Structure</title>
<mediaobject>
@@ -332,12 +289,10 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>The view tier of the
- application is also important. Seam uses facelets and there is a built-in facelets GUI
- editor that has some nice WYSIWYG and component drag/drop functionality. Try this out by
- opening <property>home.xhtml</property> from <property>WebContent</property> folder.</para>
-
+ <para>The view tier of the application is also important. Seam uses facelets and there is a
+ built-in facelets GUI editor that has some nice WYSIWYG and component drag/drop
+ functionality. Try this out by opening <property>home.xhtml</property> from <property
+ >WebContent</property> folder.</para>
<figure>
<title>Facelets GUI Editor</title>
<mediaobject>
@@ -346,14 +301,12 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Notice that the templates reside in the <emphasis>
<property>WebContent/layout</property>
</emphasis> folder. There is a stylesheet in the <emphasis>
<property>WebContent/stylesheet</property>
</emphasis> folder. There is also a login and default error page. The Facelet editor will be
explored in more detail later in the lab.</para>
-
<para>The project already has a datasource that was created per the Seam project wizard
database settings. And, obviously all of the Seam specific configuration files and JAR
dependencies are included and placed in the proper locations. On last noteworthy line item
@@ -363,30 +316,21 @@
setup/deployment process. The end result is a developer that is writing code, not spending
days/weeks trying to figure out how to get a decent development environment and project
build process.</para>
-
</section>
-
</section>
-
-
<section id="seam_action_dev">
<title>Seam Action Development</title>
-
<para>Now, it’s time to write some code. The good news is that JBoss Developer Studio can also
help out in this respect. In this section, we will create a new Seam Action POJO and facelet
with some custom business logic and some GUI changes.</para>
-
<section id="create_seam_action">
<title>Create a New Seam Action</title>
-
<para>Go to main menu bar and click on <emphasis>
<property>File > New > New Seam Action</property>
</emphasis> to start the New Seam Action wizard.</para>
-
- <para>Specify a <property>Seam component name</property> (e.g., "myAction").
- The other properties will be auto-completed for you so there is no need to change them.
- Click on <property>Finish</property>.</para>
-
+ <para>Specify a <property>Seam component name</property> (e.g., "myAction"). The
+ other properties will be auto-completed for you so there is no need to change them. Click on
+ <property>Finish</property>.</para>
<figure>
<title>New Seam Action Wizard</title>
<mediaobject>
@@ -395,27 +339,20 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Now, open the <property>MyAction.java</property> file and replace the
"myAction" method with this logic:</para>
-
<programlisting><![CDATA[public void myAction() {
Calendar cal = Calendar.getInstance();
log.info("myAction.myAction() action called");
facesMessages.add("MyAction Executed on:" + cal.getTime());
}]]></programlisting>
-
<para>You also need to import the <property>java.util.Calendar</property> class by clicking
<emphasis><property>CTRL + Shift + O</property>.</emphasis></para>
-
</section>
-
<section id="test_seam_action">
<title>Test Seam Action</title>
-
<para>The new action can be tested by browsing the workshop-test project. JBoss Developer
Studio has already created a TestNG test case for you.</para>
-
<figure>
<title>"workshop-test" Project</title>
<mediaobject>
@@ -424,14 +361,13 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>The test case simulates a Seam component/method execution for the
- <property>MyAction.myAction()</property> logic.</para>
- <para>To run the test case, right click on <property>MyActionTest.xml</property> and click <emphasis>
+ <para>The test case simulates a Seam component/method execution for the <property
+ >MyAction.myAction()</property> logic.</para>
+ <para>To run the test case, right click on <property>MyActionTest.xml</property> and click
+ <emphasis>
<property>Run As > TestNG Suite</property>
</emphasis> or use the <property>Run As...</property> toolbar shortcut as shown
below.</para>
-
<figure>
<title>TestNG Running</title>
<mediaobject>
@@ -440,9 +376,7 @@
</imageobject>
</mediaobject>
</figure>
-
<para>With any luck, the test case will pass. Look at the TestNG view.</para>
-
<figure>
<title>TestNG Results</title>
<mediaobject>
@@ -451,7 +385,6 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Now, it’s safe to test the new Seam Action in a web browser. The fastest way to do that
is to right click on <property>myAction.xhtml</property> and use <emphasis>
<property>Run As... > Run On Server</property>
@@ -459,7 +392,6 @@
manually enter <emphasis>
<property>http://localhost:8080/workshop/myAction.seam</property>
</emphasis> into a browser.</para>
-
<figure>
<title>Seam Action in a Web Browser</title>
<mediaobject>
@@ -468,21 +400,16 @@
</imageobject>
</mediaobject>
</figure>
-
</section>
-
<section id="modify_seam_action">
<title>Modify Seam Action User Interface</title>
-
<para>Browse to <emphasis>
<property>http://localhost:8080/workshop/myAction.seam</property>
</emphasis> and click on <property>myAction</property>. This executes the “myAction” method.
This looks pretty good, but we could make this page look a little better.</para>
-
<para>Open <emphasis>
<property>WebContent/myAction.xhtml</property>
</emphasis> in JBoss Developer Studio to use the nice facelets editor.</para>
-
<figure>
<title>Open Seam Action with Editor </title>
<mediaobject>
@@ -491,10 +418,8 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Right click on the "myAction!" button in the visual part of editor and
- select <property><h:commandButton> Attributes</property>.</para>
-
+ <para>Right click on the "myAction!" button in the visual part of editor and select
+ <property><h:commandButton> Attributes</property>.</para>
<figure>
<title>Seam Action Editing</title>
<mediaobject>
@@ -503,12 +428,10 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Change the <property>value</property> of the button to something different. If desired,
you can change any other text on the page. Then, type <emphasis>
<property>CTRL + S</property>
</emphasis> to save the facelet.</para>
-
<figure>
<title>Attributes Dialog</title>
<mediaobject>
@@ -517,14 +440,11 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Refresh <emphasis>
<property>http://localhost:8080/workshop/myAction.seam</property>
</emphasis> and now you should see your changes.</para>
-
<para>Notice that you did not have to publish the application. JBoss Developer Studio
auto-published it for you.</para>
-
<figure>
<title>Seam Action Is Modified</title>
<mediaobject>
@@ -533,28 +453,20 @@
</imageobject>
</mediaobject>
</figure>
-
</section>
-
-
</section>
-
<section id="declarative_security">
<title>Declarative Security</title>
-
<para>In this section you will see how it’s easy to secure the facelets and facelet components
in Seam. Let’s go ahead and secure the action button, then we will secure the entire
page.</para>
-
<section id="edit_login">
<title>Edit Login Authentication Logic</title>
-
<para>There is a class called <property>Authenticator.java</property>. The login page will
execute the <property>Authenticator.authenticate()</property> method by default, so we’ll
start by adding some custom login logic.</para>
<para>Open <property>Authenticator.java</property> in JBoss Developer Studio and replace the
<property>authenticate()</property> method with this code:</para>
-
<programlisting><![CDATA[public boolean authenticate() {
if (identity.getUsername().equals("admin")
&& identity.getPassword().equals("password")) {
@@ -564,23 +476,18 @@
else
return true;
}]]></programlisting>
-
</section>
<section id="secure_seam_page">
<title>Secure Seam Page Component</title>
-
<para>Open <property>myAction.xhtml</property> and add a new secured command button:</para>
<programlisting><![CDATA[<h:commandButton id="myActionSecured"
value="Secured Action Button"
action="#{myAction.myAction}"
rendered="#{s:hasRole('admin')}"/>]]></programlisting>
-
<para>Refresh <emphasis>
<property>http://localhost:8080/workshop/myAction.seam</property>
</emphasis> If you are not logged in you will only see one button. If you are logged in,
there will be two buttons.</para>
-
-
<figure>
<title>One Button on a Page</title>
<mediaobject>
@@ -589,10 +496,8 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>The secured button is not visible because the user isn’t logged in as
- <property>"admin"</property>.</para>
-
+ <para>The secured button is not visible because the user isn’t logged in as <property
+ >"admin"</property>.</para>
<figure>
<title>Secured Button is Visible</title>
<mediaobject>
@@ -601,20 +506,15 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>The user is logged in as <property>"admin"</property>. Securing
- components is easy but securing pages is pretty simple as well. </para>
+ <para>The user is logged in as <property>"admin"</property>. Securing components is
+ easy but securing pages is pretty simple as well. </para>
<para>Open <emphasis>
<property>WebContent/WEB-INF/pages.xml</property>
- </emphasis>. Then add this markup directly underneath the <pages>
- element:</para>
-
+ </emphasis>. Then add this markup directly underneath the <pages> element:</para>
<programlisting><![CDATA[<page view-id="/myAction.xhtml" login-required="true"/>]]></programlisting>
-
<para>Refresh <emphasis>
<property>http://localhost:8080/workshop/myAction.seam</property>
</emphasis> If you are not logged in you will get bounced back to the login page.</para>
-
<figure>
<title>Login Page</title>
<mediaobject>
@@ -623,36 +523,26 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Thus, if you enter login credentials for the
- <property>"admin"</property> user, you will be re-directed to the
- secured page and secured component. If you enter different login credentials, page access
- will be granted, but the secured component will not be displayed.</para>
-
+ <para>Thus, if you enter login credentials for the <property>"admin"</property>
+ user, you will be re-directed to the secured page and secured component. If you enter
+ different login credentials, page access will be granted, but the secured component will not
+ be displayed.</para>
<para>Congratulations! You have secured your new action both at the facelet component and page
level. You also added custom authentication logic to the login action.</para>
-
</section>
-
</section>
-
<section id="browsing_workshop_db">
<title>Browsing Workshop Database</title>
-
<para>In this section you get to know how to use the workshop database that was started at the
beginning of the lab.</para>
-
<section id="database_connectivity">
<title>Database Connectivity Setup</title>
-
<para>The workshop data can be browsed inside of JBoss Developer Studio.</para>
-
<para>To open the Data Source Explorer, click on <emphasis><property>Window > Open Perspective
> Other > Database Development</property>.</emphasis></para>
<para>In the Data Source Explorer, expand a <property>Databases</property> node and select a
- <property>Default</property> database. Right click on it, select
- <property>Connect</property> from the context menu.</para>
-
+ <property>Default</property> database. Right click on it, select <property
+ >Connect</property> from the context menu.</para>
<figure>
<title>Data Source Explorer</title>
<mediaobject>
@@ -661,14 +551,10 @@
</imageobject>
</mediaobject>
</figure>
-
</section>
-
<section id="browsing_workshop_db2">
<title>Browse Workshop Database</title>
-
<para>Then in the current view, drill down to the <property>CUSTOMERS</property> table.</para>
-
<figure>
<title>"CUSTOMERS" Table</title>
<mediaobject>
@@ -677,16 +563,12 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Right click on <property>CUSTOMERS</property>, select <emphasis>
<property>Data > Sample Contents</property>
</emphasis> to view the data in the table.</para>
-
<para>There should be a SQL Results view on the workbench, but it could be hidden. Click on
- the <property>"Result1"</property> tab in the right side and you should
- see the data in the CUSTOMERS table.</para>
-
-
+ the <property>"Result1"</property> tab in the right side and you should see the
+ data in the CUSTOMERS table.</para>
<figure>
<title>SQL Results View</title>
<mediaobject>
@@ -695,39 +577,28 @@
</imageobject>
</mediaobject>
</figure>
-
<note>
<title>Note:</title>
<para>If you can’t find the SQL Results view tab, click on <emphasis><property>Window > Show
View > Other > SQL Development > SQL Results</property>.</emphasis></para>
</note>
-
<para>Congratulations! You just connected to the workshop database and queried the content
using Database Explorer tools.</para>
-
</section>
-
</section>
-
<section id="db_programming">
<title>Database Programming</title>
-
<para>Now, it’s time to reverse engineer the workshop database into a fully functioning Seam
CRUD(Create Read Update Delete) application.</para>
-
<section id="reverse_engineer_crud">
<title>Reverse Engineer CRUD from a Running Database</title>
-
<para>In <property>JBoss Developer Studio</property>, switch to <property>Seam
- perspective</property>, and then right-click the project and select
- <emphasis><property>New > Seam Generate Entities</property>.</emphasis></para>
-
- <para>"workshop" project in the <property>Seam Generate Entities
- wizard</property> will be selected automatically. There is no need to change something
- more, click <emphasis>
+ perspective</property>, and then right-click the project and select <emphasis><property
+ >New > Seam Generate Entities</property>.</emphasis></para>
+ <para>"workshop" project in the <property>Seam Generate Entities wizard</property>
+ will be selected automatically. There is no need to change something more, click <emphasis>
<property>Next</property>
</emphasis> to proceed further.</para>
-
<figure>
<title>Generate Seam Entities</title>
<mediaobject>
@@ -736,12 +607,10 @@
</imageobject>
</mediaobject>
</figure>
-
<para>On the next page use the <emphasis>
<property>Include</property>
</emphasis> button to include all the tables from the database and click <emphasis>
<property>Finish</property>.</emphasis></para>
-
<figure>
<title>Selecting Tables</title>
<mediaobject>
@@ -750,11 +619,9 @@
</imageobject>
</mediaobject>
</figure>
-
<para>After running the Generate Entities action, you will see new <emphasis>
<property>org.domain.workshop.entity</property>
</emphasis> classes. These classes represent insert/update/delete/query logic.</para>
-
<figure>
<title>org.domain.workshop.entity Classes</title>
<mediaobject>
@@ -763,7 +630,6 @@
</imageobject>
</mediaobject>
</figure>
-
<para>There are also <emphasis>
<property>org.domain.workshop.entity</property>
</emphasis> package that contains the JPA classes. These are the entity beans that are
@@ -771,7 +637,6 @@
Read more about it in <ulink
url="http://download.jboss.org/jbosstools/nightly-docs/en/seam/html_single/ind..."
>Seam refactoring tools chapter</ulink> of Seam Dev Tools Reference Guide.</para>
-
<para>Last, but not least, there are facelets for all of the CRUD screens. The best way to get
a feel for the generated code is to open a browser and play around with the application. Go
to <emphasis>
@@ -779,7 +644,6 @@
</emphasis> and insert/update/delete/query a few records. There is quite a bit of AJAX in
this application, but which we will explore further later on in the lab. For now, take note
of the page tabs, required field logic and data table sorting in the list pages. </para>
-
<figure>
<title>CustomersList.xhtml in the Editor</title>
<mediaobject>
@@ -788,20 +652,15 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Congratulations! You now have a fully functioning CRUD application that is already AJAX
enabled.</para>
-
</section>
-
<section id="use_hibernate_tools">
<title>Use Hibernate Tools to Query Data via JPA</title>
-
<para>Now, it's time to write some JPA queries using the Hibernate perspective in
<property>JBoss Developer Studio</property>.</para>
<para>In the upper right corner of the workbench there is a small icon (see the figure below),
click on it and choose <property>Hibernate</property>.</para>
-
<figure>
<title>Hibernate Perspective</title>
<mediaobject>
@@ -810,11 +669,9 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Look at the Hibernate Configurations view. In the "workshop" project,
- drill down on the <property>Session Factory</property> and notice that the JPA
- entities/attributes are listed in a nice tree view.</para>
-
+ <para>Look at the Hibernate Configurations view. In the "workshop" project, drill
+ down on the <property>Session Factory</property> and notice that the JPA entities/attributes
+ are listed in a nice tree view.</para>
<figure>
<title>Hibernate Configurations View</title>
<mediaobject>
@@ -823,13 +680,10 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Right click on the <property>Session Factory</property> and select <property>HQL
Editor</property>. This will open a JPA query scratch pad window.</para>
-
- <para>Write your query and click on the "Hibernate Dynamic SQL Preview" tab.
- You should see the SQL that will be executed if this JPA query is run.</para>
-
+ <para>Write your query and click on the "Hibernate Dynamic SQL Preview" tab. You
+ should see the SQL that will be executed if this JPA query is run.</para>
<figure>
<title>JPA Query Editor</title>
<mediaobject>
@@ -838,14 +692,11 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Run the query by clicking on the green run icon.</para>
-
<para>The results are listed in the "Hibernate Query Result" tab. There is a
- "Properties" tab in the workbench that can be used to see a specific JPA
- result. These results represent the JPA objects because our query did not specify column
+ "Properties" tab in the workbench that can be used to see a specific JPA result.
+ These results represent the JPA objects because our query did not specify column
names.</para>
-
<figure>
<title>Hibernate Query Result View</title>
<mediaobject>
@@ -854,10 +705,8 @@
</imageobject>
</mediaobject>
</figure>
-
<para>The query can be refined, and take note that there is nice code completion in the JPA
query editor.</para>
-
<figure>
<title>Code Completion</title>
<mediaobject>
@@ -866,10 +715,8 @@
</imageobject>
</mediaobject>
</figure>
-
<para>A refined query will return results that are more ResultSet oriented. Notice the join
logic that JPA supports.</para>
-
<figure>
<title>The Hibernate Query Result</title>
<mediaobject>
@@ -878,15 +725,12 @@
</imageobject>
</mediaobject>
</figure>
-
-
- <para>There was no need to specify an <property>Employees</property> table in the
- <property>from</property> part of the JPA query because JPA supports reference traversal
- via Java class attribute references. Not only are JPA and HQL queries fully supported, but
- Criteria based queries can also be written in the Criteria Editor. You should spend some
- time tinkering with different queries and possibly Criteria based queries, even though the
+ <para>There was no need to specify an <property>Employees</property> table in the <property
+ >from</property> part of the JPA query because JPA supports reference traversal via Java
+ class attribute references. Not only are JPA and HQL queries fully supported, but Criteria
+ based queries can also be written in the Criteria Editor. You should spend some time
+ tinkering with different queries and possibly Criteria based queries, even though the
instructions are not provided in this lab.</para>
-
<figure>
<title>Criteria Editor</title>
<mediaobject>
@@ -895,19 +739,13 @@
</imageobject>
</mediaobject>
</figure>
-
</section>
-
<section id="use_hibernate_to_vizualize">
<title>Use Hibernate Tools to visualize the Data Model</title>
-
<para>Now, it’s time to view the data model for the workshop database.</para>
-
- <para>In the Hibernate Configurations view, select "workshop" project and
- expand the <property>Configuration</property> node. Select the
- <property>Customers</property> entity, right click on it, choose <property>Open Mapping
- Diagram</property>.</para>
-
+ <para>In the Hibernate Configurations view, select "workshop" project and expand the
+ <property>Configuration</property> node. Select the <property>Customers</property> entity,
+ right click on it, choose <property>Open Mapping Diagram</property>.</para>
<figure>
<title>Mapping Diagram Opening</title>
<mediaobject>
@@ -916,13 +754,9 @@
</imageobject>
</mediaobject>
</figure>
-
-
<para>You see a Diagram tab for the CUSTOMERS table and any tables that have FK references.
This is a handy way to view the data model and JPA mappings. Now, you’ve got access to
something that the Erwin Data Modeler can’t do.</para>
-
-
<figure>
<title>Diagram Tab</title>
<mediaobject>
@@ -931,26 +765,19 @@
</imageobject>
</mediaobject>
</figure>
-
</section>
</section>
-
-
<section id="rich_components">
<title>Rich Components</title>
-
<para>This lab will conclude with one last AJAX twist. In this section we add a RichFaces
<property>inputNumberSlider</property> to the Order Details edit screen.</para>
-
<section id="add_richfaces">
<title>Add a Richfaces component to the CRUD Application</title>
-
<para>Switch to Seam perspective, open <emphasis>
<property>WebContent/OrderdetailsEdit.xhtml</property>
</emphasis> in JBoss Developer Studio.</para>
<para>Change the form field values using the visual editor. Seam has generated the form field
names that match the database column names. This is not ideal for business users.</para>
-
<figure>
<title>Form Fields Editing</title>
<mediaobject>
@@ -959,11 +786,9 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Also, replace the QTY Ordered input field with a <property>inputNumberSlider</property>.
You can use the JBoss Developer Studio palette or right click on the form and insert the
RichFaces component.</para>
-
<figure>
<title>Insert RichFaces Component from Context Menu</title>
<mediaobject>
@@ -972,13 +797,10 @@
</imageobject>
</mediaobject>
</figure>
-
<para>One the last option is to use the source view and manually copy the inputNumberSlider
markup listed below:</para>
-
<programlisting><![CDATA[<rich:inputNumberSlider id="quantityOrdered" required="true"
value="#{orderdetailsHome.instance.quantityordered}"/>]]></programlisting>
-
<figure>
<title>Manually coping Source Code</title>
<mediaobject>
@@ -987,10 +809,8 @@
</imageobject>
</mediaobject>
</figure>
-
<para>The end result is an edit page that has better form labels and a new RichFaces
control.</para>
-
<figure>
<title>The Result Page</title>
<mediaobject>
@@ -999,10 +819,7 @@
</imageobject>
</mediaobject>
</figure>
-
<para>Congratulations! You have completed the JBoss Developer Studio lab.</para>
-
</section>
-
</section>
</chapter>
Added: trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam5a.png
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam5a.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam6.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/images/first_seam/first_seam7.png
===================================================================
(Binary files differ)
14 years, 8 months
JBoss Tools SVN: r21797 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-29 11:58:02 -0400 (Thu, 29 Apr 2010)
New Revision: 21797
Modified:
branches/modular_build/build/build.xml
Log:
document osgi-test:test target for running tests w/o first building
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-29 15:54:37 UTC (rev 21796)
+++ branches/modular_build/build/build.xml 2010-04-29 15:58:02 UTC (rev 21797)
@@ -30,11 +30,13 @@
<!-- To run this script via commandline (build default modules & run tests):
cd /home/nboldt/workspace36/jbosstools-modular_build; ant
or, to build everything but not *run* the tests:
- cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DMAVEN_FLAGS="-Dmaven.test.skip"
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DMAVEN_FLAGS="clean install -Dmaven.test.skip"
or, to build specific module(s):
cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common,flow,jbpm
or, to rebuild even if sources have not changed:
cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common -Dbuild.if.sources.unchanged=true
+ or, to (re-)run tests w/o (re-)building first:
+ cd /home/nboldt/workspace36/jbosstools-modular_build; ant -DCOMPONENTS=tests,common,jmx -DMAVEN_FLAGS="osgi-test:test -B -fn"
-->
<target name="run"
@@ -296,7 +298,7 @@
</target>
<target name="run.build">
- <!-- could set -Dmaven.test.skip to skip tests, etc. -->
+ <!-- could set -Dmaven.test.skip to skip tests, or use osgi-test:test to just (re-)run tests w/o first building -->
<property name="MAVEN_FLAGS" value="clean install -B -fn -q" />
<for param="COMPONENT" list="${COMPONENTS.to.build}" delimiter=",
">
14 years, 8 months
JBoss Tools SVN: r21796 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-29 11:54:37 -0400 (Thu, 29 Apr 2010)
New Revision: 21796
Modified:
branches/modular_build/build/build.xml
Log:
move "clean install" into MAVEN_OPTS default so that same build.xml can be used with "osgi-test:test" target instead; set some other default flags for Maven (-B -fn -q)
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-29 15:20:02 UTC (rev 21795)
+++ branches/modular_build/build/build.xml 2010-04-29 15:54:37 UTC (rev 21796)
@@ -297,7 +297,7 @@
<target name="run.build">
<!-- could set -Dmaven.test.skip to skip tests, etc. -->
- <property name="MAVEN_FLAGS" value="" />
+ <property name="MAVEN_FLAGS" value="clean install -B -fn -q" />
<for param="COMPONENT" list="${COMPONENTS.to.build}" delimiter=",
">
<sequential>
@@ -319,7 +319,7 @@
<env key="MAVEN_OPTS" value="-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m" />
<!-- more debug output with <env key="MAVEN_OPTS" value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/> -->
<!-- <arg line="-o -Dmaven.test.skip" /> -->
- <arg line="${MAVEN_FLAGS} -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository clean install" />
+ <arg line="${MAVEN_FLAGS} -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository" />
</exec>
<antcall target="collect.test.results">
<param name="COMPONENT" value="@{COMPONENT}" />
14 years, 8 months
JBoss Tools SVN: r21795 - in branches/jbosstools-3.1.x: vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2010-04-29 11:20:02 -0400 (Thu, 29 Apr 2010)
New Revision: 21795
Modified:
branches/jbosstools-3.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
branches/jbosstools-3.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6204
VPE is empty and crashing
- Fixed
Modified: branches/jbosstools-3.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
===================================================================
--- branches/jbosstools-3.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2010-04-29 14:33:58 UTC (rev 21794)
+++ branches/jbosstools-3.1.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2010-04-29 15:20:02 UTC (rev 21795)
@@ -82,7 +82,7 @@
}
public IVisualController getController() {
- IEditorPart editor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editor = getEditor();
if(!(editor instanceof JSPMultiPageEditor)) return null;
IVisualEditor v = ((JSPMultiPageEditor)editor).getVisualEditor();
if(v == null) return null;
@@ -91,7 +91,7 @@
boolean init() {
if(isVisualContextInitialized) return true;
- IEditorPart editor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editor = getEditor();
if(!(editor instanceof JSPMultiPageEditor)) return false;
JSPTextEditor jspEditor = ((JSPMultiPageEditor)editor).getJspEditor();
@@ -103,6 +103,11 @@
return getIVisualContext() != null;
}
+ protected IEditorPart getEditor() {
+ return ModelUIPlugin.getDefault().getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ }
+
private IVisualContext getIVisualContext(){
JSPTextEditor jspEditor = getJSPTextEditor();
return (jspEditor == null) ? null : jspEditor.getPageContext();
@@ -120,7 +125,7 @@
}
protected JSPTextEditor getJSPTextEditor() {
- IEditorPart editor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editor = getEditor();
if(!(editor instanceof JSPMultiPageEditor)) return null;
return ((JSPMultiPageEditor)editor).getJspEditor();
}
@@ -189,7 +194,7 @@
}
public IEditorInput getEditorInput() {
- IEditorPart editor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editor = getEditor();
return editor.getEditorInput();
}
@@ -221,7 +226,7 @@
//Support of StructuredTextEditor
boolean init2() {
if(isVisualContextInitialized) return true;
- IEditorPart editor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editor = getEditor();
if(!(editor instanceof StructuredTextEditor)) return false;
StructuredTextEditor jspEditor = ((StructuredTextEditor)editor);
IDocument document = jspEditor.getDocumentProvider().getDocument(getEditorInput());
@@ -266,7 +271,7 @@
public ISourceViewer getSourceViewer() {
JSPTextEditor jspEditor = getJSPTextEditor();
if(jspEditor != null) return jspEditor.getTextViewer();
- IEditorPart editor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editor = getEditor();
if (editor == null) return null;
if(editor instanceof AbstractTextEditor) {
try {
Modified: branches/jbosstools-3.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
===================================================================
--- branches/jbosstools-3.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2010-04-29 14:33:58 UTC (rev 21794)
+++ branches/jbosstools-3.1.x/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2010-04-29 15:20:02 UTC (rev 21795)
@@ -19,6 +19,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.editors.text.ILocationProvider;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
@@ -182,8 +183,16 @@
if (document == null || query == null) {
return tagValue;
}
-
- ValueHelper valueHelper = new ValueHelper();
+ final IEditorPart editor = pageContext.getEditPart().getSite().getPage().getActiveEditor();
+ ValueHelper valueHelper = new ValueHelper() {
+ // yradtsevich: fix of JBIDE-6204: NPE was thrown in the base method
+ // because getActivePage() may be null before the page is initialized
+ @Override
+ protected IEditorPart getEditor() {
+ return editor;
+ }
+ };
+
JspContentAssistProcessor processor = valueHelper.createContentAssistProcessor();
int offset = 0;
if(sourceNode instanceof IndexedRegion) {
14 years, 8 months