Search in sources :

Example 21 with ModuleServer

use of org.eclipse.wst.server.ui.internal.view.servers.ModuleServer in project liferay-ide by liferay.

the class RedeployAction method selectionChanged.

@Override
public void selectionChanged(IAction action, ISelection selection) {
    boolean validServerState = true;
    if (!selection.isEmpty()) {
        final List<ModuleServer> newModules = new ArrayList<>();
        if (selection instanceof IStructuredSelection) {
            final IStructuredSelection obj = (IStructuredSelection) selection;
            final Iterator selectionIterator = obj.iterator();
            while (selectionIterator.hasNext()) {
                ModuleServer moduleServer = (ModuleServer) selectionIterator.next();
                newModules.add(moduleServer);
                validServerState = validServerState && ((moduleServer.getServer().getServerState() & getRequiredServerState()) > 0);
            }
            this.selectedModules = newModules.toArray(new ModuleServer[0]);
            action.setEnabled(validServerState);
        }
    }
}
Also used : ModuleServer(org.eclipse.wst.server.ui.internal.view.servers.ModuleServer) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

ModuleServer (org.eclipse.wst.server.ui.internal.view.servers.ModuleServer)21 IModule (org.eclipse.wst.server.core.IModule)8 IServer (org.eclipse.wst.server.core.IServer)7 IProject (org.eclipse.core.resources.IProject)5 ILiferayServerBehavior (com.liferay.ide.server.core.ILiferayServerBehavior)3 ArrayList (java.util.ArrayList)3 CoreException (org.eclipse.core.runtime.CoreException)3 IStatus (org.eclipse.core.runtime.IStatus)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 Image (org.eclipse.swt.graphics.Image)2 Iterator (java.util.Iterator)1 List (java.util.List)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 IFile (org.eclipse.core.resources.IFile)1 IMarker (org.eclipse.core.resources.IMarker)1 IPath (org.eclipse.core.runtime.IPath)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1 ILabelProvider (org.eclipse.jface.viewers.ILabelProvider)1 ISelection (org.eclipse.jface.viewers.ISelection)1