Search in sources :

Example 1 with ParentSDKProjectImportOp

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;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.sapphire.modeling.Status) Path(org.eclipse.sapphire.modeling.Path) IStatus(org.eclipse.core.runtime.IStatus) CoreException(org.eclipse.core.runtime.CoreException) ParentSDKProjectImportOp(com.liferay.ide.project.core.model.ParentSDKProjectImportOp) SDK(com.liferay.ide.sdk.core.SDK)

Example 2 with ParentSDKProjectImportOp

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);
}
Also used : PropertyContentEvent(org.eclipse.sapphire.PropertyContentEvent) ParentSDKProjectImportOp(com.liferay.ide.project.core.model.ParentSDKProjectImportOp)

Example 3 with ParentSDKProjectImportOp

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;
}
Also used : Path(org.eclipse.sapphire.modeling.Path) ParentSDKProjectImportOp(com.liferay.ide.project.core.model.ParentSDKProjectImportOp) SDK(com.liferay.ide.sdk.core.SDK)

Example 4 with ParentSDKProjectImportOp

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();
}
Also used : ParentSDKProjectImportOp(com.liferay.ide.project.core.model.ParentSDKProjectImportOp)

Aggregations

ParentSDKProjectImportOp (com.liferay.ide.project.core.model.ParentSDKProjectImportOp)4 SDK (com.liferay.ide.sdk.core.SDK)2 Path (org.eclipse.sapphire.modeling.Path)2 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1 PropertyContentEvent (org.eclipse.sapphire.PropertyContentEvent)1 Status (org.eclipse.sapphire.modeling.Status)1