JBoss Tools SVN: r11628 - trunk/hibernatetools/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-11-10 04:30:17 -0500 (Mon, 10 Nov 2008)
New Revision: 11628
Modified:
trunk/hibernatetools/docs/reference/en/modules/codegen.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-447 - adding the concluding part;
Modified: trunk/hibernatetools/docs/reference/en/modules/codegen.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en/modules/codegen.xml 2008-11-10 09:23:16 UTC (rev 11627)
+++ trunk/hibernatetools/docs/reference/en/modules/codegen.xml 2008-11-10 09:30:17 UTC (rev 11628)
@@ -218,7 +218,7 @@
</entry>
<entry>include this property in the <literal>equals()</literal> and
- <literal>hashCode()</literal> method. If no use-in-equals is specified, no
+ <literal>hashCode()</literal> method. If no use-in-equals is specified, no
equals/hashcode will be generated.</entry>
</row>
@@ -282,7 +282,7 @@
<literal><meta></literal>-tags. Thus it can also e.g. be used to specify that
all fields should be declare protected, instead of the default private. This is done by
adding <literal><meta
- attribute="scope-field">protected</meta></literal> at e.g. just under
+ attribute="scope-field">protected</meta></literal> at e.g. just under
the <literal><class></literal> tag and all fields of that class will be
protected.</para>
</note>
@@ -417,11 +417,12 @@
<property><meta></property>
</emphasis> attribute <emphasis>
<property>use-in-equals</property>
- </emphasis> could be a dangerous decision that could produce non expected side-effect.</para>
+ </emphasis> could be a dangerous decision that could produce non expected
+ side-effect.</para>
<para><ulink url="http://www.hibernate.org/109.html">Here</ulink> you can get more in-depth
explanation on the subject of <property>equals()</property> and
- <property>hashcode()</property>.</para>
+ <property>hashcode()</property>.</para>
</section>
</section>
@@ -430,7 +431,7 @@
<para>This section shows an example for using meta attributes (including userspecific
attributes) together with the code generation features in <property>Hibernate
- Tools</property>.</para>
+ Tools</property>.</para>
<para>The usecase being implemented is to automatically insert some pre- and post-conditions
into the getter and setters of the generated POJO. </para>
@@ -452,7 +453,8 @@
<property>pojo/PojoPropertyAccessor.ftl</property>
</emphasis></para>
- <para>This file is as the name indicates used to generate property accessors for pojo's.</para>
+ <para>This file is as the name indicates used to generate property accessors for
+ pojo's.</para>
<para>Extract the <emphasis>
<property>PojoPropertyAccessor.ftl</property>
@@ -508,10 +510,12 @@
</emphasis> file we define the <emphasis>
<property><meta></property>
</emphasis> attributes: <literal>pre-cond</literal> or <literal>post-cond</literal>, their
- contents will be generated into the body of the relevant <literal>set</literal> method.</para>
+ contents will be generated into the body of the relevant <literal>set</literal>
+ method.</para>
<para>As an example let us add a pre-condition for property <literal>name</literal>
- preventing no <property>Person</property> can have an empty name. Hence we have to modify the <emphasis>
+ preventing no <property>Person</property> can have an empty name. Hence we have to modify
+ the <emphasis>
<property>Person.hbm.xml</property>
</emphasis> file like this:</para>
@@ -607,12 +611,26 @@
this.name = name;
}
}]]></programlisting>
- <para>To find additional information about <property>Hibernate Tools</property> we suggest that you
- visit our <ulink url="http://www.hibernate.org/255.html">website</ulink>. If you have questions, you are always welcome in our
- <ulink url="http://forum.hibernate.org/viewforum.php?f=6">forum</ulink>.</para>
+
+ <para>In conclusion, this document is intended to introduce you to Hibernate plugin specific
+ features related to tools bath for the Eclipse and Ant tasks.</para>
+
+ <para>In the <link linkend="plugins">Eclipse Plugins</link> chapter you've learnt
+ about a set of wizards for creating Mapping files, Configuration file, Console
+ Configuration, got familiar with Mapping and Configuration files editors, tooling for
+ organizing and controlling Reverse Engineering, Hibernate Console and Mapping diagram as
+ well.</para>
+
+ <para>The rest chapters have shown the aspects of using the <property>Hibernate
+ Tools</property> via Ant tasks.</para>
+
+ <para>Please, visit <ulink
+ url="http://www.jboss.com/index.html?module=bb&op=viewforum&f=201">JBoss
+ Tools Users Forum</ulink> to leave questions or/and suggestions on the topic. Your
+ feedback is always appreciated.</para>
</section>
</section>
-
+
</section>
-
+
</chapter>
17 years, 5 months
JBoss Tools SVN: r11627 - trunk/esb/plugins/org.jboss.tools.esb.project.ui.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2008-11-10 04:23:16 -0500 (Mon, 10 Nov 2008)
New Revision: 11627
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.properties
Log:
JBIDE-3115:Ensure that correct provider name appears for plug-ins
Added: trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.properties (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.properties 2008-11-10 09:23:16 UTC (rev 11627)
@@ -0,0 +1,2 @@
+providerName=JBoss, a division of Red Hat
+pluginName=JBoss ESB Project UI Plugin
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r11626 - in trunk/esb/plugins: org.jboss.tools.esb.project.core and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2008-11-10 04:21:42 -0500 (Mon, 10 Nov 2008)
New Revision: 11626
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.properties
Removed:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.properties
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/plugin.properties
trunk/esb/plugins/org.jboss.tools.esb.project.core/META-INF/MANIFEST.MF
trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.xml
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF
trunk/esb/plugins/org.jboss.tools.esb.project.ui/build.properties
trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.properties
Log:
JBIDE-3115:Ensure that correct provider name appears for plug-ins
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/plugin.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/plugin.properties 2008-11-10 08:53:12 UTC (rev 11625)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/plugin.properties 2008-11-10 09:21:42 UTC (rev 11626)
@@ -0,0 +1,2 @@
+providerName=JBoss, a division of Red Hat
+pluginName=ESB Core Plugin
\ No newline at end of file
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.core/META-INF/MANIFEST.MF 2008-11-10 08:53:12 UTC (rev 11625)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.core/META-INF/MANIFEST.MF 2008-11-10 09:21:42 UTC (rev 11626)
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: %PLUGIN_NAME
+Bundle-Name: %pluginName
Bundle-SymbolicName: org.jboss.tools.esb.project.core;singleton:=true
Bundle-Version: 1.0.0
Bundle-Localization: plugin
@@ -26,7 +26,7 @@
org.eclipse.wst.server.core,
org.eclipse.jst.common.project.facet.core;bundle-version="1.3.0"
Bundle-ActivationPolicy: lazy
-Bundle-Vendor: %PLUGIN_PROVIDER
+Bundle-Vendor: %providerName
Export-Package: org.jboss.tools.esb.core,
org.jboss.tools.esb.core.facet,
org.jboss.tools.esb.core.messages,
Added: trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.properties (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.properties 2008-11-10 09:21:42 UTC (rev 11626)
@@ -0,0 +1,2 @@
+providerName=JBoss, a division of Red Hat
+pluginName=JBoss ESB Project Core Plugin
\ No newline at end of file
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.xml
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.xml 2008-11-10 08:53:12 UTC (rev 11625)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.core/plugin.xml 2008-11-10 09:21:42 UTC (rev 11626)
@@ -139,4 +139,11 @@
</moduleType>
</moduleFactory>
</extension>
+ <extension
+ point="org.eclipse.wst.server.core.moduleArtifactAdapters">
+ <moduleArtifactAdapter
+ id="org.jboss.tools.esb.project.core.moduleArtifactAdapter1">
+ <enablement></enablement>
+ </moduleArtifactAdapter>
+ </extension>
</plugin>
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java 2008-11-10 08:53:12 UTC (rev 11625)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/facet/JBossESBFacetInstallationDelegate.java 2008-11-10 09:21:42 UTC (rev 11626)
@@ -96,7 +96,6 @@
private void createProjectStructure(IProject project) throws CoreException{
- IFile esbFile = null;
String strContentFolder = model.getStringProperty(IJBossESBFacetDataModelProperties.ESB_CONTENT_FOLDER);
project.setPersistentProperty(IJBossESBFacetDataModelProperties.QNAME_ESB_CONTENT_FOLDER, strContentFolder);
IFolder esbContent = project.getFolder(strContentFolder);
@@ -106,7 +105,7 @@
esbContent.getFolder("lib").create(true, true, null);
esbContent.getFolder("META-INF").create(true, true, null);
- esbFile = createJBossESBXML(esbContent.getFolder("META-INF"));
+ createJBossESBXML(esbContent.getFolder("META-INF"));
project.refreshLocal(IResource.DEPTH_ZERO, null);
}
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF 2008-11-10 08:53:12 UTC (rev 11625)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF 2008-11-10 09:21:42 UTC (rev 11626)
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Esbproject Plug-in
+Bundle-Name: JBoss ESB Project UI Plugin
Bundle-SymbolicName: org.jboss.tools.esb.project.ui;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: org.jboss.tools.esb.project.ui.ESBProjectPlugin
@@ -32,3 +32,4 @@
org.jboss.tools.esb.project.core;bundle-version="1.0.0",
org.jboss.tools.common.model.ui;bundle-version="2.0.0"
Eclipse-LazyStart: true
+Bundle-Vendor: JBoss, a division of Red Hat
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.ui/build.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/build.properties 2008-11-10 08:53:12 UTC (rev 11625)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/build.properties 2008-11-10 09:21:42 UTC (rev 11626)
@@ -3,4 +3,5 @@
bin.includes = META-INF/,\
.,\
plugin.xml,\
- icons/
+ icons/,\
+ plugin.properties
Deleted: trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.properties 2008-11-10 08:53:12 UTC (rev 11625)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.properties 2008-11-10 09:21:42 UTC (rev 11626)
@@ -1 +0,0 @@
-JBOSS_ESB_PREFERENCE_PAGE=JBoss ESB Runtimes
\ No newline at end of file
Modified: trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.properties 2008-11-10 08:53:12 UTC (rev 11625)
+++ trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.properties 2008-11-10 09:21:42 UTC (rev 11626)
@@ -1,2 +1,2 @@
-providerName=Red Hat, Inc.
+providerName=JBoss, a division of Red Hat
pluginName=ESB XML
\ No newline at end of file
17 years, 5 months
JBoss Tools SVN: r11625 - trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2008-11-10 03:53:12 -0500 (Mon, 10 Nov 2008)
New Revision: 11625
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java
Log:
JBIDE-3114:ESB project wizard allows for invalid content and source folder names
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java 2008-11-10 08:45:15 UTC (rev 11624)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/ESBFacetInstallationPage.java 2008-11-10 08:53:12 UTC (rev 11625)
@@ -6,8 +6,11 @@
import java.util.List;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.Dialog;
@@ -330,7 +333,7 @@
}
- private void checkServerSuppliedESBRuntime() {
+ private boolean checkServerSuppliedESBRuntime() {
try {
IFacetedProjectWorkingCopy ifpwc = getFacetedProjectWorkingCopy();
@@ -341,7 +344,7 @@
setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_Have_Not_Set_Target_Runtime);
hasRuntime = false;
setPageComplete(isPageComplete());
- return;
+ return false;
}
org.eclipse.wst.server.core.IRuntime serverRuntime = ServerCore
@@ -351,7 +354,7 @@
hasRuntime = false;
setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_Invalid_ESB_Runtime);
setPageComplete(isPageComplete());
- return;
+ return false;
}
}
// when the UI loaded from project facet properties page
@@ -366,7 +369,7 @@
setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_No_Target_Runtime);
hasRuntime = false;
setPageComplete(isPageComplete());
- return;
+ return false;
}
org.eclipse.wst.server.core.IRuntime serverRuntime = ServerCore
.findRuntime(runtime.getProperty("id"));
@@ -375,17 +378,17 @@
setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_Invalid_ESB_Runtime);
hasRuntime = false;
setPageComplete(isPageComplete());
- return;
+ return false;
}
}
}
} catch (CoreException e) {
ESBProjectPlugin.getDefault().getLog().log(e.getStatus());
+ return false;
}
- hasRuntime = true;
- setPageComplete(isPageComplete());
- setErrorMessage(null);
+
+ return true;
}
@@ -513,26 +516,23 @@
StatusUtils.errorStatus(e1));
}*/
- if(contentFolder.getText().trim().equals("")){ //$NON-NLS-1$
+ if(!validFolderName(contentFolder.getText())){
setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_Specify_Content_Folder);
hasValidContentFolder = false;
setPageComplete(isPageComplete());
}
- else if(configFolder.getText().trim().equals("")){ //$NON-NLS-1$
+ else if(!validFolderName(configFolder.getText())){
setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_Specify_Source_Folder);
hasValidSrc = false;
setPageComplete(isPageComplete());
}else if(btnUserSupplied.getSelection() && !hasRuntime){
setErrorMessage(JBossESBUIMessages.ESBFacetInstallationPage_Error_Message_Specify_ESB_Runtime);
setPageComplete(isPageComplete());
- }else if(btnServerSupplied.getSelection()){
- checkServerSuppliedESBRuntime();
- }
- /* else if (!duplicateMsg.equals("")) {
- setErrorMessage("Duplicated jar on classpath:" + duplicateMsg);
- }*/
- else{
- setErrorMessage(null);
+ }else if(btnServerSupplied.getSelection() && !checkServerSuppliedESBRuntime()){
+ return;
+ }else{
+ setErrorMessage(null);
+ hasRuntime = true;
hasValidSrc = true;
hasValidContentFolder = true;
setPageComplete(isPageComplete());
@@ -540,6 +540,11 @@
}
}
+ private boolean validFolderName(String folderName) {
+ IWorkspace ws = ResourcesPlugin.getWorkspace();
+ return ws.validateName(folderName, IResource.FOLDER).isOK();
+ }
+
@Override
public boolean isPageComplete() {
return hasValidContentFolder
17 years, 5 months
JBoss Tools SVN: r11624 - trunk/esb/plugins/org.jboss.tools.esb.project.ui.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2008-11-10 03:45:15 -0500 (Mon, 10 Nov 2008)
New Revision: 11624
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.xml
Log:
JBIDE-3040: set the default of the decorator is on
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.xml
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.xml 2008-11-10 07:38:42 UTC (rev 11623)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.xml 2008-11-10 08:45:15 UTC (rev 11624)
@@ -51,12 +51,21 @@
point="org.eclipse.ui.decorators">
<decorator
class="org.jboss.tools.esb.project.ui.ESBProjectDecorator"
- icon="icons/obj16/esb_module_ovr.gif"
id="org.jboss.tools.esb.project.ui.decorator"
- label="label"
+ label="JBoss ESB Project Decorator"
lightweight="true"
location="TOP_LEFT"
- state="false">
+ state="true">
+ <enablement>
+ <or>
+ <objectClass
+ name="org.eclipse.core.resources.IProject">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.jdt.core.IJavaProject">
+ </objectClass>
+ </or>
+ </enablement>
</decorator>
</extension>
</plugin>
17 years, 5 months
JBoss Tools SVN: r11622 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui: META-INF and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-11-10 02:15:12 -0500 (Mon, 10 Nov 2008)
New Revision: 11622
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java
Log:
JBIDE-3142
Add WST xml source editor
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2008-11-09 00:29:36 UTC (rev 11621)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2008-11-10 07:15:12 UTC (rev 11622)
@@ -22,7 +22,8 @@
org.eclipse.emf.edit.ui,
org.eclipse.xsd.edit,
org.jboss.tools.smooks.core,
- org.jboss.tools.common.model.ui
+ org.jboss.tools.common.model.ui,
+ org.eclipse.wst.xml.ui;bundle-version="1.0.401"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .,
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2008-11-09 00:29:36 UTC (rev 11621)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2008-11-10 07:15:12 UTC (rev 11622)
@@ -10,7 +10,65 @@
class = "org.jboss.tools.smooks.graphical.GraphicalPackage"
genModel = "model/graphical.genmodel" />
</extension>
-
+ <extension
+ point="org.eclipse.wst.sse.ui.adapterFactoryDescription">
+ <adapterFactoryDescription
+ class="org.eclipse.wst.xml.ui.internal.registry.AdapterFactoryProviderForXML">
+ <contentType id="org.eclipse.core.runtime.xml" />
+ <contentType id="org.jboss.tools.smooks.ui.smooks.contentType" />
+ </adapterFactoryDescription>
+ </extension>
+ <extension point="org.eclipse.wst.sse.ui.editorConfiguration">
+ <sourceViewerConfiguration
+ class="org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML"
+ target="org.eclipse.core.runtime.xml, org.jboss.tools.smooks.ui.smooks.contentType" />
+ <contentOutlineConfiguration
+ class="org.eclipse.wst.xml.ui.views.contentoutline.XMLContentOutlineConfiguration"
+ target="org.eclipse.core.runtime.xml, org.jboss.tools.smooks.ui.smooks.contentType" />
+ <propertySheetConfiguration
+ class="org.eclipse.wst.xml.ui.views.properties.XMLPropertySheetConfiguration"
+ target="org.eclipse.core.runtime.xml, org.jboss.tools.smooks.ui.smooks.contentType" />
+ <documentationTextHover
+ class="org.eclipse.wst.xml.ui.internal.taginfo.XMLTagInfoHoverProcessor"
+ target="org.eclipse.wst.xml.XML_DEFAULT">
+ </documentationTextHover>
+ <doubleClickStrategy
+ class="org.eclipse.wst.xml.ui.internal.doubleclick.XMLDoubleClickStrategy"
+ target="org.eclipse.wst.xml.XML_DEFAULT">
+ </doubleClickStrategy>
+ <provisionalConfiguration
+ type="sourceeditingtexttools"
+ class="org.eclipse.wst.xml.ui.internal.provisional.XMLSourceEditingTextTools"
+ target="org.eclipse.core.runtime.xml, org.jboss.tools.smooks.ui.smooks.contentType" />
+ <provisionalConfiguration
+ type="characterpairmatcher"
+ class="org.eclipse.wst.xml.ui.internal.text.XMLDocumentRegionEdgeMatcher"
+ target="org.eclipse.core.runtime.xml, org.jboss.tools.smooks.ui.smooks.contentType" />
+ <provisionalConfiguration
+ type="structuredtextfoldingprovider"
+ class="org.eclipse.wst.xml.ui.internal.projection.StructuredTextFoldingProviderXML"
+ target="org.eclipse.core.runtime.xml, org.jboss.tools.smooks.ui.smooks.contentType" />
+ <provisionalConfiguration
+ type="org.eclipse.jface.text.quickassist.IQuickAssistProcessor"
+ class="org.eclipse.wst.xml.ui.internal.correction.XMLQuickAssistProcessor"
+ target="org.eclipse.wst.xml.XML_DEFAULT" />
+ <provisionalConfiguration
+ type="autoeditstrategy"
+ class="org.eclipse.wst.xml.ui.internal.autoedit.StructuredAutoEditStrategyXML"
+ target="org.eclipse.wst.xml.XML_DEFAULT" />
+ <provisionalDefinition
+ type="preferencepages"
+ value="org.eclipse.wst.xml.ui.preferences.xml.xml, org.eclipse.wst.sse.ui.preferences.xml.source, org.eclipse.wst.sse.ui.preferences.xml.templates, org.eclipse.wst.sse.ui.preferences.xml.colors"
+ target="org.eclipse.core.runtime.xml, org.jboss.tools.smooks.ui.smooks.contentType" />
+ <provisionalDefinition
+ type="spellingregions"
+ value="XML_COMMENT_TEXT, XML_CONTENT, XML_DEFAULT"
+ target="org.eclipse.core.runtime.xml, org.jboss.tools.smooks.ui.smooks.contentType" />
+ <provisionalDefinition
+ type="activecontexts"
+ value="org.eclipse.core.runtime.xml, org.eclipse.wst.xml.navigation, org.eclipse.wst.xml.cleanup, org.eclipse.wst.xml.comments, org.eclipse.wst.xml.selection, org.eclipse.wst.xml.dependencies, org.eclipse.wst.xml.grammar, org.eclipse.wst.xml.expand, org.eclipse.wst.xml.occurrences"
+ target="org.eclipse.core.runtime.xml" />
+ </extension>
<extension
point="org.eclipse.ui.editors">
<editor
@@ -19,6 +77,10 @@
icon="icons/sample.gif"
class="org.jboss.tools.smooks.ui.editors.SmooksFormEditor"
id="org.jboss.tools.smooks.ui.editors.SmooksFormEditor">
+ <contentTypeBinding
+ contentTypeId="org.eclipse.core.runtime.xml" />
+ <contentTypeBinding
+ contentTypeId="org.jboss.tools.smooks.ui.smooks.contentType" />
</editor>
</extension>
<extension
@@ -197,4 +259,14 @@
class="org.jboss.tools.smooks.ui.SmooksListenerRegister">
</startup>
</extension>
+ <extension
+ point="org.eclipse.core.contenttype.contentTypes">
+ <content-type
+ base-type="org.eclipse.core.runtime.xml"
+ file-extensions="smooks"
+ id="org.jboss.tools.smooks.ui.smooks.contentType"
+ name="Smooks Configuration File"
+ priority="normal">
+ </content-type>
+ </extension>
</plugin>
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-11-09 00:29:36 UTC (rev 11621)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-11-10 07:15:12 UTC (rev 11622)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.smooks.javabean.analyzer;
-import java.awt.event.InvocationEvent;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collection;
@@ -22,10 +21,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.emf.common.command.BasicCommandStack;
import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.ExtendedMetaData;
-import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
@@ -34,7 +30,6 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
-import org.jboss.tools.smooks.analyzer.CompositeResolveCommand;
import org.jboss.tools.smooks.analyzer.DesignTimeAnalyzeResult;
import org.jboss.tools.smooks.analyzer.IMappingAnalyzer;
import org.jboss.tools.smooks.analyzer.ISourceModelAnalyzer;
@@ -55,12 +50,10 @@
import org.jboss.tools.smooks.model.SmooksResourceListType;
import org.jboss.tools.smooks.model.provider.SmooksItemProviderAdapterFactory;
import org.jboss.tools.smooks.model.util.SmooksModelUtils;
-import org.jboss.tools.smooks.ui.SmooksUIActivator;
import org.jboss.tools.smooks.ui.gef.model.AbstractStructuredDataModel;
import org.jboss.tools.smooks.ui.gef.model.GraphRootModel;
import org.jboss.tools.smooks.ui.gef.model.IConnectableModel;
import org.jboss.tools.smooks.ui.gef.model.LineConnectionModel;
-import org.jboss.tools.smooks.ui.gef.model.PropertyModel;
import org.jboss.tools.smooks.ui.gef.model.TreeItemRelationModel;
import org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext;
import org.jboss.tools.smooks.utils.ProjectClassLoader;
@@ -474,9 +467,10 @@
}
if (!(sourceObject instanceof JavaBeanModel)
|| !(targetObject instanceof JavaBeanModel)) {
-// throw new RuntimeException(
-// "[JavaBeanAnalyzer]Can't load the source/target data from Smooks configuration file.");
- return MappingResourceConfigList.createEmptyList();
+ // throw new RuntimeException(
+ // "[JavaBeanAnalyzer]Can't load the source/target data from Smooks configuration file."
+ // );
+ return MappingResourceConfigList.createEmptyList();
}
MappingResourceConfigList resourceConfigList = new MappingResourceConfigList();
JavaBeanModel source = (JavaBeanModel) sourceObject;
@@ -487,7 +481,13 @@
ResourceConfigType rc = (ResourceConfigType) iterator.next();
ResourceType rt = rc.getResource();
// find the first BeanPopulator resource config , this is the root.
- if (rt != null && BEANPOPULATOR.equals(rt.getValue())) {
+ String resourceClazz = null;
+ if (rt != null) {
+ resourceClazz = rt.getValue();
+ }
+ if (resourceClazz != null)
+ resourceClazz = resourceClazz.trim();
+ if (rt != null && BEANPOPULATOR.equals(resourceClazz)) {
String sourceName = source.getName();
Class sourceClazz = source.getBeanClass();
if (sourceClazz != null) {
@@ -551,9 +551,10 @@
if (childTargetModel == null) {
// TODO if can't find the child node , throw exception
// MODIFY by Dart 2008.11.07
- throw new RuntimeException("[JavaBeanAnalyzer]There isn't any child property named \""
- + property + "\" of \"" + target.getName()
- + "\" JavaBean model");
+ throw new RuntimeException(
+ "[JavaBeanAnalyzer]There isn't any child property named \""
+ + property + "\" of \"" + target.getName()
+ + "\" JavaBean model");
}
if (isReferenceSelector(selector)) {
ResourceConfigType rc = this
@@ -590,25 +591,29 @@
String parentName = parentModel.getName();
Class clazz = parentModel.getBeanClass();
JavaBeanModel current = parentModel;
- if (clazz != null){
+ if (clazz != null) {
parentName = clazz.getName();
- }else{
+ } else {
// TODO if can't find the class, throw exception
// MODIFY by Dart 08.11.07
- throw new RuntimeException("[JavaBeanAnalyzer]JavaBean \"" + parentModel.getName()+ "\" can't load its class.");
+ throw new RuntimeException("[JavaBeanAnalyzer]JavaBean \""
+ + parentModel.getName() + "\" can't load its class.");
}
if (s != null) {
for (int i = 0; i < s.length; i++) {
String childName = s[i];
if (childName.equals(parentName))
continue;
- JavaBeanModel child = findTheChildJavaBeanModel(childName, current);
- if (child == null){
+ JavaBeanModel child = findTheChildJavaBeanModel(childName,
+ current);
+ if (child == null) {
// TODO if can't find the child node , throw exception
// MODIFY by Dart 2008.11.07
- throw new RuntimeException("[JavaBeanAnalyzer]There isn't any child property named \""
- + childName + "\" of \"" + parentModel.getName()
- + "\" JavaBean model");
+ throw new RuntimeException(
+ "[JavaBeanAnalyzer]There isn't any child property named \""
+ + childName + "\" of \""
+ + parentModel.getName()
+ + "\" JavaBean model");
}
current = child;
}
@@ -654,6 +659,8 @@
if (resourceType == null)
continue;
String resource = resourceType.getValue();
+ if (resource != null)
+ resource = resource.trim();
if (BEANPOPULATOR.equals(resource)) {
// create root beanmodel
rootClassName = rc.getSelector();
@@ -757,6 +764,8 @@
if (resourceType == null)
continue;
String resource = resourceType.getValue();
+ if (resource != null)
+ resource = resource.trim();
if (BEANPOPULATOR.equals(resource)) {
// create root beanmodel
current = rc;
@@ -835,6 +844,10 @@
JavaBeanModel model = this.findTheChildJavaBeanModel(property,
parentModel);
if (model == null) {
+ // TODO if the model can't be found , throw exception
+ if (true)
+ throw new RuntimeException("Can't find the \"" + property
+ + "\" from \"" + parentModel.getName() + "\" model");
model = new JavaBeanModel(null, property);
parentModel.addProperty(model);
model.setError(Messages.getString("JavaBeanAnalyzer.DontExist")); //$NON-NLS-1$
@@ -844,8 +857,14 @@
selector = selector.substring(2, selector.length() - 1);
ResourceConfigType resourceConfig = findResourceConfigTypeWithSelector(
selector, listType);
- model.setBeanClassString(SmooksModelUtils.getParmaText(
- SmooksModelUtils.BEAN_CLASS, resourceConfig));
+ if (resourceConfig == null) {
+ throw new RuntimeException(
+ "Can't find some ResourceConfig element in the config file.Maybe some ResourceConfig element miss <param name = \"beanId\">"
+ + selector + "</param>");
+ }
+ String beanClassText = SmooksModelUtils.getParmaText(
+ SmooksModelUtils.BEAN_CLASS, resourceConfig);
+ model.setBeanClassString(beanClassText);
if (resourceConfig != null) {
this.buildChildrenOfTargetInputModel(listType, model, false,
false, resourceConfig, classLoader);
@@ -914,6 +933,9 @@
protected void analyzeBindingSelector(String selector,
JavaBeanModel currentModel, SmooksResourceListType listType,
ClassLoader classLoader) {
+ if (selector != null) {
+ selector = selector.trim();
+ }
if (selector.startsWith(COMPLEX_PRIX_START)
&& selector.endsWith(COMPLEX_PRIX_END)) {
// should get the bean properties
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java 2008-11-09 00:29:36 UTC (rev 11621)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksFormEditor.java 2008-11-10 07:15:12 UTC (rev 11622)
@@ -24,16 +24,17 @@
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.jboss.tools.smooks.analyzer.MappingResourceConfigList;
import org.jboss.tools.smooks.analyzer.NormalSmooksModelBuilder;
import org.jboss.tools.smooks.analyzer.NormalSmooksModelPackage;
@@ -52,8 +53,10 @@
public class SmooksFormEditor extends FormEditor implements
ITabbedPropertySheetPageContributor {
- SmooksGraphicalFormPage graphicalPage = null;
+ private StructuredTextEditor xmlTextEditor;
+ private SmooksGraphicalFormPage graphicalPage = null;
+
public SmooksGraphicalFormPage getGraphicalPage() {
return graphicalPage;
}
@@ -92,25 +95,39 @@
return forceDirty || super.isDirty();
}
+ private void createGraphicalEditor() throws PartInitException {
+ graphicalPage = new SmooksGraphicalFormPage(this, "graph", "Mapping");
+ int index = this.addPage(this.graphicalPage);
+ this.setPageText(index, "Graph");
+ }
+
+ private void createConfigurationEditor() throws PartInitException {
+ normalPage = new SmooksNormalContentEditFormPage(this, "configuration",
+ "Configuration", null);
+ int index = this.addPage(normalPage);
+ setPageText(index, "Configuration");
+ // Set a default NormalPacakge to Normal Page
+ MappingResourceConfigList mappingResourceConfig = graphicalPage
+ .getMappingResourceConfigList();
+ if (mappingResourceConfig != null) {
+ refreshNormalPage(mappingResourceConfig
+ .getRelationgResourceConfigList());
+ }
+ }
+
+ private void createXMLTextEditor() throws PartInitException {
+ this.xmlTextEditor = new StructuredTextEditor();
+ xmlTextEditor.setEditorPart(this);
+ int index = this.addPage(xmlTextEditor, getEditorInput());
+ this.setPageText(index, "Source");
+ }
+
@Override
protected void addPages() {
-
try {
- graphicalPage = new SmooksGraphicalFormPage(this, "graph",
- "Mapping");
- int index = this.addPage(this.graphicalPage);
- this.setPageText(index, "Graph");
- normalPage = new SmooksNormalContentEditFormPage(this,
- "configuration", "Configuration", null);
- index = this.addPage(normalPage);
- setPageText(index, "Configuration");
- // Set a default NormalPacakge to Normal Page
- MappingResourceConfigList mappingResourceConfig = graphicalPage
- .getMappingResourceConfigList();
- if (mappingResourceConfig != null) {
- refreshNormalPage(mappingResourceConfig
- .getRelationgResourceConfigList());
- }
+ createGraphicalEditor();
+ createConfigurationEditor();
+ createXMLTextEditor();
if (onlyShowTextEditor) {
removeGraphicalFormPage();
}
@@ -247,12 +264,25 @@
// TODO Auto-generated method stub
return false;
}
+
+ @Override
+ protected IEditorSite createSite(IEditorPart editor) {
+ return super.createSite(editor);
+ }
+
public Object getAdapter(Class adapter) {
- if (adapter == IPropertySheetPage.class) {
+ if(adapter == IPropertySheetPage.class){
+ System.out.println();
+ }
+ if (adapter == IPropertySheetPage.class && this.getActiveEditor() == graphicalPage) {
tabbedPropertySheetPage = new TabbedPropertySheetPage(this);
return tabbedPropertySheetPage;
}
+ if (adapter == IContentOutlinePage.class && this.getActiveEditor() == xmlTextEditor){
+ return super.getAdapter(adapter);
+ }else{
+ }
return super.getAdapter(adapter);
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java 2008-11-09 00:29:36 UTC (rev 11621)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java 2008-11-10 07:15:12 UTC (rev 11622)
@@ -54,7 +54,7 @@
*/
public class UIUtils {
- public static final String[] SELECTORE_SPLITER = new String[] { ":", "\\",
+ public static final String[] SELECTORE_SPLITER = new String[] { "\\",
"/" };
public static FillLayout createFillLayout(int marginW, int marginH) {
17 years, 5 months
JBoss Tools SVN: r11621 - in trunk/examples/plugins/org.jboss.tools.project.examples: src/org/jboss/tools/project/examples and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-11-08 19:29:36 -0500 (Sat, 08 Nov 2008)
New Revision: 11621
Added:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerContentProvider.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerDialog.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerLabelProvider.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/xpl/
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/xpl/QuickFixPage.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/xpl/QuickFixWizard.java
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/actions/ProjectExamplesHandler.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
Log:
JBIDE-3075 Adding general quickfixes to the imported project examples
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF 2008-11-09 00:29:23 UTC (rev 11620)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF 2008-11-09 00:29:36 UTC (rev 11621)
@@ -17,5 +17,7 @@
org.eclipse.equinox.security,
org.eclipse.equinox.p2.engine,
org.eclipse.equinox.p2.core,
- org.eclipse.ui.ide
+ org.eclipse.ui.ide,
+ org.eclipse.wst.validation,
+ org.eclipse.ui.views
Bundle-ActivationPolicy: lazy
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java 2008-11-09 00:29:23 UTC (rev 11620)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java 2008-11-09 00:29:36 UTC (rev 11621)
@@ -1,8 +1,31 @@
+/*************************************************************************************
+ * Copyright (c) 2008 JBoss, a division of Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss, a division of Red Hat - Initial implementation.
+ ************************************************************************************/
package org.jboss.tools.project.examples;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.wst.validation.internal.operations.ValidationBuilder;
+import org.jboss.tools.project.examples.model.Project;
import org.osgi.framework.BundleContext;
/**
@@ -17,7 +40,26 @@
private static ProjectExamplesActivator plugin;
private static BundleContext context;
+
+ public static Job waitForBuildAndValidation = new Job("Waiting...") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD,
+ monitor);
+ Job.getJobManager().join(
+ ValidationBuilder.FAMILY_VALIDATION_JOB, monitor);
+ } catch (OperationCanceledException e) {
+ return Status.CANCEL_STATUS;
+ } catch (InterruptedException e) {
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+
/**
* The constructor
*/
@@ -69,4 +111,22 @@
return context;
}
+ public static List<IMarker> getMarkers(List<Project> projects) {
+ List<IMarker> markers = new ArrayList<IMarker>();
+ for(Project project:projects) {
+ try {
+ String projectName = project.getName();
+ IProject eclipseProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ IMarker[] projectMarkers = eclipseProject.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
+ for (int i = 0; i < projectMarkers.length; i++) {
+ if (projectMarkers[i].getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR) == IMarker.SEVERITY_ERROR) {
+ markers.add(projectMarkers[i]);
+ }
+ }
+ } catch (CoreException e) {
+ ProjectExamplesActivator.log(e);
+ }
+ }
+ return markers;
+ }
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/actions/ProjectExamplesHandler.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/actions/ProjectExamplesHandler.java 2008-11-09 00:29:23 UTC (rev 11620)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/actions/ProjectExamplesHandler.java 2008-11-09 00:29:36 UTC (rev 11621)
@@ -1,3 +1,13 @@
+/*************************************************************************************
+ * Copyright (c) 2008 JBoss, a division of Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss, a division of Red Hat - Initial implementation.
+ ************************************************************************************/
package org.jboss.tools.project.examples.actions;
import org.eclipse.core.commands.AbstractHandler;
@@ -8,6 +18,10 @@
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.project.examples.wizard.NewProjectExamplesWizard;
+/**
+* @author snjeza
+*
+*/
public class ProjectExamplesHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
Added: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerContentProvider.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerContentProvider.java (rev 0)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerContentProvider.java 2008-11-09 00:29:36 UTC (rev 11621)
@@ -0,0 +1,46 @@
+/*************************************************************************************
+ * Copyright (c) 2008 JBoss, a division of Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss, a division of Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.project.examples.dialog;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.jboss.tools.project.examples.ProjectExamplesActivator;
+import org.jboss.tools.project.examples.model.Project;
+
+/**
+* @author snjeza
+*
+*/
+public class MarkerContentProvider implements IStructuredContentProvider {
+
+ private List<Project> projects;
+
+ public MarkerContentProvider(List<Project> projects) {
+ this.projects = projects;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ List<IMarker> markers = ProjectExamplesActivator.getMarkers(projects);
+ return markers.toArray();
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+}
Added: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerDialog.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerDialog.java (rev 0)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerDialog.java 2008-11-09 00:29:36 UTC (rev 11621)
@@ -0,0 +1,351 @@
+/*************************************************************************************
+ * Copyright (c) 2008 JBoss, a division of Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss, a division of Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.project.examples.dialog;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+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.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.internal.ide.IDEInternalWorkbenchImages;
+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
+import org.eclipse.ui.internal.views.markers.MarkerSupportInternalUtilities;
+import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
+import org.eclipse.ui.statushandlers.IStatusAdapterConstants;
+import org.eclipse.ui.statushandlers.StatusAdapter;
+import org.eclipse.ui.statushandlers.StatusManager;
+import org.eclipse.ui.views.markers.WorkbenchMarkerResolution;
+import org.eclipse.ui.views.markers.internal.MarkerMessages;
+import org.jboss.tools.project.examples.ProjectExamplesActivator;
+import org.jboss.tools.project.examples.dialog.xpl.QuickFixWizard;
+import org.jboss.tools.project.examples.model.Project;
+
+/**
+* @author snjeza
+*
+*/
+public class MarkerDialog extends TitleAreaDialog {
+
+ private static final String QUICK_FIX = "Quick Fix";
+ private static final IMarkerResolution[] EMPTY_ARRAY = new IMarkerResolution[0];
+ private List<Project> projects;
+ private Image _dlgTitleImage;
+ private Button quickFixButton;
+ private Button finishButton;
+ private TableViewer tableViewer;
+ private IResourceChangeListener resourceChangeListener;
+
+ private class QuickFixWizardDialog extends WizardDialog {
+
+ /**
+ * @param parentShell
+ * @param newWizard
+ */
+ public QuickFixWizardDialog(Shell parentShell, IWizard newWizard) {
+ super(parentShell, newWizard);
+ setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
+ | SWT.MODELESS | SWT.RESIZE | getDefaultOrientation());
+ }
+
+ }
+
+
+ public MarkerDialog(Shell parentShell, List<Project> projects) {
+ super(parentShell);
+ this.projects = projects;
+ setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
+ | SWT.MODELESS | SWT.RESIZE | getDefaultOrientation());
+ _dlgTitleImage = IDEInternalWorkbenchImages.getImageDescriptor(
+ IDEInternalWorkbenchImages.IMG_DLGBAN_QUICKFIX_DLG)
+ .createImage();
+ setTitleImage(_dlgTitleImage);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite area = (Composite) super.createDialogArea(parent);
+ Composite contents = new Composite(area, SWT.NONE);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 300;
+ contents.setLayoutData(gd);
+ contents.setLayout(new GridLayout());
+ setTitle(QUICK_FIX);
+ setMessage("Select a marker and click the Quick Fix button.");
+ getShell().setText(QUICK_FIX);
+ applyDialogFont(contents);
+ initializeDialogUnits(area);
+
+ Label markersLabel = new Label(contents, SWT.NULL);
+ markersLabel.setText("Markers:");
+ tableViewer = new TableViewer(contents, SWT.H_SCROLL
+ | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE);
+ Table table = tableViewer.getTable();
+ gd = new GridData(GridData.FILL_BOTH);
+ table.setLayoutData(gd);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ String[] columnNames = new String[] { "Description", "Resource", "Type" };
+ int[] columnWidths = new int[] { 200, 150, 150 };
+
+ for (int i = 0; i < columnNames.length; i++) {
+ TableColumn tc = new TableColumn(table, SWT.LEFT);
+ tc.setText(columnNames[i]);
+ tc.setWidth(columnWidths[i]);
+ }
+
+ tableViewer.setLabelProvider(new MarkerLabelProvider());
+ tableViewer.setContentProvider(new MarkerContentProvider(projects));
+ tableViewer.setInput(projects);
+
+ tableViewer
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelection source = event.getSelection();
+ if (source instanceof IStructuredSelection) {
+ IMarkerResolution[] resolutions = getMarkerResolutions(source);
+ quickFixButton.setEnabled(resolutions.length > 0);
+ }
+ }
+
+ });
+ resourceChangeListener = new IResourceChangeListener() {
+
+ public void resourceChanged(IResourceChangeEvent event) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ if (tableViewer != null && !tableViewer.getTable().isDisposed()) {
+ refreshTableViewer();
+ }
+ }
+
+ });
+
+ }
+
+ };
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(
+ resourceChangeListener);
+ return area;
+ }
+
+ @Override
+ public boolean close() {
+ if (_dlgTitleImage != null) {
+ _dlgTitleImage.dispose();
+ }
+ if (resourceChangeListener != null) {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);
+ resourceChangeListener = null;
+ }
+ return super.close();
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ quickFixButton = getButton(IDialogConstants.OK_ID);
+ quickFixButton.setText("Quick Fix");
+ finishButton = getButton(IDialogConstants.CANCEL_ID);
+ finishButton.setText("Finish");
+ quickFixButton.setEnabled(false);
+ }
+
+ @Override
+ protected void cancelPressed() {
+ setReturnCode(OK);
+ close();
+ }
+
+ @Override
+ protected void okPressed() {
+ ISelection source = tableViewer.getSelection();
+ if (source instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) source;
+ Object object = selection.getFirstElement();
+ if (object instanceof IMarker) {
+ IMarker selected = (IMarker) object;
+ try {
+ quickFixButton.setSelection(false);
+ openQuickFixWizard(selected);
+ for (Project project:projects) {
+ IProject eclipseProject = ResourcesPlugin.getWorkspace().getRoot().getProject(project.getName());
+ if (eclipseProject != null && eclipseProject.isOpen()) {
+ eclipseProject.build(IncrementalProjectBuilder.CLEAN_BUILD, null);
+ }
+ }
+ ProjectExamplesActivator.waitForBuildAndValidation.schedule();
+ ProjectExamplesActivator.waitForBuildAndValidation.join();
+ } catch (Exception e) {
+ ProjectExamplesActivator.log(e);
+ } finally {
+ refreshTableViewer();
+ }
+ }
+ }
+ }
+
+
+ private void refreshTableViewer() {
+ tableViewer.setInput(projects);
+ ISelection source = tableViewer.getSelection();
+ if (source instanceof IStructuredSelection) {
+ IMarkerResolution[] resolutions = getMarkerResolutions(source);
+ quickFixButton.setEnabled(resolutions.length > 0);
+ } else {
+ quickFixButton.setSelection(false);
+ }
+ }
+
+ private void openQuickFixWizard(final IMarker selected) throws ExecutionException {
+ final Map resolutions = new LinkedHashMap();
+
+ IRunnableWithProgress resolutionsRunnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ monitor
+ .beginTask(
+ MarkerMessages.resolveMarkerAction_computationManyAction,
+ 100);
+
+ IMarker[] allMarkers = (IMarker[]) ProjectExamplesActivator.getMarkers(projects).toArray(new IMarker[0]);
+ monitor.worked(20);
+ IMarkerResolution[] found = IDE.getMarkerHelpRegistry()
+ .getResolutions(selected);
+ int progressCount = 80;
+ if (found.length > 1)
+ progressCount = progressCount / found.length;
+ for (int i = 0; i < found.length; i++) {
+ IMarkerResolution markerResolution = found[i];
+ if (markerResolution instanceof WorkbenchMarkerResolution) {
+ IMarker[] other = ((WorkbenchMarkerResolution) markerResolution)
+ .findOtherMarkers(allMarkers);
+ Collection markers = new ArrayList();
+ markers.add(selected);
+ for (int j = 0; j < other.length; j++) {
+ markers.add(other[j]);
+ }
+ resolutions.put(markerResolution, markers);
+ } else {
+ Collection markers = new ArrayList();
+ markers.add(selected);
+ resolutions.put(markerResolution, markers);
+ }
+ monitor.worked(progressCount);
+ }
+ monitor.done();
+ }
+ };
+
+ Object service = null;
+
+ IRunnableContext context = new ProgressMonitorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell());
+
+ try {
+ if (service == null) {
+ PlatformUI.getWorkbench().getProgressService().runInUI(context,
+ resolutionsRunnable, null);
+ } else {
+ ((IWorkbenchSiteProgressService) service).runInUI(context,
+ resolutionsRunnable, null);
+ }
+ } catch (InvocationTargetException exception) {
+ throw new ExecutionException(exception.getLocalizedMessage(),
+ exception);
+ } catch (InterruptedException exception) {
+
+ throw new ExecutionException(exception.getLocalizedMessage(),
+ exception);
+ }
+
+ String markerDescription = selected.getAttribute(IMarker.MESSAGE,
+ MarkerSupportInternalUtilities.EMPTY_STRING);
+ if (resolutions.isEmpty()) {
+ Status newStatus = new Status(
+ IStatus.INFO,
+ IDEWorkbenchPlugin.IDE_WORKBENCH,
+ NLS
+ .bind(
+ MarkerMessages.MarkerResolutionDialog_NoResolutionsFound,
+ new Object[] { markerDescription }));
+ StatusAdapter adapter = new StatusAdapter(newStatus);
+ adapter.setProperty(IStatusAdapterConstants.TITLE_PROPERTY,
+ MarkerMessages.MarkerResolutionDialog_CannotFixTitle);
+ StatusManager.getManager().handle(adapter, StatusManager.SHOW);
+ } else {
+
+ String description = NLS.bind(
+ MarkerMessages.MarkerResolutionDialog_Description,
+ markerDescription);
+
+ Wizard wizard = new QuickFixWizard(description, resolutions);
+ wizard.setWindowTitle(MarkerMessages.resolveMarkerAction_dialogTitle);
+ WizardDialog dialog = new QuickFixWizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
+ dialog.open();
+ }
+ }
+
+ private IMarkerResolution[] getMarkerResolutions(ISelection source) {
+ IStructuredSelection selection = (IStructuredSelection) source;
+ IMarker marker = (IMarker) selection
+ .getFirstElement();
+ if (marker == null) {
+ return EMPTY_ARRAY;
+ }
+ IMarkerResolution[] resolutions = IDE
+ .getMarkerHelpRegistry().getResolutions(
+ marker);
+ return resolutions;
+ }
+}
\ No newline at end of file
Added: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerLabelProvider.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerLabelProvider.java (rev 0)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerLabelProvider.java 2008-11-09 00:29:36 UTC (rev 11621)
@@ -0,0 +1,67 @@
+/*************************************************************************************
+ * Copyright (c) 2008 JBoss, a division of Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * JBoss, a division of Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.project.examples.dialog;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+* @author snjeza
+*
+*/
+public class MarkerLabelProvider extends LabelProvider implements
+ ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (!(element instanceof IMarker)) {
+ return null;
+ }
+ IMarker marker = (IMarker) element;
+ switch (columnIndex) {
+ case 0:
+ return marker.getAttribute(IMarker.MESSAGE, "");
+ case 1:
+ return marker.getResource().getName();
+ case 2:
+ try {
+ IExtensionPoint extensionPoint = Platform
+ .getExtensionRegistry().getExtensionPoint(
+ "org.eclipse.core.resources.markers");
+ IExtension[] extensions = extensionPoint.getExtensions();
+ for (int i = 0; i < extensions.length; i++) {
+ IExtension extension = extensions[i];
+ String id = extension.getUniqueIdentifier();
+ if (id != null && id.equals(marker.getType())) {
+ String name = extension.getLabel();
+ if (name != null) {
+ return name;
+ }
+ }
+ }
+ return marker.getType();
+ } catch (CoreException e) {
+ return "";
+ }
+ }
+ return null;
+ }
+
+}
Added: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/xpl/QuickFixPage.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/xpl/QuickFixPage.java (rev 0)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/xpl/QuickFixPage.java 2008-11-09 00:29:36 UTC (rev 11621)
@@ -0,0 +1,639 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.jboss.tools.project.examples.dialog.xpl;
+
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+import java.util.Map;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelection;
+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.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+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.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
+import org.eclipse.ui.internal.views.markers.ExtendedMarkersView;
+import org.eclipse.ui.internal.views.markers.MarkerSupportInternalUtilities;
+import org.eclipse.ui.statushandlers.StatusAdapter;
+import org.eclipse.ui.statushandlers.StatusManager;
+import org.eclipse.ui.views.markers.WorkbenchMarkerResolution;
+import org.eclipse.ui.views.markers.internal.MarkerMessages;
+import org.eclipse.ui.views.markers.internal.Util;
+
+/**
+ * QuickFixPage is a page for the quick fixes of a marker.
+ *
+ * @since 3.4
+ *
+ */
+public class QuickFixPage extends WizardPage {
+
+ static final IMarker[] EMPTY_MARKER_ARRAY = new IMarker[0];
+ private Map resolutions;
+ private ListViewer resolutionsList;
+ private CheckboxTableViewer markersTable;
+ //private IWorkbenchPartSite site;
+
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param problemDescription
+ * the description of the problem being fixed
+ * @param resolutions
+ * {@link Map} with key of {@link IMarkerResolution} and value of
+ * {@link Collection} of {@link IMarker}
+ * @param site
+ * The IWorkbenchPartSite to show markers
+ */
+ public QuickFixPage(String problemDescription, Map resolutions) {
+ super(problemDescription);
+ this.resolutions = resolutions;
+ //this.site = site;
+ setTitle(MarkerMessages.resolveMarkerAction_dialogTitle);
+ setMessage(problemDescription);
+ }
+
+ public void createControl(Composite parent) {
+
+ initializeDialogUnits(parent);
+
+ // Create a new composite as there is the title bar seperator
+ // to deal with
+ Composite control = new Composite(parent, SWT.NONE);
+ control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ setControl(control);
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(control,
+ IWorkbenchHelpContextIds.PROBLEMS_VIEW);
+
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.spacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ control.setLayout(layout);
+
+ Label resolutionsLabel = new Label(control, SWT.NONE);
+ resolutionsLabel
+ .setText(MarkerMessages.MarkerResolutionDialog_Resolutions_List_Title);
+
+ resolutionsLabel.setLayoutData(new FormData());
+
+ createResolutionsList(control);
+
+ FormData listData = new FormData();
+ listData.top = new FormAttachment(resolutionsLabel, 0);
+ listData.left = new FormAttachment(0);
+ listData.right = new FormAttachment(100, 0);
+ listData.height = convertHeightInCharsToPixels(10);
+ resolutionsList.getControl().setLayoutData(listData);
+
+ Label title = new Label(control, SWT.NONE);
+ title
+ .setText(MarkerMessages.MarkerResolutionDialog_Problems_List_Title);
+ FormData labelData = new FormData();
+ labelData.top = new FormAttachment(resolutionsList.getControl(), 0);
+ labelData.left = new FormAttachment(0);
+ title.setLayoutData(labelData);
+
+ createMarkerTable(control);
+
+ Composite buttons = createTableButtons(control);
+ FormData buttonData = new FormData();
+ buttonData.top = new FormAttachment(title, 0);
+ buttonData.right = new FormAttachment(100);
+ buttonData.height = convertHeightInCharsToPixels(10);
+ buttons.setLayoutData(buttonData);
+
+ FormData tableData = new FormData();
+ tableData.top = new FormAttachment(buttons, 0, SWT.TOP);
+ tableData.left = new FormAttachment(0);
+ tableData.bottom = new FormAttachment(100);
+ tableData.right = new FormAttachment(buttons, 0);
+ tableData.height = convertHeightInCharsToPixels(10);
+ markersTable.getControl().setLayoutData(tableData);
+
+ Dialog.applyDialogFont(control);
+
+ resolutionsList.setSelection(new StructuredSelection(resolutionsList
+ .getElementAt(0)));
+
+ markersTable.setAllChecked(true);
+ }
+
+ /**
+ * Create the table buttons for the receiver.
+ *
+ * @param control
+ * @return {@link Composite}
+ */
+ private Composite createTableButtons(Composite control) {
+
+ Composite buttonComposite = new Composite(control, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ buttonComposite.setLayout(layout);
+
+ Button selectAll = new Button(buttonComposite, SWT.PUSH);
+ selectAll.setText(MarkerMessages.selectAllAction_title);
+ selectAll.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false));
+
+ selectAll.addSelectionListener(new SelectionAdapter() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent arg0) {
+ markersTable.setAllChecked(true);
+ setPageComplete(!resolutionsList.getSelection().isEmpty());
+ }
+ });
+
+ Button deselectAll = new Button(buttonComposite, SWT.PUSH);
+ deselectAll.setText(MarkerMessages.filtersDialog_deselectAll);
+ deselectAll
+ .setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false));
+
+ deselectAll.addSelectionListener(new SelectionAdapter() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent arg0) {
+ markersTable.setAllChecked(false);
+ setPageComplete(false);
+ }
+ });
+
+ return buttonComposite;
+ }
+
+ /**
+ * @param control
+ */
+ private void createResolutionsList(Composite control) {
+ resolutionsList = new ListViewer(control, SWT.BORDER | SWT.SINGLE
+ | SWT.V_SCROLL);
+ resolutionsList.setContentProvider(new IStructuredContentProvider() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ return resolutions.keySet().toArray();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
+ * java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+
+ }
+ });
+
+ resolutionsList.setLabelProvider(new LabelProvider() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object element) {
+ return ((IMarkerResolution) element).getLabel();
+ }
+ });
+
+ resolutionsList.setInput(this);
+
+ resolutionsList.setComparator(new ViewerComparator() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer,
+ * java.lang.Object, java.lang.Object)
+ */
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ return ((IMarkerResolution) e1).getLabel().compareTo(
+ ((IMarkerResolution) e1).getLabel());
+ }
+ });
+
+ resolutionsList
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+
+ markersTable.refresh();
+
+ IWorkbenchWindow window = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+ if (window == null)
+ return;
+ IWorkbenchPage page = window.getActivePage();
+ if (page == null)
+ return;
+
+ }
+
+ });
+ }
+
+ /**
+ * Create the table that shows the markers.
+ *
+ * @param control
+ */
+ private void createMarkerTable(Composite control) {
+ markersTable = CheckboxTableViewer.newCheckList(control, SWT.BORDER
+ | SWT.V_SCROLL | SWT.SINGLE);
+
+ createTableColumns();
+
+ markersTable.setContentProvider(new IStructuredContentProvider() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ IMarkerResolution selected = getSelectedResolution();
+ if (selected == null) {
+ return new Object[0];
+ }
+
+ if (resolutions.containsKey(selected)) {
+ return ((Collection) resolutions.get(selected)).toArray();
+ }
+ return EMPTY_MARKER_ARRAY;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
+ * java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+
+ }
+ });
+
+ markersTable.setLabelProvider(new ITableLabelProvider() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object,
+ * int)
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0)
+ return Util.getImage(((IMarker) element).getAttribute(
+ IMarker.SEVERITY, -1));
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object,
+ * int)
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ if (columnIndex == 0)
+ return Util.getResourceName((IMarker) element);
+ int line = ((IMarker) element).getAttribute(
+ IMarker.LINE_NUMBER, -1);
+ if (line < 0) {
+ return MarkerMessages.Unknown;
+ }
+ return NLS.bind(MarkerMessages.label_lineNumber, Integer
+ .toString(line));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ public void addListener(ILabelProviderListener listener) {
+ // do nothing
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ public void dispose() {
+ // do nothing
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object,
+ * java.lang.String)
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ // do nothing
+
+ }
+ });
+
+ markersTable.addCheckStateListener(new ICheckStateListener() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
+ */
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (event.getChecked() == true) {
+ setPageComplete(true);
+ } else {
+ setPageComplete(markersTable.getCheckedElements().length > 0);
+ }
+
+ }
+ });
+
+ markersTable
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+
+ if (event.getSelection().isEmpty())
+ return;
+ IMarker marker = (IMarker) ((IStructuredSelection) event
+ .getSelection()).getFirstElement();
+ ExtendedMarkersView.openMarkerInEditor(marker,PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage());
+
+ }
+ });
+
+ markersTable.setInput(this);
+ }
+
+ /**
+ * Create the table columns for the receiver.
+ */
+ private void createTableColumns() {
+ TableLayout layout = new TableLayout();
+
+ Table table = markersTable.getTable();
+ table.setLayout(layout);
+ table.setLinesVisible(true);
+ table.setHeaderVisible(true);
+
+ layout.addColumnData(new ColumnWeightData(70, true));
+ TableColumn tc = new TableColumn(table, SWT.NONE, 0);
+ tc
+ .setText(MarkerMessages.MarkerResolutionDialog_Problems_List_Location);
+ layout.addColumnData(new ColumnWeightData(30, true));
+ tc = new TableColumn(table, SWT.NONE, 0);
+ tc
+ .setText(MarkerMessages.MarkerResolutionDialog_Problems_List_Resource);
+
+ }
+
+ /**
+ * Return the marker being edited.
+ *
+ * @return IMarker or <code>null</code>
+ */
+ public IMarker getSelectedMarker() {
+ ISelection selection = markersTable.getSelection();
+ if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
+ IStructuredSelection struct = (IStructuredSelection) selection;
+ if (struct.size() == 1)
+ return (IMarker) struct.getFirstElement();
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
+ */
+ public boolean isPageComplete() {
+ return true;
+ }
+
+ /**
+ * Finish has been pressed. Process the resolutions. monitor the monitor to
+ * report to.
+ */
+ /**
+ * @param monitor
+ */
+ /**
+ * @param monitor
+ */
+ void performFinish(IProgressMonitor monitor) {
+
+ final IMarkerResolution resolution = getSelectedResolution();
+ if (resolution == null)
+ return;
+
+ final Object[] checked = markersTable.getCheckedElements();
+ if (checked.length == 0)
+ return;
+
+ if (resolution instanceof WorkbenchMarkerResolution) {
+
+ try {
+ getWizard().getContainer().run(false, true,
+ new IRunnableWithProgress() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void run(IProgressMonitor monitor) {
+ IMarker[] markers = new IMarker[checked.length];
+ System.arraycopy(checked, 0, markers, 0,
+ checked.length);
+ ((WorkbenchMarkerResolution) resolution).run(
+ markers, monitor);
+ }
+
+ });
+ } catch (InvocationTargetException e) {
+ StatusManager.getManager().handle(
+ errorFor(e));
+ } catch (InterruptedException e) {
+ StatusManager.getManager().handle(
+ errorFor(e));
+ }
+
+ } else {
+
+ try {
+ getWizard().getContainer().run(false, true,
+ new IRunnableWithProgress() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void run(IProgressMonitor monitor) {
+ monitor
+ .beginTask(
+ MarkerMessages.MarkerResolutionDialog_Fixing,
+ checked.length);
+ for (int i = 0; i < checked.length; i++) {
+ // Allow paint events and wake up the button
+ getShell().getDisplay().readAndDispatch();
+ if (monitor.isCanceled())
+ return;
+ IMarker marker = (IMarker) checked[i];
+ monitor.subTask(Util.getProperty(
+ IMarker.MESSAGE, marker));
+ resolution.run(marker);
+ monitor.worked(1);
+ }
+ }
+
+ });
+ } catch (InvocationTargetException e) {
+ StatusManager.getManager().handle(
+ errorFor(e));
+ } catch (InterruptedException e) {
+ StatusManager.getManager().handle(
+ errorFor(e));
+ }
+
+ }
+
+ }
+
+ /**
+ * Return the marker resolution that is currently selected/
+ *
+ * @return IMarkerResolution or <code>null</code> if there is no
+ * selection.
+ */
+ private IMarkerResolution getSelectedResolution() {
+ ISelection selection = resolutionsList.getSelection();
+ if (!(selection instanceof IStructuredSelection)) {
+ return null;
+ }
+
+ Object first = ((IStructuredSelection) selection).getFirstElement();
+
+ return (IMarkerResolution) first;
+
+ }
+
+ /**
+ * Return a StatusAdapter for the error
+ *
+ * @param exception
+ * @return StatusAdapter
+ */
+ static final StatusAdapter errorFor(Throwable exception) {
+ IStatus status = new Status(IStatus.ERROR,
+ IDEWorkbenchPlugin.IDE_WORKBENCH, IStatus.ERROR, exception
+ .getLocalizedMessage(), exception);
+ return new StatusAdapter(status);
+ }
+
+}
Added: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/xpl/QuickFixWizard.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/xpl/QuickFixWizard.java (rev 0)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/xpl/QuickFixWizard.java 2008-11-09 00:29:36 UTC (rev 11621)
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.jboss.tools.project.examples.dialog.xpl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.internal.ide.IDEInternalWorkbenchImages;
+import org.eclipse.ui.internal.ide.StatusUtil;
+import org.eclipse.ui.statushandlers.StatusManager;
+import org.eclipse.ui.views.markers.internal.MarkerMessages;
+
+/**
+ * QuickFixWizard is the wizard for quick fixes.
+ *
+ * @since 3.4
+ *
+ */
+public class QuickFixWizard extends Wizard {
+
+ private Map resolutionMap;
+ private String description;
+ //private IWorkbenchPartSite partSite;
+
+ /**
+ * Create the wizard with the map of resolutions.
+ *
+ * @param description the description of the problem
+ * @param resolutions
+ * Map key {@link IMarkerResolution} value {@link IMarker} []
+ * @param site the {@link IWorkbenchPartSite} to open the markers in
+ */
+ public QuickFixWizard(String description,Map resolutions) {
+ super();
+ this.resolutionMap = resolutions;
+ this.description = description;
+ //partSite = site;
+ setDefaultPageImageDescriptor(IDEInternalWorkbenchImages
+ .getImageDescriptor(IDEInternalWorkbenchImages.IMG_DLGBAN_QUICKFIX_DLG));
+ setNeedsProgressMonitor(true);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ public void addPages() {
+ super.addPages();
+ addPage(new QuickFixPage(description,resolutionMap));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ public boolean performFinish() {
+ IRunnableWithProgress finishRunnable = new IRunnableWithProgress() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void run(IProgressMonitor monitor)
+ {
+ IWizardPage[] pages = getPages();
+ monitor.beginTask(MarkerMessages.MarkerResolutionDialog_Fixing,
+ (10 * pages.length) + 1);
+ monitor.worked(1);
+ for (int i = 0; i < pages.length; i++) {
+ //Allow for cancel event processing
+ getShell().getDisplay().readAndDispatch();
+ if(monitor.isCanceled())
+ return;
+ QuickFixPage wizardPage = (QuickFixPage) pages[i];
+ wizardPage.performFinish(new SubProgressMonitor(monitor,10));
+ monitor.worked(1);
+ }
+ monitor.done();
+
+ }
+ };
+
+ try {
+ getContainer().run(false, true, finishRunnable);
+ } catch (InvocationTargetException e) {
+ StatusManager.getManager().handle(
+ StatusUtil.newStatus(IStatus.ERROR,
+ e.getLocalizedMessage(), e));
+ return false;
+ } catch (InterruptedException e) {
+ StatusManager.getManager().handle(
+ StatusUtil.newStatus(IStatus.ERROR,
+ e.getLocalizedMessage(), e));
+ return false;
+ }
+
+ return true;
+ }
+
+}
+
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2008-11-09 00:29:23 UTC (rev 11620)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2008-11-09 00:29:36 UTC (rev 11621)
@@ -112,7 +112,7 @@
Category other = Category.OTHER;
try {
// TODO add a progress monitor
- File file = getProjectExamplesFile(PROJECT_EXAMPLES_XML,"projectExamples", ".xml",null);
+ File file = getProjectExamplesFile(getProjectExamplesXml(),"projectExamples", ".xml",null);
if (file.exists() && file.isFile()) {
DocumentBuilderFactory dbf = DocumentBuilderFactory
.newInstance();
@@ -182,6 +182,14 @@
return list;
}
+ private static String getProjectExamplesXml() {
+ String projectXML = System.getProperty("org.jboss.tools.project.examples.xml");
+ if (projectXML != null && projectXML.length() > 0) {
+ return projectXML;
+ }
+ return PROJECT_EXAMPLES_XML;
+ }
+
private static String getContent(Element child) {
String value = child.getTextContent();
if (value == null) {
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2008-11-09 00:29:23 UTC (rev 11620)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2008-11-09 00:29:36 UTC (rev 11621)
@@ -20,6 +20,7 @@
import java.util.List;
import java.util.zip.ZipFile;
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -27,19 +28,28 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.IOverwriteQuery;
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
+import org.eclipse.wst.validation.internal.operations.ValidationBuilder;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
+import org.jboss.tools.project.examples.dialog.MarkerDialog;
import org.jboss.tools.project.examples.model.Project;
import org.jboss.tools.project.examples.model.ProjectUtil;
@@ -51,6 +61,7 @@
}
};
+ private List<Project> projects = new ArrayList<Project>();
/**
* The workbench.
*/
@@ -65,6 +76,8 @@
protected boolean overwrite;
+ private WorkspaceJob workspaceJob;
+
public NewProjectExamplesWizard() {
super();
setWindowTitle("New Project Example");
@@ -77,18 +90,18 @@
@Override
public boolean performFinish() {
-
+
if (page.getSelection() == null || page.getSelection().size() <= 0) {
return false;
}
- WorkspaceJob job = new WorkspaceJob("Downloading...") {
+ workspaceJob = new WorkspaceJob("Downloading...") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor)
throws CoreException {
- IStructuredSelection selection= page.getSelection();
+ IStructuredSelection selection = page.getSelection();
Iterator iterator = selection.iterator();
- List<Project> projects = new ArrayList<Project>();
+ projects.clear();
List<File> files = new ArrayList<File>();
while (iterator.hasNext()) {
Object object = iterator.next();
@@ -107,37 +120,94 @@
}
try {
int i = 0;
- for (Project project:projects) {
+ setName("Importing...");
+ for (Project project : projects) {
importProject(project, files.get(i++), monitor);
}
} catch (final Exception e) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
- MessageDialogWithToggle.openError(getShell(), "Error", e
- .getMessage(), "Detail", false,
+ MessageDialogWithToggle.openError(getShell(),
+ "Error", e.getMessage(), "Detail", false,
ProjectExamplesActivator.getDefault()
- .getPreferenceStore(), "errorDialog");
+ .getPreferenceStore(),
+ "errorDialog");
}
-
+
});
ProjectExamplesActivator.log(e);
- }
+ }
return Status.OK_STATUS;
}
};
- job.setUser(true);
- job.schedule();
- //try {
- // job.join();
- //} catch (InterruptedException e) {
- // return false;
- //}
+ workspaceJob.setUser(true);
+ final boolean showQuickFix = page.showQuickFix();
+ workspaceJob.schedule();
+
+ if (showQuickFix) {
+ workspaceJob.addJobChangeListener(new IJobChangeListener() {
+
+ public void aboutToRun(IJobChangeEvent event) {
+
+ }
+
+ public void awake(IJobChangeEvent event) {
+
+ }
+
+ public void done(IJobChangeEvent event) {
+ try {
+ ProjectExamplesActivator.waitForBuildAndValidation.schedule();
+ ProjectExamplesActivator.waitForBuildAndValidation.join();
+
+ } catch (InterruptedException e) {
+ return;
+ }
+ if (showQuickFix) {
+ List<IMarker> markers = ProjectExamplesActivator
+ .getMarkers(projects);
+ if (markers != null && markers.size() > 0) {
+ showQuickFix();
+ }
+ }
+ }
+
+ public void running(IJobChangeEvent event) {
+
+ }
+
+ public void scheduled(IJobChangeEvent event) {
+
+ }
+
+ public void sleeping(IJobChangeEvent event) {
+
+ }
+
+ });
+ }
return true;
}
- private void importProject(Project projectDescription, File file, IProgressMonitor monitor) throws Exception {
+ private void showQuickFix() {
+
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+
+ Shell shell = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell();
+ Dialog dialog = new MarkerDialog(shell, projects);
+ dialog.open();
+ }
+
+ });
+ }
+
+ private void importProject(Project projectDescription, File file,
+ IProgressMonitor monitor) throws Exception {
final String projectName = projectDescription.getName();
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject project = workspace.getRoot().getProject(projectName);
@@ -145,9 +215,11 @@
Display.getDefault().syncExec(new Runnable() {
public void run() {
- overwrite = MessageDialog.openQuestion(getShell(), "Question", "Overwrite project '" + projectName + "'");
+ overwrite = MessageDialog.openQuestion(getShell(),
+ "Question", "Overwrite project '" + projectName
+ + "'");
}
-
+
});
if (!overwrite) {
return;
@@ -160,8 +232,8 @@
ZipFileStructureProvider structureProvider = new ZipFileStructureProvider(
sourceFile);
- ImportOperation operation = new ImportOperation(workspace.getRoot().getFullPath(),
- structureProvider.getRoot(), structureProvider,
+ ImportOperation operation = new ImportOperation(workspace.getRoot()
+ .getFullPath(), structureProvider.getRoot(), structureProvider,
OVERWRITE_ALL_QUERY);
operation.setContext(getShell());
operation.run(monitor);
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2008-11-09 00:29:23 UTC (rev 11620)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2008-11-09 00:29:36 UTC (rev 11621)
@@ -26,6 +26,7 @@
import org.eclipse.swt.graphics.Image;
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.Label;
import org.eclipse.swt.widgets.Text;
@@ -42,6 +43,7 @@
public class NewProjectExamplesWizardPage extends WizardPage {
private IStructuredSelection selection;
+ private Button showQuickFixButton;
public NewProjectExamplesWizardPage() {
super("org.jboss.tools.project.examples");
@@ -59,6 +61,7 @@
gd.widthHint= 225;
composite.setLayoutData(gd);
+ new Label(composite,SWT.NONE).setText("Projects:");
TreeViewer viewer = new TreeViewer(composite,SWT.MULTI);
Tree tree = viewer.getTree();
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
@@ -107,7 +110,7 @@
projectURL.setText(selectedProject.getUrl());
projectSize.setText(selectedProject.getSizeAsText());
} else {
- Project selectedProject=null;
+ //Project selectedProject=null;
text.setText("");
projectName.setText("");
projectURL.setText("");
@@ -128,6 +131,16 @@
}
});
+
+ showQuickFixButton = new Button(internal,SWT.CHECK);
+ showQuickFixButton.setText("Show the Quick Fix dialog");
+ showQuickFixButton.setSelection(true);
+ gd=new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan=2;
+ showQuickFixButton.setLayoutData(gd);
+ //Label showQuickFixLabel = new Label(internal,SWT.NULL);
+ //showQuickFixLabel.setText("Show the Quick Fix dialog:");
+
setPageComplete(false);
setControl(composite);
@@ -194,4 +207,11 @@
public IStructuredSelection getSelection() {
return selection;
}
+
+ public boolean showQuickFix() {
+ if (showQuickFixButton != null) {
+ return showQuickFixButton.getSelection();
+ }
+ return false;
+ }
}
17 years, 5 months
JBoss Tools SVN: r11620 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-11-08 19:29:23 -0500 (Sat, 08 Nov 2008)
New Revision: 11620
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
Log:
JBIDE-3075 Adding general quickfixes to the imported project examples
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2008-11-09 00:29:18 UTC (rev 11619)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2008-11-09 00:29:23 UTC (rev 11620)
@@ -48,7 +48,7 @@
#Invalid seam project settings
INVALID_PARENT_PROJECT=Main Seam project "{0}" specified for Seam project "{1}" does not exist.
-INVALID_RUNTIME=Seam Runtime "{0}" specified for Seam project "{1}" does not exist. Please correct this property in "Seam settings" page (Project->Properties->Seam Settings).
+INVALID_RUNTIME=Seam Runtime "{0}" specified for Seam project "{1}" does not exist.
INVALID_WEBFOLDER=View Folder "{0}" specified for Seam project "{1}" does not exist. Please correct this property in "Seam settings" page (Project->Properties->Seam Settings).
INVALID_EJB_PROJECT=EJB project "{0}" specified for Seam project "{1}" does not exist. Please correct this property in "Seam settings" page (Project->Properties->Seam Settings).
INVALID_TEST_PROJECT=Test project "{0}" specified for Seam project "{1}" does not exist. Please correct this property in "Seam settings" page (Project->Properties->Seam Settings).
@@ -58,7 +58,7 @@
INVALID_MODEL_PACKAGE_NAME=Model package name "{0}" specified for Seam project "{1}" is not valid. Please correct this property in "Seam settings" page (Project->Properties->Seam Settings).
INVALID_ACTION_PACKAGE_NAME=Action / Form / Conversation package name "{0}" specified for Seam project "{1}" is not valid. Please correct this property in "Seam settings" page (Project->Properties->Seam Settings).
INVALID_TEST_PACKAGE_NAME=Test package name "{0}" specified for Seam project "{1}" is not valid. Please correct this property in "Seam settings" page (Project->Properties->Seam Settings).
-INVALID_CONNECTION_NAME=Connection profiler "{0}" specified for Seam project "{1}" does not exist. Please correct this property in "Seam settings" page (Project->Properties->Seam Settings).
+INVALID_CONNECTION_NAME=Connection profiler "{0}" specified for Seam project "{1}" does not exist.
#Invalid ear application.xml
INVALID_SEAM_JAR_MODULE_IN_APPLICATION_XML=jboss-seam.jar must be declared as <module><ejb>jboss-seam.jar</ejb><module> to work correctly.
17 years, 5 months
JBoss Tools SVN: r11619 - in trunk/seam/plugins/org.jboss.tools.seam.ui: src/org/jboss/tools/seam/ui and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-11-08 19:29:18 -0500 (Sat, 08 Nov 2008)
New Revision: 11619
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/MarkerResolutionGenerator.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/SeamRuntimeMarkerResolution.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
Log:
JBIDE-3075 Adding general quickfixes to the imported project examples
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2008-11-08 02:44:01 UTC (rev 11618)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2008-11-09 00:29:18 UTC (rev 11619)
@@ -607,5 +607,11 @@
commandId="org.jboss.tools.seam.ui.refactoring.component"
class="org.jboss.tools.seam.ui.refactoring.SeamComponentRenameHandler"/>
</extension>
+
+ <extension point="org.eclipse.ui.ide.markerResolution">
+ <markerResolutionGenerator
+ class="org.jboss.tools.seam.ui.marker.MarkerResolutionGenerator"
+ markerType="org.jboss.tools.seam.core.seamProjectProblem"/>
+ </extension>
</plugin>
\ No newline at end of file
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/MarkerResolutionGenerator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/MarkerResolutionGenerator.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/MarkerResolutionGenerator.java 2008-11-09 00:29:18 UTC (rev 11619)
@@ -0,0 +1,17 @@
+package org.jboss.tools.seam.ui.marker;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolutionGenerator2;
+
+public class MarkerResolutionGenerator implements IMarkerResolutionGenerator2 {
+
+ public boolean hasResolutions(IMarker marker) {
+ return true;
+ }
+
+ public IMarkerResolution[] getResolutions(IMarker marker) {
+ return new IMarkerResolution[] { new SeamRuntimeMarkerResolution() };
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/SeamRuntimeMarkerResolution.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/SeamRuntimeMarkerResolution.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/SeamRuntimeMarkerResolution.java 2008-11-09 00:29:18 UTC (rev 11619)
@@ -0,0 +1,38 @@
+package org.jboss.tools.seam.ui.marker;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IMarkerResolution2;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.dialogs.PropertyDialog;
+import org.jboss.tools.seam.ui.preferences.SeamSettingsPreferencePage;
+
+public class SeamRuntimeMarkerResolution implements IMarkerResolution2 {
+
+ public String getDescription() {
+ return "Set Seam properties";
+ }
+
+ public Image getImage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getLabel() {
+ return "Set Seam properties";
+ }
+
+ public void run(IMarker marker) {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ IResource resource = marker.getResource();
+ PropertyDialog dialog = PropertyDialog.createDialogOn(shell, SeamSettingsPreferencePage.ID, resource);
+
+ if (dialog != null) {
+ dialog.open();
+ }
+
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2008-11-08 02:44:01 UTC (rev 11618)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2008-11-09 00:29:18 UTC (rev 11619)
@@ -78,6 +78,7 @@
*/
public class SeamSettingsPreferencePage extends PropertyPage implements PropertyChangeListener {
+ public static final String ID = "org.jboss.tools.seam.ui.propertyPages.SeamSettingsPreferencePage";
private Map<String,IFieldEditor> editorRegistry = new HashMap<String,IFieldEditor>();
private IProject project;
private IProject warProject;
17 years, 5 months
JBoss Tools SVN: r11618 - workspace/rstryker/event_refactor.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-11-07 21:44:01 -0500 (Fri, 07 Nov 2008)
New Revision: 11618
Added:
workspace/rstryker/event_refactor/as/
Log:
re-copying
Copied: workspace/rstryker/event_refactor/as (from rev 11617, trunk/as)
17 years, 5 months