use of org.eclipse.wst.ws.internal.explorer.WSExplorerLauncherCommand in project liferay-ide by liferay.
the class TestWebServicesAction method run.
public void run(IAction action) {
if (selectedServer == null && selectedModule == null) {
// can't do anything if server has not been selected
return;
}
URL webServicesListURL = null;
String[] names = null;
WebServicesHelper helper = null;
if (selectedServer != null) {
ILiferayServer portalServer = (ILiferayServer) selectedServer.loadAdapter(ILiferayServer.class, null);
webServicesListURL = portalServer.getWebServicesListURL();
helper = new WebServicesHelper(webServicesListURL);
names = helper.getWebServiceNames();
} else if (selectedModule != null) {
selectedModule.getModule()[0].getProject();
ILiferayServer portalServer = (ILiferayServer) selectedModule.getServer().loadAdapter(ILiferayServer.class, null);
try {
webServicesListURL = // $NON-NLS-1$
new URL(portalServer.getPortalHomeUrl(), selectedModule.getModule()[0].getName() + "/axis");
} catch (MalformedURLException e) {
LiferayServerUI.logError(e);
return;
}
helper = new WebServicesHelper(webServicesListURL);
names = helper.getWebServiceNames();
if (ListUtil.isEmpty(names)) {
try {
webServicesListURL = // $NON-NLS-1$
new URL(portalServer.getPortalHomeUrl(), selectedModule.getModule()[0].getName() + "/api/axis");
} catch (MalformedURLException e) {
LiferayServerUI.logError(e);
return;
}
helper = new WebServicesHelper(webServicesListURL);
names = helper.getWebServiceNames();
}
}
StringsFilteredDialog dialog = new StringsFilteredDialog(getActiveShell());
dialog.setTitle(Msgs.webServiceSelection);
dialog.setMessage(Msgs.selectWebService);
dialog.setInput(names);
int retval = dialog.open();
if (retval == Window.OK) {
String serviceName = dialog.getFirstResult().toString();
String url = helper.getWebServiceWSDLURLByName(serviceName);
String stateLocation = ExplorerPlugin.getInstance().getPluginStateLocation();
String defaultFavoritesLocation = ExplorerPlugin.getInstance().getDefaultFavoritesLocation();
WSExplorerLauncherCommand command = new WSExplorerLauncherCommand();
command.setForceLaunchOutsideIDE(false);
Vector launchOptions = new Vector();
addLaunchOptions(launchOptions, url, stateLocation, defaultFavoritesLocation);
command.setLaunchOptions((LaunchOption[]) launchOptions.toArray(new LaunchOption[0]));
command.execute();
}
}
Aggregations