Search in sources :

Example 46 with IServer

use of org.eclipse.wst.server.core.IServer in project webtools.servertools by eclipse.

the class GlobalDeleteAction method selectionChanged.

@Override
public void selectionChanged(IStructuredSelection sel) {
    if (sel.isEmpty()) {
        setEnabled(false);
        return;
    }
    boolean enabled = false;
    Iterator iterator = sel.iterator();
    while (iterator.hasNext()) {
        Object obj = iterator.next();
        if (obj instanceof IServer) {
            IServer server = (IServer) obj;
            if (accept(server))
                enabled = true;
        } else if (obj instanceof ModuleServer) {
            ModuleServer ms = (ModuleServer) obj;
            if (accept(ms))
                enabled = true;
        } else {
            setEnabled(false);
            return;
        }
    }
    setEnabled(enabled);
}
Also used : IServer(org.eclipse.wst.server.core.IServer) Iterator(java.util.Iterator)

Example 47 with IServer

use of org.eclipse.wst.server.core.IServer in project webtools.servertools by eclipse.

the class GlobalDeleteAction method run.

@Override
public void run() {
    IStructuredSelection sel = getStructuredSelection();
    // filter the selection
    if (!sel.isEmpty()) {
        Object firstElement = sel.getFirstElement();
        if (sel.size() == 1 && firstElement instanceof IServer) {
            deleteServer((IServer) firstElement);
        } else {
            ArrayList<IModule> moduleList = getRemovableModuleList(sel);
            if (moduleList != null) {
                IServer s = ((ModuleServer) firstElement).getServer();
                IModule[] asArray = moduleList.toArray(new IModule[moduleList.size()]);
                new RemoveModuleAction(shell, s, asArray).run();
            }
        }
    }
}
Also used : IServer(org.eclipse.wst.server.core.IServer) IModule(org.eclipse.wst.server.core.IModule) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 48 with IServer

use of org.eclipse.wst.server.core.IServer in project webtools.servertools by eclipse.

the class PublishTestCase method testPublish.

public void testPublish() throws Exception {
    Dimension[] dims = new Dimension[] { Dimension.ELAPSED_PROCESS, Dimension.USED_JAVA_HEAP };
    tagAsSummary("Publish to Tomcat", dims);
    IServer server = AbstractTomcatServerTestCase.server;
    IServerWorkingCopy wc = server.createWorkingCopy();
    int size = CreateModulesTestCase.NUM_MODULES;
    IModule[] modules = new IModule[size];
    for (int i = 0; i < size; i++) modules[i] = ModuleHelper.getModule(CreateModulesTestCase.WEB_MODULE_NAME + i);
    wc.modifyModules(modules, null, null);
    wc.save(true, null);
    startMeasuring();
    server.publish(IServer.PUBLISH_FULL, null);
    stopMeasuring();
    commitMeasurements();
    assertPerformance();
}
Also used : IServer(org.eclipse.wst.server.core.IServer) IModule(org.eclipse.wst.server.core.IModule) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) Dimension(org.eclipse.test.performance.Dimension)

Example 49 with IServer

use of org.eclipse.wst.server.core.IServer in project webtools.servertools by eclipse.

the class PublishHugeModuleTestCase method testHugePublish.

public void testHugePublish() throws Exception {
    Dimension[] dims = new Dimension[] { Dimension.ELAPSED_PROCESS, Dimension.USED_JAVA_HEAP };
    tagAsSummary("Publish huge module to Tomcat", dims);
    IServer server = AbstractTomcatServerTestCase.server;
    IServerWorkingCopy wc = server.createWorkingCopy();
    // remove previous apps
    IModule[] remove = server.getModules();
    wc.modifyModules(null, remove, null);
    wc.save(true, null);
    server.publish(IServer.PUBLISH_FULL, null);
    for (int i = 0; i < 5; i++) {
        // add huge app
        IModule[] add = new IModule[1];
        add[0] = ModuleHelper.getModule(CreateHugeModuleTestCase.WEB_MODULE_NAME);
        wc.modifyModules(add, null, null);
        wc.save(true, null);
        // publish huge app
        startMeasuring();
        server.publish(IServer.PUBLISH_FULL, null);
        stopMeasuring();
        // remove huge app and republish
        remove = server.getModules();
        wc.modifyModules(null, add, null);
        wc.save(true, null);
        server.publish(IServer.PUBLISH_FULL, null);
    }
    commitMeasurements();
    assertPerformance();
}
Also used : IServer(org.eclipse.wst.server.core.IServer) IModule(org.eclipse.wst.server.core.IModule) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) Dimension(org.eclipse.test.performance.Dimension)

Example 50 with IServer

use of org.eclipse.wst.server.core.IServer in project webtools.servertools by eclipse.

the class OpenEditorAgainTestCase method testOpenEditor.

public void testOpenEditor() throws Exception {
    Dimension[] dims = new Dimension[] { Dimension.ELAPSED_PROCESS, Dimension.USED_JAVA_HEAP };
    tagAsSummary("Open Tomcat editor again", dims);
    for (int i = 0; i < 5; i++) {
        startMeasuring();
        IServer server = getFirstServer(getServerTypeId());
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        IEditorPart editor = page.openEditor(new ServerEditorInput(server.getId()), SERVER_EDITOR_ID, true);
        stopMeasuring();
        page.closeEditor(editor, false);
    }
    commitMeasurements();
    assertPerformance();
}
Also used : IServer(org.eclipse.wst.server.core.IServer) ServerEditorInput(org.eclipse.wst.server.ui.internal.editor.ServerEditorInput) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) Dimension(org.eclipse.test.performance.Dimension) IEditorPart(org.eclipse.ui.IEditorPart)

Aggregations

IServer (org.eclipse.wst.server.core.IServer)183 CoreException (org.eclipse.core.runtime.CoreException)39 IModule (org.eclipse.wst.server.core.IModule)32 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)30 Test (org.junit.Test)30 IProject (org.eclipse.core.resources.IProject)25 IStatus (org.eclipse.core.runtime.IStatus)25 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)23 ArrayList (java.util.ArrayList)20 File (java.io.File)17 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)13 Status (org.eclipse.core.runtime.Status)12 Iterator (java.util.Iterator)11 IPath (org.eclipse.core.runtime.IPath)11 IServerType (org.eclipse.wst.server.core.IServerType)11 CDKServer (org.jboss.tools.openshift.cdk.server.core.internal.adapter.CDKServer)11 IOException (java.io.IOException)10 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)10 Server (org.eclipse.wst.server.core.internal.Server)10 IFolder (org.eclipse.core.resources.IFolder)8