diff options
6 files changed, 47 insertions, 34 deletions
diff --git a/bundles/org.eclipse.jst.ws.axis.consumption.ui/src/org/eclipse/jst/ws/internal/axis/consumption/ui/task/Stub2BeanInfo.java b/bundles/org.eclipse.jst.ws.axis.consumption.ui/src/org/eclipse/jst/ws/internal/axis/consumption/ui/task/Stub2BeanInfo.java index c9bcc4967..90b6111e6 100644 --- a/bundles/org.eclipse.jst.ws.axis.consumption.ui/src/org/eclipse/jst/ws/internal/axis/consumption/ui/task/Stub2BeanInfo.java +++ b/bundles/org.eclipse.jst.ws.axis.consumption.ui/src/org/eclipse/jst/ws/internal/axis/consumption/ui/task/Stub2BeanInfo.java @@ -19,6 +19,7 @@ import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; import java.util.Vector; + import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; @@ -27,14 +28,13 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jem.internal.plugin.JavaEMFNature; import org.eclipse.jem.java.JavaClass; import org.eclipse.jem.java.JavaHelpers; import org.eclipse.jem.java.JavaParameter; -import org.eclipse.jem.java.JavaRefFactory; import org.eclipse.jem.java.JavaVisibilityKind; import org.eclipse.jem.java.Method; import org.eclipse.jst.ws.internal.axis.consumption.ui.util.WSDLUtils; +import org.eclipse.jst.ws.internal.common.JavaMOFUtils; import org.eclipse.jst.ws.internal.common.ResourceUtils; import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; import org.eclipse.wst.command.internal.env.common.FileResourceUtils; @@ -201,7 +201,6 @@ public class Stub2BeanInfo sb = new StringBuffer(sb.toString().replace('.', '/')); sb.append(".java"); - JavaEMFNature.createRuntime(clientProject_); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); IPath sourceFolderPath = null; IPath filePath = null; @@ -501,12 +500,11 @@ public class Stub2BeanInfo newLine(w); //WebServiceElement wse = WebServiceElement.getWebServiceElement(model_); if (clientProject_ == null) return;//wse.getProxyProject(); - JavaEMFNature javaMOF = (JavaEMFNature)JavaEMFNature.createRuntime(clientProject_); StringTokenizer st = new StringTokenizer(seis_.toString(), ";"); while (st.hasMoreTokens()) { String sei = st.nextToken(); - JavaClass javaClass = (JavaClass)JavaRefFactory.eINSTANCE.reflectType(getPackageName(sei), getClassName(sei), javaMOF.getResourceSet()); + JavaClass javaClass = JavaMOFUtils.getJavaClass(getPackageName(sei), getClassName(sei), clientProject_); if (javaClass != null) { List methods = javaClass.getMethods(); diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/JavaToWSDLMethodCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/JavaToWSDLMethodCommand.java index 02233df1f..cb5e35d08 100644 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/JavaToWSDLMethodCommand.java +++ b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/command/JavaToWSDLMethodCommand.java @@ -14,16 +14,16 @@ package org.eclipse.jst.ws.internal.axis.creation.ui.command; import java.util.Hashtable; import java.util.Iterator; import java.util.List; + import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -import org.eclipse.jem.internal.plugin.JavaEMFNature; import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaRefFactory; import org.eclipse.jem.java.Method; import org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParameter; +import org.eclipse.jst.ws.internal.common.JavaMOFUtils; import org.eclipse.wst.command.internal.env.core.common.MessageUtils; import org.eclipse.wst.command.internal.env.core.common.StatusUtils; import org.eclipse.wst.common.environment.IEnvironment; @@ -84,11 +84,7 @@ public class JavaToWSDLMethodCommand extends AbstractDataModelOperation { qName = qName.substring(0, qName.lastIndexOf('.')); } - JavaEMFNature jMOF = - (JavaEMFNature) JavaEMFNature.createRuntime( - serviceProject_); - JavaClass javaClass = - (JavaClass)JavaRefFactory.eINSTANCE.reflectType(qName, jMOF.getResourceSet()); + JavaClass javaClass = JavaMOFUtils.getJavaClass(qName, serviceProject_); if (!javaClass.isExistingType()) { environment.getLog().log(ILog.ERROR, 5022, this, "execute", msgUtils_.getMessage( diff --git a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/widgets/bean/ValidateObjectSelectionCommand.java b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/widgets/bean/ValidateObjectSelectionCommand.java index 3c9e0e46c..2b0fe4a03 100644 --- a/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/widgets/bean/ValidateObjectSelectionCommand.java +++ b/bundles/org.eclipse.jst.ws.axis.creation.ui/src/org/eclipse/jst/ws/internal/axis/creation/ui/widgets/bean/ValidateObjectSelectionCommand.java @@ -17,11 +17,10 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -import org.eclipse.jem.internal.plugin.JavaEMFNature; import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaRefFactory; import org.eclipse.jem.util.emf.workbench.ProjectUtilities; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jst.ws.internal.common.JavaMOFUtils; import org.eclipse.jst.ws.internal.common.ResourceUtils; import org.eclipse.jst.ws.internal.consumption.common.JavaResourceFilter; import org.eclipse.wst.command.internal.env.core.common.MessageUtils; @@ -102,8 +101,7 @@ public class ValidateObjectSelectionCommand extends AbstractDataModelOperation try { - JavaEMFNature jMOF = (JavaEMFNature) JavaEMFNature.createRuntime(serviceProject); - JavaClass javaClass = (JavaClass)JavaRefFactory.eINSTANCE.reflectType(javaBeanName, jMOF.getResourceSet()); + JavaClass javaClass = JavaMOFUtils.getJavaClass(javaBeanName, serviceProject); if (!javaClass.isExistingType()) { IStatus errorStatus = StatusUtils.errorStatus( msgUtils_.getMessage("MSG_ERROR_CANNOT_LOAD_JAVA_BEAN", new String[] { javaBeanName, serviceProjectName })); diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java index 315cd122b..9626b82f5 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/ClientHandlersWidgetOutputCommand.java @@ -16,19 +16,19 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.List; + import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -import org.eclipse.jem.internal.plugin.JavaEMFNature; import org.eclipse.jem.java.JavaClass; -import org.eclipse.jem.java.JavaRefFactory; import org.eclipse.jst.j2ee.webservice.wsclient.Handler; import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef; import org.eclipse.jst.j2ee.webservice.wsclient.WebServicesResource; import org.eclipse.jst.j2ee.webservice.wsclient.Webservice_clientFactory; import org.eclipse.jst.j2ee.webservice.wsclient.internal.impl.Webservice_clientFactoryImpl; +import org.eclipse.jst.ws.internal.common.JavaMOFUtils; import org.eclipse.jst.ws.internal.consumption.ui.widgets.object.HandlerTableItem; import org.eclipse.wst.command.internal.env.core.common.MessageUtils; import org.eclipse.wst.command.internal.env.core.common.StatusUtils; @@ -68,8 +68,6 @@ public class ClientHandlersWidgetOutputCommand extends AbstractDataModelOperatio try { - JavaEMFNature jMOF = (JavaEMFNature) JavaEMFNature.createRuntime(project_); - oldWSServiceRefsToHandlersTable_ = new Hashtable(); newWSServiceRefsToHandlersTable_ = new Hashtable(); @@ -110,7 +108,7 @@ public class ClientHandlersWidgetOutputCommand extends AbstractDataModelOperatio Handler newHandler = wsClientFactory.createHandler(); newHandler.setHandlerName(hti.getHandlerName()); - JavaClass javaClass = (JavaClass)JavaRefFactory.eINSTANCE.reflectType(hti.getHandlerClassName(), jMOF.getResourceSet()); + JavaClass javaClass = JavaMOFUtils.getJavaClass(hti.getHandlerClassName(), project_); if (javaClass != null) { newHandler.setHandlerClass(javaClass); } diff --git a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/JavaMofReflectionCommand.java b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/JavaMofReflectionCommand.java index 896e121c2..2a1041df3 100644 --- a/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/JavaMofReflectionCommand.java +++ b/bundles/org.eclipse.jst.ws.consumption/src/org/eclipse/jst/ws/internal/consumption/command/common/JavaMofReflectionCommand.java @@ -20,9 +20,12 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.jem.internal.plugin.JavaEMFNature; +import org.eclipse.jem.java.JavaClass; import org.eclipse.jem.java.JavaHelpers; import org.eclipse.jem.java.JavaRefFactory; +import org.eclipse.jem.util.emf.workbench.nature.EMFNature; +import org.eclipse.jem.workbench.utility.JemProjectUtilities; +import org.eclipse.jst.ws.internal.common.JavaMOFUtils; import org.eclipse.jst.ws.internal.common.ResourceUtils; import org.eclipse.jst.ws.internal.consumption.plugin.WebServiceConsumptionPlugin; import org.eclipse.wst.command.internal.env.core.common.StatusUtils; @@ -93,14 +96,11 @@ public class JavaMofReflectionCommand extends AbstractDataModelOperation if(clientProject == null || qname == null) return StatusUtils.warningStatus( WebServiceConsumptionPlugin.getMessage("%MSG_WARN_UNABLE_TO_FIND_PROXY") ); - JavaEMFNature nature = (JavaEMFNature)JavaEMFNature.getRuntime(clientIProject); - if(nature == null){ - try{ - nature = (JavaEMFNature)JavaEMFNature.createRuntime(clientIProject); - }catch(CoreException exc){} - } - resourceSet = nature.getResourceSet(); - javaClass = JavaRefFactory.eINSTANCE.reflectType(qname,resourceSet); + try { + EMFNature nature = JemProjectUtilities.getJEM_EMF_Nature(clientIProject, true); + javaClass = JavaRefFactory.eINSTANCE.reflectType(qname, nature.getResourceSet()); + } catch (CoreException e) { + } return status; } diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/JavaMOFUtils.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/JavaMOFUtils.java index 02ee57941..f883dd34c 100644 --- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/JavaMOFUtils.java +++ b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/JavaMOFUtils.java @@ -16,7 +16,8 @@ import java.util.List; import java.util.Vector; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; -import org.eclipse.jem.internal.plugin.JavaEMFNature; +import org.eclipse.jem.util.emf.workbench.nature.EMFNature; +import org.eclipse.jem.workbench.utility.JemProjectUtilities; import org.eclipse.jem.java.JavaClass; import org.eclipse.jem.java.JavaRefFactory; import org.eclipse.jem.java.JavaVisibilityKind; @@ -183,11 +184,33 @@ public static boolean implementsInterface(JavaClass javaClass, JavaClass interfa return false; } - public static JavaClass getJavaClass(String className , IProject project) throws CoreException + /* + * + */ + /** + * @param classQName Fully qualified classname (packageName + typeName) + * @param project + * @return + * @throws CoreException + */ +public static JavaClass getJavaClass(String classQName , IProject project) throws CoreException { - JavaEMFNature jMOF = (JavaEMFNature)JavaEMFNature.createRuntime(project); - return (JavaClass)JavaRefFactory.eINSTANCE.reflectType(className,jMOF.getResourceSet()); + EMFNature jMOF = JemProjectUtilities.getJEM_EMF_Nature(project, true); + return (JavaClass)JavaRefFactory.eINSTANCE.reflectType(classQName,jMOF.getResourceSet()); } + + /** + * @param packageName + * @param typeName + * @param project + * @return + * @throws CoreException + */ +public static JavaClass getJavaClass(String packageName, String typeName , IProject project) throws CoreException + { + EMFNature jMOF = JemProjectUtilities.getJEM_EMF_Nature(project, true); + return (JavaClass)JavaRefFactory.eINSTANCE.reflectType(packageName, typeName, jMOF.getResourceSet()); + } public static boolean isValidSEIFile(JavaClass beanClass, JavaClass seiClass) { |