public static Object getRuntimeAdapter( org.eclipse.wst.common.project.facet.core.runtime.IRuntime facetRuntime, Class<?> adapterClass) { String runtimeId = facetRuntime.getProperty("id"); for (org.eclipse.wst.server.core.IRuntime runtime : ServerCore.getRuntimes()) { if (runtime.getId().equals(runtimeId)) { if (IRuntime.class.equals(adapterClass)) { return runtime; } IRuntimeWorkingCopy runtimeWC = null; if (!runtime.isWorkingCopy()) { runtimeWC = runtime.createWorkingCopy(); } else { runtimeWC = (IRuntimeWorkingCopy) runtime; } return (ILiferayRuntime) runtimeWC.loadAdapter(adapterClass, null); } } return null; }
public static ILiferayRuntime getLiferayRuntime(IRuntime runtime) { if (runtime != null) { return (ILiferayRuntime) runtime.createWorkingCopy().loadAdapter(ILiferayRuntime.class, null); } return null; }
public static IRuntimeWorkingCopy getRuntime(String runtimeTypeId, IPath location) { IRuntimeType runtimeType = ServerCore.findRuntimeType(runtimeTypeId); try { IRuntime runtime = runtimeType.createRuntime("runtime", null); IRuntimeWorkingCopy runtimeWC = runtime.createWorkingCopy(); runtimeWC.setName("Runtime"); runtimeWC.setLocation(location); return runtimeWC; } catch (CoreException e) { e.printStackTrace(); } return null; }