Search in sources :

Example 66 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class ProjectNameListener method handleTypedEvent.

@Override
protected void handleTypedEvent(PropertyContentEvent event) {
    NewLiferayPluginProjectOp op = op(event);
    op.setImportProjectStatus(false);
    NewLiferayPluginProjectOpMethods.updateLocation(op);
}
Also used : NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)

Example 67 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class ProjectNameValidationService method dispose.

@Override
public void dispose() {
    super.dispose();
    NewLiferayPluginProjectOp op = _op();
    op.detach(_listener, "*");
}
Also used : NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)

Example 68 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class PluginTypeValidationService method compute.

@Override
protected Status compute() {
    Status retval = Status.createOkStatus();
    NewLiferayPluginProjectOp op = _op();
    try {
        SDK sdk = SDKUtil.getWorkspaceSDK();
        if (sdk == null) {
            Path sdkLocation = op.getSdkLocation().content();
            if (sdkLocation != null) {
                sdk = SDKUtil.createSDKFromLocation(PathBridge.create(sdkLocation));
            }
        }
        PluginType pluginType = op.getPluginType().content();
        if (sdk != null) {
            if (pluginType.equals(PluginType.web) && !supportsTypePlugin(op, "web")) {
                StringBuilder sb = new StringBuilder();
                sb.append("The selected Plugins SDK does not support creating new web type plugins. ");
                sb.append("");
                sb.append("Please configure version 7.0 or greater.");
                return Status.createErrorStatus(sb.toString());
            } else if (pluginType.equals(PluginType.theme) && !supportsTypePlugin(op, "theme")) {
                StringBuilder sb = new StringBuilder();
                sb.append("The selected Plugins SDK does not support creating theme type plugins. ");
                sb.append("");
                sb.append("Please configure version 6.2 or less or using gulp way.");
                return Status.createErrorStatus(sb.toString());
            } else if (pluginType.equals(PluginType.ext) && !supportsTypePlugin(op, "ext")) {
                StringBuilder sb = new StringBuilder();
                sb.append("The selected Plugins SDK does not support creating ext type plugins. ");
                sb.append("");
                sb.append("Please try to confirm whether sdk has ext folder.");
                return Status.createErrorStatus(sb.toString());
            }
        } else if (pluginType.equals(PluginType.ext) && !supportsTypePlugin(op, "ext")) {
            retval = Status.createErrorStatus("New ext plugins with maven build type are no longer supported.");
        }
    } catch (CoreException ce) {
    }
    return retval;
}
Also used : Status(org.eclipse.sapphire.modeling.Status) Path(org.eclipse.sapphire.modeling.Path) CoreException(org.eclipse.core.runtime.CoreException) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) SDK(com.liferay.ide.sdk.core.SDK) PluginType(com.liferay.ide.project.core.model.PluginType)

Example 69 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class PortletFrameworkValidationService method compute.

@Override
protected Status compute() {
    Status retval = Status.createOkStatus();
    NewLiferayPluginProjectOp op = _op();
    ILiferayProjectProvider projectProvider = op.getProjectProvider().content();
    IPortletFramework portletFramework = op.getPortletFramework().content();
    if (!portletFramework.supports(projectProvider)) {
        return Status.createErrorStatus("Selected portlet framework is not supported with " + projectProvider.getDisplayName());
    }
    try {
        if ("ant".equals(projectProvider.getShortName())) {
            SDK sdk = SDKUtil.getWorkspaceSDK();
            if (sdk != null) {
                Version requiredVersion = new Version(portletFramework.getRequiredSDKVersion());
                Version sdkVersion = new Version(sdk.getVersion());
                if (CoreUtil.compareVersions(requiredVersion, sdkVersion) > 0) {
                    retval = Status.createErrorStatus("Selected portlet framework requires SDK version at least " + requiredVersion);
                }
            }
        }
    } catch (CoreException ce) {
    }
    return retval;
}
Also used : Status(org.eclipse.sapphire.modeling.Status) IPortletFramework(com.liferay.ide.project.core.IPortletFramework) CoreException(org.eclipse.core.runtime.CoreException) Version(org.osgi.framework.Version) ILiferayProjectProvider(com.liferay.ide.core.ILiferayProjectProvider) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) SDK(com.liferay.ide.sdk.core.SDK)

Example 70 with NewLiferayPluginProjectOp

use of com.liferay.ide.project.core.model.NewLiferayPluginProjectOp in project liferay-ide by liferay.

the class SDKLocationValidationService method compute.

