use of org.eclipse.wst.common.project.facet.core.runtime.internal.BridgedRuntime in project liferay-ide by liferay.
the class BinaryProjectImportOperation method execute.
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Object selectedProjects = getDataModel().getProperty(ISDKProjectsImportDataModelProperties.SELECTED_PROJECTS);
BridgedRuntime bridgedRuntime = (BridgedRuntime) model.getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
String sdkLocation = model.getStringProperty(ISDKProjectsImportDataModelProperties.SDK_LOCATION);
if (selectedProjects == null) {
return super.execute(monitor, info);
}
SDKManager sdkManager = SDKManager.getInstance();
SDK liferaySDK = sdkManager.getSDK(new Path(sdkLocation));
Object[] seleBinaryRecords = (Object[]) selectedProjects;
ProjectRecord[] projectRecords = new ProjectRecord[1];
BinaryProjectRecord pluginBinaryRecord = (BinaryProjectRecord) seleBinaryRecords[0];
try {
projectRecords[0] = ProjectImportUtil.createSDKPluginProject(bridgedRuntime, pluginBinaryRecord, liferaySDK);
} catch (Exception e) {
throw new ExecutionException("Error while importing Binary:" + pluginBinaryRecord.getBinaryName(), e);
}
getDataModel().setProperty(SELECTED_PROJECTS, projectRecords);
return super.execute(monitor, info);
}
use of org.eclipse.wst.common.project.facet.core.runtime.internal.BridgedRuntime in project liferay-ide by liferay.
the class SDKProjectsImportDataModelProvider method _compareSDKRuntimeVersion.
private boolean _compareSDKRuntimeVersion(String sdkVersion, Object runtime) {
if ((sdkVersion == null) && !(runtime instanceof BridgedRuntime)) {
return false;
}
try {
Version liferaySdkVersion = new Version(sdkVersion);
String runtimeVersion = ServerUtil.getLiferayRuntime((BridgedRuntime) runtime).getPortalVersion();
Version liferayRuntimeVersion = new Version(runtimeVersion);
if ((liferaySdkVersion.getMajor() == liferayRuntimeVersion.getMajor()) && (liferaySdkVersion.getMinor() == liferayRuntimeVersion.getMinor())) {
return true;
}
return false;
} catch (Exception e) {
LiferayCore.logError("invalid sdk or runtime version ", e);
return false;
}
}
Aggregations