JBoss Tools SVN: r21844 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2010-04-30 14:37:20 -0400 (Fri, 30 Apr 2010)
New Revision: 21844
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java
Log:
JBIDE-6225: NullPointerException in CDI EL Resolver occures when using CA
Issue is fixed
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java 2010-04-30 17:43:53 UTC (rev 21843)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java 2010-04-30 18:37:20 UTC (rev 21844)
@@ -91,18 +91,20 @@
Set<IBean> resolvedBeans = null;
if (varName != null) {
IBeanManager manager = CDICorePlugin.getCDI(project, false).getDelegate();
- if(onlyEqualNames) {
- resolvedBeans = manager.getBeans(varName, true);
- beans.addAll(resolvedBeans);
- } else {
- resolvedBeans = manager.getNamedBeans(true);
- for (IBean bean : resolvedBeans) {
- if(bean.getName().startsWith(varName)) {
- beans.add(bean);
+ if (manager != null) {
+ if(onlyEqualNames) {
+ resolvedBeans = manager.getBeans(varName, true);
+ beans.addAll(resolvedBeans);
+ } else {
+ resolvedBeans = manager.getNamedBeans(true);
+ for (IBean bean : resolvedBeans) {
+ if(bean.getName().startsWith(varName)) {
+ beans.add(bean);
+ }
}
+ resolvedBeans.clear();
+ resolvedBeans.addAll(beans);
}
- resolvedBeans.clear();
- resolvedBeans.addAll(beans);
}
}
if (resolvedBeans != null && !resolvedBeans.isEmpty()) {
14 years, 8 months
JBoss Tools SVN: r21843 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-30 13:43:53 -0400 (Fri, 30 Apr 2010)
New Revision: 21843
Modified:
branches/modular_build/build/build.xml
Log:
new get.components.to.test target
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-30 17:33:55 UTC (rev 21842)
+++ branches/modular_build/build/build.xml 2010-04-30 17:43:53 UTC (rev 21843)
@@ -63,8 +63,9 @@
depends="init, get.bootstrap.scripts, get.sources, get.components.to.build, run.build, collect.all.test.results"
/>
- <target name="test" description="run tests w/o first getting sources + list of components to build; assumes an upstream build job was already run"
- depends="init, get.bootstrap.scripts, run.build, collect.all.test.results"
+ <target name="test"
+ description="run tests w/o first getting sources + list of components to build; assumes an upstream build job was already run"
+ depends="init, get.bootstrap.scripts, get.components.to.test, run.build, collect.all.test.results"
/>
<!-- override for local build -->
@@ -130,7 +131,7 @@
<target name="init" depends="local">
<macrodef name="now">
- <attribute name="level" default="error" />
+ <attribute name="level" default="warning" />
<text name="info" optional="true" />
<sequential>
<var name="now" unset="true" />
@@ -303,12 +304,22 @@
<get src="${svn.root}/genpom.xml" dest="${WORKINGDIR}/genpom.xml" usetimestamp="true" />
</target>
+ <target name="get.components.to.test">
+ <var name="COMPONENTS.to.build" unset="true" />
+ <var name="COMPONENTS.to.build" value="" />
+ <for param="COMPONENT" list="${COMPONENTS}" delimiter="; ">
+ <sequential>
+ <var name="COMPONENTS.to.build" value="${COMPONENTS.to.build}@{COMPONENT}," />
+ </sequential>
+ </for>
+ </target>
+
<target name="get.components.to.build">
<property file="build.cfg" />
<if>
<equals arg1="${COMPONENTS.to.build}" arg2="" />
<then>
- <echo level="error">All components up to date: nothing to do!
+ <echo level="warning">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 -->
@@ -322,7 +333,7 @@
<property name="no.tests.run" value="true" />
</then>
<else>
- <echo level="error">The following components' sources have changed and will be built:
+ <echo level="warning">The following components' sources have changed and will be built:
COMPONENTS.to.build = ${COMPONENTS.to.build}
</echo>
</else>
@@ -335,7 +346,7 @@
<for param="COMPONENT" list="${COMPONENTS.to.build}" delimiter=",
">
<sequential>
- <now level="error">Build @{COMPONENT}</now>
+ <now level="warning">Build @{COMPONENT}</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}" />
@@ -599,6 +610,10 @@
<property name="get.components.to.build.expected.4.all" value="tests,common,xulrunner," />
<property name="get.components.to.build.expected.6.all" value="tests,common,xulrunner," />
+ <!-- expected values for test.get.components.to.test -->
+ <property name="get.components.to.test.expected"
+ 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,"
+ />
</target>
<target name="test.all">
@@ -780,4 +795,27 @@
<now level="info">info!</now>
</target>
+ <target name="test.get.components.to.test" depends="init, test.expected.values">
+ <var name="COMPONENTS" unset="true" />
+ <var 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"
+ />
+ <antcallback target="get.components.to.test" return="COMPONENTS.to.build" />
+ <assert failonerror="true"
+ message="expected: [${get.components.to.test.expected}] but got: [${COMPONENTS.to.build}]"
+ >
+ <bool>
+ <equals arg1="${get.components.to.test.expected}" arg2="${COMPONENTS.to.build}" />
+ </bool>
+ </assert>
+ </target>
+
</project>
14 years, 8 months
JBoss Tools SVN: r21842 - in trunk/workingset/docs/reference/en-US: images and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2010-04-30 13:33:55 -0400 (Fri, 30 Apr 2010)
New Revision: 21842
Added:
trunk/workingset/docs/reference/en-US/images/new_pattern/
trunk/workingset/docs/reference/en-US/images/new_pattern/add_new_pattern_dialog.png
trunk/workingset/docs/reference/en-US/images/new_pattern/empty_preferences_page.png
trunk/workingset/docs/reference/en-US/images/new_pattern/preference_page_with_added_pattern.png
trunk/workingset/docs/reference/en-US/images/preferences_page/
trunk/workingset/docs/reference/en-US/images/preferences_page/preferences_page.png
trunk/workingset/docs/reference/en-US/references.xml
trunk/workingset/docs/reference/en-US/tasks.xml
Modified:
trunk/workingset/docs/reference/en-US/intro.xml
trunk/workingset/docs/reference/en-US/master.xml
Log:
https://jira.jboss.org/jira/browse/TOOLSDOC-36 Update Workingset guide with draft version
Added: trunk/workingset/docs/reference/en-US/images/new_pattern/add_new_pattern_dialog.png
===================================================================
(Binary files differ)
Property changes on: trunk/workingset/docs/reference/en-US/images/new_pattern/add_new_pattern_dialog.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/workingset/docs/reference/en-US/images/new_pattern/empty_preferences_page.png
===================================================================
(Binary files differ)
Property changes on: trunk/workingset/docs/reference/en-US/images/new_pattern/empty_preferences_page.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/workingset/docs/reference/en-US/images/new_pattern/preference_page_with_added_pattern.png
===================================================================
(Binary files differ)
Property changes on: trunk/workingset/docs/reference/en-US/images/new_pattern/preference_page_with_added_pattern.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: trunk/workingset/docs/reference/en-US/images/preferences_page/preferences_page.png
===================================================================
(Binary files differ)
Property changes on: trunk/workingset/docs/reference/en-US/images/preferences_page/preferences_page.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/workingset/docs/reference/en-US/intro.xml
===================================================================
--- trunk/workingset/docs/reference/en-US/intro.xml 2010-04-30 17:21:45 UTC (rev 21841)
+++ trunk/workingset/docs/reference/en-US/intro.xml 2010-04-30 17:33:55 UTC (rev 21842)
@@ -11,18 +11,21 @@
<title>Introduction</title>
- <section>
+ <section id="whatisworkingset">
<title>What is Workingset?</title>
<para>This introduction will help you to understand what is <property>Workingset Tools</property>.</para>
</section>
- <section><title>Key Features of Workingset Tools</title>
+ <section id="keyfeatures">
+ <title>Key Features of Workingset Tools</title>
+ <para>The JBoss Workingset Tools make grouping though using regular expressions. </para>
-</section>
+ </section>
-<section>
+ <section id="resources">
<title>Other relevant resources on the topic</title>
+ <para>You can read about standard workingset in Eclipse on <ulink url="http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc....">Working sets page in Workbench User Guide</ulink> </para>
</section>
</chapter>
Modified: trunk/workingset/docs/reference/en-US/master.xml
===================================================================
--- trunk/workingset/docs/reference/en-US/master.xml 2010-04-30 17:21:45 UTC (rev 21841)
+++ trunk/workingset/docs/reference/en-US/master.xml 2010-04-30 17:33:55 UTC (rev 21842)
@@ -3,7 +3,10 @@
"http://www.docbook.org/xml/4.3/docbookx.dtd"
[<!ENTITY intro SYSTEM "intro.xml">
+<!ENTITY references SYSTEM "references.xml">
+<!ENTITY tasks SYSTEM "tasks.xml">
+
<!ENTITY seamlink "../../seam/html_single/index.html">
<!ENTITY aslink "../../as/html_single/index.html">
<!ENTITY esblink "../../esb_ref_guide/html_single/index.html">
@@ -57,5 +60,7 @@
<toc/>
&intro;
+ &tasks;
+ &references;
</book>
Added: trunk/workingset/docs/reference/en-US/references.xml
===================================================================
--- trunk/workingset/docs/reference/en-US/references.xml (rev 0)
+++ trunk/workingset/docs/reference/en-US/references.xml 2010-04-30 17:33:55 UTC (rev 21842)
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="referencies">
+ <title>References</title>
+ <section id="autoworkingsetspreferenciespage">
+ <title>Automatics WorkingSets Preferences Page
+ </title>
+ <para>To configure <property>JBoss Workingset Tools</property> you can use <property>Automatics WorkingSets</property> preferences page.
+ The <property>Automatics WorkingSets Preferences Page</property> is available in <emphasis><property>Windows->Preferences</property></emphasis> menu.
+ </para>
+ <figure>
+ <title>Automatics WorkingSets Preferences Page</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/preferences_page/preferences_page.png"/>
+ </imageobject>
+
+ </mediaobject>
+ </figure>
+ <para>On this page you are able to add, remove and change pattern order grouping patterns and turn on/off automatic grouping by selecting <emphasis><property>Automatic grouping of projects</property></emphasis> check box. </para>
+
+
+ </section>
+ <section id="patternsstructure">
+ <title>Structure of the Grouping Pattern </title>
+ <para>Pattern consists of three part: <searchpattern>, <replacepattern>, <exclusive>. </para>
+ <para>They are described in following table.</para>
+ <table>
+ <title>Pattern structure</title>
+ <tgroup cols="3">
+ <colspec colnum="1" align="left" colwidth="2*"/>
+ <colspec colnum="2" colwidth="4*"/>
+ <colspec colnum="3" align="left" colwidth="2*"/>
+ <thead>
+ <row>
+ <entry>Pattern component part
+ </entry>
+
+ <entry>What part does
+ </entry>
+ <entry>Default value
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><searchpattern></entry>
+ <entry>searchpattern is a regular expression which are used to find project names. For example, the default value finds all projects started with org.jboss.tools and captures the text between the last two dots and uses it as capture group names.
+ </entry>
+ <entry>org\.jboss\.tools\.([^\.]+).*
+ </entry>
+ </row>
+ <row>
+ <entry><replacepattern></entry>
+ <entry>This expression sets name, which will be used for group. The $1 value saves names captured by searchpattern.
+
+ </entry>
+ <entry>&1
+ </entry>
+ </row>
+ <row>
+ <entry><exclusive></entry>
+ <entry>This expression define how many names should be found. Set “true” if you want to get only one name and set “false” if you want to capture more the one.
+
+ </entry>
+ <entry>true
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ </section>
+ <section id="workprocess">
+ <title>Principle of work</title>
+ <para>Let's look at work process on the default value (“org\.jboss\.tools\.([^\.]+).*,$1,true”) example.
+ </para>
+ <para>Workingset Tools will look through all project and add to a workingset each project which name starts with “org.jboss.tools.<captured name>.<the rest of name>”. For org.jboss.tools.vpe.util project, the vpe workingset will be created or if it's already existed this project will be added to it.</para>
+ </section>
+ <section id="examples">
+ <title>Pattern examples</title>
+
+ <para>There are some patterns example in the following table. </para>
+ <table>
+ <title>Pattern examples</title>
+ <tgroup cols="2">
+ <colspec colnum="1" align="left" colwidth="5*"/>
+ <colspec colnum="2" align="right" colwidth="1*"/>
+ <thead>
+ <row>
+ <entry>Pattern </entry>
+
+ <entry>Possible case of usage </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>org\.([^\.]+).*,$1,false </entry>
+ <entry>May be used to create major group such as eclipse, jboss, hibernate, etc. </entry>
+ </row>
+ <row>
+ <entry>org\.hibernate\.eclipse\.([^\.]+).*,hibernate,true </entry>
+ <entry>May be used to group hibernate tools projects </entry>
+ </row>
+ <row>
+ <entry>org\.jboss\.ide\.eclipse\.([^\.]+).*,$1,true </entry>
+ <entry>May be used to put as and archives in their own group </entry>
+ </row>
+ <row>
+ <entry>org\.jbpm\.gd\.([^\.]+).*,jbpm,true </entry>
+ <entry>May be used to group JPBM projects </entry>
+ </row>
+ <row>
+ <entry>org\.jboss\.tools\.([^\.]+).*,$1-jbt,true </entry>
+ <entry>May be used to split out group for jboss tools </entry>
+ </row>
+ <row>
+ <entry>org\.eclipse\.([^\.]+).*,$1-eclipse,true</entry>
+ <entry>May be used to split out group for eclipse</entry>
+ </row>
+
+
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+
+
+</chapter>
\ No newline at end of file
Property changes on: trunk/workingset/docs/reference/en-US/references.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/workingset/docs/reference/en-US/tasks.xml
===================================================================
--- trunk/workingset/docs/reference/en-US/tasks.xml (rev 0)
+++ trunk/workingset/docs/reference/en-US/tasks.xml 2010-04-30 17:33:55 UTC (rev 21842)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="tasks">
+ <title>Tasks</title>
+ <section>
+ <title>Create a new pattern to group projects. </title>
+ <para>To create a new grouping pattern you neen to open Windows->Preferences->Automatics WorkingSets page.
+ </para>
+ <figure>
+ <title>Automatics WorkingSets preferences page </title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/new_pattern/empty_preferences_page.png"/>
+ </imageobject>
+
+ </mediaobject>
+ </figure>
+ <para>Then you should click New button. You will get a Add new pattern dialog. </para>
+ <figure>
+ <title>Add new pattern dialog</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/new_pattern/add_new_pattern_dialog.png"/>
+ </imageobject>
+
+ </mediaobject>
+ </figure>
+ <para>As you see it's dialog contains a Pattern field. Here you can insert your pattern. We leave a default value. After entering pattern click OK. The pattern will be add to the Grouping patterns list.
+ </para>
+ <figure>
+ <title>Add new pattern dialog</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/new_pattern/preference_page_with_added_pattern.png"/>
+ </imageobject>
+
+ </mediaobject>
+ </figure>
+ <para>Finally you need to select Automatic grouping of projects checkbox to start project proccesing.</para>
+
+
+ </section>
+
+</chapter>
\ No newline at end of file
Property changes on: trunk/workingset/docs/reference/en-US/tasks.xml
___________________________________________________________________
Name: svn:executable
+ *
14 years, 8 months
JBoss Tools SVN: r21841 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-30 13:21:45 -0400 (Fri, 30 Apr 2010)
New Revision: 21841
Modified:
branches/modular_build/build/build.xml
Log:
add target that will run tests w/o first fetching sources (assumes already on disk thx to upstream Hudson job)
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-30 17:20:33 UTC (rev 21840)
+++ branches/modular_build/build/build.xml 2010-04-30 17:21:45 UTC (rev 21841)
@@ -63,6 +63,10 @@
depends="init, get.bootstrap.scripts, get.sources, get.components.to.build, run.build, collect.all.test.results"
/>
+ <target name="test" description="run tests w/o first getting sources + list of components to build; assumes an upstream build job was already run"
+ depends="init, get.bootstrap.scripts, run.build, collect.all.test.results"
+ />
+
<!-- override for local build -->
<condition property="isInHudson" value="true">
<or>
14 years, 8 months
JBoss Tools SVN: r21840 - in trunk: jsf/plugins/org.jboss.tools.jsf.ui/src and 16 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-04-30 13:20:33 -0400 (Fri, 30 Apr 2010)
New Revision: 21840
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jsf/
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jsf/ui/
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jsf/ui/editor/
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/TemplateContextTypeIdsXHTML.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/TemplateContextTypeXHTML.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/VPETemplatePreferencePage.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLTemplatesWizardPage.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLWizard.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLWizardSelectTagLibrariesPage.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/templates/
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/TemplateContextTypeIdsXHTML.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/TemplateContextTypeXHTML.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/VPETemplatePreferencePage.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/contentassist/
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLTemplatesWizardPage.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizardSelectTagLibrariesPage.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/templates/
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUIMessages.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUiPlugin.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/Messages.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/WebUiPlugin.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLTemplateCompletionProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties
trunk/jst/tests/org.jboss.tools.jst.web.ui.test/src/org/jboss/tools/jst/web/ui/test/WebWizardsTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6217, https://jira.jboss.org/jira/browse/JBIDE-6190 wizard has been moved to org.jboss.tools.jst.web.ui plugin.
JUnit testMethod not call inint method in wizard, so test not fixed yet. I am working under it.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2010-04-30 17:20:33 UTC (rev 21840)
@@ -136,10 +136,10 @@
</wizard>
<wizard
category="org.jboss.tools.jst.web"
- class="org.jboss.tools.jsf.ui.wizard.newfile.NewXHTMLWizard"
+ class="org.jboss.tools.jst.web.ui.wizards.newfile.NewXHTMLWizard"
finalPerspective="org.jboss.tools.jsf.ui.wizard.project.NewProjectWizard"
icon="$nl$/images/xstudio/wizards/new_html_file.gif"
- id="org.jboss.tools.jsf.ui.wizard.newfile.NewXHTMLWizard"
+ id="org.jboss.tools.jst.web.ui.wizards.newfile.NewXHTMLWizard"
name="%NewXHTMLPage"
project="false">
<description>
@@ -479,48 +479,5 @@
</dynamic>
</menuContribution>
</extension>
- <!-- Templates -->
- <extension point="org.eclipse.ui.editors.templates">
- <contextType
- name="%All_XHTML_context_type_Extension_Element.name"
- class="org.jboss.tools.jsf.ui.editor.pref.template.TemplateContextTypeXHTML"
- id="xhtml_all">
- </contextType>
- <contextType
- name="%XHTML_New_context_type_Extension_Element.name"
- class="org.jboss.tools.jsf.ui.editor.pref.template.TemplateContextTypeXHTML"
- id="xhtml_new">
- </contextType>
- <contextType
- name="%XHTML_Tag_context_type_Extension_Element.name"
- class="org.jboss.tools.jsf.ui.editor.pref.template.TemplateContextTypeXHTML"
- id="xhtml_tag">
- </contextType>
- <contextType
- name="%XHTML_Attribute_context_type_Extension_Element.name"
- class="org.jboss.tools.jsf.ui.editor.pref.template.TemplateContextTypeXHTML"
- id="xhtml_attribute">
- </contextType>
- <contextType
- name="%XHTML_Attribute_value_context_type_Extension_Element.name"
- class="org.jboss.tools.jsf.ui.editor.pref.template.TemplateContextTypeXHTML"
- id="xhtml_attribute_value">
- </contextType>
- <include
- file="src/templates/xhtmldefault-templates.xml"
- translations="src/templates/xhtmldefault-templates.properties">
- </include>
- </extension>
- <extension point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension targetID="org.jboss.tools.jst.web.ui.WebDevelopmentPerspective">
- <newWizardShortcut id="org.jboss.tools.jsf.ui.wizard.newfile.NewXHTMLWizard">
- </newWizardShortcut>
- </perspectiveExtension>
- </extension>
- <extension
- point="org.jboss.tools.jst.jsp.editorContentAssistent">
- <contentassisten class="org.jboss.tools.jsf.ui.editor.pref.template.contentassist.XHTMLContentAssistProcessor"/>
- </extension>
-
</plugin>
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUIMessages.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUIMessages.java 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUIMessages.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -29,18 +29,7 @@
public static String REFACTOR_CONTRIBUTOR_RENAME_EL_VARIABLE;
public static String EL_REFACTOR_RENAME_HANDLER_ERROR;
public static String RENAME_EL_VARIABLE_WIZARD_EL_VARIABLE_NAME;
- public static String UI_WIZARD_XHTML_NEW_TITLE;
- public static String UI_WIZARD_XHTML_NEW_Description;
- public static String NewXHTMLTemplatesWizardPage_0;
- public static String NewXHTMLTemplatesWizardPage_1;
- public static String NewXHTMLTemplatesWizardPage_2;
- public static String NewXHTMLTemplatesWizardPage_3;
- public static String NewXHTMLTemplatesWizardPage_4;
- public static String NewXHTMLTemplatesWizardPage_5;
- public static String NewXHTMLTemplatesWizardPage_6;
- public static String NewXHTMLTemplatesWizardPage_7;
-
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, JsfUIMessages.class);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUiPlugin.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUiPlugin.java 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUiPlugin.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -10,34 +10,17 @@
******************************************************************************/
package org.jboss.tools.jsf.ui;
-import java.io.IOException;
-
-
import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.text.templates.ContextTypeRegistry;
-import org.eclipse.jface.text.templates.persistence.TemplateStore;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry;
-import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
import org.jboss.tools.jsf.ui.editor.check.ProjectNaturesChecker;
-import org.jboss.tools.jsf.ui.editor.pref.template.TemplateContextTypeIdsXHTML;
import org.osgi.framework.BundleContext;
public class JsfUiPlugin extends BaseUIPlugin {
public static String PLUGIN_ID = "org.jboss.tools.jsf.ui"; //$NON-NLS-1$
- /**
- * The template store for the html editor.
- */
- private TemplateStore fTemplateStore;
- /**
- * The template context type registry for the html editor.
- */
- private ContextTypeRegistry fContextTypeRegistry;
-
public JsfUiPlugin() {
}
@@ -74,36 +57,4 @@
super.stop(context);
}
- public TemplateStore getTemplateStore() {
- if (this.fTemplateStore == null) {
- this.fTemplateStore = new ContributionTemplateStore(getTemplateContextRegistry(), getPreferenceStore(), "org.jboss.tools.jsf.ui.custom_templates");
-
- try {
- this.fTemplateStore.load();
- } catch (IOException e) {
- this.logError(e);
- }
- }
- return this.fTemplateStore;
- }
-
- /**
- * Returns the template context type registry for the html plugin.
- *
- * @return the template context type registry for the html plugin
- */
- public ContextTypeRegistry getTemplateContextRegistry() {
- if (this.fContextTypeRegistry == null) {
- ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry();
- registry.addContextType(TemplateContextTypeIdsXHTML.ALL);
- registry.addContextType(TemplateContextTypeIdsXHTML.NEW);
- registry.addContextType(TemplateContextTypeIdsXHTML.TAG);
- registry.addContextType(TemplateContextTypeIdsXHTML.ATTRIBUTE);
- registry.addContextType(TemplateContextTypeIdsXHTML.ATTRIBUTE_VALUE);
-
- this.fContextTypeRegistry = registry;
- }
-
- return this.fContextTypeRegistry;
- }
}
\ No newline at end of file
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/TemplateContextTypeIdsXHTML.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/TemplateContextTypeIdsXHTML.java 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/TemplateContextTypeIdsXHTML.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -1,51 +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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.ui.editor.pref.template;
-
-/**
- * @author mareshkau
- *
- */
-public class TemplateContextTypeIdsXHTML {
- public static final String ALL = getAll();
-
- public static final String ATTRIBUTE = getAttribute();
-
- public static final String ATTRIBUTE_VALUE = getAttributeValue();
-
- public static final String NEW = getNew();
-
- public static final String TAG = getTag();
-
- private static String getAll() {
- return getPrefix() + "_all"; //$NON-NLS-1$
- }
-
- private static String getAttribute() {
- return getPrefix() + "_attribute"; //$NON-NLS-1$
- }
-
- private static String getAttributeValue() {
- return getPrefix() + "_attribute_value"; //$NON-NLS-1$
- }
-
- private static String getNew() {
- return getPrefix() + "_new"; //$NON-NLS-1$
- }
-
- private static String getTag() {
- return getPrefix() + "_tag"; //$NON-NLS-1$
- }
-
- private static String getPrefix() {
- return "xhtml"; //$NON-NLS-1$
- }
-}
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/TemplateContextTypeXHTML.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/TemplateContextTypeXHTML.java 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/TemplateContextTypeXHTML.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -1,26 +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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.ui.editor.pref.template;
-
-import org.eclipse.wst.html.ui.internal.templates.TemplateContextTypeHTML;
-
-/**
- * @author mareshkau
- *
- */
-public class TemplateContextTypeXHTML extends TemplateContextTypeHTML {
-
- public TemplateContextTypeXHTML() {
- super();
- // TODO Auto-generated constructor stub
- }
-
-}
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/VPETemplatePreferencePage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/VPETemplatePreferencePage.java 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/VPETemplatePreferencePage.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -1,39 +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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.ui.editor.pref.template;
-
-import org.eclipse.wst.html.ui.internal.preferences.ui.HTMLTemplatePreferencePage;
-import org.jboss.tools.jsf.ui.JsfUiPlugin;
-
-/**
- * @author mareshkau
- *
- */
-public class VPETemplatePreferencePage extends HTMLTemplatePreferencePage {
-
- public VPETemplatePreferencePage() {
- JsfUiPlugin jsfUiPlugin = JsfUiPlugin.getDefault();
- setPreferenceStore(jsfUiPlugin.getPreferenceStore());
- setTemplateStore(jsfUiPlugin.getTemplateStore());
- setContextTypeRegistry(jsfUiPlugin.getTemplateContextRegistry());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- @Override
- public boolean performOk() {
- boolean ok = super.performOk();
- JsfUiPlugin.getDefault().savePluginPreferences();
- return ok;
- }
-
-}
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLTemplatesWizardPage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLTemplatesWizardPage.java 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLTemplatesWizardPage.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -1,512 +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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.ui.wizard.newfile;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.jface.text.templates.DocumentTemplateContext;
-import org.eclipse.jface.text.templates.Template;
-import org.eclipse.jface.text.templates.TemplateBuffer;
-import org.eclipse.jface.text.templates.TemplateContext;
-import org.eclipse.jface.text.templates.TemplateContextType;
-import org.eclipse.jface.text.templates.persistence.TemplateStore;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
-import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.html.ui.internal.preferences.HTMLUIPreferenceNames;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
-import org.jboss.tools.jsf.ui.JsfUIMessages;
-import org.jboss.tools.jsf.ui.JsfUiPlugin;
-import org.jboss.tools.jsf.ui.editor.pref.template.TemplateContextTypeIdsXHTML;
-
-/**
- * Copied from NewHTMLTemplatesWizardPage, because the class is internal and not provide possibility
- * to inherit from this
- *
- *
- * @author mareshkau
- *
- */
-public class NewXHTMLTemplatesWizardPage extends WizardPage {
- /**
- * Content provider for templates
- */
- private class TemplateContentProvider implements IStructuredContentProvider {
- /** The template store. */
- private TemplateStore fStore;
-
- /*
- * @see IContentProvider#dispose()
- */
- public void dispose() {
- this.fStore = null;
- }
-
- /*
- * @see IStructuredContentProvider#getElements(Object)
- */
- public Object[] getElements(Object input) {
- return this.fStore.getTemplates(TemplateContextTypeIdsXHTML.NEW);
- }
-
- /*
- * @see IContentProvider#inputChanged(Viewer, Object, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- this.fStore = (TemplateStore) newInput;
- }
- }
-
- /**
- * Label provider for templates.
- */
- private class TemplateLabelProvider extends LabelProvider implements ITableLabelProvider {
-
- /*
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object,
- * int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- /*
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object,
- * int)
- */
- public String getColumnText(Object element, int columnIndex) {
- Template template = (Template) element;
-
- switch (columnIndex) {
- case 0 :
- return template.getName();
- case 1 :
- return template.getDescription();
- default :
- return ""; //$NON-NLS-1$
- }
- }
- }
-
- /** Last selected template name */
- private String fLastSelectedTemplateName;
- /** The viewer displays the pattern of selected template. */
- private SourceViewer fPatternViewer;
- /** The table presenting the templates. */
- private TableViewer fTableViewer;
- /** Template store used by this wizard page */
- private TemplateStore fTemplateStore;
- /** Checkbox for using templates. */
- private Button fUseTemplateButton;
-
- public NewXHTMLTemplatesWizardPage() {
- super("NewXHTMLTemplatesWizardPage", JsfUIMessages.NewXHTMLTemplatesWizardPage_0, null); //$NON-NLS-1$
- setDescription(JsfUIMessages.NewXHTMLTemplatesWizardPage_0);
- }
-
- /**
- * Correctly resizes the table so no phantom columns appear
- *
- * @param parent
- * the parent control
- * @param buttons
- * the buttons
- * @param table
- * the table
- * @param column1
- * the first column
- * @param column2
- * the second column
- * @param column3
- * the third column
- */
- private void configureTableResizing(final Composite parent, final Table table, final TableColumn column1, final TableColumn column2) {
- parent.addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- Rectangle area = parent.getClientArea();
- Point preferredSize = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- int width = area.width - 2 * table.getBorderWidth();
- if (preferredSize.y > area.height) {
- // Subtract the scrollbar width from the total column
- // width
- // if a vertical scrollbar will be required
- Point vBarSize = table.getVerticalBar().getSize();
- width -= vBarSize.x;
- }
-
- Point oldSize = table.getSize();
- if (oldSize.x > width) {
- // table is getting smaller so make the columns
- // smaller first and then resize the table to
- // match the client area width
- column1.setWidth(width / 2);
- column2.setWidth(width / 2);
- table.setSize(width, area.height);
- }
- else {
- // table is getting bigger so make the table
- // bigger first and then make the columns wider
- // to match the client area width
- table.setSize(width, area.height);
- column1.setWidth(width / 2);
- column2.setWidth(width / 2);
- }
- }
- });
- }
-
- public void createControl(Composite ancestor) {
- Composite parent = new Composite(ancestor, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- parent.setLayout(layout);
-
- // create checkbox for user to use HTML Template
- fUseTemplateButton = new Button(parent, SWT.CHECK);
- fUseTemplateButton.setText(JsfUIMessages.NewXHTMLTemplatesWizardPage_4);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
- fUseTemplateButton.setLayoutData(data);
- fUseTemplateButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- enableTemplates();
- }
- });
-
- // create composite for Templates table
- Composite innerParent = new Composite(parent, SWT.NONE);
- GridLayout innerLayout = new GridLayout();
- innerLayout.numColumns = 2;
- innerLayout.marginHeight = 0;
- innerLayout.marginWidth = 0;
- innerParent.setLayout(innerLayout);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
- innerParent.setLayoutData(gd);
-
- Label label = new Label(innerParent, SWT.NONE);
- label.setText(JsfUIMessages.NewXHTMLTemplatesWizardPage_7);
- data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
- label.setLayoutData(data);
-
- // create table that displays templates
- Table table = new Table(innerParent, SWT.BORDER | SWT.FULL_SELECTION);
-
- data = new GridData(GridData.FILL_BOTH);
- data.widthHint = convertWidthInCharsToPixels(2);
- data.heightHint = convertHeightInCharsToPixels(10);
- data.horizontalSpan = 2;
- table.setLayoutData(data);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- TableLayout tableLayout = new TableLayout();
- table.setLayout(tableLayout);
-
- TableColumn column1 = new TableColumn(table, SWT.NONE);
- column1.setText(JsfUIMessages.NewXHTMLTemplatesWizardPage_2);
-
- TableColumn column2 = new TableColumn(table, SWT.NONE);
- column2.setText(JsfUIMessages.NewXHTMLTemplatesWizardPage_3);
-
- fTableViewer = new TableViewer(table);
- fTableViewer.setLabelProvider(new TemplateLabelProvider());
- fTableViewer.setContentProvider(new TemplateContentProvider());
-
- fTableViewer.setSorter(new ViewerSorter() {
- public int compare(Viewer viewer, Object object1, Object object2) {
- if ((object1 instanceof Template) && (object2 instanceof Template)) {
- Template left = (Template) object1;
- Template right = (Template) object2;
- int result = left.getName().compareToIgnoreCase(right.getName());
- if (result != 0)
- return result;
- return left.getDescription().compareToIgnoreCase(right.getDescription());
- }
- return super.compare(viewer, object1, object2);
- }
-
- public boolean isSorterProperty(Object element, String property) {
- return true;
- }
- });
-
- fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- updateViewerInput();
- }
- });
-
- // create viewer that displays currently selected template's contents
- fPatternViewer = doCreateViewer(parent);
-
- fTemplateStore = JsfUiPlugin.getDefault().getTemplateStore();
- fTableViewer.setInput(fTemplateStore);
-
- // Create linked text to just to templates preference page
- Link link = new Link(parent, SWT.NONE);
- link.setText(JsfUIMessages.NewXHTMLTemplatesWizardPage_6);
- data = new GridData(SWT.END, SWT.FILL, true, false, 2, 1);
- link.setLayoutData(data);
- link.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- linkClicked();
- }
- });
-
- configureTableResizing(innerParent, table, column1, column2);
- loadLastSavedPreferences();
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.HTML_NEWWIZARD_TEMPLATE_HELPID);
- Dialog.applyDialogFont(parent);
- setControl(parent);
- }
-
- /**
- * Creates, configures and returns a source viewer to present the template
- * pattern on the preference page. Clients may override to provide a
- * custom source viewer featuring e.g. syntax coloring.
- *
- * @param parent
- * the parent control
- * @return a configured source viewer
- */
- private SourceViewer createViewer(Composite parent) {
- SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() {
- StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationHTML();
-
- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return baseConfiguration.getConfiguredContentTypes(sourceViewer);
- }
-
- public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
- return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType);
- }
- };
- SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
- IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor("org.eclipse.wst.html.core.htmlsource");
- IDocument document = scratchModel.getStructuredDocument();
- viewer.configure(sourceViewerConfiguration);
- viewer.setDocument(document);
- return viewer;
- }
-
- private SourceViewer doCreateViewer(Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(JsfUIMessages.NewXHTMLTemplatesWizardPage_5);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- label.setLayoutData(data);
-
- SourceViewer viewer = createViewer(parent);
- viewer.setEditable(false);
-
- Control control = viewer.getControl();
- data = new GridData(GridData.FILL_BOTH);
- data.horizontalSpan = 2;
- data.heightHint = convertHeightInCharsToPixels(5);
- // [261274] - source viewer was growing to fit the max line width of the template
- data.widthHint = convertWidthInCharsToPixels(2);
- control.setLayoutData(data);
-
- return viewer;
- }
-
- /**
- * Enable/disable controls in page based on fUseTemplateButton's current
- * state.
- */
- void enableTemplates() {
- boolean enabled = fUseTemplateButton.getSelection();
-
- if (!enabled) {
- // save last selected template
- Template template = getSelectedTemplate();
- if (template != null)
- fLastSelectedTemplateName = template.getName();
- else
- fLastSelectedTemplateName = ""; //$NON-NLS-1$
-
- fTableViewer.setSelection(null);
- }
- else {
- setSelectedTemplate(fLastSelectedTemplateName);
- }
-
- fTableViewer.getControl().setEnabled(enabled);
- fPatternViewer.getControl().setEnabled(enabled);
- }
-
- /**
- * Return the template preference page id
- *
- * @return
- */
- private String getPreferencePageId() {
- return "org.jboss.tools.jsf.ui.editor.pref.template"; //$NON-NLS-1$
- }
-
- /**
- * Get the currently selected template.
- *
- * @return
- */
- private Template getSelectedTemplate() {
- Template template = null;
- IStructuredSelection selection = (IStructuredSelection) fTableViewer.getSelection();
-
- if (selection.size() == 1) {
- template = (Template) selection.getFirstElement();
- }
- return template;
- }
-
- /**
- * Returns template string to insert.
- *
- * @return String to insert or null if none is to be inserted
- */
- String getTemplateString() {
- String templateString = null;
-
- Template template = getSelectedTemplate();
- if (template != null) {
- TemplateContextType contextType = JsfUiPlugin.getDefault().getTemplateContextRegistry().getContextType(TemplateContextTypeIdsXHTML.NEW);
- IDocument document = new Document();
- TemplateContext context = new DocumentTemplateContext(contextType, document, 0, 0);
- try {
- TemplateBuffer buffer = context.evaluate(template);
- templateString = buffer.getString();
- }
- catch (Exception e) {
- JsfUiPlugin.getDefault().logWarning("Could not create template for new html", e); //$NON-NLS-1$
- }
- }
-
- return templateString;
- }
-
- void linkClicked() {
- String pageId = getPreferencePageId();
- PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), pageId, new String[]{pageId}, null);
- dialog.open();
- fTableViewer.refresh();
- }
-
- /**
- * Load the last template name used in New HTML File wizard.
- */
- private void loadLastSavedPreferences() {
- String templateName = JsfUiPlugin.getDefault().getPreferenceStore().getString(HTMLUIPreferenceNames.NEW_FILE_TEMPLATE_NAME);
- if (templateName == null || templateName.length() == 0) {
- fLastSelectedTemplateName = ""; //$NON-NLS-1$
- fUseTemplateButton.setSelection(false);
- }
- else {
- fLastSelectedTemplateName = templateName;
- fUseTemplateButton.setSelection(true);
- }
- enableTemplates();
- }
-
- /**
- * Save template name used for next call to New HTML File wizard.
- */
- void saveLastSavedPreferences() {
- String templateName = ""; //$NON-NLS-1$
-
- Template template = getSelectedTemplate();
- if (template != null) {
- templateName = template.getName();
- }
-
- JsfUiPlugin.getDefault().getPreferenceStore().setValue(HTMLUIPreferenceNames.NEW_FILE_TEMPLATE_NAME, templateName);
- JsfUiPlugin.getDefault().savePluginPreferences();
- }
-
- /**
- * Select a template in the table viewer given the template name. If
- * template name cannot be found or templateName is null, just select
- * first item in table. If no items in table select nothing.
- *
- * @param templateName
- */
- private void setSelectedTemplate(String templateName) {
- Object template = null;
-
- if (templateName != null && templateName.length() > 0) {
- // pick the last used template
- template = fTemplateStore.findTemplate(templateName, TemplateContextTypeIdsXHTML.NEW);
- }
-
- // no record of last used template so just pick first element
- if (template == null) {
- // just pick first element
- template = fTableViewer.getElementAt(0);
- }
-
- if (template != null) {
- IStructuredSelection selection = new StructuredSelection(template);
- fTableViewer.setSelection(selection, true);
- }
- }
-
- /**
- * Updates the pattern viewer.
- */
- void updateViewerInput() {
- Template template = getSelectedTemplate();
- if (template != null) {
- fPatternViewer.getDocument().set(template.getPattern());
- }
- else {
- fPatternViewer.getDocument().set(""); //$NON-NLS-1$
- }
- }
-}
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizard.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizard.java 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizard.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -1,200 +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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.ui.wizard.newfile;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.wst.html.ui.internal.wizard.NewHTMLWizard;
-import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-import org.jboss.tools.common.meta.action.XEntityData;
-import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
-import org.jboss.tools.common.model.XModelException;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.wizard.newfile.NewXHTMLFileWizard;
-import org.jboss.tools.common.model.ui.wizards.standard.DefaultStandardStep;
-import org.jboss.tools.jsf.ui.JsfUIMessages;
-import org.jboss.tools.jsf.ui.JsfUiPlugin;
-import org.jboss.tools.jst.web.model.handlers.CreateJSPFileSupport;
-
-/**
- * @author mareshkau
- *
- */
-public class NewXHTMLWizard extends NewHTMLWizard{
-
- private static final String HTMLWizardNewFileCreationPage = "HTMLWizardNewFileCreationPage"; //$NON-NLS-1$
- private static final String NewHTMLTemplatesWizardPage = "NewHTMLTemplatesWizardPage"; //$NON-NLS-1$
-
- private WizardNewFileCreationPage fNewFilePage;
- private NewXHTMLTemplatesWizardPage fNewFileTemplatesPage;
- private NewXHTMLFileWizard newXHTMLFileWizard;
- private NewXHTMLWizardSelectTagLibrariesPage newXHTMLWizardSelectTagLibrariesPage;
-
-
-
- @Override
- public void addPages() {
- super.addPages();
-
- this.fNewFilePage = (WizardNewFileCreationPage) getPage(NewXHTMLWizard.HTMLWizardNewFileCreationPage);
- this.fNewFilePage.setTitle(JsfUIMessages.UI_WIZARD_XHTML_NEW_TITLE);
- this.fNewFilePage.setDescription(JsfUIMessages.UI_WIZARD_XHTML_NEW_Description);
-
- this.fNewFileTemplatesPage = new NewXHTMLTemplatesWizardPage();
- addPage(this.fNewFileTemplatesPage);
- this.newXHTMLWizardSelectTagLibrariesPage = getURISelectionPage();
- addPage(this.newXHTMLWizardSelectTagLibrariesPage);
- }
- @Override
- public void init(IWorkbench aWorkbench, IStructuredSelection aSelection) {
- super.init(aWorkbench, aSelection);
- setWindowTitle(JsfUIMessages.UI_WIZARD_XHTML_NEW_TITLE);
- setNewXHTMLFileWizard(new NewXHTMLFileWizard());
- getNewXHTMLFileWizard().init(aWorkbench, aSelection);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#addPage(org.eclipse.jface.wizard.IWizardPage)
- */
- @Override
- public void addPage(IWizardPage page) {
- if(!NewXHTMLWizard.NewHTMLTemplatesWizardPage.equalsIgnoreCase(page.getName())){
- super.addPage(page);
- }
- }
- private NewXHTMLWizardSelectTagLibrariesPage getURISelectionPage() {
- SpecialWizardSupport support = getNewXHTMLFileWizard().getFileContext().getSupport();
- NewXHTMLWizardSelectTagLibrariesPage step = new NewXHTMLWizardSelectTagLibrariesPage(support, 1);
- try {
- support.action(SpecialWizardSupport.NEXT);
- } catch (XModelException e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
- step.setWizard(this);
- return step;
- }
- @Override
- public boolean performFinish() {
- boolean performedOK = false;
- // save user options for next use
- fNewFileTemplatesPage.saveLastSavedPreferences();
-
- // no file extension specified so add default extension
- String fileName = fNewFilePage.getFileName();
- if (fileName.lastIndexOf('.') == -1) {
- String newFileName = fileName+".xhtml"; //$NON-NLS-1$
- fNewFilePage.setFileName(newFileName);
- }
-
- // create a new empty file
- IFile file = fNewFilePage.createNewFile();
-
- // if there was problem with creating file, it will be null, so make
- // sure to check
- if (file != null) {
- // put template contents into file
- String templateString = fNewFileTemplatesPage.getTemplateString();
- try {
- templateString=((CreateJSPFileSupport)getNewXHTMLFileWizard().getFileContext().getSupport()).addTaglibs(templateString);
- } catch (IOException ex) {
- JsfUiPlugin.getDefault().logWarning("Problems with adding taglibs",ex); //$NON-NLS-1$
- }
- if (templateString != null) {
- templateString = applyLineDelimiter(file, templateString);
- // determine the encoding for the new file
- Preferences preference = JsfUiPlugin.getDefault().getPluginPreferences();
- String charSet = preference.getString(CommonEncodingPreferenceNames.OUTPUT_CODESET);
-
- try {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- OutputStreamWriter outputStreamWriter = null;
- if (charSet == null || charSet.trim().equals("")) { //$NON-NLS-1$
- // just use default encoding
- outputStreamWriter = new OutputStreamWriter(outputStream);
- }
- else {
- outputStreamWriter = new OutputStreamWriter(outputStream, charSet);
- }
- outputStreamWriter.write(templateString);
- outputStreamWriter.flush();
- outputStreamWriter.close();
- ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
- file.setContents(inputStream, true, false, null);
- inputStream.close();
- }
- catch (Exception e) {
- JsfUiPlugin.getDefault().logWarning("Could not create contents for new HTML file", e); //$NON-NLS-1$
- }
- }
-
- // open the file in editor
- openEditor(file);
-
- // everything's fine
- performedOK = true;
- }
- return performedOK;
- }
- private String applyLineDelimiter(IFile file, String text) {
- String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, System.getProperty("line.separator"), new IScopeContext[] {new ProjectScope(file.getProject()), new InstanceScope() });//$NON-NLS-1$
- String convertedText = StringUtils.replace(text, "\r\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- convertedText = StringUtils.replace(convertedText, "\r", "\n"); //$NON-NLS-1$//$NON-NLS-2$
- convertedText = StringUtils.replace(convertedText, "\n", lineDelimiter); //$NON-NLS-1$
- return convertedText;
- }
- private void openEditor(final IFile file) {
- if (file != null) {
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- try {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IDE.openEditor(page, file, true);
- }
- catch (PartInitException e) {
- JsfUiPlugin.getDefault().logError(e.getMessage(), e);
- }
- }
- });
- }
- }
- /**
- * @return the newXHTMLFileWizard
- */
- private NewXHTMLFileWizard getNewXHTMLFileWizard() {
- return newXHTMLFileWizard;
- }
- /**
- * @param newXHTMLFileWizard the newXHTMLFileWizard to set
- */
- private void setNewXHTMLFileWizard(NewXHTMLFileWizard newXHTMLFileWizard) {
- this.newXHTMLFileWizard = newXHTMLFileWizard;
- }
-
-
-}
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizardSelectTagLibrariesPage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizardSelectTagLibrariesPage.java 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizardSelectTagLibrariesPage.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -1,36 +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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.ui.wizard.newfile;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
-import org.jboss.tools.common.model.ui.wizards.standard.DefaultStandardStep;
-
-/**
- * @author mareshkau
- *
- */
-public class NewXHTMLWizardSelectTagLibrariesPage extends DefaultStandardStep {
-
- public NewXHTMLWizardSelectTagLibrariesPage(SpecialWizardSupport support,
- int id) {
- super(support, id);
- }
- @Override
- public void setWizard(IWizard wizard) {
- super.setWizard(wizard);
-// this.wizard = (DefaultStandardWizard)wizard;
- }
- @Override
- public void validate() {
- setPageComplete(true);
- }
-}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/META-INF/MANIFEST.MF 2010-04-30 17:20:33 UTC (rev 21840)
@@ -40,7 +40,9 @@
org.jboss.tools.jst.jsp;bundle-version="2.0.0",
org.eclipse.jface.text;bundle-version="3.5.0",
org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.1.300",
- org.apache.velocity;bundle-version="1.5.0"
+ org.apache.velocity;bundle-version="1.5.0",
+ org.eclipse.ui.workbench.texteditor;bundle-version="3.5.1",
+ org.eclipse.wst.html.ui;bundle-version="1.0.401"
Bundle-Version: 3.1.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-04-30 17:20:33 UTC (rev 21840)
@@ -691,5 +691,47 @@
class="org.jboss.tools.jst.web.ui.action.JSPProblemMarkerResolutionGenerator">
</markerResolutionGenerator>
</extension>
-
+ <!-- Templates -->
+ <extension point="org.eclipse.ui.editors.templates">
+ <contextType
+ name="%All_XHTML_context_type_Extension_Element.name"
+ class="org.jboss.tools.jst.web.ui.editor.pref.template.TemplateContextTypeXHTML"
+ id="xhtml_all">
+ </contextType>
+ <contextType
+ name="%XHTML_New_context_type_Extension_Element.name"
+ class="org.jboss.tools.jst.web.ui.editor.pref.template.TemplateContextTypeXHTML"
+ id="xhtml_new">
+ </contextType>
+ <contextType
+ name="%XHTML_Tag_context_type_Extension_Element.name"
+ class="org.jboss.tools.jst.web.ui.editor.pref.template.TemplateContextTypeXHTML"
+ id="xhtml_tag">
+ </contextType>
+ <contextType
+ name="%XHTML_Attribute_context_type_Extension_Element.name"
+ class="org.jboss.tools.jst.web.ui.editor.pref.template.TemplateContextTypeXHTML"
+ id="xhtml_attribute">
+ </contextType>
+ <contextType
+ name="%XHTML_Attribute_value_context_type_Extension_Element.name"
+ class="org.jboss.tools.jst.web.ui.editor.pref.template.TemplateContextTypeXHTML"
+ id="xhtml_attribute_value">
+ </contextType>
+ <include
+ file="src/templates/xhtmldefault-templates.xml"
+ translations="src/templates/xhtmldefault-templates.properties">
+ </include>
+ </extension>
+
+ <extension point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension targetID="org.jboss.tools.jst.web.ui.WebDevelopmentPerspective">
+ <newWizardShortcut id="org.jboss.tools.jst.web.ui.wizards.newfile.NewXHTMLWizard">
+ </newWizardShortcut>
+ </perspectiveExtension>
+ </extension>
+ <extension
+ point="org.jboss.tools.jst.jsp.editorContentAssistent">
+ <contentassisten class="org.jboss.tools.jst.web.ui.editor.pref.template.contentassist.XHTMLContentAssistProcessor"/>
+ </extension>
</plugin>
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/Messages.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/Messages.java 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/Messages.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -72,7 +72,19 @@
public static String WebCompoundEditor_WebXMLEditor;
public static String XActionProvider_CompanyName;
public static String AddTLDMarkerResolution_Name;
+ public static String UI_WIZARD_XHTML_NEW_TITLE;
+ public static String UI_WIZARD_XHTML_NEW_Description;
+
+ public static String NewXHTMLTemplatesWizardPage_0;
+ public static String NewXHTMLTemplatesWizardPage_1;
+ public static String NewXHTMLTemplatesWizardPage_2;
+ public static String NewXHTMLTemplatesWizardPage_3;
+ public static String NewXHTMLTemplatesWizardPage_4;
+ public static String NewXHTMLTemplatesWizardPage_5;
+ public static String NewXHTMLTemplatesWizardPage_6;
+ public static String NewXHTMLTemplatesWizardPage_7;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/WebUiPlugin.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/WebUiPlugin.java 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/WebUiPlugin.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -10,15 +10,30 @@
******************************************************************************/
package org.jboss.tools.jst.web.ui;
+import java.io.IOException;
+
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.text.templates.ContextTypeRegistry;
+import org.eclipse.jface.text.templates.persistence.TemplateStore;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry;
+import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
+import org.jboss.tools.jst.web.ui.editor.pref.template.TemplateContextTypeIdsXHTML;
import org.osgi.framework.BundleContext;
public class WebUiPlugin extends BaseUIPlugin {
public static final String PLUGIN_ID = "org.jboss.tools.jst.web.ui"; //$NON-NLS-1$
static WebUiPlugin INSTANCE;
+ /**
+ * The template store for the html editor.
+ */
+ private TemplateStore fTemplateStore;
+ /**
+ * The template context type registry for the html editor.
+ */
+ private ContextTypeRegistry fContextTypeRegistry;
public WebUiPlugin() {
INSTANCE = this;
@@ -49,4 +64,36 @@
public static IPluginLog getPluginLog() {
return getDefault();
}
+ public TemplateStore getTemplateStore() {
+ if (this.fTemplateStore == null) {
+ this.fTemplateStore = new ContributionTemplateStore(getTemplateContextRegistry(), getPreferenceStore(), "org.jboss.tools.jsf.ui.custom_templates");
+
+ try {
+ this.fTemplateStore.load();
+ } catch (IOException e) {
+ this.logError(e);
+ }
+ }
+ return this.fTemplateStore;
+ }
+
+ /**
+ * Returns the template context type registry for the html plugin.
+ *
+ * @return the template context type registry for the html plugin
+ */
+ public ContextTypeRegistry getTemplateContextRegistry() {
+ if (this.fContextTypeRegistry == null) {
+ ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry();
+ registry.addContextType(TemplateContextTypeIdsXHTML.ALL);
+ registry.addContextType(TemplateContextTypeIdsXHTML.NEW);
+ registry.addContextType(TemplateContextTypeIdsXHTML.TAG);
+ registry.addContextType(TemplateContextTypeIdsXHTML.ATTRIBUTE);
+ registry.addContextType(TemplateContextTypeIdsXHTML.ATTRIBUTE_VALUE);
+
+ this.fContextTypeRegistry = registry;
+ }
+
+ return this.fContextTypeRegistry;
+ }
}
\ No newline at end of file
Added: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/TemplateContextTypeIdsXHTML.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/TemplateContextTypeIdsXHTML.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/TemplateContextTypeIdsXHTML.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.ui.editor.pref.template;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class TemplateContextTypeIdsXHTML {
+ public static final String ALL = getAll();
+
+ public static final String ATTRIBUTE = getAttribute();
+
+ public static final String ATTRIBUTE_VALUE = getAttributeValue();
+
+ public static final String NEW = getNew();
+
+ public static final String TAG = getTag();
+
+ private static String getAll() {
+ return getPrefix() + "_all"; //$NON-NLS-1$
+ }
+
+ private static String getAttribute() {
+ return getPrefix() + "_attribute"; //$NON-NLS-1$
+ }
+
+ private static String getAttributeValue() {
+ return getPrefix() + "_attribute_value"; //$NON-NLS-1$
+ }
+
+ private static String getNew() {
+ return getPrefix() + "_new"; //$NON-NLS-1$
+ }
+
+ private static String getTag() {
+ return getPrefix() + "_tag"; //$NON-NLS-1$
+ }
+
+ private static String getPrefix() {
+ return "xhtml"; //$NON-NLS-1$
+ }
+}
Added: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/TemplateContextTypeXHTML.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/TemplateContextTypeXHTML.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/TemplateContextTypeXHTML.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.ui.editor.pref.template;
+
+import org.eclipse.wst.html.ui.internal.templates.TemplateContextTypeHTML;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class TemplateContextTypeXHTML extends TemplateContextTypeHTML {
+
+ public TemplateContextTypeXHTML() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+}
Added: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/VPETemplatePreferencePage.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/VPETemplatePreferencePage.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/VPETemplatePreferencePage.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.ui.editor.pref.template;
+
+import org.eclipse.wst.html.ui.internal.preferences.ui.HTMLTemplatePreferencePage;
+import org.jboss.tools.jst.web.ui.WebUiPlugin;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class VPETemplatePreferencePage extends HTMLTemplatePreferencePage {
+
+ public VPETemplatePreferencePage() {
+ WebUiPlugin webUiPlugin = WebUiPlugin.getDefault();
+ setPreferenceStore(webUiPlugin.getPreferenceStore());
+ setTemplateStore(webUiPlugin.getTemplateStore());
+ setContextTypeRegistry(webUiPlugin.getTemplateContextRegistry());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ @Override
+ public boolean performOk() {
+ boolean ok = super.performOk();
+ WebUiPlugin.getDefault().savePluginPreferences();
+ return ok;
+ }
+
+}
Copied: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist (from rev 21828, trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/contentassist)
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLContentAssistProcessor.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/contentassist/XHTMLContentAssistProcessor.java 2010-04-30 14:14:04 UTC (rev 21828)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLContentAssistProcessor.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jsf.ui.editor.pref.template.contentassist;
+package org.jboss.tools.jst.web.ui.editor.pref.template.contentassist;
import java.util.ArrayList;
import java.util.List;
@@ -24,8 +24,8 @@
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.jboss.tools.jsf.ui.JsfUiPlugin;
-import org.jboss.tools.jsf.ui.editor.pref.template.TemplateContextTypeIdsXHTML;
+import org.jboss.tools.jst.web.ui.WebUiPlugin;
+import org.jboss.tools.jst.web.ui.editor.pref.template.TemplateContextTypeIdsXHTML;
import org.w3c.dom.Node;
/**
@@ -186,7 +186,7 @@
protected IPreferenceStore getPreferenceStore() {
if (this.fPreferenceStore == null)
- this.fPreferenceStore = JsfUiPlugin.getDefault().getPreferenceStore();
+ this.fPreferenceStore = WebUiPlugin.getDefault().getPreferenceStore();
return this.fPreferenceStore;
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLTemplateCompletionProcessor.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/contentassist/XHTMLTemplateCompletionProcessor.java 2010-04-30 14:14:04 UTC (rev 21828)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLTemplateCompletionProcessor.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jsf.ui.editor.pref.template.contentassist;
+package org.jboss.tools.jst.web.ui.editor.pref.template.contentassist;
import java.util.ArrayList;
import java.util.Collections;
@@ -31,7 +31,7 @@
import org.eclipse.jface.text.templates.persistence.TemplateStore;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.html.ui.internal.contentassist.ReplaceNameTemplateContext;
-import org.jboss.tools.jsf.ui.JsfUiPlugin;
+import org.jboss.tools.jst.web.ui.WebUiPlugin;
/**
@@ -142,7 +142,7 @@
// }
private ContextTypeRegistry getTemplateContextRegistry() {
- return JsfUiPlugin.getDefault().getTemplateContextRegistry();
+ return WebUiPlugin.getDefault().getTemplateContextRegistry();
}
protected Template[] getTemplates(String contextTypeId) {
@@ -156,7 +156,7 @@
}
private TemplateStore getTemplateStore() {
- return JsfUiPlugin.getDefault().getTemplateStore();
+ return WebUiPlugin.getDefault().getTemplateStore();
}
void setContextType(String contextTypeId) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties 2010-04-30 17:20:33 UTC (rev 21840)
@@ -66,3 +66,14 @@
WebCompoundEditor_WebXMLEditor=Web XML Editor
XActionProvider_CompanyName=Red Hat
AddTLDMarkerResolution_Name=Insert ''{0}'' tag library definition
+NewXHTMLTemplatesWizardPage_0=Select XHTML Template
+NewXHTMLTemplatesWizardPage_1=Select a template as initial content in theX HTML page.
+NewXHTMLTemplatesWizardPage_2=Name
+NewXHTMLTemplatesWizardPage_3=Description
+NewXHTMLTemplatesWizardPage_4=&Use XHTML Template
+NewXHTMLTemplatesWizardPage_5=&Preview:
+NewXHTMLTemplatesWizardPage_6=Templates are 'New XHTML' templates found in the <a>XHTML Templates</a> preference page.
+NewXHTMLTemplatesWizardPage_7=&Templates:
+
+UI_WIZARD_XHTML_NEW_TITLE=New XHTML Page
+UI_WIZARD_XHTML_NEW_Description=Create New XHTML Page
Copied: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLTemplatesWizardPage.java (from rev 21828, trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLTemplatesWizardPage.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLTemplatesWizardPage.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLTemplatesWizardPage.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -0,0 +1,512 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.ui.wizards.newfile;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.jface.text.templates.DocumentTemplateContext;
+import org.eclipse.jface.text.templates.Template;
+import org.eclipse.jface.text.templates.TemplateBuffer;
+import org.eclipse.jface.text.templates.TemplateContext;
+import org.eclipse.jface.text.templates.TemplateContextType;
+import org.eclipse.jface.text.templates.persistence.TemplateStore;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
+import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds;
+import org.eclipse.wst.html.ui.internal.preferences.HTMLUIPreferenceNames;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
+import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
+import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
+import org.jboss.tools.jst.web.ui.Messages;
+import org.jboss.tools.jst.web.ui.WebUiPlugin;
+import org.jboss.tools.jst.web.ui.editor.pref.template.TemplateContextTypeIdsXHTML;
+
+/**
+ * Copied from NewHTMLTemplatesWizardPage, because the class is internal and not provide possibility
+ * to inherit from this
+ *
+ *
+ * @author mareshkau
+ *
+ */
+public class NewXHTMLTemplatesWizardPage extends WizardPage {
+ /**
+ * Content provider for templates
+ */
+ private class TemplateContentProvider implements IStructuredContentProvider {
+ /** The template store. */
+ private TemplateStore fStore;
+
+ /*
+ * @see IContentProvider#dispose()
+ */
+ public void dispose() {
+ this.fStore = null;
+ }
+
+ /*
+ * @see IStructuredContentProvider#getElements(Object)
+ */
+ public Object[] getElements(Object input) {
+ return this.fStore.getTemplates(TemplateContextTypeIdsXHTML.NEW);
+ }
+
+ /*
+ * @see IContentProvider#inputChanged(Viewer, Object, Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ this.fStore = (TemplateStore) newInput;
+ }
+ }
+
+ /**
+ * Label provider for templates.
+ */
+ private class TemplateLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ /*
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object,
+ * int)
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object,
+ * int)
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ Template template = (Template) element;
+
+ switch (columnIndex) {
+ case 0 :
+ return template.getName();
+ case 1 :
+ return template.getDescription();
+ default :
+ return ""; //$NON-NLS-1$
+ }
+ }
+ }
+
+ /** Last selected template name */
+ private String fLastSelectedTemplateName;
+ /** The viewer displays the pattern of selected template. */
+ private SourceViewer fPatternViewer;
+ /** The table presenting the templates. */
+ private TableViewer fTableViewer;
+ /** Template store used by this wizard page */
+ private TemplateStore fTemplateStore;
+ /** Checkbox for using templates. */
+ private Button fUseTemplateButton;
+
+ public NewXHTMLTemplatesWizardPage() {
+ super("NewXHTMLTemplatesWizardPage", Messages.NewXHTMLTemplatesWizardPage_0, null); //$NON-NLS-1$
+ setDescription(Messages.NewXHTMLTemplatesWizardPage_0);
+ }
+
+ /**
+ * Correctly resizes the table so no phantom columns appear
+ *
+ * @param parent
+ * the parent control
+ * @param buttons
+ * the buttons
+ * @param table
+ * the table
+ * @param column1
+ * the first column
+ * @param column2
+ * the second column
+ * @param column3
+ * the third column
+ */
+ private void configureTableResizing(final Composite parent, final Table table, final TableColumn column1, final TableColumn column2) {
+ parent.addControlListener(new ControlAdapter() {
+ public void controlResized(ControlEvent e) {
+ Rectangle area = parent.getClientArea();
+ Point preferredSize = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int width = area.width - 2 * table.getBorderWidth();
+ if (preferredSize.y > area.height) {
+ // Subtract the scrollbar width from the total column
+ // width
+ // if a vertical scrollbar will be required
+ Point vBarSize = table.getVerticalBar().getSize();
+ width -= vBarSize.x;
+ }
+
+ Point oldSize = table.getSize();
+ if (oldSize.x > width) {
+ // table is getting smaller so make the columns
+ // smaller first and then resize the table to
+ // match the client area width
+ column1.setWidth(width / 2);
+ column2.setWidth(width / 2);
+ table.setSize(width, area.height);
+ }
+ else {
+ // table is getting bigger so make the table
+ // bigger first and then make the columns wider
+ // to match the client area width
+ table.setSize(width, area.height);
+ column1.setWidth(width / 2);
+ column2.setWidth(width / 2);
+ }
+ }
+ });
+ }
+
+ public void createControl(Composite ancestor) {
+ Composite parent = new Composite(ancestor, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ parent.setLayout(layout);
+
+ // create checkbox for user to use HTML Template
+ fUseTemplateButton = new Button(parent, SWT.CHECK);
+ fUseTemplateButton.setText(Messages.NewXHTMLTemplatesWizardPage_4);
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
+ fUseTemplateButton.setLayoutData(data);
+ fUseTemplateButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ enableTemplates();
+ }
+ });
+
+ // create composite for Templates table
+ Composite innerParent = new Composite(parent, SWT.NONE);
+ GridLayout innerLayout = new GridLayout();
+ innerLayout.numColumns = 2;
+ innerLayout.marginHeight = 0;
+ innerLayout.marginWidth = 0;
+ innerParent.setLayout(innerLayout);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
+ innerParent.setLayoutData(gd);
+
+ Label label = new Label(innerParent, SWT.NONE);
+ label.setText(Messages.NewXHTMLTemplatesWizardPage_7);
+ data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
+ label.setLayoutData(data);
+
+ // create table that displays templates
+ Table table = new Table(innerParent, SWT.BORDER | SWT.FULL_SELECTION);
+
+ data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = convertWidthInCharsToPixels(2);
+ data.heightHint = convertHeightInCharsToPixels(10);
+ data.horizontalSpan = 2;
+ table.setLayoutData(data);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ TableLayout tableLayout = new TableLayout();
+ table.setLayout(tableLayout);
+
+ TableColumn column1 = new TableColumn(table, SWT.NONE);
+ column1.setText(Messages.NewXHTMLTemplatesWizardPage_2);
+
+ TableColumn column2 = new TableColumn(table, SWT.NONE);
+ column2.setText(Messages.NewXHTMLTemplatesWizardPage_3);
+
+ fTableViewer = new TableViewer(table);
+ fTableViewer.setLabelProvider(new TemplateLabelProvider());
+ fTableViewer.setContentProvider(new TemplateContentProvider());
+
+ fTableViewer.setSorter(new ViewerSorter() {
+ public int compare(Viewer viewer, Object object1, Object object2) {
+ if ((object1 instanceof Template) && (object2 instanceof Template)) {
+ Template left = (Template) object1;
+ Template right = (Template) object2;
+ int result = left.getName().compareToIgnoreCase(right.getName());
+ if (result != 0)
+ return result;
+ return left.getDescription().compareToIgnoreCase(right.getDescription());
+ }
+ return super.compare(viewer, object1, object2);
+ }
+
+ public boolean isSorterProperty(Object element, String property) {
+ return true;
+ }
+ });
+
+ fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent e) {
+ updateViewerInput();
+ }
+ });
+
+ // create viewer that displays currently selected template's contents
+ fPatternViewer = doCreateViewer(parent);
+
+ fTemplateStore = WebUiPlugin.getDefault().getTemplateStore();
+ fTableViewer.setInput(fTemplateStore);
+
+ // Create linked text to just to templates preference page
+ Link link = new Link(parent, SWT.NONE);
+ link.setText(Messages.NewXHTMLTemplatesWizardPage_6);
+ data = new GridData(SWT.END, SWT.FILL, true, false, 2, 1);
+ link.setLayoutData(data);
+ link.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ linkClicked();
+ }
+ });
+
+ configureTableResizing(innerParent, table, column1, column2);
+ loadLastSavedPreferences();
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.HTML_NEWWIZARD_TEMPLATE_HELPID);
+ Dialog.applyDialogFont(parent);
+ setControl(parent);
+ }
+
+ /**
+ * Creates, configures and returns a source viewer to present the template
+ * pattern on the preference page. Clients may override to provide a
+ * custom source viewer featuring e.g. syntax coloring.
+ *
+ * @param parent
+ * the parent control
+ * @return a configured source viewer
+ */
+ private SourceViewer createViewer(Composite parent) {
+ SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() {
+ StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationHTML();
+
+ public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+ return baseConfiguration.getConfiguredContentTypes(sourceViewer);
+ }
+
+ public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
+ return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType);
+ }
+ };
+ SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+ IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor("org.eclipse.wst.html.core.htmlsource");
+ IDocument document = scratchModel.getStructuredDocument();
+ viewer.configure(sourceViewerConfiguration);
+ viewer.setDocument(document);
+ return viewer;
+ }
+
+ private SourceViewer doCreateViewer(Composite parent) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(Messages.NewXHTMLTemplatesWizardPage_5);
+ GridData data = new GridData();
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+
+ SourceViewer viewer = createViewer(parent);
+ viewer.setEditable(false);
+
+ Control control = viewer.getControl();
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 2;
+ data.heightHint = convertHeightInCharsToPixels(5);
+ // [261274] - source viewer was growing to fit the max line width of the template
+ data.widthHint = convertWidthInCharsToPixels(2);
+ control.setLayoutData(data);
+
+ return viewer;
+ }
+
+ /**
+ * Enable/disable controls in page based on fUseTemplateButton's current
+ * state.
+ */
+ void enableTemplates() {
+ boolean enabled = fUseTemplateButton.getSelection();
+
+ if (!enabled) {
+ // save last selected template
+ Template template = getSelectedTemplate();
+ if (template != null)
+ fLastSelectedTemplateName = template.getName();
+ else
+ fLastSelectedTemplateName = ""; //$NON-NLS-1$
+
+ fTableViewer.setSelection(null);
+ }
+ else {
+ setSelectedTemplate(fLastSelectedTemplateName);
+ }
+
+ fTableViewer.getControl().setEnabled(enabled);
+ fPatternViewer.getControl().setEnabled(enabled);
+ }
+
+ /**
+ * Return the template preference page id
+ *
+ * @return
+ */
+ private String getPreferencePageId() {
+ return "org.jboss.tools.jsf.ui.editor.pref.template"; //$NON-NLS-1$
+ }
+
+ /**
+ * Get the currently selected template.
+ *
+ * @return
+ */
+ private Template getSelectedTemplate() {
+ Template template = null;
+ IStructuredSelection selection = (IStructuredSelection) fTableViewer.getSelection();
+
+ if (selection.size() == 1) {
+ template = (Template) selection.getFirstElement();
+ }
+ return template;
+ }
+
+ /**
+ * Returns template string to insert.
+ *
+ * @return String to insert or null if none is to be inserted
+ */
+ String getTemplateString() {
+ String templateString = null;
+
+ Template template = getSelectedTemplate();
+ if (template != null) {
+ TemplateContextType contextType = WebUiPlugin.getDefault().getTemplateContextRegistry().getContextType(TemplateContextTypeIdsXHTML.NEW);
+ IDocument document = new Document();
+ TemplateContext context = new DocumentTemplateContext(contextType, document, 0, 0);
+ try {
+ TemplateBuffer buffer = context.evaluate(template);
+ templateString = buffer.getString();
+ }
+ catch (Exception e) {
+ WebUiPlugin.getDefault().logWarning("Could not create template for new html", e); //$NON-NLS-1$
+ }
+ }
+
+ return templateString;
+ }
+
+ void linkClicked() {
+ String pageId = getPreferencePageId();
+ PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), pageId, new String[]{pageId}, null);
+ dialog.open();
+ fTableViewer.refresh();
+ }
+
+ /**
+ * Load the last template name used in New HTML File wizard.
+ */
+ private void loadLastSavedPreferences() {
+ String templateName = WebUiPlugin.getDefault().getPreferenceStore().getString(HTMLUIPreferenceNames.NEW_FILE_TEMPLATE_NAME);
+ if (templateName == null || templateName.length() == 0) {
+ fLastSelectedTemplateName = ""; //$NON-NLS-1$
+ fUseTemplateButton.setSelection(false);
+ }
+ else {
+ fLastSelectedTemplateName = templateName;
+ fUseTemplateButton.setSelection(true);
+ }
+ enableTemplates();
+ }
+
+ /**
+ * Save template name used for next call to New HTML File wizard.
+ */
+ void saveLastSavedPreferences() {
+ String templateName = ""; //$NON-NLS-1$
+
+ Template template = getSelectedTemplate();
+ if (template != null) {
+ templateName = template.getName();
+ }
+
+ WebUiPlugin.getDefault().getPreferenceStore().setValue(HTMLUIPreferenceNames.NEW_FILE_TEMPLATE_NAME, templateName);
+ WebUiPlugin.getDefault().savePluginPreferences();
+ }
+
+ /**
+ * Select a template in the table viewer given the template name. If
+ * template name cannot be found or templateName is null, just select
+ * first item in table. If no items in table select nothing.
+ *
+ * @param templateName
+ */
+ private void setSelectedTemplate(String templateName) {
+ Object template = null;
+
+ if (templateName != null && templateName.length() > 0) {
+ // pick the last used template
+ template = fTemplateStore.findTemplate(templateName, TemplateContextTypeIdsXHTML.NEW);
+ }
+
+ // no record of last used template so just pick first element
+ if (template == null) {
+ // just pick first element
+ template = fTableViewer.getElementAt(0);
+ }
+
+ if (template != null) {
+ IStructuredSelection selection = new StructuredSelection(template);
+ fTableViewer.setSelection(selection, true);
+ }
+ }
+
+ /**
+ * Updates the pattern viewer.
+ */
+ void updateViewerInput() {
+ Template template = getSelectedTemplate();
+ if (template != null) {
+ fPatternViewer.getDocument().set(template.getPattern());
+ }
+ else {
+ fPatternViewer.getDocument().set(""); //$NON-NLS-1$
+ }
+ }
+}
Copied: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLWizard.java (from rev 21828, trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizard.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLWizard.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLWizard.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.ui.wizards.newfile;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.wst.html.ui.internal.wizard.NewHTMLWizard;
+import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames;
+import org.eclipse.wst.sse.core.utils.StringUtils;
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.wizard.newfile.NewXHTMLFileWizard;
+import org.jboss.tools.jst.web.model.handlers.CreateJSPFileSupport;
+import org.jboss.tools.jst.web.ui.Messages;
+import org.jboss.tools.jst.web.ui.WebUiPlugin;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class NewXHTMLWizard extends NewHTMLWizard{
+
+ private static final String HTMLWizardNewFileCreationPage = "HTMLWizardNewFileCreationPage"; //$NON-NLS-1$
+ private static final String NewHTMLTemplatesWizardPage = "NewHTMLTemplatesWizardPage"; //$NON-NLS-1$
+
+ private WizardNewFileCreationPage fNewFilePage;
+ private NewXHTMLTemplatesWizardPage fNewFileTemplatesPage;
+ private NewXHTMLFileWizard newXHTMLFileWizard;
+ private NewXHTMLWizardSelectTagLibrariesPage newXHTMLWizardSelectTagLibrariesPage;
+
+
+
+ @Override
+ public void addPages() {
+ super.addPages();
+
+ this.fNewFilePage = (WizardNewFileCreationPage) getPage(NewXHTMLWizard.HTMLWizardNewFileCreationPage);
+ this.fNewFilePage.setTitle(Messages.UI_WIZARD_XHTML_NEW_TITLE);
+ this.fNewFilePage.setDescription(Messages.UI_WIZARD_XHTML_NEW_Description);
+
+ this.fNewFileTemplatesPage = new NewXHTMLTemplatesWizardPage();
+ addPage(this.fNewFileTemplatesPage);
+ this.newXHTMLWizardSelectTagLibrariesPage = getURISelectionPage();
+ addPage(this.newXHTMLWizardSelectTagLibrariesPage);
+ }
+ @Override
+ public void init(IWorkbench aWorkbench, IStructuredSelection aSelection) {
+ super.init(aWorkbench, aSelection);
+ setWindowTitle(Messages.UI_WIZARD_XHTML_NEW_TITLE);
+ setNewXHTMLFileWizard(new NewXHTMLFileWizard());
+ getNewXHTMLFileWizard().init(aWorkbench, aSelection);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPage(org.eclipse.jface.wizard.IWizardPage)
+ */
+ @Override
+ public void addPage(IWizardPage page) {
+ if(!NewXHTMLWizard.NewHTMLTemplatesWizardPage.equalsIgnoreCase(page.getName())){
+ super.addPage(page);
+ }
+ }
+ private NewXHTMLWizardSelectTagLibrariesPage getURISelectionPage() {
+ SpecialWizardSupport support = getNewXHTMLFileWizard().getFileContext().getSupport();
+ NewXHTMLWizardSelectTagLibrariesPage step = new NewXHTMLWizardSelectTagLibrariesPage(support, 1);
+ try {
+ support.action(SpecialWizardSupport.NEXT);
+ } catch (XModelException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
+ step.setWizard(this);
+ return step;
+ }
+ @Override
+ public boolean performFinish() {
+ boolean performedOK = false;
+ // save user options for next use
+ fNewFileTemplatesPage.saveLastSavedPreferences();
+
+ // no file extension specified so add default extension
+ String fileName = fNewFilePage.getFileName();
+ if (fileName.lastIndexOf('.') == -1) {
+ String newFileName = fileName+".xhtml"; //$NON-NLS-1$
+ fNewFilePage.setFileName(newFileName);
+ }
+
+ // create a new empty file
+ IFile file = fNewFilePage.createNewFile();
+
+ // if there was problem with creating file, it will be null, so make
+ // sure to check
+ if (file != null) {
+ // put template contents into file
+ String templateString = fNewFileTemplatesPage.getTemplateString();
+ try {
+ templateString=((CreateJSPFileSupport)getNewXHTMLFileWizard().getFileContext().getSupport()).addTaglibs(templateString);
+ } catch (IOException ex) {
+ WebUiPlugin.getDefault().logWarning("Problems with adding taglibs",ex); //$NON-NLS-1$
+ }
+ if (templateString != null) {
+ templateString = applyLineDelimiter(file, templateString);
+ // determine the encoding for the new file
+ Preferences preference = WebUiPlugin.getDefault().getPluginPreferences();
+ String charSet = preference.getString(CommonEncodingPreferenceNames.OUTPUT_CODESET);
+
+ try {
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ OutputStreamWriter outputStreamWriter = null;
+ if (charSet == null || charSet.trim().equals("")) { //$NON-NLS-1$
+ // just use default encoding
+ outputStreamWriter = new OutputStreamWriter(outputStream);
+ }
+ else {
+ outputStreamWriter = new OutputStreamWriter(outputStream, charSet);
+ }
+ outputStreamWriter.write(templateString);
+ outputStreamWriter.flush();
+ outputStreamWriter.close();
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
+ file.setContents(inputStream, true, false, null);
+ inputStream.close();
+ }
+ catch (Exception e) {
+ WebUiPlugin.getDefault().logWarning("Could not create contents for new HTML file", e); //$NON-NLS-1$
+ }
+ }
+
+ // open the file in editor
+ openEditor(file);
+
+ // everything's fine
+ performedOK = true;
+ }
+ return performedOK;
+ }
+ private String applyLineDelimiter(IFile file, String text) {
+ String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, System.getProperty("line.separator"), new IScopeContext[] {new ProjectScope(file.getProject()), new InstanceScope() });//$NON-NLS-1$
+ String convertedText = StringUtils.replace(text, "\r\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ convertedText = StringUtils.replace(convertedText, "\r", "\n"); //$NON-NLS-1$//$NON-NLS-2$
+ convertedText = StringUtils.replace(convertedText, "\n", lineDelimiter); //$NON-NLS-1$
+ return convertedText;
+ }
+ private void openEditor(final IFile file) {
+ if (file != null) {
+ getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IDE.openEditor(page, file, true);
+ }
+ catch (PartInitException e) {
+ WebUiPlugin.getDefault().logError(e.getMessage(), e);
+ }
+ }
+ });
+ }
+ }
+ /**
+ * @return the newXHTMLFileWizard
+ */
+ private NewXHTMLFileWizard getNewXHTMLFileWizard() {
+ return this.newXHTMLFileWizard;
+ }
+ /**
+ * @param newXHTMLFileWizard the newXHTMLFileWizard to set
+ */
+ private void setNewXHTMLFileWizard(NewXHTMLFileWizard newXHTMLFileWizard) {
+ this.newXHTMLFileWizard = newXHTMLFileWizard;
+ }
+
+
+}
Copied: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLWizardSelectTagLibrariesPage.java (from rev 21828, trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizardSelectTagLibrariesPage.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLWizardSelectTagLibrariesPage.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewXHTMLWizardSelectTagLibrariesPage.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.ui.wizards.newfile;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+import org.jboss.tools.common.model.ui.wizards.standard.DefaultStandardStep;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class NewXHTMLWizardSelectTagLibrariesPage extends DefaultStandardStep {
+
+ public NewXHTMLWizardSelectTagLibrariesPage(SpecialWizardSupport support,
+ int id) {
+ super(support, id);
+ }
+ @Override
+ public void setWizard(IWizard wizard) {
+ super.setWizard(wizard);
+// this.wizard = (DefaultStandardWizard)wizard;
+ }
+ @Override
+ public void validate() {
+ setPageComplete(true);
+ }
+}
Copied: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/templates (from rev 21828, trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/templates)
Modified: trunk/jst/tests/org.jboss.tools.jst.web.ui.test/src/org/jboss/tools/jst/web/ui/test/WebWizardsTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.ui.test/src/org/jboss/tools/jst/web/ui/test/WebWizardsTest.java 2010-04-30 17:16:33 UTC (rev 21839)
+++ trunk/jst/tests/org.jboss.tools.jst.web.ui.test/src/org/jboss/tools/jst/web/ui/test/WebWizardsTest.java 2010-04-30 17:20:33 UTC (rev 21840)
@@ -14,11 +14,11 @@
import org.jboss.tools.common.model.ui.wizard.newfile.NewHTMLFileWizard;
import org.jboss.tools.common.model.ui.wizard.newfile.NewJSPFileWizard;
import org.jboss.tools.common.model.ui.wizard.newfile.NewPropertiesFileWizard;
-import org.jboss.tools.common.model.ui.wizard.newfile.NewXHTMLFileWizard;
import org.jboss.tools.jst.web.ui.wizards.newfile.NewCSSFileWizard;
import org.jboss.tools.jst.web.ui.wizards.newfile.NewJSFileWizard;
import org.jboss.tools.jst.web.ui.wizards.newfile.NewTLDFileWizard;
import org.jboss.tools.jst.web.ui.wizards.newfile.NewWebFileWizard;
+import org.jboss.tools.jst.web.ui.wizards.newfile.NewXHTMLWizard;
/**
* @author eskimo
@@ -43,7 +43,7 @@
}
public void testNewXhtmlWizardInstanceIsCreated() {
- testNewWizardInstanceIsCreated(NewXHTMLFileWizard.class.getName());
+ testNewWizardInstanceIsCreated(NewXHTMLWizard.class.getName());
}
public void testNewHtmlWizardInstanceIsCreated() {
14 years, 8 months
JBoss Tools SVN: r21839 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-30 13:16:33 -0400 (Fri, 30 Apr 2010)
New Revision: 21839
Modified:
branches/modular_build/build/build.xml
Log:
tweak log output
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-30 17:00:10 UTC (rev 21838)
+++ branches/modular_build/build/build.xml 2010-04-30 17:16:33 UTC (rev 21839)
@@ -126,13 +126,14 @@
<target name="init" depends="local">
<macrodef name="now">
+ <attribute name="level" default="error" />
<text name="info" optional="true" />
<sequential>
<var name="now" unset="true" />
<tstamp>
<format property="now" pattern="hh:mm:ss" />
</tstamp>
- <echo>${now} @{info}</echo>
+ <echo level="@{level}">${now} @{info}</echo>
</sequential>
</macrodef>
@@ -187,16 +188,16 @@
<attribute name="op" />
<sequential>
<!-- check out or update -->
- <now>Fetch @{COMPONENT}</now>
<if>
<equals arg1="@{op}" arg2="up" />
<then>
+ <now level="info">Update @{COMPONENT}</now>
<svn javahl="false" svnkit="true" failonerror="false">
<update recurse="${svn.recurse}" dir="@{component}" />
</svn>
</then>
<else>
- <echo level="info">Fetch sources from ${svn.root}/@{component} into ${WORKINGDIR}/@{component}</echo>
+ <now level="info">Fetch sources from ${svn.root}/@{component} into ${WORKINGDIR}/@{component}</now>
<svn javahl="false" svnkit="true" failonerror="true">
<checkout recurse="${svn.recurse}"
url="${svn.root}/@{component}"
@@ -303,7 +304,7 @@
<if>
<equals arg1="${COMPONENTS.to.build}" arg2="" />
<then>
- <echo level="info">All components up to date: nothing to do!
+ <echo level="error">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 -->
@@ -317,7 +318,7 @@
<property name="no.tests.run" value="true" />
</then>
<else>
- <echo>The following components' sources have changed and will be built:
+ <echo level="error">The following components' sources have changed and will be built:
COMPONENTS.to.build = ${COMPONENTS.to.build}
</echo>
</else>
@@ -330,7 +331,7 @@
<for param="COMPONENT" list="${COMPONENTS.to.build}" delimiter=",
">
<sequential>
- <now>Build @{COMPONENT}</now>
+ <now level="error">Build @{COMPONENT}</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}" />
@@ -398,7 +399,7 @@
</if>
</sequential>
</for>
- <now>Builds done</now>
+ <now level="info">Builds done</now>
</target>
<target name="collect.test.results">
@@ -770,7 +771,9 @@
<target name="test.now" depends="init">
<now>foobar!</now>
- <now/>
+ <now />
+ <now level="error">error!</now>
+ <now level="info">info!</now>
</target>
</project>
14 years, 8 months
JBoss Tools SVN: r21838 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-30 13:00:10 -0400 (Fri, 30 Apr 2010)
New Revision: 21838
Modified:
branches/modular_build/build/build.xml
Log:
add suffix to timestamp so we know what component is being built
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-30 16:58:32 UTC (rev 21837)
+++ branches/modular_build/build/build.xml 2010-04-30 17:00:10 UTC (rev 21838)
@@ -398,7 +398,7 @@
</if>
</sequential>
</for>
- <now>@{COMPONENT} build done.</now>
+ <now>Builds done</now>
</target>
<target name="collect.test.results">
14 years, 8 months
JBoss Tools SVN: r21837 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-30 12:58:32 -0400 (Fri, 30 Apr 2010)
New Revision: 21837
Modified:
branches/modular_build/build/build.xml
Log:
add suffix to timestamp so we know what component is being built
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-30 16:56:28 UTC (rev 21836)
+++ branches/modular_build/build/build.xml 2010-04-30 16:58:32 UTC (rev 21837)
@@ -187,7 +187,7 @@
<attribute name="op" />
<sequential>
<!-- check out or update -->
- <now/>
+ <now>Fetch @{COMPONENT}</now>
<if>
<equals arg1="@{op}" arg2="up" />
<then>
@@ -330,7 +330,7 @@
<for param="COMPONENT" list="${COMPONENTS.to.build}" delimiter=",
">
<sequential>
- <now>@{COMPONENT}</now>
+ <now>Build @{COMPONENT}</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}" />
@@ -398,7 +398,7 @@
</if>
</sequential>
</for>
- <now />
+ <now>@{COMPONENT} build done.</now>
</target>
<target name="collect.test.results">
14 years, 8 months
JBoss Tools SVN: r21836 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-30 12:56:28 -0400 (Fri, 30 Apr 2010)
New Revision: 21836
Modified:
branches/modular_build/build/build.xml
Log:
add suffix to timestamp so we know what component is being built
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-30 16:34:54 UTC (rev 21835)
+++ branches/modular_build/build/build.xml 2010-04-30 16:56:28 UTC (rev 21836)
@@ -126,12 +126,13 @@
<target name="init" depends="local">
<macrodef name="now">
+ <text name="info" optional="true" />
<sequential>
<var name="now" unset="true" />
<tstamp>
<format property="now" pattern="hh:mm:ss" />
</tstamp>
- <echo>${now}</echo>
+ <echo>${now} @{info}</echo>
</sequential>
</macrodef>
@@ -186,7 +187,7 @@
<attribute name="op" />
<sequential>
<!-- check out or update -->
- <now />
+ <now/>
<if>
<equals arg1="@{op}" arg2="up" />
<then>
@@ -329,7 +330,7 @@
<for param="COMPONENT" list="${COMPONENTS.to.build}" delimiter=",
">
<sequential>
- <now />
+ <now>@{COMPONENT}</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}" />
@@ -767,4 +768,9 @@
</antcall>
</target>
+ <target name="test.now" depends="init">
+ <now>foobar!</now>
+ <now/>
+ </target>
+
</project>
14 years, 8 months
JBoss Tools SVN: r21835 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-30 12:34:54 -0400 (Fri, 30 Apr 2010)
New Revision: 21835
Modified:
branches/modular_build/build/build.xml
Log:
set no.tests.run to prevent collecting test results summaries and failing the build
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-30 16:09:11 UTC (rev 21834)
+++ branches/modular_build/build/build.xml 2010-04-30 16:34:54 UTC (rev 21835)
@@ -391,6 +391,9 @@
<param name="COMPONENT" value="@{COMPONENT}" />
</antcall>
</then>
+ <else>
+ <property name="no.tests.run" value="true" />
+ </else>
</if>
</sequential>
</for>
14 years, 8 months