JBoss Tools SVN: r8293 - branches/jbosstools-2.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2008-05-22 12:24:39 -0400 (Thu, 22 May 2008)
New Revision: 8293
Modified:
branches/jbosstools-2.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
Log:
fix http://jira.jboss.com/jira/browse/JBIDE-2249
Modified: branches/jbosstools-2.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- branches/jbosstools-2.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2008-05-22 16:04:09 UTC (rev 8292)
+++ branches/jbosstools-2.1.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2008-05-22 16:24:39 UTC (rev 8293)
@@ -258,7 +258,9 @@
}
finally{
try{
- packager.finished();
+ if(packager!=null) {
+ packager.finished();
+ }
}
catch(IOException e){
IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, 0,
17 years, 11 months
JBoss Tools SVN: r8292 - branches/jbosstools-2.1.x/jsf/tests/org.jboss.tools.jsf.text.ext.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-05-22 12:04:09 -0400 (Thu, 22 May 2008)
New Revision: 8292
Modified:
branches/jbosstools-2.1.x/jsf/tests/org.jboss.tools.jsf.text.ext.test/META-INF/MANIFEST.MF
Log:
JUnit TestCase ELExprPartitionerTest.testELExprPartitioner() is fixed due to support new partition types.
Modified: branches/jbosstools-2.1.x/jsf/tests/org.jboss.tools.jsf.text.ext.test/META-INF/MANIFEST.MF
===================================================================
--- branches/jbosstools-2.1.x/jsf/tests/org.jboss.tools.jsf.text.ext.test/META-INF/MANIFEST.MF 2008-05-22 16:03:12 UTC (rev 8291)
+++ branches/jbosstools-2.1.x/jsf/tests/org.jboss.tools.jsf.text.ext.test/META-INF/MANIFEST.MF 2008-05-22 16:04:09 UTC (rev 8292)
@@ -15,7 +15,8 @@
org.jboss.tools.common.text.ext,
org.eclipse.wst.sse.core,
org.jboss.tools.common.model,
- org.jboss.tools.common.test
+ org.jboss.tools.common.test,
+ org.jboss.tools.tests
Eclipse-LazyStart: true
Bundle-Vendor: Red Hat, Inc.
Export-Package: org.jboss.tools.jsf.text.ext.tests
17 years, 11 months
JBoss Tools SVN: r8291 - branches/jbosstools-2.1.x/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/tests.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-05-22 12:03:12 -0400 (Thu, 22 May 2008)
New Revision: 8291
Modified:
branches/jbosstools-2.1.x/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/tests/ELExprPartitionerTest.java
Log:
JUnit TestCase ELExprPartitionerTest.testELExprPartitioner() is fixed due to support new partition types.
Modified: branches/jbosstools-2.1.x/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/tests/ELExprPartitionerTest.java
===================================================================
--- branches/jbosstools-2.1.x/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/tests/ELExprPartitionerTest.java 2008-05-22 15:00:32 UTC (rev 8290)
+++ branches/jbosstools-2.1.x/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/tests/ELExprPartitionerTest.java 2008-05-22 16:03:12 UTC (rev 8291)
@@ -21,6 +21,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentExtension3;
import org.eclipse.jface.text.ITypedRegion;
@@ -38,6 +39,7 @@
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.AxisUtil;
import org.jboss.tools.jsf.text.ext.hyperlink.JSPExprHyperlinkPartitioner;
+import org.jboss.tools.test.util.xpl.EditorTestHelper;
public class ELExprPartitionerTest extends TestCase {
TestProjectProvider provider = null;
@@ -71,10 +73,10 @@
public void testELExprPartitioner() {
try {
- XJob.waitForJob();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ EditorTestHelper.joinBackgroundActivities();
+ } catch (CoreException e) {
+ assertNull("An exception caught: " + (e != null? e.getMessage() : ""), e);
+ }
assertTrue("Test project \"" + PROJECT_NAME + "\" is not loaded", (project != null));
IFile jspFile = project.getFile(PAGE_NAME);
@@ -144,18 +146,19 @@
regionList.add(new Region(639, 1));
regionList.add(new Region(722, 1));
regionList.add(new Region(831, 1));
- regionList.add(new Region(887, 1));
regionList.add(new Region(933, 1));
regionList.add(new Region(990, 1));
regionList.add(new Region(1058, 1));
recognitionTest.put("org.jboss.tools.common.text.ext.jsp.JSP_EXPRESSION", regionList);
-
+
int counter = 0;
for (int i = 0; i < document.getLength(); i++) {
TestData testData = new TestData(document, i);
boolean recognized = elPartitioner.recognize(testData.document, testData.getHyperlinkRegion());
if (recognized) {
String childPartitionType = elPartitioner.getChildPartitionType(testData.document, testData.getHyperlinkRegion());
+// if (childPartitionType != null)
+// System.out.println("#" + i + " partitionType: " + childPartitionType);
if (childPartitionType != null) {
ArrayList test = (ArrayList)recognitionTest.get(childPartitionType);
@@ -194,7 +197,7 @@
}
assertTrue("Wrong recognized region count: " + counter
- + " (must be 138)" , (counter == 138));
+ + " (must be 137)" , (counter == 137));
model.releaseFromEdit();
17 years, 11 months
JBoss Tools SVN: r8290 - in trunk: documentation/guides/Exadel-migration/en and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: afedosik
Date: 2008-05-22 11:00:32 -0400 (Thu, 22 May 2008)
New Revision: 8290
Modified:
trunk/as/docs/reference/en/master.xml
trunk/documentation/guides/Exadel-migration/en/master.xml
trunk/documentation/guides/GettingStartedGuide/en/master.xml
trunk/esb/docs/esb_ref_guide/en/master.xml
trunk/hibernatetools/docs/reference/en/master.xml
trunk/jsf/docs/jsf_tools_ref_guide/en/master.xml
trunk/jsf/docs/jsf_tools_tutorial/en/master.xml
trunk/jsf/docs/userguide/en/master.xml
trunk/seam/docs/reference/en/master.xml
trunk/struts/docs/struts_tools_ref_guide/en/master.xml
trunk/struts/docs/struts_tools_tutorial/en/master.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-292 Docs version update according to GA release
Modified: trunk/as/docs/reference/en/master.xml
===================================================================
--- trunk/as/docs/reference/en/master.xml 2008-05-22 14:26:22 UTC (rev 8289)
+++ trunk/as/docs/reference/en/master.xml 2008-05-22 15:00:32 UTC (rev 8290)
@@ -40,7 +40,7 @@
<holder>JBoss, a division of Red Hat Inc.</holder>
</copyright>
<releaseinfo>
- Version: 1.1.0.CR1
+ Version: 1.1.0.GA
</releaseinfo>
</bookinfo>
Modified: trunk/documentation/guides/Exadel-migration/en/master.xml
===================================================================
--- trunk/documentation/guides/Exadel-migration/en/master.xml 2008-05-22 14:26:22 UTC (rev 8289)
+++ trunk/documentation/guides/Exadel-migration/en/master.xml 2008-05-22 15:00:32 UTC (rev 8290)
@@ -33,7 +33,7 @@
<holder>JBoss, a division of Red Hat Inc.</holder>
</copyright>
<releaseinfo>
-Version: 1.1.0.CR1
+Version: 1.1.0.GA
</releaseinfo>
</bookinfo>
Modified: trunk/documentation/guides/GettingStartedGuide/en/master.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/master.xml 2008-05-22 14:26:22 UTC (rev 8289)
+++ trunk/documentation/guides/GettingStartedGuide/en/master.xml 2008-05-22 15:00:32 UTC (rev 8290)
@@ -34,7 +34,7 @@
<year>2008</year>
<holder>JBoss, a division of Red Hat Inc.</holder>
</copyright>
- <releaseinfo>Version: 1.1.0.CR1</releaseinfo>
+ <releaseinfo>Version: 1.1.0.GA</releaseinfo>
</bookinfo>
<toc/>
Modified: trunk/esb/docs/esb_ref_guide/en/master.xml
===================================================================
--- trunk/esb/docs/esb_ref_guide/en/master.xml 2008-05-22 14:26:22 UTC (rev 8289)
+++ trunk/esb/docs/esb_ref_guide/en/master.xml 2008-05-22 15:00:32 UTC (rev 8290)
@@ -34,7 +34,7 @@
<holder>JBoss, a division of Red Hat Inc.</holder>
</copyright>
<releaseinfo>
- Version: 2.1.0.CR1
+ Version: 2.1.0.GA
</releaseinfo>
</bookinfo>
Modified: trunk/hibernatetools/docs/reference/en/master.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en/master.xml 2008-05-22 14:26:22 UTC (rev 8289)
+++ trunk/hibernatetools/docs/reference/en/master.xml 2008-05-22 15:00:32 UTC (rev 8290)
@@ -39,7 +39,7 @@
</copyright>
<releaseinfo>
- Version: 3.2.1.CR1
+ Version: 3.2.1.GA
</releaseinfo>
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en/master.xml
===================================================================
--- trunk/jsf/docs/jsf_tools_ref_guide/en/master.xml 2008-05-22 14:26:22 UTC (rev 8289)
+++ trunk/jsf/docs/jsf_tools_ref_guide/en/master.xml 2008-05-22 15:00:32 UTC (rev 8290)
@@ -41,7 +41,7 @@
<holder>JBoss, a division of Red Hat Inc.</holder>
</copyright>
<releaseinfo>
- Version: 2.1.0.CR1
+ Version: 2.1.0.GA
</releaseinfo>
</bookinfo>
Modified: trunk/jsf/docs/jsf_tools_tutorial/en/master.xml
===================================================================
--- trunk/jsf/docs/jsf_tools_tutorial/en/master.xml 2008-05-22 14:26:22 UTC (rev 8289)
+++ trunk/jsf/docs/jsf_tools_tutorial/en/master.xml 2008-05-22 15:00:32 UTC (rev 8290)
@@ -42,7 +42,7 @@
</copyright>
<releaseinfo>
- Version: 2.1.0.CR1
+ Version: 2.1.0.GA
</releaseinfo>
</bookinfo>
Modified: trunk/jsf/docs/userguide/en/master.xml
===================================================================
--- trunk/jsf/docs/userguide/en/master.xml 2008-05-22 14:26:22 UTC (rev 8289)
+++ trunk/jsf/docs/userguide/en/master.xml 2008-05-22 15:00:32 UTC (rev 8290)
@@ -34,7 +34,7 @@
<holder>JBoss, a division of Red Hat Inc.</holder>
</copyright>
<releaseinfo>
- Version: 1.1.0.CR1
+ Version: 1.1.0.GA
</releaseinfo>
</bookinfo>
Modified: trunk/seam/docs/reference/en/master.xml
===================================================================
--- trunk/seam/docs/reference/en/master.xml 2008-05-22 14:26:22 UTC (rev 8289)
+++ trunk/seam/docs/reference/en/master.xml 2008-05-22 15:00:32 UTC (rev 8290)
@@ -47,7 +47,7 @@
<holder>JBoss, a division of Red Hat Inc.</holder>
</copyright>
<releaseinfo>
- Version: 2.1.0.CR1
+ Version: 2.1.0.GA
</releaseinfo>
</bookinfo>
Modified: trunk/struts/docs/struts_tools_ref_guide/en/master.xml
===================================================================
--- trunk/struts/docs/struts_tools_ref_guide/en/master.xml 2008-05-22 14:26:22 UTC (rev 8289)
+++ trunk/struts/docs/struts_tools_ref_guide/en/master.xml 2008-05-22 15:00:32 UTC (rev 8290)
@@ -42,7 +42,7 @@
<holder>JBoss, a division of Red Hat Inc.</holder>
</copyright>
<releaseinfo>
- Version: 2.1.0.CR1
+ Version: 2.1.0.GA
</releaseinfo>
</bookinfo>
Modified: trunk/struts/docs/struts_tools_tutorial/en/master.xml
===================================================================
--- trunk/struts/docs/struts_tools_tutorial/en/master.xml 2008-05-22 14:26:22 UTC (rev 8289)
+++ trunk/struts/docs/struts_tools_tutorial/en/master.xml 2008-05-22 15:00:32 UTC (rev 8290)
@@ -41,7 +41,7 @@
</copyright>
<releaseinfo>
- Version: 2.1.0.CR1
+ Version: 2.1.0.GA
</releaseinfo>
</bookinfo>
17 years, 11 months
JBoss Tools SVN: r8289 - trunk/jsf/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-05-22 10:26:22 -0400 (Thu, 22 May 2008)
New Revision: 8289
Modified:
trunk/jsf/docs/userguide/en/modules/Visual_Web_Tools.xml
trunk/jsf/docs/userguide/en/modules/editors.xml
trunk/jsf/docs/userguide/en/modules/palette.xml
Log:
http://jira.jboss.com/jira/browse/RF-398
Modified: trunk/jsf/docs/userguide/en/modules/Visual_Web_Tools.xml
===================================================================
--- trunk/jsf/docs/userguide/en/modules/Visual_Web_Tools.xml 2008-05-22 11:22:53 UTC (rev 8288)
+++ trunk/jsf/docs/userguide/en/modules/Visual_Web_Tools.xml 2008-05-22 14:26:22 UTC (rev 8289)
@@ -131,12 +131,12 @@
</row>
<row>
- <entry>Rich Faces Support</entry>
+ <entry>RichFaces Support</entry>
<entry>Tight integration between JBDS and RichFaces frameworks. Easy managing RichFaces
components in any web application. Support for RichFaces and Ajax4jsf libraries in JBoss
Tools Palette. Rendering RichFaces components in Visual Page Editor.</entry>
<entry>
- <link linkend="RichFacesSupport">rich faces support</link>
+ <link linkend="RichFacesSupport">RichFaces support</link>
</entry>
</row>
</tbody>
Modified: trunk/jsf/docs/userguide/en/modules/editors.xml
===================================================================
--- trunk/jsf/docs/userguide/en/modules/editors.xml 2008-05-22 11:22:53 UTC (rev 8288)
+++ trunk/jsf/docs/userguide/en/modules/editors.xml 2008-05-22 14:26:22 UTC (rev 8289)
@@ -538,7 +538,7 @@
<title>JavaScript Tags Content Assist</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/editors_features/editors_features_27.png"
+ <imagedata fileref="images/ediors_features/editors_features_27.png"
scale="75"/>
</imageobject>
</mediaobject>
@@ -549,13 +549,13 @@
</section>
<section id="ContentAssistForRF">
- <title>Rich Faces components</title>
- <para>JBDS indeed provides code completion for Rich Faces framework components. All
- you have to do is to install Rich Faces libraries into your project. See <ulink
+ <title>RichFaces components</title>
+ <para>JBDS indeed provides code completion for RichFaces framework components. All
+ you have to do is to install RichFaces libraries into your project. See <ulink
url="http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..."
>here</ulink> how to install it.</para>
<figure>
- <title>Content Assist for Rich Faces Components</title>
+ <title>Content Assist for RichFaces Components</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/editors_features/editors_features_29.png"
@@ -565,8 +565,8 @@
</figure>
<itemizedlist>
<listitem>
- <para>To insert a Rich Faces component on a page expand <emphasis>
- <property>JBoss Rich Faces</property>
+ <para>To insert a RichFaces component on a page expand <emphasis>
+ <property>JBoss RichFaces</property>
</emphasis> group on the palette</para>
</listitem>
<listitem>
@@ -590,10 +590,10 @@
</para>
</listitem>
</itemizedlist>
- <para>The Rich Faces tag will be inserted on your page displayed in source and
+ <para>The RichFaces tag will be inserted on your page displayed in source and
visual modes: </para>
<figure>
- <title>Rich Faces Component</title>
+ <title>RichFaces Component</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/editors_features/editors_features_31.png"
Modified: trunk/jsf/docs/userguide/en/modules/palette.xml
===================================================================
--- trunk/jsf/docs/userguide/en/modules/palette.xml 2008-05-22 11:22:53 UTC (rev 8288)
+++ trunk/jsf/docs/userguide/en/modules/palette.xml 2008-05-22 14:26:22 UTC (rev 8289)
@@ -565,21 +565,21 @@
</section>
<section id="RichFacesSupport">
<?dbhtml filename="RichFacesSupport.html"?>
- <title>Rich Faces Support</title>
+ <title>RichFaces Support</title>
<para>JBoss Developer Studio comes with a tight integration with <emphasis>
- <property>Rich Faces</property>
- </emphasis> component framework. Rich Faces and Ajax4jsf in JBoss Tools Palette always
+ <property>RichFaces</property>
+ </emphasis> component framework. RichFaces and Ajax4jsf in JBoss Tools Palette always
exist, this palette is not dynamic and is not changed from file to file. JBoss Tools
- Palette supports only the last version of the Rich Faces components. <tip>
+ Palette supports only the last version of the RichFaces components. <tip>
<title>Tip:</title>
- <para>If you'd like to know the last version of Rich Faces component
+ <para>If you'd like to know the last version of RichFaces component
framework see <ulink url="http://labs.jboss.com/jbossrichfaces/">JBoss
RichFaces</ulink> site.</para>
- </tip>Rich Faces components, as well, as <emphasis>
+ </tip>RichFaces components, as well, as <emphasis>
<property>Ajax4jsf</property>
</emphasis> ones are already on the <property>JBoss Tools Palette</property>:</para>
<figure>
- <title>Rich Faces Components</title>
+ <title>RichFaces Components</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/palette/palette_13.png"/>
17 years, 11 months
JBoss Tools SVN: r8288 - in trunk/ws/plugins: org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2008-05-22 07:22:53 -0400 (Thu, 22 May 2008)
New Revision: 8288
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/BindingFilesValidationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImpl.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSProviderInvokeCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebService.java
Log:
JBIDE-2200: generate implmentation skeleton class for every port type interface
Modify web.xml to configure web service servlets
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF 2008-05-22 02:01:46 UTC (rev 8287)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF 2008-05-22 11:22:53 UTC (rev 8288)
@@ -24,7 +24,9 @@
org.eclipse.emf.common,
org.eclipse.emf.ecore,
org.eclipse.jdt.core,
- org.eclipse.jface.text
+ org.eclipse.jface.text,
+ org.eclipse.core.filebuffers,
+ org.eclipse.jdt.ui
Eclipse-LazyStart: true
Export-Package: org.jboss.tools.ws.creation.core,
org.jboss.tools.ws.creation.core.commands,
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/BindingFilesValidationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/BindingFilesValidationCommand.java 2008-05-22 02:01:46 UTC (rev 8287)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/BindingFilesValidationCommand.java 2008-05-22 11:22:53 UTC (rev 8288)
@@ -55,6 +55,9 @@
return status;
}
+ /*
+ * just ensure that the file is a readable xml file to avoid breaking code generation
+ */
private IStatus validateXMLFile(XMLReader reader, String filename){
try {
InputSource is = new InputSource(filename);
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2008-05-22 02:01:46 UTC (rev 8287)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2008-05-22 11:22:53 UTC (rev 8288)
@@ -1,10 +1,8 @@
package org.jboss.tools.ws.creation.core.commands;
import java.io.File;
-import java.io.StringBufferInputStream;
import java.util.ArrayList;
import java.util.List;
-import java.util.StringTokenizer;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
@@ -20,315 +18,315 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jdt.core.IBuffer;
import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration;
import org.eclipse.jdt.core.dom.ArrayType;
-import org.eclipse.jdt.core.dom.Assignment;
import org.eclipse.jdt.core.dom.Block;
+import org.eclipse.jdt.core.dom.BooleanLiteral;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.FieldAccess;
import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.ImportDeclaration;
import org.eclipse.jdt.core.dom.Initializer;
+import org.eclipse.jdt.core.dom.MemberValuePair;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.MethodInvocation;
import org.eclipse.jdt.core.dom.Modifier;
import org.eclipse.jdt.core.dom.Name;
+import org.eclipse.jdt.core.dom.NormalAnnotation;
import org.eclipse.jdt.core.dom.NumberLiteral;
import org.eclipse.jdt.core.dom.PackageDeclaration;
import org.eclipse.jdt.core.dom.ParameterizedType;
import org.eclipse.jdt.core.dom.PrimitiveType;
import org.eclipse.jdt.core.dom.QualifiedName;
-import org.eclipse.jdt.core.dom.QualifiedType;
import org.eclipse.jdt.core.dom.ReturnStatement;
-import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
import org.eclipse.jdt.core.dom.StringLiteral;
import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jdt.core.dom.TypeLiteral;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.core.dom.WildcardType;
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
+import org.eclipse.jdt.core.dom.rewrite.ListRewrite;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.text.edits.MalformedTreeException;
import org.eclipse.text.edits.TextEdit;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
+import org.jboss.tools.ws.creation.core.utils.JBossStatusUtils;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
public class ImplementationClassCreationCommand extends
AbstractDataModelOperation {
- protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
- protected static final String TAB = "\t"; //$NON-NLS-1$
- protected static final String SPACE = " "; //$NON-NLS-1$
- protected static final String DOT = "."; //$NON-NLS-1$
- protected static final String COMMA = ","; //$NON-NLS-1$
- protected static final String SEMICOLON = ";"; //$NON-NLS-1$
- protected static final String POUND = "#"; //$NON-NLS-1$
- protected static final String OPEN_PAR = "("; //$NON-NLS-1$
- protected static final String CLOSE_PAR = ")"; //$NON-NLS-1$
- protected static final String OPEN_BRA = "{"; //$NON-NLS-1$
- protected static final String CLOSE_BRA = "}"; //$NON-NLS-1$
- protected static final String lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
+ private static final String RESOURCE_FOLDER = "src";
- protected static final String JAVA_LANG_OBJECT = "java.lang.Object"; //$NON-NLS-1$
- protected static final String PACKAGE = "package "; //$NON-NLS-1$
- protected static final String CLASS = "class "; //$NON-NLS-1$
- protected static final String IMPORT = "import "; //$NON-NLS-1$
- protected static final String EXTENDS = "extends "; //$NON-NLS-1$
- protected static final String IMPLEMENTS = "implements "; //$NON-NLS-1$
- protected static final String THROWS = "throws "; //$NON-NLS-1$
- protected static final String SUPER = "super"; //$NON-NLS-1$
- protected static final String PUBLIC = "public "; //$NON-NLS-1$
- protected static final String PROTECTED = "protected "; //$NON-NLS-1$
- protected static final String PRIVATE = "private "; //$NON-NLS-1$
- protected static final String STATIC = "static "; //$NON-NLS-1$
- protected static final String ABSTRACT = "abstract "; //$NON-NLS-1$
- protected static final String FINAL = "final "; //$NON-NLS-1$
- protected static final String VOID = "void"; //$NON-NLS-1$
- protected static final String INT = "int"; //$NON-NLS-1$
- protected static final String BOOLEAN = "boolean"; //$NON-NLS-1$
- protected static final String MAIN_METHOD = "\tpublic static void main(String[] args) {"; //$NON-NLS-1$
- protected static final String TODO_COMMENT = "\t\t// TODO Auto-generated method stub"; //$NON-NLS-1$
- protected static final String RETURN_NULL = "\t\treturn null;"; //$NON-NLS-1$
- protected static final String RETURN_0 = "\t\treturn 0;"; //$NON-NLS-1$
- protected static final String RETURN_FALSE = "\t\treturn false;"; //$NON-NLS-1$
- protected static final String RESOURCE_FOLDER = "src";
-
- protected static final String PREFIX_JAXWS_ANNOTATION_CLASS = "javax.jws";
- protected static final String CLASS_LOGGER = "Logger";
- protected static final String SUFFIX_PACKAGENAME_IMPL = "impl";
- protected static final String DEFAULT_CU_SUFFIX = ".java";
-
+ private static final String PREFIX_JAXWS_ANNOTATION_CLASS = "javax.jws";
+ private static final String CLASS_LOGGER = "Logger";
+ private static final String SUFFIX_PACKAGENAME_IMPL = "impl";
+ private static final String DEFAULT_CU_SUFFIX = ".java";
+
+ private static final String ANNOTATION_TYPE_NAME_WEBSERVICE = "WebService";;
+ private static final String ANNOTATION_PROPERTY_NAME = "name";
+ private static final String ANNOTATION_PROPERTY_SERVICE_NAME = "serviceName";
+ private static final String ANNOTATION_PROPERTY_ENDPOINT_INTERFACE = "endpointInterface";
+
private ServiceModel model;
- private List<String> importStatements;
private IWorkspaceRoot fWorkspaceRoot;
- private IJavaProject javaProject;
-
- public ImplementationClassCreationCommand(ServiceModel model){
+
+ public ImplementationClassCreationCommand(ServiceModel model) {
this.model = model;
- fWorkspaceRoot= ResourcesPlugin.getWorkspace().getRoot();
-
+ fWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+
}
-
-
-
+
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
-
-
-
- IFile inFile = getServiceInterfaceFile(model.getPortTypes().get(0));
-
+ IStatus status = Status.OK_STATUS;
try {
- //IFile implJavaFile = createEmptyImplJavaFile("Test");
- //so far, it only generate implementation for first port type, neet to generate impl class for all
- //port type interfaces
- generateImplClass(model.getPortTypes().get(0));
+ /*
+ * so far, it only generate implementation for first port type, need
+ * to generate impl class for all port type interfaces
+ */
+ List<String> portTypes = model.getPortTypes();
+ for (String portTypeName : portTypes) {
+ generateImplClass(portTypeName);
+ String implClsName = getImplPackageName() + "." + getImplClassName(portTypeName);
+ model.addServiceClasses(implClsName);
+ }
+
} catch (CoreException e) {
- e.printStackTrace();
+ status = JBossStatusUtils
+ .errorStatus(
+ JBossWSCreationCoreMessages.ERROR_MESSAGE_INVALID_BINDING_FILE,
+ e);
} catch (MalformedTreeException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ status = JBossStatusUtils
+ .errorStatus(
+ JBossWSCreationCoreMessages.ERROR_MESSAGE_INVALID_BINDING_FILE,
+ e);
} catch (BadLocationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ status = JBossStatusUtils
+ .errorStatus(
+ JBossWSCreationCoreMessages.ERROR_MESSAGE_INVALID_BINDING_FILE,
+ e);
}
- return Status.OK_STATUS;
+ return status;
}
-
- private String getImplPackageName(){
- return model.getCustomPackage() + ".impl";
- }
-
- private IPackageFragmentRoot getPackageFragmentRoot(){
- String str = model.getWebProjectName() + File.separator + RESOURCE_FOLDER;
- IPath path= new Path(str);
- IResource res= fWorkspaceRoot.findMember(path);
- IProject prj = res.getProject();
- IJavaProject javaPrj = JavaCore.create(prj);
- return javaPrj.getPackageFragmentRoot(res);
-
- }
-
- private String getCompilationUnitName(String portTypeName){
- return getImplClassName(portTypeName) + DEFAULT_CU_SUFFIX;
- }
-
+ protected void generateImplClass(String portTypeName/* , IFile implJavaFile */)
+ throws CoreException, MalformedTreeException, BadLocationException {
- private String getImplClassName(String portTypeName){
- String firstLetter = portTypeName.substring(0,1);
- String implClsName = firstLetter.toUpperCase() + portTypeName.substring(1);
- implClsName = implClsName + "Impl";
- return implClsName;
- }
-
- /*private CompilationUnit createASTForImplementation(String portTypeName) throws JavaModelException {
- IPackageFragmentRoot root= getPackageFragmentRoot();
- IPackageFragment pack= root.getPackageFragment(getImplPackageName()); //$NON-NLS-1$
-
- if (!pack.exists()) {
- String packName= pack.getElementName();
- pack= root.createPackageFragment(packName, true, null);
- }
-
- String cuName= getCompilationUnitName(portTypeName);
- ICompilationUnit parentCU= pack.createCompilationUnit(cuName, "", false, null); //$NON-NLS-1$
- // create a working copy with a new owner
-
- boolean needsSave= true;
- parentCU.becomeWorkingCopy(null); // cu is now a (primary) working copy
-
-
- ASTParser parser= ASTParser.newParser(AST.JLS3);
- parser.setSource(parentCU);
- parser.setResolveBindings(false);
- parser.setFocalPosition(0);
- return (CompilationUnit) parser.createAST(null);
- }*/
+ CompilationUnit portTypeCU = getCompilationUnitForInterface(portTypeName);
+ Object obj = portTypeCU.imports();
+ List<ImportDeclaration> imports = getImportsWithoutJaxwsAnnotation(portTypeCU);
-/* private IFile createEmptyImplJavaFile(String portTypeName) throws CoreException{
-
-
- IFile inFile = getServiceInterfaceFile(portTypeName);
- if(inFile != null && inFile.exists()){
- IFolder implFolder = inFile.getParent().getFolder(new Path("impl"));
- if(!implFolder.exists()){
- implFolder.create(true, true, null);
- }
- IFile implJava = implFolder.getFile(model.getServiceNames().get(0) + ".java");
- return implJava;
- }
- return null;
- }*/
-
- protected void generateImplClass(String portTypeName/*, IFile implJavaFile*/) throws CoreException, MalformedTreeException, BadLocationException{
+ IPackageFragment pack = getImplPakcage();
- CompilationUnit cu = getCompilationUnitForInterface(portTypeName);
- Object obj = cu.imports();
- List<ImportDeclaration> imports = getImportsWithoutJaxwsAnnotation(cu);
-
- IPackageFragmentRoot root= getPackageFragmentRoot();
- IPackageFragment pack= root.getPackageFragment(getImplPackageName()); //$NON-NLS-1$
-
- if (!pack.exists()) {
- String packName= pack.getElementName();
- pack= root.createPackageFragment(packName, true, null);
- }
-
- String cuName= getCompilationUnitName(portTypeName);
- ICompilationUnit parentCU= pack.createCompilationUnit(cuName, "", true, null); //$NON-NLS-1$
+ String cuName = getJavaFileName(portTypeName);
+ ICompilationUnit icu = pack.createCompilationUnit(cuName,
+ "", true, null); //$NON-NLS-1$
// create a working copy with a new owner
-
- parentCU.becomeWorkingCopy(null); // cu is now a (primary) working copy
-
-
- ASTParser parser= ASTParser.newParser(AST.JLS3);
- parser.setSource(parentCU);
+
+ icu.becomeWorkingCopy(null);
+
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setSource(icu);
parser.setResolveBindings(false);
parser.setFocalPosition(0);
-
+
CompilationUnit implCu = (CompilationUnit) parser.createAST(null);
AST ast = implCu.getAST();
- //creation of a Document and ASTRewrite
- String source = parentCU.getBuffer().getContents();
+ // creation of a Document and ASTRewrite
+ String source = icu.getBuffer().getContents();
Document document = new Document(source);
-
- ASTRewrite rewrite = ASTRewrite.create(implCu.getAST());
+
implCu.recordModifications();
-
- //start to add content implementation class
-
-
- //add package declaration for impl class:
+
+ // start to add content into implementation class
+
+ // add package declaration for impl class:
PackageDeclaration implPackage = ast.newPackageDeclaration();
implPackage.setName(ast.newName(pack.getElementName()));
implCu.setPackage(implPackage);
-
- //add imports for implementation class
- for(ImportDeclaration id: imports){
- ImportDeclaration newId = ast.newImportDeclaration();
- newId.setName(ast.newName(id.getName().getFullyQualifiedName()));
- implCu.imports().add(newId);
- }
-
- //import port type interface and jboss Logger
- ImportDeclaration id = ast.newImportDeclaration();
- QualifiedName portTypeImport = ast.newQualifiedName(ast.newName(cu
- .getPackage().getName().getFullyQualifiedName()), ast
- .newSimpleName(portTypeName));
- id.setName(portTypeImport);
- implCu.imports().add(id);
- id = ast.newImportDeclaration();
- id.setName(ast.newName("org.jboss.logging.Logger"));
- implCu.imports().add(id);
-
- //add class declaration
+
+ // add imports for implementation class
+ addImportsToImplementationClass(implCu, portTypeCU, portTypeName);
+
+ // add class declaration
TypeDeclaration type = ast.newTypeDeclaration();
type.setInterface(false);
- type.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
+ // add WebService annotation
+ String endpoint = getPortTypeInterfaceFullName(portTypeName);
+ NormalAnnotation ann = createAnnotation(ast,
+ getImplClassName(portTypeName), portTypeName, endpoint);
+ type.modifiers().add(ann);
+ type.modifiers().add(
+ ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
type.setName(ast.newSimpleName(getImplClassName(portTypeName)));
- type.superInterfaceTypes().add(ast.newSimpleType(ast.newName(portTypeName)));
-
- //add Logger variable declaration
- //createLoggerField(ast, type);
-
-
- //add method implementation
- TypeDeclaration inTD = (TypeDeclaration)cu.types().get(0);
- //firstly, get all methods that declared in Interface class and then add corresponding methods to
+ type.superInterfaceTypes().add(
+ ast.newSimpleType(ast.newName(portTypeName)));
+
+ // add Logger variable declaration
+ // createLoggerField(ast, type);
+
+ // add method implementation
+ TypeDeclaration inTD = (TypeDeclaration) portTypeCU.types().get(0);
+ // firstly, get all methods that declared in Interface class and then
+ // add corresponding methods to
// the impl class
MethodDeclaration[] methods = inTD.getMethods();
- for(int i = 0; i < methods.length; i++){
- MethodDeclaration newMethod = createMethodForImplClass(ast, methods[i]);
+ for (int i = 0; i < methods.length; i++) {
+ MethodDeclaration newMethod = createMethodForImplClass(ast,
+ methods[i]);
type.bodyDeclarations().add(newMethod);
}
-
-
+
implCu.types().add(type);
-
-
- //try to save the modification
- TextEdit edits = implCu.rewrite(document, parentCU.getJavaProject().getOptions(true));
+
+ // try to save the Java file
+ TextEdit edits = implCu.rewrite(document, icu.getJavaProject()
+ .getOptions(true));
edits.apply(document);
String newSource = document.get();
- parentCU.getBuffer().setContents(newSource);
- parentCU.reconcile(ICompilationUnit.NO_AST, false, null, null);
- parentCU.commitWorkingCopy(true, null);
- parentCU.discardWorkingCopy();
-
-
-/* String content = implCu.toString();
-
- if(implJavaFile.exists()){
- implJavaFile.delete(true, null);
+ icu.getBuffer().setContents(newSource);
+ icu.reconcile(ICompilationUnit.NO_AST, false, null, null);
+
+ icu.commitWorkingCopy(true, null);
+ icu.discardWorkingCopy();
+
+ }
+
+ private String getImplPackageName() {
+ return model.getCustomPackage() /* + ".impl" */;
+ }
+
+ private IPackageFragmentRoot getPackageFragmentRoot() {
+ String str = model.getWebProjectName() + File.separator
+ + RESOURCE_FOLDER;
+ IPath path = new Path(str);
+ IResource res = fWorkspaceRoot.findMember(path);
+ IProject prj = res.getProject();
+ IJavaProject javaPrj = JavaCore.create(prj);
+ return javaPrj.getPackageFragmentRoot(res);
+
+ }
+
+ private String getJavaFileName(String portTypeName) {
+
+ return getImplClassName(portTypeName) + DEFAULT_CU_SUFFIX;
+ }
+
+ private String getImplClassName(String portTypeName) {
+ String firstLetter = portTypeName.substring(0, 1);
+ String implClsName = firstLetter.toUpperCase()
+ + portTypeName.substring(1);
+ implClsName = implClsName + "Impl";
+ return implClsName;
+ }
+
+ private IPackageFragment getImplPakcage() throws JavaModelException {
+ IPackageFragmentRoot root = getPackageFragmentRoot();
+ String implPackageName = getImplPackageName();
+ IPackageFragment pack = root.getPackageFragment(implPackageName);
+
+ if (!pack.exists()) {
+ String packName = pack.getElementName();
+ pack = root.createPackageFragment(packName, true, null);
}
-
- implJavaFile.create(new StringBufferInputStream(content), true, null);*/
-
+
+ return pack;
}
-
- protected FieldDeclaration createLoggerField(AST ast, TypeDeclaration type){
- //for now, have no idea how to generate a field like:
+
+ private String getPortTypeInterfaceFullName(String portTypeName) {
+ return model.getCustomPackage() + "." + portTypeName;
+ }
+
+ private void addImportsToImplementationClass(CompilationUnit implCU,
+ CompilationUnit portTypeCU, String portTypeName) {
+ List<ImportDeclaration> imports = getImportsWithoutJaxwsAnnotation(portTypeCU);
+ AST implAST = implCU.getAST();
+
+ // add imports for implementation class
+ for (ImportDeclaration id : imports) {
+ ImportDeclaration newId = implAST.newImportDeclaration();
+ newId
+ .setName(implAST.newName(id.getName()
+ .getFullyQualifiedName()));
+ implCU.imports().add(newId);
+ }
+
+ // import port type interface and jboss Logger
+ ImportDeclaration importDec = implAST.newImportDeclaration();
+ QualifiedName portTypeImport = implAST.newQualifiedName(implAST
+ .newName(portTypeCU.getPackage().getName()
+ .getFullyQualifiedName()), implAST
+ .newSimpleName(portTypeName));
+ importDec.setName(portTypeImport);
+ implCU.imports().add(importDec);
+ importDec = implAST.newImportDeclaration();
+ importDec.setName(implAST.newName("org.jboss.logging.Logger"));
+ implCU.imports().add(importDec);
+
+ // import jaxws WebService
+ importDec = implAST.newImportDeclaration();
+ // hardcode here?
+ importDec.setName(implAST.newName("javax.jws.WebService"));
+ implCU.imports().add(importDec);
+ }
+
+ /*
+ * create web service annotation
+ */
+ protected NormalAnnotation createAnnotation(AST ast, String name,
+ String serviceName, String endpoint) {
+ NormalAnnotation ann = ast.newNormalAnnotation();
+ ann.setTypeName(ast.newSimpleName(ANNOTATION_TYPE_NAME_WEBSERVICE));
+
+ MemberValuePair member = createMemberValuePair(ast,
+ ANNOTATION_PROPERTY_NAME, name);
+ ann.values().add(member);
+ member = createMemberValuePair(ast, ANNOTATION_PROPERTY_SERVICE_NAME,
+ serviceName);
+ ann.values().add(member);
+ member = createMemberValuePair(ast,
+ ANNOTATION_PROPERTY_ENDPOINT_INTERFACE, endpoint);
+ ann.values().add(member);
+ return ann;
+ }
+
+ private MemberValuePair createMemberValuePair(AST ast, String propertyName,
+ String Value) {
+ MemberValuePair member = ast.newMemberValuePair();
+ member.setName(ast.newSimpleName(propertyName));
+ StringLiteral value = ast.newStringLiteral();
+ value.setLiteralValue(Value);
+ member.setValue(value);
+
+ return member;
+ }
+
+ protected FieldDeclaration createLoggerField(AST ast, TypeDeclaration type) {
+ // for now, have no idea how to generate a field like:
// private static Logger log = Logger.getLooger(TestEdnpointImpl.class);
- //TODO
-
+ // TODO
+ // ast.newWildcardType().setBound(type.);
VariableDeclarationFragment vdf = ast.newVariableDeclarationFragment();
vdf.setName(ast.newSimpleName("log"));
Initializer clsAccesss = ast.newInitializer();
@@ -343,164 +341,158 @@
mi.setName(ast.newSimpleName("getLogger"));
mi.arguments().add(fa);
vdf.setInitializer(mi);
-
+
type.bodyDeclarations().add(vdf);
-
- /*SingleVariableDeclaration svd = ast.newSingleVariableDeclaration();
- svd.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD));
- svd.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.STATIC_KEYWORD));
- svd.setType(ast.newSimpleType(ast.newSimpleName(CLASS_LOGGER)));
- svd.setName(ast.newSimpleName("log"));
- Initializer initializer = ast.newInitializer();
- Block initBlock = ast.newBlock();
-
- MethodInvocation mi = ast.newMethodInvocation();
- mi.setExpression(ast.newName("Logger"));
- mi.setName(ast.newSimpleName("getLogger"));
-
-
- MethodInvocation invokCls = ast.newMethodInvocation();
- invokCls.setExpression((ast.newSimpleName("TestImpl"));
- invokCls.setName(ast.newSimpleName("class"));
- mi.arguments().add(invokCls.getExpression();
- svd.setInitializer(ast.newExpressionStatement(mi).getExpression());*/
+
+ /*
+ * SingleVariableDeclaration svd = ast.newSingleVariableDeclaration();
+ * svd.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD));
+ * svd.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.STATIC_KEYWORD));
+ * svd.setType(ast.newSimpleType(ast.newSimpleName(CLASS_LOGGER)));
+ * svd.setName(ast.newSimpleName("log")); Initializer initializer =
+ * ast.newInitializer(); Block initBlock = ast.newBlock();
+ *
+ * MethodInvocation mi = ast.newMethodInvocation();
+ * mi.setExpression(ast.newName("Logger"));
+ * mi.setName(ast.newSimpleName("getLogger"));
+ *
+ *
+ * MethodInvocation invokCls = ast.newMethodInvocation();
+ * invokCls.setExpression((ast.newSimpleName("TestImpl"));
+ * invokCls.setName(ast.newSimpleName("class"));
+ * mi.arguments().add(invokCls.getExpression();
+ * svd.setInitializer(ast.newExpressionStatement(mi).getExpression());
+ */
return null;
}
-
- protected MethodDeclaration createMethodForImplClass(AST ast, MethodDeclaration inMethod){
-
+
+ protected MethodDeclaration createMethodForImplClass(AST ast,
+ MethodDeclaration inMethod) {
+
MethodDeclaration md = ast.newMethodDeclaration();
md.setConstructor(false);
List modifiers = md.modifiers();
modifiers.add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
- md.setName(ast.newSimpleName(inMethod.getName().getFullyQualifiedName()));
-
- SimpleType sType = (SimpleType)inMethod.getReturnType2();
- Name sTypeName = sType.getName();
- md.setReturnType2(ast.newSimpleType(ast.newName(sTypeName.getFullyQualifiedName())));
-
- List parameters = inMethod.parameters();;
- for(Object obj: parameters){
- SingleVariableDeclaration implSvd = ast.newSingleVariableDeclaration();
- SingleVariableDeclaration svd = (SingleVariableDeclaration)obj;
- implSvd.setName(ast.newSimpleName(svd.getName().getFullyQualifiedName()));
+ md.setName(ast
+ .newSimpleName(inMethod.getName().getFullyQualifiedName()));
+
+ SimpleType sType = (SimpleType) inMethod.getReturnType2();
+ Name sTypeName = sType.getName();
+ md.setReturnType2(ast.newSimpleType(ast.newName(sTypeName
+ .getFullyQualifiedName())));
+
+ List parameters = inMethod.parameters();
+ ;
+ for (Object obj : parameters) {
+ SingleVariableDeclaration implSvd = ast
+ .newSingleVariableDeclaration();
+ SingleVariableDeclaration svd = (SingleVariableDeclaration) obj;
+ implSvd.setName(ast.newSimpleName(svd.getName()
+ .getFullyQualifiedName()));
implSvd.setType(copyTypeFromOtherASTNode(ast, svd.getType()));
md.parameters().add(implSvd);
}
-
- //create method body
+
+ // create method body
Block block = ast.newBlock();
Type returnType = inMethod.getReturnType2();
ReturnStatement rs = ast.newReturnStatement();
- String typeName = ((SimpleType)returnType).getName().getFullyQualifiedName();
- if(returnType.isPrimitiveType() && returnType.isSimpleType()){
+ String typeName = ((SimpleType) returnType).getName()
+ .getFullyQualifiedName();
+ if (returnType.isPrimitiveType() && returnType.isSimpleType()) {
+ if (((PrimitiveType) returnType).getPrimitiveTypeCode().equals(
+ PrimitiveType.BOOLEAN)) {
+ BooleanLiteral bl = ast.newBooleanLiteral(false);
+ rs.setExpression(bl);
+ } else {
NumberLiteral nl = ast.newNumberLiteral();
nl.setToken("0");
rs.setExpression(nl);
-
- }else if("String".equals(typeName)){
+ }
+
+ } else if ("String".equals(typeName)) {
StringLiteral sl = ast.newStringLiteral();
sl.setLiteralValue("");
rs.setExpression(sl);
-
- }else{
+
+ } else {
rs.setExpression(ast.newNullLiteral());
}
block.statements().add(rs);
md.setBody(block);
-
+
return md;
}
-
- protected Name copyQualifiedName(AST ast, QualifiedName qname){
- String fullQName = qname.getFullyQualifiedName();
- StringTokenizer st = new StringTokenizer(fullQName,".");
- Name copy = null;
- SimpleName sn = ast.newSimpleName(st.nextToken());
- while(st.hasMoreTokens()){
- SimpleName snNext = ast.newSimpleName(st.nextToken());
- if(copy == null){
- copy = ast.newQualifiedName(sn, snNext);
- }else{
- //copy = ast.newn)
- }
- }
-
- return null;
- }
-
- private Type copyTypeFromOtherASTNode(AST ast, Type type){
- if(type instanceof PrimitiveType){
- return ast.newPrimitiveType(((PrimitiveType)type).getPrimitiveTypeCode());
- }
- else if(type instanceof SimpleType){
- SimpleType simpleType = (SimpleType)type;
-
- return ast.newSimpleType(ast.newName(simpleType.getName().getFullyQualifiedName()));
- }
- else if(type instanceof ArrayType){
- ArrayType atype = (ArrayType)type;
- return ast.newArrayType(copyTypeFromOtherASTNode(ast, atype.getComponentType()));
- }
- else if(type instanceof ParameterizedType){
- ParameterizedType ptype = (ParameterizedType)type;
- ast.newParameterizedType(copyTypeFromOtherASTNode(ast, ptype.getType()));
- }
- else if(type instanceof WildcardType){
- WildcardType sourcetype = (WildcardType)type;
+
+
+ private Type copyTypeFromOtherASTNode(AST ast, Type type) {
+ if (type instanceof PrimitiveType) {
+ return ast.newPrimitiveType(((PrimitiveType) type)
+ .getPrimitiveTypeCode());
+ } else if (type instanceof SimpleType) {
+ SimpleType simpleType = (SimpleType) type;
+
+ return ast.newSimpleType(ast.newName(simpleType.getName()
+ .getFullyQualifiedName()));
+ } else if (type instanceof ArrayType) {
+ ArrayType atype = (ArrayType) type;
+ return ast.newArrayType(copyTypeFromOtherASTNode(ast, atype
+ .getComponentType()));
+ } else if (type instanceof ParameterizedType) {
+ ParameterizedType ptype = (ParameterizedType) type;
+ ast.newParameterizedType(copyTypeFromOtherASTNode(ast, ptype
+ .getType()));
+ } else if (type instanceof WildcardType) {
+ WildcardType sourcetype = (WildcardType) type;
WildcardType wtype = ast.newWildcardType();
wtype.setBound(sourcetype.getBound());
return wtype;
}
-
+
return null;
}
- protected List<ImportDeclaration> getImportsWithoutJaxwsAnnotation(CompilationUnit cu){
+
+ protected List<ImportDeclaration> getImportsWithoutJaxwsAnnotation(
+ CompilationUnit cu) {
List<ImportDeclaration> importList = new ArrayList<ImportDeclaration>();
List imports = cu.imports();
- for(Object obj: imports){
- ImportDeclaration id = (ImportDeclaration)obj;
+ for (Object obj : imports) {
+ ImportDeclaration id = (ImportDeclaration) obj;
String imClsName = id.getName().getFullyQualifiedName();
- if(!imClsName.startsWith(PREFIX_JAXWS_ANNOTATION_CLASS)){
+ if (!imClsName.startsWith(PREFIX_JAXWS_ANNOTATION_CLASS)) {
importList.add(id);
}
}
-
+
return importList;
}
-
- private CompilationUnit getCompilationUnitForInterface(String portTypeName){
+
+ private CompilationUnit getCompilationUnitForInterface(String portTypeName) {
IFile inFile = getServiceInterfaceFile(portTypeName);
- IJavaElement inSrc = JavaCore.create(inFile);
ICompilationUnit icu = JBossWSCreationUtils.getJavaUnitFromFile(inFile);
ASTParser astp = ASTParser.newParser(AST.JLS3);
astp.setSource(icu);
- CompilationUnit cu = (CompilationUnit)astp.createAST(null);
-
+ CompilationUnit cu = (CompilationUnit) astp.createAST(null);
+
return cu;
}
-
- private IFile getServiceInterfaceFile(String portTypeName){
- String packageName = model.getCustomPackage();
- IProject project = JBossWSCreationUtils.getProjectByName(model.getWebProjectName());
+
+ private IFile getServiceInterfaceFile(String portTypeName) {
IFolder pkgFolder = getPackageFolder();
- IFile inFile = pkgFolder.getFile(portTypeName + ".java");
+ IFile inFile = pkgFolder.getFile(portTypeName + DEFAULT_CU_SUFFIX);
return inFile;
}
-
-
- private IFolder getPackageFolder(){
- IProject project = JBossWSCreationUtils.getProjectByName(model.getWebProjectName());
+
+ private IFolder getPackageFolder() {
+ IProject project = JBossWSCreationUtils.getProjectByName(model
+ .getWebProjectName());
IFolder srcFolder = project.getFolder(RESOURCE_FOLDER);
- String pkgFolderName = model.getCustomPackage().replace(".", File.separator);
+ String pkgFolderName = model.getCustomPackage().replace(".",
+ File.separator);
return srcFolder.getFolder(pkgFolderName);
-
+
}
-
-
-
-
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java 2008-05-22 02:01:46 UTC (rev 8287)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java 2008-05-22 11:22:53 UTC (rev 8288)
@@ -51,7 +51,7 @@
return StatusUtils.errorStatus(e.getLocalizedMessage(), e);
}
} else {
- model.setServiceClass(ws.getWebServiceInfo().getImplURL());
+ model.addServiceClasses(ws.getWebServiceInfo().getImplURL());
}
return Status.OK_STATUS;
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java 2008-05-22 02:01:46 UTC (rev 8287)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java 2008-05-22 11:22:53 UTC (rev 8288)
@@ -50,7 +50,13 @@
throws ExecutionException {
IEnvironment environment = getEnvironment();
IStatus status = null;
- status = mergeWebXML(getAxisServletDescriptor());
+ ServletDescriptor[] servletDescriptors = new ServletDescriptor[model.getServiceClasses().size()];
+ List<String> serviceClasses = model.getServiceClasses();
+ for(int i = 0; i < serviceClasses.size(); i++){
+ servletDescriptors[i] = getAxisServletDescriptor(serviceClasses.get(i));
+ }
+
+ status = mergeWebXML(servletDescriptors);
if (status.getSeverity() == Status.ERROR) {
environment.getStatusHandler().reportError(status);
return status;
@@ -58,7 +64,7 @@
return Status.OK_STATUS;
}
- private IStatus mergeWebXML(final ServletDescriptor servletDescriptor) {
+ private IStatus mergeWebXML(final ServletDescriptor[] servletDescriptors) {
IStatus status = Status.OK_STATUS;
final IModelProvider provider = ModelProviderManager
.getModelProvider(JBossWSCreationUtils.getProjectByName(model
@@ -68,8 +74,10 @@
Object object = provider.getModelObject();
if (object instanceof org.eclipse.jst.javaee.web.WebApp) {
WebApp webApp = (WebApp) object;
+ for(int i = 0; i < servletDescriptors.length; i++){
addServlet(JBossWSCreationUtils.getProjectByName(model
- .getWebProjectName()), servletDescriptor, webApp);
+ .getWebProjectName()), servletDescriptors[i], webApp);
+ }
}
}
@@ -77,13 +85,12 @@
return status;
}
- private ServletDescriptor getAxisServletDescriptor() {
+ private ServletDescriptor getAxisServletDescriptor(String clsName) {
ServletDescriptor sd = new ServletDescriptor();
- sd._name = JBossWSCreationUtils.classNameFromQualifiedName(model
- .getServiceClass());
+ sd._name = JBossWSCreationUtils.classNameFromQualifiedName(clsName);
sd._displayName = sd._name;
- sd._className = model.getServiceClass();
+ sd._className = clsName;
sd._mappings = JBossWSCreationCoreMessages.SEPARATOR_JAVA + sd._name;
return sd;
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImpl.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImpl.java 2008-05-22 02:01:46 UTC (rev 8287)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImpl.java 2008-05-22 11:22:53 UTC (rev 8288)
@@ -40,7 +40,7 @@
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
- String implClass = model.getServiceClass();
+ String implClass = model.getServiceClasses().get(0);
String project = model.getWebProjectName();
ICompilationUnit unit = null;
try {
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSProviderInvokeCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSProviderInvokeCommand.java 2008-05-22 02:01:46 UTC (rev 8287)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSProviderInvokeCommand.java 2008-05-22 11:22:53 UTC (rev 8288)
@@ -112,7 +112,7 @@
commandLine += " -c " + projectRoot + Path.SEPARATOR
+ "build/classes/ ";
- commandLine += model.getServiceClass();
+ commandLine += model.getServiceClasses().get(0);
return commandLine;
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java 2008-05-22 02:01:46 UTC (rev 8287)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java 2008-05-22 11:22:53 UTC (rev 8288)
@@ -10,23 +10,29 @@
private boolean serverStatus;
private String wsdlURI;
private List<String> portTypes;
- private List<String> serviceName;
+ private List<String> serviceNames;
private String customPackage;
- private List<String> bindingFileLocation;
+ private List<String> bindingFiles;
private String catalog;
- private String serviceClass;
+ private List<String> serviceClasses;
private boolean isGenWSDL;
private String target;
-
- public String getServiceClass() {
- return serviceClass;
- }
- public void setServiceClass(String serviceClass) {
- this.serviceClass = serviceClass;
+ public List<String> getServiceClasses(){
+ if(serviceClasses == null){
+ serviceClasses = new ArrayList<String>();
+ }
+ return this.serviceClasses;
}
+ public void addServiceClasses(String serviceCls){
+ this.serviceClasses = getServiceClasses();
+ if(!serviceClasses.contains(serviceCls)){
+ serviceClasses.add(serviceCls);
+ }
+ }
+
public String getCustomPackage() {
return customPackage;
}
@@ -41,20 +47,29 @@
return portTypes;
}
public void addPortTypes(String portType) {
- this.getPortTypes().add(portType);
+ this.portTypes = getPortTypes();
+ if(!this.portTypes.contains(portType)){
+ this.portTypes.add(portType);
+ }
}
public void setPortTypeList(List<String> portTypeList) {
this.portTypes = portTypeList;
}
public List<String> getServiceNames() {
- return serviceName;
+ if(serviceNames == null){
+ serviceNames = new ArrayList<String>();
+ }
+ return serviceNames;
}
public void addServiceName(String serviceName) {
- this.getServiceNames().add(serviceName);
+ this.serviceNames = getServiceClasses();
+ if(!serviceName.contains(serviceName)){
+ this.serviceNames.add(serviceName);
+ }
}
public void setServiceList(List<String> serviceList) {
- this.serviceName = serviceList;
+ this.serviceNames = serviceList;
}
public String getWsdlURI() {
@@ -79,13 +94,16 @@
}
public List<String> getBindingFiles(){
- if(bindingFileLocation == null){
- bindingFileLocation = new ArrayList<String>();
+ if(bindingFiles == null){
+ bindingFiles = new ArrayList<String>();
}
- return this.bindingFileLocation;
+ return this.bindingFiles;
}
public void addBindingFile(String bindingFileLocation){
- this.bindingFileLocation.add(bindingFileLocation);
+ this.bindingFiles = this.getBindingFiles();
+ if(!this.bindingFiles.contains(bindingFileLocation)){
+ this.bindingFiles.add(bindingFileLocation);
+ }
}
public boolean isGenWSDL() {
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2008-05-22 02:01:46 UTC (rev 8287)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2008-05-22 11:22:53 UTC (rev 8288)
@@ -10,7 +10,9 @@
ERROR_MESSAGE_INVALID_BINDING_FILE={0} is not a valid JAX-WS or JAXB binding file
ERROR_READ_BINDING_FILE=Exception occurred while reading binding file
SEPARATOR_JAVA=/
-ERROR_NO_ANNOTATION=This class has not required Annotation!
+
+ERROR_IMPLEMENTATION_CODE_GENERATION=Exception occurred while generating implementation class
+ERROR_NO_ANNOTATION=This class has no required Annotation!
WEBSERVICE_ANNOTATION=@WebService
ERROR_NO_CLASS= The class '{0}' cannot be loaded via project {1}.Check that the project contains the class, or that the class is loadable according to the Java Build Path of the project.
-ERROR_WS_LOCATION=The JBoss WS Runtime Location is NULL. Please set the location on JBoss WS preferences page.
\ No newline at end of file
+ERROR_WS_LOCATION=The JBoss WS Runtime Location is NULL. Please set the location on JBoss WS preferences page.
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2008-05-22 02:01:46 UTC (rev 8287)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2008-05-22 11:22:53 UTC (rev 8288)
@@ -18,6 +18,7 @@
public static String ERROR_READ_BINDING_FILE;
public static String SEPARATOR_JAVA;
+ public static String ERROR_IMPLEMENTATION_CODE_GENERATION;
public static String ERROR_NO_ANNOTATION;
public static String WEBSERVICE_ANNOTATION;
public static String ERROR_NO_CLASS;
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebService.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebService.java 2008-05-22 02:01:46 UTC (rev 8287)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebService.java 2008-05-22 11:22:53 UTC (rev 8288)
@@ -52,7 +52,7 @@
commands.add(new BindingFilesValidationCommand(model));
commands.add(new WSDL2JavaCommand(model));
commands.add(new ImplementationClassCreationCommand(model));
- //commands.add(new JbossWSRuntimeCommand(ResourcesPlugin.getWorkspace().getRoot().getProject(project)));
+ commands.add(new MergeWebXMLCommand(model));
}
else if (ctx.getScenario().getValue() == WebServiceScenario.BOTTOMUP){
commands.add(new InitialCommand(model, this, WebServiceScenario.BOTTOMUP));
17 years, 11 months
JBoss Tools SVN: r8287 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-05-21 22:01:46 -0400 (Wed, 21 May 2008)
New Revision: 8287
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
JBIDE-1458 - changes suggested by max
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2008-05-22 01:36:55 UTC (rev 8286)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2008-05-22 02:01:46 UTC (rev 8287)
@@ -319,7 +319,7 @@
objectClass="org.eclipse.core.resources.IFile">
<action
id="org.jboss.ide.eclipse.as.ui.popups.makeDeployable.action"
- label="Deploy To Server"
+ label="Make Publishable"
icon="icons/publish.gif"
menubarPath="additions"
class="org.jboss.ide.eclipse.as.ui.actions.DeployAction">
17 years, 11 months
JBoss Tools SVN: r8286 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-05-21 21:36:55 -0400 (Wed, 21 May 2008)
New Revision: 8286
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java
Log:
using new server API
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java 2008-05-22 00:32:22 UTC (rev 8285)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java 2008-05-22 01:36:55 UTC (rev 8286)
@@ -187,8 +187,7 @@
IServerWorkingCopy copy = server.createWorkingCopy();
copy.modifyModules(modules, new IModule[0], new NullProgressMonitor());
IServer saved = copy.save(false, new NullProgressMonitor());
- PublishServerJob job = new PublishServerJob(saved);
- job.schedule();
+ saved.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor());
} catch( CoreException ce ) {
errorStatus = new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, "Publishing files to server failed", ce);
errorTitle = "Cannot Publish to Server";
17 years, 11 months
JBoss Tools SVN: r8285 - in trunk/as/plugins: org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-05-21 20:32:22 -0400 (Wed, 21 May 2008)
New Revision: 8285
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/SingleDeployableFactory.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java
Log:
JBIDE-1458 - changes suggested by max
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/SingleDeployableFactory.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/SingleDeployableFactory.java 2008-05-21 21:47:33 UTC (rev 8284)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/SingleDeployableFactory.java 2008-05-22 00:32:22 UTC (rev 8285)
@@ -38,6 +38,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
@@ -288,21 +289,28 @@
}
}
- public class UndeployFromServerJob extends Job {
+ public static class UndeployFromServerJob extends Job {
private ArrayList<IPath> paths;
+ private boolean removeFromFactory;
public UndeployFromServerJob(ArrayList<IPath> paths) {
+ this(paths,true);
+ }
+ public UndeployFromServerJob(ArrayList<IPath> paths, boolean removeFromFactory) {
super("Undeploy Single Files From Server");
this.paths = paths;
+ this.removeFromFactory = removeFromFactory;
}
protected IStatus run(IProgressMonitor monitor) {
IPath next;
IModule mod;
IServer[] allServers = ServerCore.getServers();
+ MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IStatus.ERROR, "Failed to undeploy modules from all servers", null);
for( Iterator i = paths.iterator(); i.hasNext(); ) {
next = (IPath)i.next();
- mod = getModule(next);
+ mod = getFactory().getModule(next);
if( mod != null ) {
+ boolean removedFromAllServers = true;
for( int j = 0; j < allServers.length; j++ ) {
List l = Arrays.asList(allServers[j].getModules());
if( l.contains(mod)) {
@@ -312,12 +320,18 @@
IServer s = copy.save(false, new NullProgressMonitor());
new PublishServerJob(s).schedule();
} catch( CoreException ce ) {
+ removedFromAllServers = false;
+ IStatus s = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Failed to remove " + next + " from " + allServers[j].getName(), ce);
+ ms.add(s);
}
}
}
+ if( removeFromFactory && removedFromAllServers )
+ SingleDeployableFactory.unmakeDeployable(next);
+
}
}
- return Status.OK_STATUS;
+ return ms.getChildren().length == 0 ? Status.OK_STATUS : ms;
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java 2008-05-21 21:47:33 UTC (rev 8284)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java 2008-05-22 00:32:22 UTC (rev 8285)
@@ -21,8 +21,13 @@
*/
package org.jboss.ide.eclipse.as.ui.actions;
+import java.util.ArrayList;
+import java.util.Iterator;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
@@ -55,6 +60,7 @@
import org.eclipse.wst.server.core.internal.PublishServerJob;
import org.eclipse.wst.server.ui.internal.ImageResource;
import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory;
+import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory.UndeployFromServerJob;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
@@ -71,6 +77,48 @@
public DeployAction() {
}
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.selection = selection;
+ action.setEnabled(verifyEnablement());
+ action.setText(getText(verifyType()));
+ }
+
+ protected boolean verifyEnablement() {
+ if( selection instanceof IStructuredSelection ) {
+ IStructuredSelection sel = (IStructuredSelection)selection;
+ if( sel.isEmpty())
+ return false;
+ Iterator i = sel.iterator();
+ while(i.hasNext())
+ if( !(i.next() instanceof IFile ))
+ return false;
+ }
+ return true;
+ }
+
+ protected String getText(boolean type) {
+ if( type )
+ return "Unmake Deployable";
+ return "Make Deployable";
+ }
+
+ // True if we want to unpublish, false if we wantt to publish
+ protected boolean verifyType() {
+ if( selection instanceof IStructuredSelection ) {
+ IStructuredSelection sel = (IStructuredSelection)selection;
+ if( sel.isEmpty())
+ return false;
+ Iterator i = sel.iterator();
+ Object o;
+ while(i.hasNext()) {
+ o = i.next();
+ if( !(o instanceof IFile) || SingleDeployableFactory.findModule(((IFile)o).getFullPath()) == null)
+ return false;
+ }
+ }
+ return true;
+ }
+
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
if(targetPart!=null && targetPart.getSite()!=null) {
shell = targetPart.getSite().getShell();
@@ -78,6 +126,35 @@
}
public void run(IAction action) {
+ if( verifyType())
+ makeUndeployable();
+ else
+ makeDeployable();
+ }
+
+ protected void makeDeployable() {
+ IStructuredSelection sel2 = (IStructuredSelection)selection;
+ Object[] objs = sel2.toArray();
+ IModule[] modules = new IModule[objs.length];
+ for( int i = 0; i < objs.length; i++ ) {
+ SingleDeployableFactory.makeDeployable(((IFile)objs[i]).getFullPath());
+ modules[i] = SingleDeployableFactory.findModule(((IFile)objs[i]).getFullPath());
+ }
+
+ tryToPublish();
+ }
+
+ protected void makeUndeployable() {
+ IStructuredSelection sel2 = (IStructuredSelection)selection;
+ Object[] objs = sel2.toArray();
+ ArrayList<IPath> paths = new ArrayList<IPath>();
+ for( int i = 0; i < objs.length; i++ )
+ if(objs[i] instanceof IFile )
+ paths.add(((IFile)objs[i]).getFullPath());
+ new UndeployFromServerJob(paths).schedule();
+ }
+
+ protected void tryToPublish() {
IServer[] deployableServersAsIServers = ServerConverter.getDeployableServersAsIServers();
if(deployableServersAsIServers.length==0) {
MessageDialog.openInformation(shell, "No deployable servers found", "There are no servers that support deploying single files.");
@@ -104,7 +181,6 @@
} else {
IModule[] modules = new IModule[objs.length];
for( int i = 0; i < objs.length; i++ ) {
- SingleDeployableFactory.makeDeployable(((IFile)objs[i]).getFullPath());
modules[i] = SingleDeployableFactory.findModule(((IFile)objs[i]).getFullPath());
}
try {
@@ -148,11 +224,6 @@
return null;
}
- public void selectionChanged(IAction action, ISelection selection) {
- this.selection = selection;
- }
-
-
public class SelectServerDialog extends Dialog {
private Object selected;
private final class LabelProviderExtension extends BaseLabelProvider implements ILabelProvider {
17 years, 11 months
JBoss Tools SVN: r8284 - tags/jbosstools-2.1.0.GA.
by jbosstools-commits@lists.jboss.org
Author: mculpepper(a)jboss.com
Date: 2008-05-21 17:47:33 -0400 (Wed, 21 May 2008)
New Revision: 8284
Added:
tags/jbosstools-2.1.0.GA/hibernatetools/
Log:
retagging hibernatetools
Copied: tags/jbosstools-2.1.0.GA/hibernatetools (from rev 8283, branches/jbosstools-2.1.x/hibernatetools)
17 years, 11 months