Search in sources :

Example 1 with ILiferayServer

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();
    }
}
Also used : LaunchOption(org.eclipse.wst.ws.internal.explorer.LaunchOption) MalformedURLException(java.net.MalformedURLException) ILiferayServer(com.liferay.ide.server.core.ILiferayServer) WSExplorerLauncherCommand(org.eclipse.wst.ws.internal.explorer.WSExplorerLauncherCommand) StringsFilteredDialog(com.liferay.ide.ui.dialog.StringsFilteredDialog) Vector(java.util.Vector) URL(java.net.URL) WebServicesHelper(com.liferay.ide.server.util.WebServicesHelper)

Example 2 with ILiferayServer

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;
}
Also used : IServer(org.eclipse.wst.server.core.IServer) ILiferayServer(com.liferay.ide.server.core.ILiferayServer) IRemoteServer(com.liferay.ide.server.remote.IRemoteServer)

Example 3 with ILiferayServer

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;
}
Also used : IServer(org.eclipse.wst.server.core.IServer) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IStatus(org.eclipse.core.runtime.IStatus) ILiferayServer(com.liferay.ide.server.core.ILiferayServer) ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Job(org.eclipse.core.runtime.jobs.Job)

Example 4 with ILiferayServer

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;
}
Also used : IServerLifecycleListener(org.eclipse.wst.server.core.IServerLifecycleListener) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServer(org.eclipse.wst.server.core.IServer) ILiferayServer(com.liferay.ide.server.core.ILiferayServer)

Aggregations

ILiferayServer (com.liferay.ide.server.core.ILiferayServer)4 IServer (org.eclipse.wst.server.core.IServer)3 IRemoteServer (com.liferay.ide.server.remote.IRemoteServer)1 WebServicesHelper (com.liferay.ide.server.util.WebServicesHelper)1 StringsFilteredDialog (com.liferay.ide.ui.dialog.StringsFilteredDialog)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 Vector (java.util.Vector)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 IServerLifecycleListener (org.eclipse.wst.server.core.IServerLifecycleListener)1 LaunchOption (org.eclipse.wst.ws.internal.explorer.LaunchOption)1 WSExplorerLauncherCommand (org.eclipse.wst.ws.internal.explorer.WSExplorerLauncherCommand)1