Search in sources :

Example 6 with ILiferayProjectProvider

use of com.liferay.ide.core.ILiferayProjectProvider in project liferay-ide by liferay.

the class LiferayVersionPossibleValuesService method compute.

@Override
protected void compute(Set<String> values) {
    if (_versions != null) {
        values.addAll(_versions);
    } else if (_versionsJob == null) {
        _versionsJob = new Job("Determining possible Liferay versions.") {

            @Override
            protected IStatus run(IProgressMonitor monitor) {
                NewLiferayPluginProjectOp op = _op();
                if (!op.disposed()) {
                    ILiferayProjectProvider projectProvider = op.getProjectProvider().content();
                    try {
                        _versions = projectProvider.getData("liferayVersions", String.class, _groupId, _artifactId);
                    } catch (Exception e) {
                        ProjectCore.logError("Could not determine possible versions.", e);
                    }
                    refresh();
                }
                return Status.OK_STATUS;
            }
        };
        _versionsJob.schedule();
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ILiferayProjectProvider(com.liferay.ide.core.ILiferayProjectProvider) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) Job(org.eclipse.core.runtime.jobs.Job)

Example 7 with ILiferayProjectProvider

use of com.liferay.ide.core.ILiferayProjectProvider in project liferay-ide by liferay.

the class JSFModuleProjectProviderDefaultValueService method compute.

@Override
protected String compute() {
    String defaultProjectBuildType = "maven-jsf";
    IScopeContext[] prefContexts = { DefaultScope.INSTANCE, InstanceScope.INSTANCE };
    String buildType = Platform.getPreferencesService().getString(ProjectCore.PLUGIN_ID, ProjectCore.PREF_DEFAULT_JSF_MODULE_PROJECT_BUILD_TYPE_OPTION, null, prefContexts);
    if (buildType == null) {
        return "maven-jsf";
    }
    ILiferayProjectProvider provider = LiferayCore.getProvider(buildType);
    if (provider != null) {
        return provider.getShortName();
    }
    return defaultProjectBuildType;
}
Also used : IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) ILiferayProjectProvider(com.liferay.ide.core.ILiferayProjectProvider)

Example 8 with ILiferayProjectProvider

use of com.liferay.ide.core.ILiferayProjectProvider in project liferay-ide by liferay.

the class ProjectProviderDefaultValueService method compute.

@Override
protected String compute() {
    String retval = "ant";
    IScopeContext[] prefContexts = { DefaultScope.INSTANCE, InstanceScope.INSTANCE };
    String defaultProjectBuildType = Platform.getPreferencesService().getString(ProjectCore.PLUGIN_ID, ProjectCore.PREF_DEFAULT_PLUGIN_PROJECT_BUILD_TYPE_OPTION, null, prefContexts);
    if (defaultProjectBuildType == null) {
        return retval;
    }
    ILiferayProjectProvider provider = LiferayCore.getProvider(defaultProjectBuildType);
    if (provider != null) {
        retval = defaultProjectBuildType;
    }
    return retval;
}
Also used : IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) ILiferayProjectProvider(com.liferay.ide.core.ILiferayProjectProvider)

Example 9 with ILiferayProjectProvider

use of com.liferay.ide.core.ILiferayProjectProvider in project liferay-ide by liferay.

the class ProjectProviderPossibleValuesService method initPossibleValuesService.

@Override
protected void initPossibleValuesService() {
    super.initPossibleValuesService();
    _possibleValues = new ArrayList<>();
    for (ILiferayProjectProvider provider : LiferayCore.getProviders("plugin")) {
        _possibleValues.add(provider.getShortName());
    }
    Collections.sort(_possibleValues);
}
Also used : ILiferayProjectProvider(com.liferay.ide.core.ILiferayProjectProvider)

Example 10 with ILiferayProjectProvider

use of com.liferay.ide.core.ILiferayProjectProvider 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)

Aggregations

ILiferayProjectProvider (com.liferay.ide.core.ILiferayProjectProvider)14 IScopeContext (org.eclipse.core.runtime.preferences.IScopeContext)5 NewLiferayProjectProvider (com.liferay.ide.project.core.NewLiferayProjectProvider)3 NewLiferayPluginProjectOp (com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)2 IProject (org.eclipse.core.resources.IProject)2 IPath (org.eclipse.core.runtime.IPath)2 Path (org.eclipse.sapphire.modeling.Path)2 IPortletFramework (com.liferay.ide.project.core.IPortletFramework)1 SDK (com.liferay.ide.sdk.core.SDK)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1 Status (org.eclipse.sapphire.modeling.Status)1 Version (org.osgi.framework.Version)1