JBoss Tools SVN: r19950 - in trunk/ws/plugins: org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2010-01-27 04:36:41 -0500 (Wed, 27 Jan 2010)
New Revision: 19950
Added:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateAction.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWebXmlWizardPage.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java
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/InitialClientCommand.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/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.ui/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.properties
trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.xml
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
Log:
JBIDE-5715: create a wizard for generating a sample web service class in a dynamic project
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 2010-01-27 09:33:52 UTC (rev 19949)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/META-INF/MANIFEST.MF 2010-01-27 09:36:41 UTC (rev 19950)
@@ -9,7 +9,6 @@
org.eclipse.core.runtime,
org.eclipse.wst.common.frameworks,
org.eclipse.wst.ws,
- org.jboss.tools.ws.ui,
org.eclipse.core.resources,
org.eclipse.jst.ws,
org.jboss.tools.ws.core,
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java 2010-01-27 09:33:52 UTC (rev 19949)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialClientCommand.java 2010-01-27 09:36:41 UTC (rev 19950)
@@ -30,7 +30,6 @@
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
import org.jboss.tools.ws.creation.core.utils.WSDLPropertyReader;
-import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
/**
* @author Grid Qian
@@ -60,8 +59,8 @@
if (location.equals("")) { //$NON-NLS-1$
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_WS_Location);
- } else if (!new Path(location).append(JBossWSUIMessages.Bin)
- .append(JBossWSUIMessages.Command).toFile().exists()) {
+ } else if (!new Path(location).append(JBossWSCreationCoreMessages.Bin)
+ .append(JBossWSCreationCoreMessages.Command).toFile().exists()) {
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_WS_Location);
}
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 2010-01-27 09:33:52 UTC (rev 19949)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/InitialCommand.java 2010-01-27 09:36:41 UTC (rev 19950)
@@ -21,7 +21,6 @@
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
import org.jboss.tools.ws.creation.core.utils.WSDLPropertyReader;
-import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
public class InitialCommand extends AbstractDataModelOperation {
@@ -44,7 +43,7 @@
if (location.equals("")) { //$NON-NLS-1$
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_WS_Location);
- } else if(!new Path(location).append(JBossWSUIMessages.Bin).append(JBossWSUIMessages.Command).toFile().exists()){
+ } else if(!new Path(location).append(JBossWSCreationCoreMessages.Bin).append(JBossWSCreationCoreMessages.Command).toFile().exists()){
return StatusUtils
.errorStatus(JBossWSCreationCoreMessages.Error_WS_Location);
}
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 2010-01-27 09:33:52 UTC (rev 19949)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java 2010-01-27 09:36:41 UTC (rev 19950)
@@ -48,10 +48,10 @@
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
- if(!model.isUpdateWebxml()){
+ if (!model.isUpdateWebxml()) {
return Status.OK_STATUS;
}
-
+
IEnvironment environment = getEnvironment();
IStatus status = null;
ServletDescriptor[] servletDescriptors = new ServletDescriptor[model
@@ -105,7 +105,8 @@
org.eclipse.jst.j2ee.webapplication.WebApp webapp) {
List theServlets = webapp.getServlets();
for (int i = 0; i < theServlets.size(); i++) {
- org.eclipse.jst.j2ee.webapplication.Servlet aServlet = (org.eclipse.jst.j2ee.webapplication.Servlet) theServlets.get(i);
+ org.eclipse.jst.j2ee.webapplication.Servlet aServlet = (org.eclipse.jst.j2ee.webapplication.Servlet) theServlets
+ .get(i);
if (aServlet.getServletName().equals(servletDescriptor._name)) {
return;
}
@@ -134,9 +135,12 @@
}
private ServletDescriptor getServletDescriptor(String clsName) {
-
- String servletName = JBossWSCreationUtils.classNameFromQualifiedName(clsName);
- if(servletName.endsWith("Impl") && servletName.length() > 4){ //$NON-NLS-1$
+ String servletName = model.getServiceName();
+ if (servletName == null) {
+ servletName = JBossWSCreationUtils
+ .classNameFromQualifiedName(clsName);
+ }
+ if (servletName.endsWith("Impl") && servletName.length() > 4) { //$NON-NLS-1$
servletName = servletName.substring(0, servletName.length() - 4);
}
ServletDescriptor sd = new ServletDescriptor();
Added: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java 2010-01-27 09:36:41 UTC (rev 19950)
@@ -0,0 +1,99 @@
+package org.jboss.tools.ws.creation.core.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.ICompilationUnit;
+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.JavaModelException;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.jboss.tools.ws.core.utils.StatusUtils;
+import org.jboss.tools.ws.creation.core.JBossWSCreationCore;
+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.JBossWSCreationUtils;
+
+public class ServiceSampleCreationCommand extends AbstractDataModelOperation {
+
+ private ServiceModel model;
+ private static final String SRC = "src"; //$NON-NLS-1$
+ public static final String LINE_SEPARATOR = System
+ .getProperty("line.separator"); //$NON-NLS-1$
+
+ public ServiceSampleCreationCommand(ServiceModel model) {
+ this.model = model;
+ }
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ IStatus status = Status.OK_STATUS;
+ IJavaProject project = null;
+ try {
+ project = JBossWSCreationUtils.getJavaProjectByName(model
+ .getWebProjectName());
+ } catch (JavaModelException e) {
+ JBossWSCreationCore.getDefault().logError(e);
+ return StatusUtils
+ .errorStatus(JBossWSCreationCoreMessages.Error_Create_Client_Sample);
+ }
+
+ createJavaClass(model.getCustomPackage(), JBossWSCreationUtils
+ .classNameFromQualifiedName(model.getServiceClasses().get(0)),
+ project);
+ return null;
+ }
+
+ private ICompilationUnit createJavaClass(String packageName,
+ String className, IJavaProject project) {
+ try {
+ IPath srcPath = project.getProject().getFolder(SRC).getFullPath();
+ IPackageFragmentRoot root = project
+ .findPackageFragmentRoot(srcPath);
+ if (packageName == null) {
+ packageName = ""; //$NON-NLS-1$
+ }
+ IPackageFragment pkg = root.createPackageFragment(packageName,
+ false, null);
+ ICompilationUnit wrapperCls = pkg.createCompilationUnit(className
+ + ".java", "", true, null); //$NON-NLS-1$//$NON-NLS-2$
+ if (!packageName.equals("")) { //$NON-NLS-1$
+ wrapperCls.createPackageDeclaration(packageName, null);
+ }
+
+ StringBuffer clsContent = new StringBuffer();
+ clsContent.append("@WebService()").append(LINE_SEPARATOR);
+ clsContent.append("public class ").append(className).append(" {" + LINE_SEPARATOR);
+ clsContent.append("}").append(LINE_SEPARATOR);
+ wrapperCls.createType(clsContent.toString(), null, true, null);
+
+ wrapperCls.createImport("javax.jws.WebMethod", null,null);
+ wrapperCls.createImport("javax.jws.WebService", null,null);
+
+ IType serviceClsType = wrapperCls.findPrimaryType();
+ clsContent = new StringBuffer();
+ clsContent.append("@WebMethod()"); //$NON-NLS-1$
+ clsContent.append(LINE_SEPARATOR);
+ clsContent.append("public String sayHello(String name) {"); //$NON-NLS-1$
+ clsContent.append(LINE_SEPARATOR);
+ clsContent.append(" System.out.println(\"Hello: \" + name);"); //$NON-NLS-1$
+ clsContent.append(LINE_SEPARATOR);
+ clsContent.append(" return \"Hello \" + name + \"!\";"); //$NON-NLS-1$
+ clsContent.append(LINE_SEPARATOR);
+ clsContent.append("}"); //$NON-NLS-1$
+ serviceClsType.createMethod(clsContent.toString(), null, true, null);
+ wrapperCls.save(null, true);
+ return wrapperCls;
+ } catch (Exception e) {
+ JBossWSCreationCore.getDefault().logError(e);
+ return null;
+ }
+ }
+
+}
Property changes on: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ServiceSampleCreationCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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 2010-01-27 09:33:52 UTC (rev 19949)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java 2010-01-27 09:36:41 UTC (rev 19950)
@@ -19,6 +19,7 @@
private String target;
private int wsScenario;
private boolean extension;
+ private String serviceName;
public int getWsScenario() {
return wsScenario;
@@ -165,4 +166,12 @@
public void setEnableSOAP12(boolean enable){
this.extension = enable;
}
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
}
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 2010-01-27 09:33:52 UTC (rev 19949)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2010-01-27 09:36:41 UTC (rev 19950)
@@ -51,3 +51,5 @@
JBossWSRuntimeInstallPage_NoValidJBossWSRuntime=The specified target runtime should be JBoss AS 5.0 or later.
Client_Sample_Run_Over= Call Over!
+Command=wsconsume.sh
+Bin=bin
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 2010-01-27 09:33:52 UTC (rev 19949)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2010-01-27 09:36:41 UTC (rev 19950)
@@ -61,6 +61,9 @@
public static String Error_Message_No_Runtime_Specified;
public static String Client_Sample_Run_Over;
+
+ public static String Command;
+ public static String Bin;
private JBossWSCreationCoreMessages() {
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF 2010-01-27 09:33:52 UTC (rev 19949)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF 2010-01-27 09:36:41 UTC (rev 19950)
@@ -10,10 +10,17 @@
org.eclipse.core.resources,
org.jboss.tools.ws.core,
org.eclipse.ui.ide,
- org.eclipse.wst.common.project.facet.core
+ org.eclipse.wst.common.project.facet.core,
+ org.eclipse.jdt.core,
+ org.eclipse.jst.j2ee,
+ org.eclipse.jem.util,
+ org.jboss.tools.ws.creation.core,
+ org.eclipse.wst.common.frameworks
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.ws.ui,
org.jboss.tools.ws.ui.messages,
org.jboss.tools.ws.ui.preferences
Bundle-Vendor: %PLUGIN_PROVIDER
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.jboss.tools.ws.creation.core.commands,
+ org.jboss.tools.ws.creation.core.data
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.properties 2010-01-27 09:33:52 UTC (rev 19949)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.properties 2010-01-27 09:36:41 UTC (rev 19950)
@@ -1,3 +1,5 @@
JBOSSWS_PREFERENCE_PAGE=JBossWS Preferences
+JBOSSWS_POPUPMENU_LABEL=JBoss Tools
+JBOSSWS_GENERATEACTION_LABEL=Create a Sample Web Service
PLUGIN_NAME=JBoss WebServices Tools
PLUGIN_PROVIDER=JBoss by Red Hat
\ No newline at end of file
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.xml
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.xml 2010-01-27 09:33:52 UTC (rev 19949)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.xml 2010-01-27 09:36:41 UTC (rev 19950)
@@ -7,4 +7,36 @@
id="org.jboss.tools.ws.ui.preferences.JBossWSRuntimePreferencePage">
</page>
</extension>
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution id="RedHatEclipse4Web_IProject" objectClass="org.eclipse.core.resources.IProject">
+ <menu id="RedHat4Web" label="%JBOSSWS_POPUPMENU_LABEL" path="additions">
+ <separator name="a">
+ </separator>
+ <separator name="b">
+ </separator>
+ <separator name="c">
+ </separator>
+ <separator name="d">
+ </separator>
+ </menu>
+ <action class="org.jboss.tools.ws.ui.wizards.JBossWSGenerateAction" enablesFor="*" id="org.jboss.tools.ws.ui.wizards.JBossWSGenerateAction" label="%JBOSSWS_GENERATEACTION_LABEL" menubarPath="RedHat4Web/c">
+ </action>
+ </objectContribution>
+ </extension>
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution id="RedHatEclipse4Web_IJavaProject" objectClass="org.eclipse.jdt.core.IJavaProject">
+ <menu id="RedHat4Web" label="%JBOSSWS_POPUPMENU_LABEL" path="additions">
+ <separator name="a">
+ </separator>
+ <separator name="b">
+ </separator>
+ <separator name="c">
+ </separator>
+ <separator name="d">
+ </separator>
+ </menu>
+ <action class="org.jboss.tools.ws.ui.wizards.JBossWSGenerateAction" enablesFor="*" id="org.jboss.tools.ws.ui.wizards.JBossWSGenerateAction" label="%JBOSSWS_GENERATEACTION_LABEL" menubarPath="RedHat4Web/c">
+ </action>
+ </objectContribution>
+ </extension>
</plugin>
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2010-01-27 09:33:52 UTC (rev 19949)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2010-01-27 09:36:41 UTC (rev 19950)
@@ -43,3 +43,12 @@
JBossWSLibraryListFieldEditor_ActionAdd=&Add
JBossWSLibraryListFieldEditor_ActionRemove=&Remove
JBossWSLibraryListFieldEditor_LIBRARY_JARS=Library Jars
+JBossWS_GenerateWizard_Title=Generate a Sample Web Service
+JBossWS_GenerateWizard_GenerateWebXmlPage_Title=Web Service
+JBossWS_GenerateWizard_GenerateWebXmlPage_Description=Create a Sample Web Service Name
+JBossWS_GenerateWizard_GenerateSampleClassPage_Title=Sample Web Service Class
+JBossWS_GenerateWizard_GenerateSampleClassPage_Description=Generate a Sample Web Service Class
+JBossWS_GenerateWizard_GenerateWebXmlPage_ServiceName_Label=Name
+JBossWS_GenerateWizard_WizardPage_CheckButton_Label=Use the default value
+JBossWS_GenerateWizard_GenerateSampleClassPage_Package_Label=Package
+JBossWS_GenerateWizard_GenerateSampleClassPage_ClassName_Label=Class
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2010-01-27 09:33:52 UTC (rev 19949)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2010-01-27 09:36:41 UTC (rev 19950)
@@ -76,6 +76,16 @@
public static String JBossWSLibraryListFieldEditor_ActionRemove;
public static String JBossWSLibraryListFieldEditor_LIBRARY_JARS;
+
+ public static String JBossWS_GenerateWizard_Title;
+ public static String JBossWS_GenerateWizard_GenerateWebXmlPage_Title;
+ public static String JBossWS_GenerateWizard_GenerateWebXmlPage_Description;
+ public static String JBossWS_GenerateWizard_GenerateSampleClassPage_Title;
+ public static String JBossWS_GenerateWizard_GenerateSampleClassPage_Description;
+ public static String JBossWS_GenerateWizard_GenerateWebXmlPage_ServiceName_Label;
+ public static String JBossWS_GenerateWizard_WizardPage_CheckButton_Label;
+ public static String JBossWS_GenerateWizard_GenerateSampleClassPage_Package_Label;
+ public static String JBossWS_GenerateWizard_GenerateSampleClassPage_ClassName_Label;
static {
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateAction.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateAction.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateAction.java 2010-01-27 09:36:41 UTC (rev 19950)
@@ -0,0 +1,95 @@
+package org.jboss.tools.ws.ui.wizards;
+
+import java.io.File;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.jboss.tools.ws.creation.core.commands.MergeWebXMLCommand;
+import org.jboss.tools.ws.creation.core.commands.ServiceSampleCreationCommand;
+import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.ui.JBossWSUIPlugin;
+
+public class JBossWSGenerateAction implements IWorkbenchWindowActionDelegate {
+ private IJavaProject project;
+ private static String WEB = "web.xml"; //$NON-NLS-1$
+ private static File webFile;
+
+ public void dispose() {
+ }
+
+ public void init(IWorkbenchWindow window) {
+ }
+
+ public void run(IAction action) {
+ JBossWSGenerateWizard wizard = new JBossWSGenerateWizard();
+
+ WizardDialog dialog = new WizardDialog(JBossWSUIPlugin.getDefault()
+ .getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
+ dialog.create();
+ int result = dialog.open();
+ if (result == WizardDialog.OK) {
+ ServiceModel model = new ServiceModel();
+ model.setWebProjectName(project.getElementName());
+ model.addServiceClasses(new StringBuffer().append(
+ wizard.getPackageName())
+ .append(".").append(wizard.getClassName()).toString()); //$NON-NLS-1$
+ model.setServiceName(wizard.getServiceName());
+ model.setUpdateWebxml(true);
+ model.setCustomPackage(wizard.getPackageName());
+ try {
+ new MergeWebXMLCommand(model).execute(null, null);
+ new ServiceSampleCreationCommand(model).execute(null, null);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+ dialog.close();
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ project = (IJavaProject) ((IStructuredSelection) selection)
+ .getFirstElement();
+ if (JavaEEProjectUtilities
+ .isDynamicWebProject(project.getProject())) {
+ webFile = findFileByPath(project.getProject().getLocation()
+ .toOSString());
+ if (webFile != null) {
+ action.setEnabled(true);
+ return;
+ }
+ }
+ }
+ action.setEnabled(false);
+
+ }
+
+ private File findFileByPath(String path) {
+ File ret = null;
+ File folder = new File(path);
+ if (folder.isDirectory()) {
+ File[] files = folder.listFiles();
+ for (File file : files) {
+ ret = findFileByPath(file.getAbsolutePath());
+ if (ret != null) {
+ break;
+ }
+ }
+ } else {
+ if (WEB.equals(folder.getName())) {
+ ret = folder;
+ }
+ }
+ return ret;
+ }
+
+}
Property changes on: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java 2010-01-27 09:36:41 UTC (rev 19950)
@@ -0,0 +1,122 @@
+package org.jboss.tools.ws.ui.wizards;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+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;
+import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+
+public class JBossWSGenerateSampleClassWizardPage extends WizardPage {
+ private JBossWSGenerateWizard wizard;
+ private Text packageName;
+ private Text className;
+ private Button checkDefault;
+
+ protected JBossWSGenerateSampleClassWizardPage(String pageName) {
+ super(pageName);
+ this
+ .setTitle(JBossWSUIMessages.JBossWS_GenerateWizard_GenerateSampleClassPage_Title);
+ this
+ .setDescription(JBossWSUIMessages.JBossWS_GenerateWizard_GenerateSampleClassPage_Description);
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = createDialogArea(parent);
+ this.wizard = (JBossWSGenerateWizard) this.getWizard();
+ new Label(composite, SWT.NONE).setText(JBossWSUIMessages.JBossWS_GenerateWizard_GenerateSampleClassPage_Package_Label);
+ packageName = new Text(composite, SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ packageName.setLayoutData(gd);
+ packageName.setText(wizard.getPackageName());
+ packageName.setEnabled(!wizard.isUseDefaultClassName());
+ packageName.addModifyListener(new ModifyListener(){
+
+ public void modifyText(ModifyEvent e) {
+ if (!"".equals(packageName.getText())&&!"".equals(className.getText())){ //$NON-NLS-1$ //$NON-NLS-2$
+ setPageComplete(true);
+ }else {
+ setPageComplete(false);
+ }
+ }
+
+ });
+
+ new Label(composite, SWT.NONE).setText(JBossWSUIMessages.JBossWS_GenerateWizard_GenerateSampleClassPage_ClassName_Label);
+ className = new Text(composite, SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ className.setLayoutData(gd);
+ className.setText(wizard.getClassName());
+ className.setEnabled(!wizard.isUseDefaultClassName());
+ className.addModifyListener(new ModifyListener(){
+
+ public void modifyText(ModifyEvent e) {
+ if (!"".equals(packageName.getText())&&!"".equals(className.getText())){ //$NON-NLS-1$ //$NON-NLS-2$
+ setPageComplete(true);
+ }else {
+ setPageComplete(false);
+ }
+ }
+
+ });
+
+ checkDefault = new Button(composite, SWT.CHECK);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ checkDefault.setLayoutData(gd);
+ checkDefault.setSelection(wizard.isUseDefaultClassName());
+ checkDefault.setText(JBossWSUIMessages.JBossWS_GenerateWizard_WizardPage_CheckButton_Label);
+ checkDefault.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ if (checkDefault.getSelection()) {
+ checkDefault.setSelection(true);
+ packageName.setText(wizard.PACKAGEDEFAULT);
+ className.setText(wizard.CLASSDEFAULT);
+ } else {
+ checkDefault.setSelection(false);
+ }
+ packageName.setEnabled(!checkDefault.getSelection());
+ className.setEnabled(!checkDefault.getSelection());
+ wizard.setUseDefaultClassName(!checkDefault.getSelection());
+ }
+
+ });
+ setControl(composite);
+
+ }
+
+ public boolean isPageComplete() {
+ if(!"".equals(packageName.getText())&&!"".equals(className.getText())){ //$NON-NLS-1$//$NON-NLS-2$
+ wizard.setPackageName(packageName.getText());
+ wizard.setClassName(className.getText());
+ return true;
+ }
+
+ return false;
+ }
+
+ private Composite createDialogArea(Composite parent) {
+ // create a composite with standard margins and spacing
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 7;
+ layout.marginWidth = 7;
+ layout.verticalSpacing = 4;
+ layout.horizontalSpacing = 4;
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ return composite;
+ }
+}
Property changes on: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWebXmlWizardPage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWebXmlWizardPage.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWebXmlWizardPage.java 2010-01-27 09:36:41 UTC (rev 19950)
@@ -0,0 +1,99 @@
+package org.jboss.tools.ws.ui.wizards;
+
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+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;
+import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+
+public class JBossWSGenerateWebXmlWizardPage extends WizardPage {
+ private JBossWSGenerateWizard wizard;
+ private Text name;
+ private Button checkDefault;
+
+
+ protected JBossWSGenerateWebXmlWizardPage(String pageName) {
+ super(pageName);
+ this.setTitle(JBossWSUIMessages.JBossWS_GenerateWizard_GenerateWebXmlPage_Title);
+ this.setDescription(JBossWSUIMessages.JBossWS_GenerateWizard_GenerateWebXmlPage_Description);
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = createDialogArea(parent);
+ this.wizard = (JBossWSGenerateWizard)this.getWizard();
+ new Label (composite, SWT.NONE).setText(JBossWSUIMessages.JBossWS_GenerateWizard_GenerateWebXmlPage_ServiceName_Label);
+ name = new Text(composite, SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ name.setLayoutData(gd);
+ name.setText(wizard.getServiceName());
+ name.setEnabled(!wizard.isUseDefaultServiceName());
+ name.addModifyListener(new ModifyListener(){
+
+ public void modifyText(ModifyEvent e) {
+ if (!"".equals(name.getText())){ //$NON-NLS-1$
+ setPageComplete(true);
+ } else {
+ setPageComplete(false);
+ }
+ }
+
+ });
+
+
+ checkDefault = new Button(composite, SWT.CHECK);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ checkDefault.setLayoutData(gd);
+ checkDefault.setSelection(wizard.isUseDefaultServiceName());
+ checkDefault.setText(JBossWSUIMessages.JBossWS_GenerateWizard_WizardPage_CheckButton_Label);
+ checkDefault.addSelectionListener(new SelectionListener(){
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ if (checkDefault.getSelection()){
+ checkDefault.setSelection(true);
+ name.setText(wizard.NAMEDEFAULT);
+ } else {
+ checkDefault.setSelection(false);
+ }
+ name.setEnabled(!checkDefault.getSelection());
+ wizard.setUseDefaultServiceName(!checkDefault.getSelection());
+ }
+
+ });
+
+ setControl(composite);
+
+
+ }
+
+ public IWizardPage getNextPage(){
+ wizard.setServiceName(name.getText());
+ return super.getNextPage();
+ }
+
+ private Composite createDialogArea(Composite parent) {
+ // create a composite with standard margins and spacing
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 7;
+ layout.marginWidth = 7;
+ layout.verticalSpacing = 4;
+ layout.horizontalSpacing = 4;
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ return composite;
+ }
+}
Property changes on: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWebXmlWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java 2010-01-27 09:36:41 UTC (rev 19950)
@@ -0,0 +1,80 @@
+package org.jboss.tools.ws.ui.wizards;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+
+public class JBossWSGenerateWizard extends Wizard {
+
+ private JBossWSGenerateWebXmlWizardPage firstPage;
+ private JBossWSGenerateSampleClassWizardPage secondPage;
+
+ String NAMEDEFAULT = "HelloWorld"; //$NON-NLS-1$
+ String PACKAGEDEFAULT = "org.jboss.samples.webservices"; //$NON-NLS-1$
+ String CLASSDEFAULT = "HelloWorld"; //$NON-NLS-1$
+
+ private String serviceName = NAMEDEFAULT;
+ private String packageName = PACKAGEDEFAULT;
+ private String className = CLASSDEFAULT;
+ private boolean useDefaultServiceName = true;
+ private boolean useDefaultClassName = true;
+
+ public JBossWSGenerateWizard() {
+ super();
+ super.setWindowTitle(JBossWSUIMessages.JBossWS_GenerateWizard_Title);
+ super.setHelpAvailable(false);
+ }
+
+ public void addPages() {
+ super.addPages();
+ firstPage = new JBossWSGenerateWebXmlWizardPage("first"); //$NON-NLS-1$
+ secondPage = new JBossWSGenerateSampleClassWizardPage("second"); //$NON-NLS-1$
+ addPage(firstPage);
+ addPage(secondPage);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return true;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getPackageName() {
+ return packageName;
+ }
+
+ public void setPackageName(String packageName) {
+ this.packageName = packageName;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public boolean isUseDefaultServiceName() {
+ return useDefaultServiceName;
+ }
+
+ public void setUseDefaultServiceName(boolean useDefaultServiceName) {
+ this.useDefaultServiceName = useDefaultServiceName;
+ }
+
+ public boolean isUseDefaultClassName() {
+ return useDefaultClassName;
+ }
+
+ public void setUseDefaultClassName(boolean useDefaultClassName) {
+ this.useDefaultClassName = useDefaultClassName;
+ }
+
+}
Property changes on: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 11 months
JBoss Tools SVN: r19949 - workspace/Denny/esb-example-soa-p5.0.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2010-01-27 04:33:52 -0500 (Wed, 27 Jan 2010)
New Revision: 19949
Modified:
workspace/Denny/esb-example-soa-p5.0/webservice_consumer1_client.zip
Log:
Modified: workspace/Denny/esb-example-soa-p5.0/webservice_consumer1_client.zip
===================================================================
(Binary files differ)
15 years, 11 months
JBoss Tools SVN: r19948 - workspace/Denny/esb-example-soa-p5.0.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2010-01-27 04:21:25 -0500 (Wed, 27 Jan 2010)
New Revision: 19948
Modified:
workspace/Denny/esb-example-soa-p5.0/helloworld_action_client.zip
workspace/Denny/esb-example-soa-p5.0/helloworld_file_action.zip
workspace/Denny/esb-example-soa-p5.0/helloworld_file_action_client.zip
workspace/Denny/esb-example-soa-p5.0/helloworld_testclient.zip
Log:
Modified: workspace/Denny/esb-example-soa-p5.0/helloworld_action_client.zip
===================================================================
(Binary files differ)
Modified: workspace/Denny/esb-example-soa-p5.0/helloworld_file_action.zip
===================================================================
(Binary files differ)
Modified: workspace/Denny/esb-example-soa-p5.0/helloworld_file_action_client.zip
===================================================================
(Binary files differ)
Modified: workspace/Denny/esb-example-soa-p5.0/helloworld_testclient.zip
===================================================================
(Binary files differ)
15 years, 11 months
JBoss Tools SVN: r19947 - workspace/Denny/esb-example-soa-p5.0.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2010-01-27 03:07:51 -0500 (Wed, 27 Jan 2010)
New Revision: 19947
Modified:
workspace/Denny/esb-example-soa-p5.0/helloworld_action.zip
Log:
Modified: workspace/Denny/esb-example-soa-p5.0/helloworld_action.zip
===================================================================
(Binary files differ)
15 years, 11 months
JBoss Tools SVN: r19946 - workspace/Denny/esb-example-soa-p5.0.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2010-01-27 02:59:36 -0500 (Wed, 27 Jan 2010)
New Revision: 19946
Modified:
workspace/Denny/esb-example-soa-p5.0/helloworld.zip
workspace/Denny/esb-example-soa-p5.0/webservice_consumer1.zip
Log:
Modified: workspace/Denny/esb-example-soa-p5.0/helloworld.zip
===================================================================
(Binary files differ)
Modified: workspace/Denny/esb-example-soa-p5.0/webservice_consumer1.zip
===================================================================
(Binary files differ)
15 years, 11 months
JBoss Tools SVN: r19945 - workspace/Denny/esb-example-soa-p5.0.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2010-01-27 02:55:43 -0500 (Wed, 27 Jan 2010)
New Revision: 19945
Modified:
workspace/Denny/esb-example-soa-p5.0/helloworld.zip
Log:
Modified: workspace/Denny/esb-example-soa-p5.0/helloworld.zip
===================================================================
(Binary files differ)
15 years, 11 months
JBoss Tools SVN: r19944 - workspace/Denny/esb-example-soa-p5.0.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2010-01-27 02:52:47 -0500 (Wed, 27 Jan 2010)
New Revision: 19944
Modified:
workspace/Denny/esb-example-soa-p5.0/helloworld.zip
Log:
Modified: workspace/Denny/esb-example-soa-p5.0/helloworld.zip
===================================================================
(Binary files differ)
15 years, 11 months
JBoss Tools SVN: r19943 - trunk/jbpm/plugins/org.jbpm.gd.jpdl.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-01-26 19:18:53 -0500 (Tue, 26 Jan 2010)
New Revision: 19943
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/build.properties
Log:
JBIDE-5224 include plugin.properties in binary
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/build.properties
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/build.properties 2010-01-26 21:55:27 UTC (rev 19942)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/build.properties 2010-01-27 00:18:53 UTC (rev 19943)
@@ -1,7 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = icons/,\
- plugin.xml,\
+ plugin.*,\
.,\
lib/,\
META-INF/,\
15 years, 11 months
JBoss Tools SVN: r19942 - trunk/struts/plugins/org.jboss.tools.struts.ui.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-01-26 16:55:27 -0500 (Tue, 26 Jan 2010)
New Revision: 19942
Added:
trunk/struts/plugins/org.jboss.tools.struts.ui/jboss_about.png
Removed:
trunk/struts/plugins/org.jboss.tools.struts.ui/jboss_about.png
Log:
update icon from copy in smooks; hopefully this will make struts feature show up in same list in Help > About
Deleted: trunk/struts/plugins/org.jboss.tools.struts.ui/jboss_about.png
===================================================================
(Binary files differ)
Added: trunk/struts/plugins/org.jboss.tools.struts.ui/jboss_about.png
===================================================================
(Binary files differ)
Property changes on: trunk/struts/plugins/org.jboss.tools.struts.ui/jboss_about.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 11 months
JBoss Tools SVN: r19941 - in trunk/smooks: tests/org.jboss.tools.smooks.templating.test/META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2010-01-26 15:56:29 -0500 (Tue, 26 Jan 2010)
New Revision: 19941
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XMLSampleModelBuilder.java
trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/META-INF/MANIFEST.MF
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/TestUtil.java
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XSD_XMLFreeMarkerTemplateBuilderTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5246
XSDModelBuilder not handling <import> and <include> definitions properly.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XMLSampleModelBuilder.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XMLSampleModelBuilder.java 2010-01-26 18:45:48 UTC (rev 19940)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XMLSampleModelBuilder.java 2010-01-26 20:56:29 UTC (rev 19941)
@@ -23,10 +23,8 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java 2010-01-26 18:45:48 UTC (rev 19940)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java 2010-01-26 20:56:29 UTC (rev 19941)
@@ -22,6 +22,8 @@
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.xsd.util.XSDResourceFactoryImpl;
import org.eclipse.xsd.util.XSDResourceImpl;
import org.eclipse.xsd.*;
@@ -128,24 +130,14 @@
}
}
- private void loadSchema(URI baseURI, String schemaLocation) throws IOException, ModelBuilderException {
- File baseFile = new File(baseURI.toFileString());
- java.net.URI resolvedURI = baseFile.toURI().resolve(schemaLocation);
- File schemaFile = new File(resolvedURI);
-
- loadSchema(URI.createFileURI(schemaFile.getAbsolutePath()));
- }
-
private void loadSchema(URI schemaURI) throws IOException, ModelBuilderException {
- if(loadedSchemas.contains(schemaURI.toFileString())) {
- return;
- }
+ ResourceSet resourceSet = new ResourceSetImpl();
+ Resource resource;
+
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xsd", new XSDResourceFactoryImpl());
+ resource = resourceSet.getResource(schemaURI, true);
- loadedSchemas.add(schemaURI.toFileString());
-
- Resource resource = new XSDResourceFactoryImpl().createResource(schemaURI);
Map<String, Object> options = new HashMap<String, Object>();
-
options.put(XSDResourceImpl.XSD_TRACK_LOCATION, true);
resource.load(options);
@@ -168,20 +160,10 @@
XSDTypeDefinition type = (XSDTypeDefinition) typeDefs.get(i);
types.put(type.getName(), type);
}
-
- // Load includes and imports types...
- List contents = schema.getContents();
- for(Object schemaComponentObj : contents) {
-
- // TODO: We need to sort this out properly i.e. handle schema <import> and <include> properly!!!
-
- if(schemaComponentObj instanceof XSDImport) {
- XSDImport xsdImport = (XSDImport) schemaComponentObj;
- loadSchema(schemaURI, xsdImport.getSchemaLocation());
- } else if(schemaComponentObj instanceof XSDInclude) {
- XSDInclude xsdInclude = (XSDInclude) schemaComponentObj;
- loadSchema(schemaURI, xsdInclude.getSchemaLocation());
- }
+
+ EList<Resource> schemaResources = resourceSet.getResources();
+ for(Resource schemaRes : schemaResources) {
+ loadedSchemas.add(schemaRes.getURI().toFileString());
}
}
Modified: trunk/smooks/tests/org.jboss.tools.smooks.templating.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.templating.test/META-INF/MANIFEST.MF 2010-01-26 18:45:48 UTC (rev 19940)
+++ trunk/smooks/tests/org.jboss.tools.smooks.templating.test/META-INF/MANIFEST.MF 2010-01-26 20:56:29 UTC (rev 19941)
@@ -7,6 +7,12 @@
.
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
-Require-Bundle: org.junit,org.jboss.tools.smooks.templating,org.jboss.tools.smooks.runtime,org.eclipse.emf.common
+Require-Bundle: org.junit,
+ org.jboss.tools.smooks.templating,
+ org.jboss.tools.smooks.runtime,
+ org.eclipse.emf.common,
+ org.eclipse.xsd,
+ org.eclipse.emf,
+ org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Modified: trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/TestUtil.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/TestUtil.java 2010-01-26 18:45:48 UTC (rev 19940)
+++ trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/TestUtil.java 2010-01-26 20:56:29 UTC (rev 19941)
@@ -78,24 +78,24 @@
}
public static TemplateBuilder createXSDFreeMarkerTemplateBuilder(File xsdFile, String rootElementName) throws IOException, ModelBuilderException {
- if(!xsdFile.exists()) {
- throw new RuntimeException("Unknown: " + xsdFile.getAbsolutePath());
- }
+ URI fileURI = fileToURI(xsdFile);
- URI fileURI = URI.createFileURI(xsdFile.getCanonicalFile().toString());
-
XSDModelBuilder modelBuilder = new XSDModelBuilder(fileURI);
modelBuilder.setRootElementName(rootElementName);
return new XMLFreeMarkerTemplateBuilder(modelBuilder);
}
public static TemplateBuilder createXMLSampleFreeMarkerTemplateBuilder(File xmlSampleFile) throws IOException, ModelBuilderException {
- if(!xmlSampleFile.exists()) {
- throw new RuntimeException("Unknown: " + xmlSampleFile.getAbsolutePath());
- }
+ URI fileURI = fileToURI(xmlSampleFile);
- URI fileURI = URI.createFileURI(xmlSampleFile.getCanonicalFile().toString());
-
return new XMLFreeMarkerTemplateBuilder(new XMLSampleModelBuilder(fileURI));
}
+
+ public static URI fileToURI(File file) throws IOException {
+ if(!file.exists()) {
+ throw new RuntimeException("Unknown: " + file.getAbsolutePath());
+ }
+
+ return URI.createFileURI(file.getCanonicalFile().toString());
+ }
}
Modified: trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XSD_XMLFreeMarkerTemplateBuilderTest.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XSD_XMLFreeMarkerTemplateBuilderTest.java 2010-01-26 18:45:48 UTC (rev 19940)
+++ trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XSD_XMLFreeMarkerTemplateBuilderTest.java 2010-01-26 20:56:29 UTC (rev 19941)
@@ -52,7 +52,7 @@
* @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
*/
public class XSD_XMLFreeMarkerTemplateBuilderTest extends TestCase {
-
+
public void test_SimplePerson_01() throws IOException, ParserConfigurationException, TemplateBuilderException,
SAXException, ModelBuilderException {
TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File(
@@ -156,19 +156,6 @@
//checkNodeName(document.getDocumentElement());
}
- private void checkNodeName(Node node) {
- if (node instanceof Element) {
- assertNotNull(((Element)node).getTagName());
- }
- System.out.println(node.getNodeName());
- assertTrue(node.getNodeName().indexOf("null") == -1);
- NodeList nodeList = node.getChildNodes();
- int length = nodeList.getLength();
- for (int i = 0; i < length; i++) {
- checkNodeName(nodeList.item(i));
- }
- }
-
public void test_creature_01() throws IOException, ParserConfigurationException, TemplateBuilderException,
SAXException, ModelBuilderException, XPathExpressionException {
TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File(
@@ -251,17 +238,14 @@
assertEquals(theTemplate, builder2.buildTemplate());
}
- // public void test_OrderStatusRequest() throws IOException,
- // ParserConfigurationException, ModelBuilderException, SAXException,
- // TemplateBuilderException {
- // TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new
- // File("resources/xcbl40/schema/org/xcbl/path_delim/schemas/xcbl/v4_0/ordermanagement/v1_0/ordermanagement.xsd"),
- // "OrderStatusResult");
- // String theTemplate = builder.buildTemplate();
- //
- // TestUtil.assertXMLEquals(theTemplate, "expected/order-status-01.xml",
- // getClass());
- // }
+ public void test_OrderStatusRequest() throws IOException, ParserConfigurationException, ModelBuilderException, SAXException, TemplateBuilderException {
+ TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new
+ File("resources/xcbl40/schema/org/xcbl/path_delim/schemas/xcbl/v4_0/ordermanagement/v1_0/ordermanagement.xsd"), "OrderStatusResult");
+ String theTemplate = builder.buildTemplate();
+
+ System.out.println(theTemplate);
+ TestUtil.assertXMLEquals(theTemplate, "expected/order-status-01.xml", getClass());
+ }
private Map createPersonObj(String first, String last, String address, int age) {
Map javaCtx = new HashMap();
15 years, 11 months