use of org.eclipse.wst.server.core.internal.ServerWorkingCopy in project webtools.servertools by eclipse.
the class SetServerStopTimeoutCommand method execute.
/**
* Execute the command.
*/
public void execute() {
ServerWorkingCopy swc = (ServerWorkingCopy) server;
oldTime = swc.getStopTimeout();
swc.setStopTimeout(time);
}
use of org.eclipse.wst.server.core.internal.ServerWorkingCopy in project webtools.servertools by eclipse.
the class NewRuntimeWizardFragment method createChildFragments.
protected void createChildFragments(List<WizardFragment> list) {
if (getTaskModel() == null)
return;
Object runtime = getTaskModel().getObject(TaskModel.TASK_RUNTIME);
if (runtime == null)
return;
WizardFragment sub = null;
if (runtime instanceof IRuntimeWorkingCopy)
sub = getWizardFragment(((RuntimeWorkingCopy) runtime).getRuntimeType().getId());
else if (runtime instanceof RuntimeTypeWithServerProxy)
sub = getWizardFragment(((RuntimeTypeWithServerProxy) runtime).getId());
if (sub != null)
list.add(sub);
Object serverObj = getTaskModel().getObject(TaskModel.TASK_SERVER);
if (serverObj != null && serverObj instanceof IServerWorkingCopy) {
IServerWorkingCopy server = (IServerWorkingCopy) serverObj;
if (server.getServerType().hasServerConfiguration() && server instanceof ServerWorkingCopy) {
ServerWorkingCopy swc = (ServerWorkingCopy) server;
try {
if (runtime instanceof IRuntimeWorkingCopy) {
RuntimeWorkingCopy runtimeWorkingCopy = (RuntimeWorkingCopy) runtime;
if (runtimeWorkingCopy.getLocation() != null && !runtimeWorkingCopy.getLocation().isEmpty())
swc.importRuntimeConfiguration(runtimeWorkingCopy, null);
}
} catch (CoreException ce) {
// ignore
}
}
list.add(new WizardFragment() {
public void enter() {
IRuntimeWorkingCopy runtime2 = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
IServerWorkingCopy server2 = (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER);
server2.setRuntime(runtime2);
}
});
sub = getWizardFragment(server.getServerType().getId());
if (sub != null)
list.add(sub);
list.add(WizardTaskUtil.SaveServerFragment);
}
}
use of org.eclipse.wst.server.core.internal.ServerWorkingCopy in project webtools.servertools by eclipse.
the class PasteAction method run.
/**
* Implementation of method defined on <code>IAction</code>.
*/
public void run() {
ServerTransfer serverTransfer = ServerTransfer.getInstance();
IServer[] servers = (IServer[]) clipboard.getContents(serverTransfer);
if (servers == null)
return;
int size = servers.length;
for (int i = 0; i < size; i++) {
try {
IServerWorkingCopy wc = servers[i].createWorkingCopy();
((ServerWorkingCopy) wc).disassociate();
// sets the name from the current one so that the
wc.setName("Temp");
// default name generation will work
ServerUtil.setServerDefaultName(wc);
wc.save(false, null);
} catch (CoreException ce) {
if (Trace.SEVERE) {
Trace.trace(Trace.STRING_SEVERE, "Failure to copy server", ce);
}
}
}
}
use of org.eclipse.wst.server.core.internal.ServerWorkingCopy in project liferay-ide by liferay.
the class ServerNameChangeTests method testPortalServiceDelegate62Name.
@Test
public void testPortalServiceDelegate62Name() throws Exception {
if (shouldSkipBundleTests())
return;
IServerType portalServer62Type = ServerCore.findServerType("com.liferay.ide.eclipse.server.tomcat.7062");
assertNotNull(portalServer62Type);
IProgressMonitor monitor = new NullProgressMonitor();
IServerWorkingCopy newServer = portalServer62Type.createServer(null, null, monitor);
assertNotNull(newServer);
newServer.setRuntime(ServerUtil.getRuntime(getTomcat62RuntimeName()));
((ServerWorkingCopy) newServer).setDefaults(null);
assertEquals("Liferay CE Tomcat62 at localhost", newServer.getName());
newServer.setRuntime(ServerUtil.getRuntime(getTomcat62DumyRuntimeName()));
((ServerWorkingCopy) newServer).setDefaults(null);
assertEquals("Liferay CE Tomcat62 Dumy at localhost", newServer.getName());
}
use of org.eclipse.wst.server.core.internal.ServerWorkingCopy in project liferay-ide by liferay.
the class ServerNameChangeTests method testPortalServiceDelegateName.
@Test
public void testPortalServiceDelegateName() throws Exception {
if (shouldSkipBundleTests())
return;
IServerType portalServerType = ServerCore.findServerType(PortalServer.ID);
assertNotNull(portalServerType);
IProgressMonitor monitor = new NullProgressMonitor();
IServerWorkingCopy newServer = portalServerType.createServer(null, null, monitor);
assertNotNull(newServer);
newServer.setRuntime(ServerUtil.getRuntime(getTomcatRuntimeName()));
((ServerWorkingCopy) newServer).setDefaults(null);
assertEquals("Liferay CE GA5 Tomcat at localhost", newServer.getName());
newServer.setRuntime(ServerUtil.getRuntime(getWildflyRuntimeName()));
((ServerWorkingCopy) newServer).setDefaults(null);
assertEquals("Liferay CE GA5 Wildfly at localhost", newServer.getName());
}
Aggregations