use of com.liferay.ide.project.core.model.ParentSDKProjectImportOp in project liferay-ide by liferay.
the class SDKImportValidationService method compute.
@Override
protected Status compute() {
Status retval = Status.createOkStatus();
ParentSDKProjectImportOp op = _op();
try {
SDK sdk = SDKUtil.getWorkspaceSDK();
if (sdk != null) {
return StatusBridge.create(ProjectCore.createErrorStatus(" This workspace already has another sdk."));
}
Path currentProjectLocation = op.getSdkLocation().content(true);
if ((currentProjectLocation != null) && !currentProjectLocation.isEmpty()) {
sdk = SDKUtil.createSDKFromLocation(PathBridge.create(currentProjectLocation));
if (sdk != null) {
IStatus sdkStatus = sdk.validate(true);
if (!sdkStatus.isOK()) {
retval = StatusBridge.create(ProjectCore.createWarningStatus(sdkStatus.getChildren()[0].getMessage()));
}
} else {
retval = StatusBridge.create(ProjectCore.createErrorStatus("This parent sdk project path is invalid."));
}
}
} catch (CoreException ce) {
}
return retval;
}
use of com.liferay.ide.project.core.model.ParentSDKProjectImportOp in project liferay-ide by liferay.
the class SDKImportDerivedValueService method initDerivedValueService.
@Override
protected void initDerivedValueService() {
super.initDerivedValueService();
_listener = new FilteredListener<PropertyContentEvent>() {
@Override
protected void handleTypedEvent(PropertyContentEvent event) {
refresh();
}
};
ParentSDKProjectImportOp op = _op();
op.property(ParentSDKProjectImportOp.PROP_SDK_LOCATION).attach(_listener);
}
use of com.liferay.ide.project.core.model.ParentSDKProjectImportOp in project liferay-ide by liferay.
the class SDKImportDerivedValueService method compute.
@Override
protected String compute() {
String retVal = null;
ParentSDKProjectImportOp op = _op();
Value<Path> path = op.getSdkLocation();
if ((path != null) && (path.content() != null) && !path.content().isEmpty()) {
Path sdkPath = path.content();
SDK sdk = SDKUtil.createSDKFromLocation(PathBridge.create(sdkPath));
if (sdk != null) {
retVal = sdk.getVersion();
}
}
return retVal;
}
use of com.liferay.ide.project.core.model.ParentSDKProjectImportOp in project liferay-ide by liferay.
the class SDKImportDerivedValueService method dispose.
@Override
public void dispose() {
ParentSDKProjectImportOp op = _op();
if (op != null) {
op.property(ParentSDKProjectImportOp.PROP_SDK_LOCATION).detach(_listener);
}
super.dispose();
}
Aggregations