@Override
protected Status compute() {
    NewLiferayPluginProjectOp op = _op();
    NewLiferayProjectProvider<NewLiferayPluginProjectOp> provider = op.getProjectProvider().content();
    if (!provider.getShortName().equals("ant")) {
        return Status.createOkStatus();
    }
    int countPossibleWorkspaceSDKProjects = SDKUtil.countPossibleWorkspaceSDKProjects();
    if (countPossibleWorkspaceSDKProjects > 1) {
        return StatusBridge.create(ProjectCore.createErrorStatus("This workspace has more than one SDK."));
    }
    Path sdkLocation = op.getSdkLocation().content(true);
    if ((sdkLocation == null) || sdkLocation.isEmpty()) {
        return StatusBridge.create(ProjectCore.createErrorStatus("This sdk location is empty."));
    }
    SDK sdk = SDKUtil.createSDKFromLocation(PathBridge.create(sdkLocation));
    if (sdk != null) {
        IStatus status = sdk.validate(true);
        if (!status.isOK()) {
            return StatusBridge.create(status);
        }
    } else {
        return StatusBridge.create(ProjectCore.createErrorStatus("This sdk location is not correct."));
    }
    Path projectLocation = op.getLocation().content();
    String projectName = op.getProjectName().content();
    IPath projectPath = PathBridge.create(projectLocation);
    if (FileUtil.exists(projectPath)) {
        return StatusBridge.create(ProjectCore.createErrorStatus("Project(" + projectName + ") is existed in sdk folder, please set new project name."));
    }
    PluginType pluginType = op.getPluginType().content();
    if (pluginType.equals(PluginType.web) && !supportsTypePlugin(op, "web")) {
        StringBuilder sb = new StringBuilder();
        sb.append("The selected Plugins SDK does not support creating new web type plugins. ");
        sb.append("");
        sb.append("Please configure version 7.0 or greater.");
        return Status.createErrorStatus(sb.toString());
    } else if (pluginType.equals(PluginType.theme) && !supportsTypePlugin(op, "theme")) {
        StringBuilder sb = new StringBuilder();
        sb.append("The selected Plugins SDK does not support creating theme type plugins. ");
        sb.append("");
        sb.append("Please configure version 6.2 or less or using gulp way.");
        return Status.createErrorStatus(sb.toString());
    } else if (pluginType.equals(PluginType.portlet)) {
        IPortletFramework portletFramework = op.getPortletFramework().content();
        Version requiredVersion = new Version(portletFramework.getRequiredSDKVersion());
        Version sdkVersion = new Version(sdk.getVersion());
        if (CoreUtil.compareVersions(requiredVersion, sdkVersion) > 0) {
            StringBuilder sb = new StringBuilder();
            sb.append("Selected portlet framework requires SDK version at least ");
            sb.append("");
            sb.append(requiredVersion);
            return Status.createErrorStatus(sb.toString());
        }
    } else if (pluginType.equals(PluginType.ext) && !supportsTypePlugin(op, "ext")) {
        StringBuilder sb = new StringBuilder();
        sb.append("The selected Plugins SDK does not support creating ext type plugins. ");
        sb.append("");
        sb.append("Please try to confirm whether sdk has ext folder.");
        return Status.createErrorStatus(sb.toString());
    }
    return Status.createOkStatus();
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.sapphire.modeling.Path) IStatus(org.eclipse.core.runtime.IStatus) IPortletFramework(com.liferay.ide.project.core.IPortletFramework) IPath(org.eclipse.core.runtime.IPath) Version(org.osgi.framework.Version) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) SDK(com.liferay.ide.sdk.core.SDK) PluginType(com.liferay.ide.project.core.model.PluginType)

Aggregations

NewLiferayPluginProjectOp (com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)122 Test (org.junit.Test)61 IProject (org.eclipse.core.resources.IProject)48 IWebProject (com.liferay.ide.core.IWebProject)18 IFile (org.eclipse.core.resources.IFile)18 IPath (org.eclipse.core.runtime.IPath)14 IFolder (org.eclipse.core.resources.IFolder)13 SDK (com.liferay.ide.sdk.core.SDK)12 Status (org.eclipse.sapphire.modeling.Status)10 PropertyContentEvent (org.eclipse.sapphire.PropertyContentEvent)9 Path (org.eclipse.sapphire.modeling.Path)8 CoreException (org.eclipse.core.runtime.CoreException)7 IPortletFramework (com.liferay.ide.project.core.IPortletFramework)6 HashSet (java.util.HashSet)5 PossibleValuesService (org.eclipse.sapphire.PossibleValuesService)5 ValidationService (org.eclipse.sapphire.services.ValidationService)5 IVirtualComponent (org.eclipse.wst.common.componentcore.resources.IVirtualComponent)5 NewLiferayProfile (com.liferay.ide.project.core.model.NewLiferayProfile)4 IStatus (org.eclipse.core.runtime.IStatus)4 LayoutTplDescriptorHelper (com.liferay.ide.layouttpl.core.operation.LayoutTplDescriptorHelper)3