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);
}
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();
}
}
}
}
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();
}
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();
}
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();
}
Aggregations