use of org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent in project webtools.sourceediting by eclipse.
the class ProductManager method getMatchingRuntime.
private static IRuntime getMatchingRuntime(String defaultProductRuntimeProperty, Set<IRuntime> runtimes) {
String defaultProductRuntimeKey = getProperty(defaultProductRuntimeProperty);
if (defaultProductRuntimeKey == null || defaultProductRuntimeKey.length() == 0) {
return null;
}
// The defaultProductRuntimeKey needs to be in the following format
// <facet runtime id>:<facet version>.
int seperatorIndex = defaultProductRuntimeKey.indexOf(RUNTIME_SEPARATOR);
if (seperatorIndex < 0 && seperatorIndex < defaultProductRuntimeKey.length()) {
// Consider throwing an exception here.
// $NON-NLS-1$
WSTWebPlugin.logError("Invalid default product runtime id. It should follow the format <facet runtime id>:<facet version>. Id processed: " + defaultProductRuntimeKey);
return null;
}
String defaultRuntimeID = defaultProductRuntimeKey.substring(0, seperatorIndex);
String defaultFacetVersion = defaultProductRuntimeKey.substring(seperatorIndex + 1);
for (Iterator<IRuntime> runtimeIt = runtimes.iterator(); runtimeIt.hasNext(); ) {
IRuntime runtime = runtimeIt.next();
List<IRuntimeComponent> runtimeComps = runtime.getRuntimeComponents();
if (!runtimeComps.isEmpty()) {
for (Iterator<IRuntimeComponent> compsIter = runtimeComps.iterator(); compsIter.hasNext(); ) {
IRuntimeComponent runtimeComp = compsIter.next();
if (defaultRuntimeID.equals(runtimeComp.getRuntimeComponentType().getId()) && (defaultFacetVersion.equals(runtimeComp.getRuntimeComponentVersion().getVersionString()))) {
return runtime;
}
}
}
}
// No matches found.
return null;
}
use of org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent in project webtools.sourceediting by eclipse.
the class DataModelFacetCreationWizardPage method handlePrimaryFacetVersionSelectedEvent.
protected void handlePrimaryFacetVersionSelectedEvent() {
final IProjectFacetVersion fv = getPrimaryFacetVersion();
if (fv != null) {
String presetID = null;
IRuntime runtime = (IRuntime) model.getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
if (runtime != null) {
if (runtime.getRuntimeComponents().size() > 0) {
IRuntimeComponent runtimeComponent = runtime.getRuntimeComponents().get(0);
String facetRuntimeTypeID = runtimeComponent.getRuntimeComponentType().getId();
String facetRuntimeVersion = runtimeComponent.getRuntimeComponentVersion().getVersionString();
String facetID = fv.getProjectFacet().getId();
String facetVersion = fv.getVersionString();
presetID = RuntimePresetMappingRegistry.INSTANCE.getPresetID(facetRuntimeTypeID, facetRuntimeVersion, facetID, facetVersion);
}
}
if (presetID == null) {
final Set<IProjectFacetVersion> facets = getFacetConfiguration(fv);
this.fpjwc.setProjectFacets(facets);
} else {
// setting the facets prior to setting the preset is to let the dynamic presets adjust
final Set<IProjectFacetVersion> facets = getFacetConfiguration(fv);
this.fpjwc.setProjectFacets(facets);
this.fpjwc.setSelectedPreset(presetID);
}
}
}
use of org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent in project webtools.servertools by eclipse.
the class JRERuntimeComponentProvider method getRuntimeComponents.
public List<IRuntimeComponent> getRuntimeComponents(IRuntime runtime) {
// define JRE component
IJavaRuntime javaRuntime = (IJavaRuntime) runtime.loadAdapter(IJavaRuntime.class, null);
if (javaRuntime != null) {
final IVMInstall vmInstall = javaRuntime.getVMInstall();
final IRuntimeComponent rc = StandardJreRuntimeComponent.create(vmInstall);
return Collections.singletonList(rc);
}
return null;
}
Aggregations