use of com.liferay.ide.server.core.ILiferayServer 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();
}
}
use of com.liferay.ide.server.core.ILiferayServer in project liferay-ide by liferay.
the class PropertiesContentProvider method shouldAddChildren.
private boolean shouldAddChildren(Object parent) {
if (parent instanceof IServer) {
final IServer server = (IServer) parent;
final ILiferayServer liferayServer = (ILiferayServer) server.loadAdapter(ILiferayServer.class, null);
if (!(liferayServer instanceof IRemoteServer)) {
return true;
}
}
return false;
}
use of com.liferay.ide.server.core.ILiferayServer in project liferay-ide by liferay.
the class OpenPortalURLHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
final ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection) {
final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
final Object selected = structuredSelection.getFirstElement();
if (selected != null) {
if (selected instanceof IServer) {
final ILiferayServer portalServer = getLiferayServer(selected);
new Job(Msgs.openPortalUrl) {
@Override
protected IStatus run(IProgressMonitor monitor) {
openPortalURL(portalServer, selected);
return Status.OK_STATUS;
}
}.schedule();
}
}
}
return null;
}
use of com.liferay.ide.server.core.ILiferayServer in project liferay-ide by liferay.
the class KaleoCore method getKaleoConnection.
public static IKaleoConnection getKaleoConnection(ILiferayServer liferayServer) {
if (_kaleoConnections == null) {
_kaleoConnections = new HashMap<>();
IServerLifecycleListener serverLifecycleListener = new IServerLifecycleListener() {
public void serverAdded(IServer server) {
}
public void serverChanged(IServer server) {
}
public void serverRemoved(IServer s) {
ILiferayServer server = (ILiferayServer) s.loadAdapter(ILiferayServer.class, new NullProgressMonitor());
if (liferayServer.equals(server)) {
IKaleoConnection service = _kaleoConnections.get(liferayServer.getId());
if (service != null) {
service = null;
_kaleoConnections.put(liferayServer.getId(), null);
}
}
}
};
ServerCore.addServerLifecycleListener(serverLifecycleListener);
}
IKaleoConnection service = _kaleoConnections.get(liferayServer.getId());
if (service == null) {
service = new KaleoConnection();
updateKaleoConnectionSettings(liferayServer, service);
_kaleoConnections.put(liferayServer.getId(), service);
}
return service;
}
Aggregations