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; }