Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkchan2007-03-29 01:49:45 +0000
committerkchan2007-03-29 01:49:45 +0000
commitf67daea431fc1e7f09a8edb19e40df91a4142d8c (patch)
treedafb3385e352788b43d635ab304f5665b0b5e13d
parentec5685b5375e6e5f5b87857049933b366883786a (diff)
downloadwebtools.webservices-f67daea431fc1e7f09a8edb19e40df91a4142d8c.tar.gz
webtools.webservices-f67daea431fc1e7f09a8edb19e40df91a4142d8c.tar.xz
webtools.webservices-f67daea431fc1e7f09a8edb19e40df91a4142d8c.zip
[176489] Web service popup actions should exploit IAdapterManager.
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java29
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionTransformer.java11
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.java16
-rw-r--r--bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidgetDefaultingCommand.java24
-rw-r--r--bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/popup/PopupTestService.java13
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/popup/PopupTestWSDL.java61
-rw-r--r--bundles/org.eclipse.wst.ws.ui/META-INF/MANIFEST.MF1
-rw-r--r--bundles/org.eclipse.wst.ws.ui/src/org/eclipse/wst/ws/internal/ui/utils/AdapterUtils.java64
-rw-r--r--tests/org.eclipse.jst.ws.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--tests/org.eclipse.jst.ws.tests/META-INF/MANIFEST.MF5
-rw-r--r--tests/org.eclipse.jst.ws.tests/plugin.properties8
-rw-r--r--tests/org.eclipse.jst.ws.tests/plugin.xml56
-rw-r--r--tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/WSCustomAdapterFactory.java88
14 files changed, 332 insertions, 54 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java
index 127c509ab..15b19f7e6 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java
@@ -4,12 +4,13 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* yyyymmdd bug Email and other contact information
* -------- -------- -----------------------------------------------------------
* 20070116 159618 makandre@ca.ibm.com - Andrew Mak, Project and EAR not defaulted properly when wizard launched from JSR-109 Web services branch in J2EE Project Explorer
+ * 20070327 172339 kathy@ca.ibm.com - Kathy Chan
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.widgets;
@@ -30,13 +31,14 @@ import org.eclipse.jst.ws.internal.common.ResourceUtils;
import org.eclipse.jst.ws.internal.common.UniversalPathTransformer;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.ws.internal.ui.utils.AdapterUtils;
import org.eclipse.wst.wsdl.internal.impl.ServiceImpl;
import org.eclipse.wst.wsdl.util.WSDLResourceImpl;
public class WSDLSelectionWidgetDefaultingCommand extends AbstractDataModelOperation
{
private IStructuredSelection selection_;
- private UniversalPathTransformer transformer_ = new UniversalPathTransformer();
+ private UniversalPathTransformer transformer_ = new UniversalPathTransformer();
public String getWebServiceURI()
{
@@ -53,24 +55,24 @@ public class WSDLSelectionWidgetDefaultingCommand extends AbstractDataModelOpera
{
uri = ifile.getFullPath().toString();
}
- }
- if (firstSel instanceof ServiceImpl)
+ } else if (firstSel instanceof ServiceImpl)
{
ServiceImpl serviceImpl = (ServiceImpl)firstSel;
uri = J2EEActionAdapterFactory.getWSDLURI(serviceImpl);
- }
- if (firstSel instanceof ServiceRef)
+ } else if (firstSel instanceof ServiceRef)
{
ServiceRef serviceRef = (ServiceRef)firstSel;
uri = J2EEActionAdapterFactory.getWSDLURI(serviceRef);
- }
- if (firstSel instanceof WSDLResourceImpl)
+ } else if (firstSel instanceof WSDLResourceImpl)
{
WSDLResourceImpl wsdlRI = (WSDLResourceImpl)firstSel;
uri = J2EEActionAdapterFactory.getWSDLURI(wsdlRI);
- }
- if (firstSel instanceof String)
+ } else if (firstSel instanceof String)
+ {
uri = (String)firstSel;
+ } else {
+ uri = AdapterUtils.getAdaptedWSDL(firstSel);
+ }
uri = transformer_.toPath(uri);
}
@@ -174,6 +176,7 @@ public class WSDLSelectionWidgetDefaultingCommand extends AbstractDataModelOpera
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
{
- return Status.OK_STATUS;
- }
-} \ No newline at end of file
+ return Status.OK_STATUS;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionTransformer.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionTransformer.java
index 2630fdc9d..b22d1eed5 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionTransformer.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionTransformer.java
@@ -4,12 +4,13 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* yyyymmdd bug Email and other contact information
* -------- -------- -----------------------------------------------------------
* 20070116 159618 makandre@ca.ibm.com - Andrew Mak, Project and EAR not defaulted properly when wizard launched from JSR-109 Web services branch in J2EE Project Explorer
+ * 20070327 172339 kathy@ca.ibm.com - Kathy Chan
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.widgets.object;
@@ -29,6 +30,7 @@ import org.eclipse.jst.j2ee.webservice.wsdd.WebServiceDescription;
import org.eclipse.jst.ws.internal.common.J2EEActionAdapterFactory;
import org.eclipse.jst.ws.internal.common.J2EEUtils;
import org.eclipse.wst.command.internal.env.core.data.Transformer;
+import org.eclipse.wst.ws.internal.ui.utils.AdapterUtils;
import org.eclipse.wst.wsdl.internal.impl.ServiceImpl;
import org.eclipse.wst.wsdl.util.WSDLResourceImpl;
@@ -76,6 +78,11 @@ public class WSDLSelectionTransformer implements Transformer
else if (sel instanceof BeanLink)
{
return new StructuredSelection(getWSDLURI((BeanLink) sel));
+ } else {
+ String wsdlURI = AdapterUtils.getAdaptedWSDL(sel);
+ if (wsdlURI != null) {
+ return new StructuredSelection(wsdlURI);
+ }
}
}
return value;
@@ -108,4 +115,4 @@ public class WSDLSelectionTransformer implements Transformer
return getWSDLURI((ServiceImplBean) eObject);
return "";
}
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.java
index f362fd288..9a9007d86 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wizard/TypeSelectionFilter2.java
@@ -1,25 +1,29 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* yyyymmdd bug Email and other contact information
* -------- -------- -----------------------------------------------------------
* 20060606 105045 mahutch@ca.ibm.com - Mark Hutchinson
+ * 20070328 172339 kathy@ca.ibm.com - Kathy Chan
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.wizard;
import java.util.ArrayList;
import java.util.Iterator;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.webservice.wsdd.BeanLink;
+import org.eclipse.jst.j2ee.webservice.wsdd.ServiceImplBean;
import org.eclipse.jst.ws.internal.common.ResourceUtils;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceImpl;
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
@@ -98,6 +102,14 @@ public class TypeSelectionFilter2
}
}
+
+ //TODO: Bug 179751 - Need to make checking for types recognized as bottom-up to be more extensible
+
+ if (supportedTypes.isEmpty()) {
+ if (initialObject instanceof BeanLink || initialObject instanceof ServiceImplBean) {
+ supportedTypes.add(wst);
+ }
+ }
}
}
diff --git a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidgetDefaultingCommand.java
index 2e9f62241..8b7d205bb 100644
--- a/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidgetDefaultingCommand.java
+++ b/bundles/org.eclipse.jst.ws.creation.ui/src/org/eclipse/jst/ws/internal/creation/ui/widgets/ServerWizardWidgetDefaultingCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
* -------- -------- -----------------------------------------------------------
* 20060524 142635 gilberta@ca.ibm.com - Gilbert Andrews
* 20060529 141422 kathy@ca.ibm.com - Kathy Chan
+ * 20070327 172339 kathy@ca.ibm.com - Kathy Chan
*******************************************************************************/
package org.eclipse.jst.ws.internal.creation.ui.widgets;
@@ -27,6 +28,8 @@ import org.eclipse.jst.ws.internal.consumption.ui.widgets.ClientWizardWidgetDefa
import org.eclipse.jst.ws.internal.consumption.ui.wsrt.WebServiceRuntimeExtensionUtils2;
import org.eclipse.jst.ws.internal.context.ScenarioContext;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
+import org.eclipse.wst.ws.internal.ui.utils.AdapterUtils;
+import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
public class ServerWizardWidgetDefaultingCommand extends ClientWizardWidgetDefaultingCommand
{
@@ -56,7 +59,24 @@ public class ServerWizardWidgetDefaultingCommand extends ClientWizardWidgetDefau
if (typeIds!=null && typeIds.length>0)
{
typeRuntimeServer_.setTypeId(typeIds[0]);
- }
+ } else {
+ if (initialSelection_ != null && !initialSelection_.isEmpty())
+ {
+ Object initialObject = initialSelection_.getFirstElement();
+ if (initialObject != null)
+ {
+ Object adaptedObject = AdapterUtils.getAdaptedObject(initialObject);
+ if (adaptedObject != null) {
+ StringBuffer entrybuff = new StringBuffer();
+ entrybuff.append(String.valueOf(WebServiceScenario.TOPDOWN));
+ entrybuff.append("/");
+ entrybuff.append("org.eclipse.jst.ws.wsImpl.java");
+ String entry = entrybuff.toString();
+ typeRuntimeServer_.setTypeId(entry);
+ }
+ }
+ }
+ }
serviceGeneration_ = getScenarioContext().getGenerateWebService();
diff --git a/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/popup/PopupTestService.java b/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/popup/PopupTestService.java
index 25a0d110e..8a4888b9c 100644
--- a/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/popup/PopupTestService.java
+++ b/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/popup/PopupTestService.java
@@ -1,15 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation and others.
+ * Copyright (c) 2002, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* yyyymmdd bug Email and other contact information
* -------- -------- -----------------------------------------------------------
* 20060803 152790 mahutch@ca.ibm.com - Mark Hutchinson (created class)
+ * 20070327 172339 kathy@ca.ibm.com - Kathy Chan
*******************************************************************************/
package org.eclipse.jst.ws.internal.ui.popup;
@@ -51,6 +52,14 @@ public class PopupTestService extends PopupTestWSDL
{
ServiceRef serviceImpl = (ServiceRef)object;
wsdlURL = J2EEActionAdapterFactory.getWSDLURI(serviceImpl);
+ } else if (object instanceof String) {
+ wsdlURL = (String) object;
+ } else {
+ // Object is not any types we recognized, wsdlURL is still null.
+ // Try looking up an adapter for the object.
+ // If found, update wsdlURL contains the adapted WSDL string.
+ // If not found, wsdlURL would still be null.
+ wsdlURL = getAdaptedWSDL(object);
}
addLaunchOptions(launchOptions, wsdlURL, stateLocation, defaultFavoritesLocation);
diff --git a/bundles/org.eclipse.wst.ws.explorer/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.ws.explorer/META-INF/MANIFEST.MF
index 283e3c385..4ae87d257 100644
--- a/bundles/org.eclipse.wst.ws.explorer/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.ws.explorer/META-INF/MANIFEST.MF
@@ -33,5 +33,6 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.wst.common.frameworks.ui;bundle-version="[1.1.0,1.2.0)",
org.eclipse.wst.common.environment;bundle-version="[1.0.100,1.1.0)",
org.eclipse.wst.common.uriresolver;bundle-version="[1.1.0,1.2.0)",
- com.ibm.icu;bundle-version="[3.4.4,4.0.0)"
+ com.ibm.icu;bundle-version="[3.4.4,4.0.0)",
+ org.eclipse.wst.ws.ui;bundle-version="[1.0.202,1.1.0)"
Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/popup/PopupTestWSDL.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/popup/PopupTestWSDL.java
index 9c770017e..ef246f691 100644
--- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/popup/PopupTestWSDL.java
+++ b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/popup/PopupTestWSDL.java
@@ -1,16 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation and others.
+ * Copyright (c) 2002, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* yyyymmdd bug Email and other contact information
* -------- -------- -----------------------------------------------------------
* 20060606 105069 mahutch@ca.ibm.com - Mark Hutchinson
* 20060803 152790 mahutch@ca.ibm.com - Mark Hutchinson
+ * 20070327 172339 kathy@ca.ibm.com - Kathy Chan
*******************************************************************************/
package org.eclipse.wst.ws.internal.explorer.popup;
@@ -34,6 +35,7 @@ import org.eclipse.wst.ws.internal.explorer.WSExplorerLauncherCommand;
import org.eclipse.wst.ws.internal.explorer.plugin.ExplorerPlugin;
import org.eclipse.wst.ws.internal.monitor.GetMonitorCommand;
import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
+import org.eclipse.wst.ws.internal.ui.utils.AdapterUtils;
import org.eclipse.wst.wsdl.Definition;
import org.eclipse.wst.wsdl.internal.impl.ServiceImpl;
import org.eclipse.wst.wsdl.util.WSDLResourceImpl;
@@ -73,29 +75,33 @@ public class PopupTestWSDL extends Action implements IActionDelegate
Object object = it.next();
if (object instanceof IResource)
{
- File wsdlFile = ((IResource)object).getLocation().toFile();
- try
- {
- wsdlURL = wsdlFile.toURL().toString();
- }
- catch (MalformedURLException murle)
- {
- wsdlURL = wsdlFile.toString();
- }
- }
-
- if (object instanceof ServiceImpl)
+ File wsdlFile = ((IResource)object).getLocation().toFile();
+ try
+ {
+ wsdlURL = wsdlFile.toURL().toString();
+ }
+ catch (MalformedURLException murle)
+ {
+ wsdlURL = wsdlFile.toString();
+ }
+ } else if (object instanceof ServiceImpl)
{
- ServiceImpl serviceImpl = (ServiceImpl)object;
- Definition definition = serviceImpl.getEnclosingDefinition();
- wsdlURL = definition.getLocation();
- }
-
- if (object instanceof WSDLResourceImpl)
+ ServiceImpl serviceImpl = (ServiceImpl)object;
+ Definition definition = serviceImpl.getEnclosingDefinition();
+ wsdlURL = definition.getLocation();
+ } else if (object instanceof WSDLResourceImpl)
{
- WSDLResourceImpl WSDLRImpl = (WSDLResourceImpl)object;
- Definition definition = WSDLRImpl.getDefinition();
- wsdlURL = definition.getLocation();
+ WSDLResourceImpl WSDLRImpl = (WSDLResourceImpl)object;
+ Definition definition = WSDLRImpl.getDefinition();
+ wsdlURL = definition.getLocation();
+ } else if (object instanceof String) {
+ wsdlURL = (String) object;
+ } else {
+ // Object is not any types we recognized, wsdlURL is still null.
+ // Try looking up an adapter for the object.
+ // If found, update wsdlURL contains the adapted WSDL string.
+ // If not found, wsdlURL would still be null.
+ wsdlURL = getAdaptedWSDL(object);
}
addLaunchOptions(launchOptions, wsdlURL, stateLocation, defaultFavoritesLocation);
@@ -140,4 +146,13 @@ public class PopupTestWSDL extends Action implements IActionDelegate
public void selectionChanged(IAction action, ISelection selection)
{
}
+
+ /**
+ * @param object Look up an adapter mapping the object to IFile or String.
+ * @return The WSDL string returned by the adapter or null if no adapter is found.
+ */
+ public static String getAdaptedWSDL (Object object) {
+ return AdapterUtils.getAdaptedWSDL(object);
+ }
+
}
diff --git a/bundles/org.eclipse.wst.ws.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.ws.ui/META-INF/MANIFEST.MF
index e1e1eb10f..8533f24cf 100644
--- a/bundles/org.eclipse.wst.ws.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.ws.ui/META-INF/MANIFEST.MF
@@ -10,6 +10,7 @@ Export-Package: org.eclipse.wst.ws.internal.ui;x-internal:=true,
org.eclipse.wst.ws.internal.ui.command;x-internal:=true,
org.eclipse.wst.ws.internal.ui.plugin;x-internal:=true,
org.eclipse.wst.ws.internal.ui.preferences;x-internal:=true,
+ org.eclipse.wst.ws.internal.ui.utils,
org.eclipse.wst.ws.internal.ui.wsi.preferences;x-internal:=true,
org.eclipse.wst.ws.internal.ui.wsi.properties;x-internal:=true,
org.eclipse.wst.ws.internal.ui.wsrt;x-internal:=true
diff --git a/bundles/org.eclipse.wst.ws.ui/src/org/eclipse/wst/ws/internal/ui/utils/AdapterUtils.java b/bundles/org.eclipse.wst.ws.ui/src/org/eclipse/wst/ws/internal/ui/utils/AdapterUtils.java
new file mode 100644
index 000000000..9104d4be4
--- /dev/null
+++ b/bundles/org.eclipse.wst.ws.ui/src/org/eclipse/wst/ws/internal/ui/utils/AdapterUtils.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20070327 172339 kathy@ca.ibm.com - Kathy Chan
+ *******************************************************************************/
+package org.eclipse.wst.ws.internal.ui.utils;
+
+import java.io.File;
+import java.net.MalformedURLException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Platform;
+
+public class AdapterUtils {
+
+ /**
+ * @param object Object to adapte
+ * @return The adapted object representing the file or String if an adapter is found.
+ * Returns null if an adapter is not found.
+ */
+ public static Object getAdaptedObject (Object object) {
+ Object adaptedObject = null;
+ adaptedObject = Platform.getAdapterManager().loadAdapter(object, "org.eclipse.core.resources.IFile");
+ if (adaptedObject == null) {
+ adaptedObject = Platform.getAdapterManager().loadAdapter(object, "java.lang.String");
+ }
+ return adaptedObject;
+ }
+
+ /**
+ * @param object Look up an adapter mapping the object to IFile or String.
+ * @return The WSDL string returned by the adapter or null if no adapter is found.
+ */
+ public static String getAdaptedWSDL (Object object) {
+ String wsdlURL = null;
+ Object adaptedObject = AdapterUtils.getAdaptedObject(object);
+ if ( adaptedObject != null) {
+ if (adaptedObject instanceof IFile)
+ {
+ File wsdlFile = ((IFile)adaptedObject).getLocation().toFile();
+ try
+ {
+ wsdlURL = wsdlFile.toURL().toString();
+ }
+ catch (MalformedURLException murle)
+ {
+ wsdlURL = wsdlFile.toString();
+ }
+ } else if (adaptedObject instanceof String) {
+ wsdlURL = (String) adaptedObject;
+ }
+ }
+ return wsdlURL;
+ }
+
+}
diff --git a/tests/org.eclipse.jst.ws.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.jst.ws.tests/.settings/org.eclipse.jdt.core.prefs
index 8f43d8c78..5af02d52d 100644
--- a/tests/org.eclipse.jst.ws.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/org.eclipse.jst.ws.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,21 +1,17 @@
-#Mon Jan 30 10:36:41 EST 2006
+#Tue Mar 20 16:58:35 EST 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=ignore
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -54,4 +50,3 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/tests/org.eclipse.jst.ws.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.ws.tests/META-INF/MANIFEST.MF
index b7d821de6..373e5ebae 100644
--- a/tests/org.eclipse.jst.ws.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.jst.ws.tests/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %PLUGIN_NAME
-Bundle-SymbolicName: org.eclipse.jst.ws.tests
+Bundle-SymbolicName: org.eclipse.jst.ws.tests;singleton:=true
Bundle-Version: 1.0.200.qualifier
Bundle-ClassPath: tests.jar
Bundle-Activator: org.eclipse.jst.ws.tests.plugin.TestsPlugin
@@ -38,5 +38,6 @@ Require-Bundle: org.eclipse.jst.ws.consumption.ui,
org.eclipse.jdt.launching,
org.eclipse.jdt.debug.ui,
org.eclipse.jst.server.tomcat.core,
- org.eclipse.wst.common.project.facet.core
+ org.eclipse.wst.common.project.facet.core,
+ org.eclipse.wst.ws.explorer
Eclipse-LazyStart: true
diff --git a/tests/org.eclipse.jst.ws.tests/plugin.properties b/tests/org.eclipse.jst.ws.tests/plugin.properties
index 6f05835fc..7e39471b1 100644
--- a/tests/org.eclipse.jst.ws.tests/plugin.properties
+++ b/tests/org.eclipse.jst.ws.tests/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2006 IBM Corporation and others.
+# Copyright (c) 2006, 2007 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -10,6 +10,7 @@
# yyyymmdd bug Email and other contact information
# -------- -------- -----------------------------------------------------------
# 20060424 138060 kathy@ca.ibm.com - Kathy Chan
+# 20070327 172339 kathy@ca.ibm.com - Kathy Chan
###############################################################################
#
@@ -17,3 +18,8 @@
#
PLUGIN_NAME=Java Web Services Tools Tests
PLUGIN_PROVIDER=Eclipse.org
+
+POPUP_TEST_WSDL=Test with Web Services Explorer
+ACTION_GENERATE_JAVA_SKELETON=Generate Java bean skeleton
+ACTION_GENERATE_JAVA_PROXY=Generate Client
+
diff --git a/tests/org.eclipse.jst.ws.tests/plugin.xml b/tests/org.eclipse.jst.ws.tests/plugin.xml
index 7bf65fb5f..af4559b4f 100644
--- a/tests/org.eclipse.jst.ws.tests/plugin.xml
+++ b/tests/org.eclipse.jst.ws.tests/plugin.xml
@@ -2,5 +2,61 @@
<?eclipse version="3.0"?>
<plugin>
+ <extension
+ point="org.eclipse.ui.popupMenus">
+
+ <objectContribution
+ objectClass="org.eclipse.jst.j2ee.webservice.wsdd.ServletLink"
+ nameFilter="*"
+ id="org.eclipse.jst.ws.creation.ui.wizard.serverwizard.java">
+ <action
+ label="%ACTION_GENERATE_JAVA_SKELETON"
+ class="org.eclipse.wst.command.internal.env.ui.widgets.popup.DynamicPopupWizard"
+ menubarPath="additions"
+ id="org.eclipse.jst.ws.creation.ui.wizard.serverwizard">
+ </action>
+ </objectContribution>
+
+ <objectContribution
+ objectClass="org.eclipse.jst.j2ee.webservice.wsdd.ServletLink"
+ nameFilter="*"
+ id="org.eclipse.jst.ws.internal.consumption.ui.wizard.client.clientwizard">
+ <action
+ label="%ACTION_GENERATE_JAVA_PROXY"
+ class="org.eclipse.wst.command.internal.env.ui.widgets.popup.DynamicPopupWizard"
+ menubarPath="additions"
+ id="org.eclipse.jst.ws.internal.consumption.ui.wizard.client.clientwizard">
+ </action>
+ </objectContribution>
+
+ <objectContribution
+ objectClass="org.eclipse.jst.j2ee.webservice.wsdd.ServletLink"
+ nameFilter="*"
+ id="org.eclipse.jst.ws.internal.consumption.ui.action.WSDLFileMenu">
+ <action
+ label="%POPUP_TEST_WSDL"
+ class="org.eclipse.wst.ws.internal.explorer.popup.PopupTestWSDL"
+ menubarPath="additions"
+ id="org.eclipse.wst.ws.internal.explorer.popup.PopupTestWSDL">
+ </action>
+ </objectContribution>
+
+ </extension>
+
+<extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ class="org.eclipse.jst.ws.tests.util.WSCustomAdapterFactory"
+ adaptableType="org.eclipse.jst.j2ee.webservice.wsdd.ServletLink">
+ <adapter type="org.eclipse.core.resources.IFile"/>
+ </factory>
+ </extension>
+
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ class="org.eclipse.jst.ws.tests.util.WSCustomAdapterFactory"
+ adaptableType="org.eclipse.jst.j2ee.webservice.wsdd.ServletLink">
+ <adapter type="java.lang.String"/>
+ </factory>
+ </extension>
</plugin>
diff --git a/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/WSCustomAdapterFactory.java b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/WSCustomAdapterFactory.java
new file mode 100644
index 000000000..128c48cd4
--- /dev/null
+++ b/tests/org.eclipse.jst.ws.tests/tests/org/eclipse/jst/ws/tests/util/WSCustomAdapterFactory.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20070327 172339 kathy@ca.ibm.com - Kathy Chan
+ *******************************************************************************/
+package org.eclipse.jst.ws.tests.util;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jst.j2ee.webservice.wsdd.ServletLink;
+import org.eclipse.jst.j2ee.webservice.wsdd.ServiceImplBean;
+import org.eclipse.jst.j2ee.webservice.wsdd.WebServiceDescription;
+import org.eclipse.jst.ws.internal.common.J2EEUtils;
+import org.eclipse.jst.ws.internal.common.ResourceUtils;
+
+public class WSCustomAdapterFactory implements IAdapterFactory {
+
+ private static final Class[] types = {
+ IFile.class, String.class
+ };
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof ServletLink) {
+ System.out.println("getAdapter on "+adaptableObject.toString());
+ ServletLink beanLink = (ServletLink) adaptableObject;
+
+ IFile wsdlFile = getWSDLFile(beanLink);
+ System.out.println("wsdlFile = "+wsdlFile);
+ if (adapterType == IFile.class) {
+ return wsdlFile;
+ } else
+ if (adapterType == String.class) {
+ String wsdlFileString = wsdlFile.getLocationURI().toString();
+ System.out.println("wsdlFileString = "+wsdlFileString);
+ return wsdlFileString;
+ } else {
+ return null;
+ }
+ }
+ else {
+ return null;
+ }
+ }
+
+ public Class[] getAdapterList() {
+ return types;
+ }
+
+ private IFile getWSDLFile(ServiceImplBean bean) {
+ EObject eObject = bean.eContainer();
+ if (eObject == null)
+ return null;
+
+ eObject = eObject.eContainer();
+
+ if (eObject instanceof WebServiceDescription) {
+ WebServiceDescription wsd = (WebServiceDescription) eObject;
+
+ IProject project = ProjectUtilities.getProject(wsd);
+
+ IPath path = J2EEUtils.getWebContentPath(project);
+ path = path.append(wsd.getWsdlFile());
+ return ResourceUtils.getWorkspaceRoot().getFile(path);
+
+ }
+ return null;
+ }
+
+ private IFile getWSDLFile(ServletLink link) {
+ EObject eObject = link.eContainer();
+ if (eObject instanceof ServiceImplBean)
+ return getWSDLFile((ServiceImplBean) eObject);
+ return null;
+ }
+
+}

Back to the top