Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Getting Server Runtime ClasspathEntry
Getting Server Runtime ClasspathEntry [message #222559] Thu, 02 October 2008 12:08 Go to next message
Philippe Sabourin is currently offline Philippe Sabourin
Messages: 28
Registered: July 2009
Junior Member
I'm trying to add a server runtime to a Java Project, and have been able
to using a static string:
org.eclipse.jst.server.core.container/org.eclipse.jst.server .tomcat.runtimeTarget/[RUNTIME
NAME] but I haven't figured out how to get this full string
programmatically. The only part I can get from the runtime (or the utility
classes) is the name. Is there any way to get that full string or a
prebuilt classpathentry object I can just insert into my class path (using
setRawClasspath).

Thanks,
Philippe
Re: Getting Server Runtime ClasspathEntry [message #222562 is a reply to message #222559] Thu, 02 October 2008 14:20 Go to previous message
Philippe Sabourin is currently offline Philippe Sabourin
Messages: 28
Registered: July 2009
Junior Member
Found the solution in ServerClasspathContainerPage
(org.eclipse.jst.server.ui.internal).

IRuntime[] runtimes = ServerCore.getRuntimes();
for (IRuntime runtime : runtimes) {
if (runtime.getRuntimeType() != null) {
RuntimeClasspathProviderWrapper rcpw =
JavaServerPlugin.findRuntimeClasspathProvider(runtime.getRun timeType());
if (rcpw != null) {
IPath serverContainerPath = new
Path(RuntimeClasspathContainer.SERVER_CONTAINER)
.append(rcpw.getId()).append(runtime.getId());
runtimeMap.put(runtime,
JavaCore.newContainerEntry(serverContainerPath));
}
}
}

This seems to work.
Previous Topic:Why does completion work with a DTD, but not with a schema?
Next Topic:Disable HTML validation for javadoc
Goto Forum:
  


Current Time: Thu Jul 31 15:54:27 EDT 2014

Powered by FUDForum. Page generated in 0.01612 seconds