use of org.eclipse.wst.server.core.IRuntimeType in project sling by apache.
the class SlingWstServer method before.
@Override
protected void before() throws Throwable {
IRuntimeType launchpadRuntime = null;
for (IRuntimeType type : ServerCore.getRuntimeTypes()) {
if ("org.apache.sling.ide.launchpadRuntimeType".equals(type.getId())) {
launchpadRuntime = type;
break;
}
}
if (launchpadRuntime == null) {
throw new IllegalArgumentException("No runtime of type 'org.apache.sling.ide.launchpadRuntimeType' found");
}
IRuntimeWorkingCopy rtwc = launchpadRuntime.createRuntime("temp.sling.launchpad.rt.id", new NullProgressMonitor());
rtwc.save(true, new NullProgressMonitor());
IServerType serverType = null;
for (IServerType type : ServerCore.getServerTypes()) {
if ("org.apache.sling.ide.launchpadServer".equals(type.getId())) {
serverType = type;
break;
}
}
if (serverType == null) {
throw new IllegalArgumentException("No server type of type 'org.apache.sling.ide.launchpadServer' found");
}
IServerWorkingCopy wc = serverType.createServer("temp.sling.launchpad.server.id", null, new NullProgressMonitor());
wc.setHost(config.getHostname());
wc.setAttribute(ISlingLaunchpadServer.PROP_PORT, config.getPort());
wc.setAttribute(ISlingLaunchpadServer.PROP_CONTEXT_PATH, config.getContextPath());
wc.setAttribute(ISlingLaunchpadServer.PROP_USERNAME, config.getUsername());
wc.setAttribute(ISlingLaunchpadServer.PROP_PASSWORD, config.getPassword());
wc.setAttribute("auto-publish-time", 0);
server = wc.save(true, new NullProgressMonitor());
}
use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class TomcatRuntimeLocator method getRuntimeFromDir.
protected static IRuntimeWorkingCopy getRuntimeFromDir(File dir, IProgressMonitor monitor) {
for (int i = 0; i < runtimeTypes.length; i++) {
try {
IRuntimeType runtimeType = ServerCore.findRuntimeType(runtimeTypes[i]);
String absolutePath = dir.getAbsolutePath();
String id = absolutePath.replace(File.separatorChar, '_').replace(':', '-');
IRuntimeWorkingCopy runtime = runtimeType.createRuntime(id, monitor);
runtime.setName(dir.getName());
runtime.setLocation(new Path(absolutePath));
ITomcatRuntimeWorkingCopy wc = (ITomcatRuntimeWorkingCopy) runtime.loadAdapter(ITomcatRuntimeWorkingCopy.class, null);
wc.setVMInstall(JavaRuntime.getDefaultVMInstall());
IStatus status = runtime.validate(monitor);
if (status == null || status.getSeverity() != IStatus.ERROR)
return runtime;
Trace.trace(Trace.FINER, "False runtime found at " + dir.getAbsolutePath() + ": " + status.getMessage());
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Could not find runtime", e);
}
}
return null;
}
use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class GenericServerRuntimeWizardFragment method createName.
private String createName() {
RuntimeDelegate dl = getRuntimeDelegate();
IRuntimeType runtimeType = dl.getRuntime().getRuntimeType();
String name = NLS.bind(GenericServerUIMessages.runtimeName, runtimeType.getName());
IRuntime[] list = ServerCore.getRuntimes();
int suffix = 1;
String suffixName = name;
for (int i = 0; i < list.length; i++) {
if ((list[i].getName().equals(name) || list[i].getName().equals(suffixName)) && !list[i].equals(dl.getRuntime()))
suffix++;
suffixName = name + ' ' + suffix;
}
if (suffix > 1)
return suffixName;
return name;
}
use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class RuntimeBridge method getExportedRuntimeNames.
public Set<String> getExportedRuntimeNames() throws CoreException {
IRuntime[] runtimes = ServerCore.getRuntimes();
Set<String> result = new HashSet<String>(runtimes.length);
for (int i = 0; i < runtimes.length; i++) {
IRuntime runtime = runtimes[i];
IRuntimeType runtimeType = runtime.getRuntimeType();
if (runtimeType != null && mappings.containsKey(runtimeType.getId())) {
result.add(runtime.getId());
}
}
return result;
}
use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class RuntimeTreeLabelProvider method getImageImpl.
/**
*/
protected Image getImageImpl(Object element) {
IRuntime runtime = (IRuntime) element;
IRuntimeType runtimeType = runtime.getRuntimeType();
if (runtimeType != null) {
Image image = ImageResource.getImage(runtimeType.getId());
if (decorator != null) {
Image dec = decorator.decorateImage(image, element);
if (dec != null)
return dec;
}
return image;
}
return null;
}
Aggregations