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:
authorkchan2005-04-25 21:10:12 +0000
committerkchan2005-04-25 21:10:12 +0000
commit32546129acf06aeec0cfc360c66efb0fbaddf73f (patch)
treeaca3a264a12247fafee4ea5544451da7d0a6b147 /bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui
parent34bfcc667028f1f4b048e47881e0bda31437735f (diff)
downloadwebtools.webservices-32546129acf06aeec0cfc360c66efb0fbaddf73f.tar.gz
webtools.webservices-32546129acf06aeec0cfc360c66efb0fbaddf73f.tar.xz
webtools.webservices-32546129acf06aeec0cfc360c66efb0fbaddf73f.zip
[92392] Defaulting for p.3.
Diffstat (limited to 'bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui')
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionOutputCommand.java13
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetDefaultingCommand.java34
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetWrapper.java19
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java4
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionWidget.java13
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/IObjectSelectionWidget.java8
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionWidget.java25
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionFragment.java1
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java51
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java49
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java46
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java46
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java37
13 files changed, 329 insertions, 17 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionOutputCommand.java
index 1d78f4722..a2af9371e 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionOutputCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionOutputCommand.java
@@ -25,6 +25,7 @@ public class WSDLSelectionOutputCommand extends SimpleCommand
private WebServicesParser webServicesParser;
private String wsdlURI;
private IProject project;
+ private String componentName;
/**
* @return Returns the project.
@@ -43,6 +44,18 @@ public class WSDLSelectionOutputCommand extends SimpleCommand
this.project = project;
}
+
+
+ public String getComponentName()
+ {
+ return componentName;
+ }
+
+ public void setComponentName(String componentName)
+ {
+ this.componentName = componentName;
+ }
+
public String getWsdlURI()
{
return wsdlURI;
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 b3c3c51b4..525ca69cb 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
@@ -19,6 +19,7 @@ import org.eclipse.jst.j2ee.webservice.wsclient.ServiceRef;
import org.eclipse.jst.ws.internal.common.J2EEActionAdapterFactory;
import org.eclipse.jst.ws.internal.common.ResourceUtils;
import org.eclipse.wst.command.internal.provisional.env.core.SimpleCommand;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.wsdl.internal.impl.ServiceImpl;
import org.eclipse.wst.wsdl.util.WSDLResourceImpl;
@@ -89,6 +90,12 @@ public class WSDLSelectionWidgetDefaultingCommand extends SimpleCommand
return p;
}
+ public String getComponentName()
+ {
+ String cname = getComponentNameFromInitialSelection(selection_);
+ return cname;
+ }
+
private IProject getProjectFromInitialSelection(IStructuredSelection selection)
{
if (selection != null && selection.size() == 1)
@@ -110,5 +117,32 @@ public class WSDLSelectionWidgetDefaultingCommand extends SimpleCommand
}
}
return null;
+ }
+
+ private String getComponentNameFromInitialSelection(IStructuredSelection selection)
+ {
+ if (selection != null && selection.size() == 1)
+ {
+ Object obj = selection.getFirstElement();
+ if (obj != null)
+ {
+ try
+ {
+ IResource resource = ResourceUtils.getResourceFromSelection(obj);
+ if (resource==null)
+ return null;
+
+ IVirtualComponent comp = ResourceUtils.getComponentOf(resource.getFullPath());
+ if (comp!=null)
+ {
+ return comp.getName();
+ }
+ } catch(CoreException e)
+ {
+ return null;
+ }
+ }
+ }
+ return null;
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetWrapper.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetWrapper.java
index dae17297e..9b3397cea 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetWrapper.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/WSDLSelectionWidgetWrapper.java
@@ -34,6 +34,7 @@ public class WSDLSelectionWidgetWrapper extends SimpleWidgetDataContributor
private WSDLSelectionWidget wsdlSelectionWidget;
private String webServiceURI;
private IProject project;
+ private String componentName;
public WSDLSelectionWidgetWrapper()
{
@@ -116,4 +117,22 @@ public class WSDLSelectionWidgetWrapper extends SimpleWidgetDataContributor
else
return p;
}
+
+ public String getComponentName()
+ {
+ String cname = wsdlSelectionWidget.getComponentName();
+ if (cname==null)
+ {
+ return componentName;
+ }
+ else
+ return cname;
+ }
+
+ public void setComponentName(String componentName)
+ {
+ this.componentName = componentName;
+ }
+
+
}
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java
index a33b7b52c..5a911c8fe 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/binding/ClientWidgetBinding.java
@@ -134,11 +134,13 @@ public class ClientWidgetBinding implements CommandWidgetBinding
// Before WSDLSelectionWidgetWrapper
dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WebServiceURI", WSDLSelectionWidgetWrapper.class );
dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "Project", WSDLSelectionWidgetWrapper.class );
+ dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "ComponentName", WSDLSelectionWidgetWrapper.class );
// After WSDLSelectionWidgetWrapper
dataRegistry.addMapping(WSDLSelectionWidgetWrapper.class, "WsdlURI", WSDLSelectionOutputCommand.class);
dataRegistry.addMapping(WSDLSelectionWidgetWrapper.class, "WebServicesParser", WSDLSelectionOutputCommand.class);
dataRegistry.addMapping(WSDLSelectionWidgetWrapper.class, "Project", WSDLSelectionOutputCommand.class);
+ dataRegistry.addMapping(WSDLSelectionWidgetWrapper.class, "ComponentName", WSDLSelectionOutputCommand.class);
// Before Client Test widget.
dataRegistry.addMapping(ClientExtensionDefaultingCommand.class, "TestService",FinishTestFragment.class);
@@ -305,6 +307,7 @@ public class ClientWidgetBinding implements CommandWidgetBinding
dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WsilURI", ClientExtensionDefaultingCommand.class);
dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "WebServiceURI", WSDLSelectionOutputCommand.class, "WsdlURI", new EclipseIPath2URLStringTransformer());
dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "Project", WSDLSelectionOutputCommand.class);
+ dataRegistry.addMapping(WSDLSelectionWidgetDefaultingCommand.class, "ComponentName", WSDLSelectionOutputCommand.class);
// WSDLSelectionOutputCommand
dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WsdlURI", ClientExtensionDefaultingCommand.class);
@@ -313,6 +316,7 @@ public class ClientWidgetBinding implements CommandWidgetBinding
dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", GetMonitorCommand.class);
dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "Project", ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientInitialProject", null);
dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WsdlURI", ClientRuntimeSelectionWidgetDefaultingCommand.class);
+ dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "ComponentName", ClientRuntimeSelectionWidgetDefaultingCommand.class, "ClientInitialComponentName", null);
dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", ClientRuntimeSelectionWidgetDefaultingCommand.class);
dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WsdlURI", CheckForServiceProjectCommand.class);
dataRegistry.addMapping(WSDLSelectionOutputCommand.class, "WebServicesParser", CheckForServiceProjectCommand.class);
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionWidget.java
index 6429936bd..afead6126 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionWidget.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/EJBSelectionWidget.java
@@ -269,6 +269,19 @@ public class EJBSelectionWidget extends AbstractObjectSelectionWidget implements
return null;
}
+ public String getComponentName()
+ {
+ String projectName = getSelectedProject();
+ if (projectName != null && projectName.length() > 0)
+ {
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ String comp = J2EEUtils.getFirstWebModuleName(p);
+ return comp;
+ }
+ else
+ return null;
+ }
+
public Status validateSelection(IStructuredSelection objectSelection)
{
return new SimpleStatus("");
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/IObjectSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/IObjectSelectionWidget.java
index c61cd0b65..3bafa00e6 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/IObjectSelectionWidget.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/IObjectSelectionWidget.java
@@ -59,4 +59,12 @@ public interface IObjectSelectionWidget extends WidgetDataContributor
* null if there is no IProject for this object.
*/
public IProject getProject();
+
+ /**
+ *
+ * @return returns the name of the IVirtualComponent that contains the selection
+ * object that the user has chosen with this widget. The value can be
+ * null if there is no IVirtualComponent for this object
+ */
+ public String getComponentName();
} \ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionWidget.java
index 8084cea8a..e3f21d34b 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionWidget.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/JavaBeanSelectionWidget.java
@@ -45,11 +45,13 @@ import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils;
import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus;
import org.eclipse.wst.command.internal.provisional.env.core.common.Status;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
public class JavaBeanSelectionWidget extends AbstractObjectSelectionWidget implements IObjectSelectionWidget
{
private String pluginId_ = "org.eclipse.jst.ws.consumption.ui";
private IProject serverProject_ = null;
+ private String serverComponentName_ = null;
private Composite parent_ = null;
private IWizardContainer context_ = null;
private JavaResourceFilter filter_ = new JavaResourceFilter();
@@ -126,6 +128,7 @@ public class JavaBeanSelectionWidget extends AbstractObjectSelectionWidget imple
{
statusListener.handleEvent(null);
serverProject_ = null;
+ serverComponentName_ = null;
}
private void handleBrowseClasses()
@@ -139,13 +142,24 @@ public class JavaBeanSelectionWidget extends AbstractObjectSelectionWidget imple
{
IResource res = itype.getCorrespondingResource();
if (res != null)
+ {
serverProject_ = res.getProject();
+ IVirtualComponent comp = ResourceUtils.getComponentOf(res.getFullPath());
+ if (comp!=null)
+ {
+ serverComponentName_ = comp.getName();
+ }
+ }
else
+ {
serverProject_ = null;
+ serverComponentName_ = null;
+ }
}
catch (JavaModelException jme)
{
serverProject_ = null;
+ serverComponentName_ = null;
}
}
}
@@ -176,6 +190,12 @@ public class JavaBeanSelectionWidget extends AbstractObjectSelectionWidget imple
beanClassText_.setText(beanClass);
serverProject_ = ResourceUtils.getProjectOf(path);
+ IVirtualComponent comp = ResourceUtils.getComponentOf(path);
+ if (comp!=null)
+ {
+ serverComponentName_ = comp.getName();
+ }
+
}
}
}
@@ -234,6 +254,11 @@ public class JavaBeanSelectionWidget extends AbstractObjectSelectionWidget imple
{
return serverProject_;
}
+
+ public String getComponentName()
+ {
+ return serverComponentName_;
+ }
public Status getStatus()
{
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionFragment.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionFragment.java
index 82e571270..4ed887fc1 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionFragment.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionFragment.java
@@ -47,6 +47,7 @@ public class ObjectSelectionFragment extends SequenceFragment implements Conditi
dataRegistry.addMapping(ObjectSelectionWidget.class, "ObjectSelection", ObjectSelectionOutputCommand.class);
dataRegistry.addMapping(ObjectSelectionWidget.class, "Project", ObjectSelectionOutputCommand.class);
+ dataRegistry.addMapping(ObjectSelectionWidget.class, "ComponentName", ObjectSelectionOutputCommand.class);
}
public boolean evaluate()
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java
index cc79b7d15..2699bb7d5 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionOutputCommand.java
@@ -25,6 +25,7 @@ import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus
import org.eclipse.wst.command.internal.provisional.env.core.common.Status;
import org.eclipse.wst.command.internal.provisional.env.core.common.StatusException;
import org.eclipse.wst.command.internal.provisional.env.core.data.Transformer;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
@@ -34,6 +35,7 @@ public class ObjectSelectionOutputCommand extends SimpleCommand
private IStructuredSelection objectSelection_;
private IObjectSelectionWidget objectSelectionWidget_;
private IProject project_;
+ private String componentName_;
private WebServicesParser parser_;
public Status execute(Environment env)
@@ -144,6 +146,12 @@ public class ObjectSelectionOutputCommand extends SimpleCommand
project_ = getProjectFromObjectSelection(objectSelection);
}
+ //Set the componentName if you can
+ if (componentName_ == null)
+ {
+ componentName_ = getComponentNameFromObjectSelection(objectSelection);
+ }
+
// Check if this is a WSDL selection object. If it is we need
// to unwrap it.
if( objectSelection != null && !objectSelection.isEmpty() )
@@ -168,9 +176,18 @@ public class ObjectSelectionOutputCommand extends SimpleCommand
public void setProject(IProject project)
{
this.project_ = project;
- }
-
+ }
+ public String getComponentName()
+ {
+ return componentName_;
+ }
+
+ public void setComponentName(String componentName)
+ {
+ this.componentName_ = componentName;
+ }
+
/**
* @return Returns the parser_.
*/
@@ -203,5 +220,35 @@ public class ObjectSelectionOutputCommand extends SimpleCommand
}
}
return null;
+ }
+
+ private String getComponentNameFromObjectSelection(IStructuredSelection selection)
+ {
+ if (selection != null && selection.size() == 1)
+ {
+ Object obj = selection.getFirstElement();
+ if (obj != null)
+ {
+ try
+ {
+ IResource resource = ResourceUtils.getResourceFromSelection(obj);
+ System.out.println("getProjectFromObjectSelection - resource = "+resource);
+ if (resource==null)
+ return null;
+
+ IVirtualComponent comp = ResourceUtils.getComponentOf(resource.getFullPath());
+ if (comp!=null)
+ {
+ return comp.getName();
+ }
+ System.out.println("ObjectSelection component = "+comp.getName());
+ } catch(CoreException e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ }
+ return null;
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java
index 61ed9bc4f..547812d10 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/ObjectSelectionWidget.java
@@ -28,6 +28,7 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus;
import org.eclipse.wst.command.internal.provisional.env.core.common.Status;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
public class ObjectSelectionWidget extends AbstractObjectSelectionWidget implements IObjectSelectionWidget
@@ -39,6 +40,7 @@ public class ObjectSelectionWidget extends AbstractObjectSelectionWidget impleme
private TypeRuntimeServer typeRuntimeServer;
private IStructuredSelection initialSelection;
private IProject project;
+ private String componentName;
private IObjectSelectionWidget child;
public WidgetDataEvents addControls(Composite parent, Listener statusListener)
@@ -123,6 +125,7 @@ public class ObjectSelectionWidget extends AbstractObjectSelectionWidget impleme
{
this.initialSelection = initialSelection;
project = getProjectFromInitialSelection(initialSelection);
+ componentName = getComponentNameFromInitialSelection(initialSelection);
if (child != null)
child.setInitialSelection(initialSelection);
}
@@ -153,6 +156,23 @@ public class ObjectSelectionWidget extends AbstractObjectSelectionWidget impleme
}
}
+ public String getComponentName()
+ {
+ if (child != null)
+ {
+ String cname = child.getComponentName();
+ if (cname != null && cname.length()>0)
+ return cname;
+ else
+ return componentName;
+ }
+ else
+ {
+ return null;
+ }
+
+ }
+
private IProject getProjectFromInitialSelection(IStructuredSelection selection)
{
if (selection != null && selection.size() == 1)
@@ -174,5 +194,32 @@ public class ObjectSelectionWidget extends AbstractObjectSelectionWidget impleme
}
}
return null;
- }
+ }
+
+ private String getComponentNameFromInitialSelection(IStructuredSelection selection)
+ {
+ if (selection != null && selection.size() == 1)
+ {
+ Object obj = selection.getFirstElement();
+ if (obj != null)
+ {
+ try
+ {
+ IResource resource = ResourceUtils.getResourceFromSelection(obj);
+ if (resource==null)
+ return null;
+ IProject p = ResourceUtils.getProjectOf(resource.getFullPath());
+ IVirtualComponent comp = ResourceUtils.getComponentOf(resource.getFullPath());
+ if (comp != null)
+ {
+ return comp.getName();
+ }
+ } catch(CoreException e)
+ {
+ return null;
+ }
+ }
+ }
+ return null;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java
index a504ef224..732006cef 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/object/WSDLSelectionWidget.java
@@ -46,6 +46,7 @@ import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
import org.eclipse.wst.command.internal.provisional.env.core.common.MessageUtils;
import org.eclipse.wst.command.internal.provisional.env.core.common.SimpleStatus;
import org.eclipse.wst.command.internal.provisional.env.core.common.Status;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.ws.internal.parser.discovery.WebServicesParserExt;
import org.eclipse.wst.ws.internal.parser.wsil.WebServiceEntity;
import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
@@ -335,6 +336,30 @@ public class WSDLSelectionWidget extends AbstractObjectSelectionWidget implement
return null;
}
+ public String getComponentName()
+ {
+ String wsdlURI = tree.getWsdlURI();
+ if (wsdlURI != null)
+ {
+ String cname = getComponentNameFromURI(wsdlURI);
+ if (cname!=null && cname.length()>0)
+ return cname;
+
+ String wsRelPath = webServiceURI.getText();
+ IResource wsRes = ResourceUtils.findResource(wsRelPath);
+ if (wsRes!=null && wsRes instanceof IFile)
+ {
+ IVirtualComponent comp = ResourceUtils.getComponentOf(wsRes.getFullPath());
+ if (comp!=null)
+ {
+ return comp.getName();
+ }
+ }
+
+ }
+ return null;
+ }
+
private IProject getProjectFromURI(String uri)
{
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
@@ -352,4 +377,25 @@ public class WSDLSelectionWidget extends AbstractObjectSelectionWidget implement
}
return null;
}
+
+ private String getComponentNameFromURI(String uri)
+ {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ String wkspcRootLoc = root.getLocation().toString();
+ int idx = uri.indexOf(wkspcRootLoc);
+ if (idx != -1)
+ {
+ String relPath = uri.substring(wkspcRootLoc.length()+idx);
+ IResource res = root.findMember(new Path(relPath));
+ if (res instanceof IFile)
+ {
+ IVirtualComponent comp = ResourceUtils.getComponentOf(res.getFullPath());
+ if (comp!=null)
+ {
+ return comp.getName();
+ }
+ }
+ }
+ return null;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
index acd3caaa6..21ca3b35d 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
@@ -75,6 +75,7 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand
// is not supported by any of the registered Web service runtimes.
private IStructuredSelection clientInitialSelection_;
private IProject clientInitialProject_;
+ private String clientInitialComponentName_;
private IStructuredSelection initialInitialSelection_;
private IProject initialInitialProject_;
@@ -475,7 +476,15 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand
if (clientInitialProject_ != null)
{
getRuntime2ClientTypes().getChoice().getChoice().getList().setSelectionValue(clientInitialProject_.getName());
- String moduleName = J2EEUtils.getFirstWebModuleName(clientInitialProject_);
+ String moduleName = null;
+ if (clientInitialComponentName_!=null && clientInitialComponentName_.length()>0)
+ {
+ moduleName = clientInitialComponentName_;
+ }
+ else
+ {
+ moduleName = J2EEUtils.getFirstWebModuleName(clientInitialProject_);
+ }
clientComponentName_ = moduleName;
String version = String.valueOf(J2EEUtils.getJ2EEVersion(clientInitialProject_, moduleName));
String[] validVersions = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(clientIds_.getRuntimeId()).getJ2eeLevels();
@@ -490,7 +499,7 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand
else
{
//Pick the first one
- IProject[] projects = ResourceUtils.getWorkspaceRoot().getProjects();
+ IProject[] projects = WebServiceRuntimeExtensionUtils.getProjectsByWebServiceType(clientIds_.getTypeId());
if (projects.length>0)
{
getRuntime2ClientTypes().getChoice().getChoice().getList().setSelectionValue(projects[0].getName());
@@ -811,6 +820,7 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand
if (clientInitialProject_ == null)
{
clientInitialProject_ = getProjectFromInitialSelection(selection);
+ clientInitialComponentName_ = getComponentNameFromInitialSelection(selection);
}
}
@@ -819,6 +829,11 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand
clientInitialProject_ = clientInitialProject;
}
+ public void setClientInitialComponentName(String name)
+ {
+ clientInitialComponentName_ = name;
+ }
+
/**
* @param initialInitialSelection_ The initialInitialSelection_ to set.
*/
@@ -868,6 +883,33 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends SimpleCommand
return null;
}
+ private String getComponentNameFromInitialSelection(IStructuredSelection selection)
+ {
+ if (selection != null && selection.size() == 1)
+ {
+ Object obj = selection.getFirstElement();
+ if (obj != null)
+ {
+ try
+ {
+ IResource resource = ResourceUtils.getResourceFromSelection(obj);
+ if (resource==null)
+ return null;
+
+ IVirtualComponent comp = ResourceUtils.getComponentOf(resource.getFullPath());
+ if (comp!=null)
+ {
+ return comp.getName();
+ }
+ } catch(CoreException e)
+ {
+ return null;
+ }
+ }
+ }
+ return null;
+ }
+
private String getClientProjectTypeFromRuntimeId(IProject p, String runtimeId)
{
//Navigate the runtimeClientTypes to see if we can navigate from the provided
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java
index bc4b62e02..df9363a62 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java
@@ -73,6 +73,8 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
private ModifyListener moduleListener_;
private ModifyListener earProjectListener_;
+ private String initialModuleName_;
+
/*
* CONTEXT_ID PWRS0006 for the service-side Web project combo box of the
* runtime selection Page
@@ -129,7 +131,7 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
{
public void modifyText(ModifyEvent evt)
{
- handleModuleProjectChanged();
+ handleModuleProjectChanged(null);
statusListener_.handleEvent( null );
}
};
@@ -171,7 +173,7 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
earProject_.removeModifyListener( earProjectListener_ );
}
- private void handleModuleProjectChanged()
+ private void handleModuleProjectChanged(String moduleName)
{
String projectName = moduleProject_.getText();
IProject project = ProjectUtilities.getProject( projectName );
@@ -187,15 +189,24 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
}
module_.setItems( modules );
-
- if( modules.length > 0 )
- {
- module_.setText( modules[0] );
- }
- else
- {
- module_.setText("");
- }
+
+ if( modules.length > 0 )
+ {
+ if (moduleName != null)
+ {
+ module_.setText(moduleName);
+ }
+ else
+ {
+ module_.setText( modules[0] );
+ }
+
+ }
+ else
+ {
+ module_.setText("");
+ }
+
}
private void handleModuleChanged()
@@ -276,7 +287,8 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
earProject_.setItems( projectNames );
earProject_.setText( selectedEarModuleProject );
- handleModuleProjectChanged();
+ handleModuleProjectChanged(initialModuleName_);
+ handleModuleChanged();
updateEAREnabledState();
listenersOn();
}
@@ -295,6 +307,7 @@ public class ProjectSelectionWidget extends SimpleWidgetDataContributor {
{
listenersOff();
module_.setText( name );
+ initialModuleName_ = name;
listenersOn();
}

Back to the top