Search in sources :

Example 16 with NewLiferayPluginProjectOp

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

the class NewLiferayProfileIdDefaultValueService method compute.

@Override
protected String compute() {
    NewLiferayProfile profile = _newLiferayProfile();
    String defaultRuntimeName = profile.getRuntimeName().content();
    /*
		 * First try to use this as a runtimeName, but need to check it against existing possible values.
		 * If no existing profiles with this name exist, use it, if not, append a (1)
		 */
    String data = defaultRuntimeName;
    if (data.equals("<None>")) {
        return StringPool.EMPTY;
    }
    data = data.replaceAll(StringPool.SPACE, StringPool.DASH);
    NewLiferayPluginProjectOp op = profile.nearest(NewLiferayPluginProjectOp.class);
    Set<String> possibleValues = NewLiferayPluginProjectOpMethods.getPossibleProfileIds(op, false);
    while (possibleValues.contains(data)) {
        try {
            data = _nextSuffix(data);
        } catch (Exception e) {
        }
    }
    return data;
}
Also used : NewLiferayProfile(com.liferay.ide.project.core.model.NewLiferayProfile) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)

Example 17 with NewLiferayPluginProjectOp

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

the class NewLiferayProfileRuntimeValidationService method compute.

@Override
protected Status compute() {
    Status retval = Status.createOkStatus();
    NewLiferayPluginProjectOp op = context(NewLiferayPluginProjectOp.class);
    NewLiferayProjectProvider<NewLiferayPluginProjectOp> provider = op.getProjectProvider().content(true);
    if ("maven".equals(provider.getShortName())) {
        NewLiferayProfile newLiferayProfile = context(NewLiferayProfile.class);
        String runtimeName = newLiferayProfile.getRuntimeName().content(true);
        IRuntime runtime = ServerUtil.getRuntime(runtimeName);
        if (runtime == null) {
            retval = Status.createErrorStatus("Liferay runtime must be configured.");
        }
    }
    return retval;
}
Also used : Status(org.eclipse.sapphire.modeling.Status) NewLiferayProfile(com.liferay.ide.project.core.model.NewLiferayProfile) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) IRuntime(org.eclipse.wst.server.core.IRuntime)

Example 18 with NewLiferayPluginProjectOp

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

the class ActiveProfilesValidationService method compute.

@Override
protected Status compute() {
    NewLiferayPluginProjectOp op = _op();
    String activeProfileId = op.getActiveProfilesValue().content();
    NewLiferayProjectProvider<NewLiferayPluginProjectOp> provider = op.getProjectProvider().content(true);
    if ("maven".equals(provider.getShortName()) && (activeProfileId != null) && activeProfileId.contains(StringPool.SPACE)) {
        return Status.createErrorStatus("No spaces are allowed in profile id values.");
    }
    return Status.createOkStatus();
}
Also used : NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)

Example 19 with NewLiferayPluginProjectOp

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

the class ArchetypeDefaultValueService method compute.

@Override
protected String compute() {
    NewLiferayPluginProjectOp op = _op();
    PluginType pluginType = op.getPluginType().content();
    String frameworkType = null;
    if (pluginType.equals(PluginType.portlet)) {
        IPortletFramework portletFramework = op.getPortletFramework().content();
        if (portletFramework.isRequiresAdvanced()) {
            IPortletFramework framework = op.getPortletFrameworkAdvanced().content();
            frameworkType = framework.getShortName();
        } else {
            frameworkType = portletFramework.getShortName();
        }
    } else {
        frameworkType = pluginType.name();
    }
    frameworkType = frameworkType.replaceAll("_", "-");
    NewLiferayProjectProvider<NewLiferayPluginProjectOp> provider = op.getProjectProvider().content();
    return provider.getData("archetypeGAV", String.class, frameworkType).get(0);
}
Also used : IPortletFramework(com.liferay.ide.project.core.IPortletFramework) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) PluginType(com.liferay.ide.project.core.model.PluginType)

Example 20 with NewLiferayPluginProjectOp

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

the class ArtifactVersionDefaultValueService method initDefaultValueService.

protected void initDefaultValueService() {
    super.initDefaultValueService();
    Listener listener = new FilteredListener<PropertyContentEvent>() {

        @Override
        protected void handleTypedEvent(PropertyContentEvent event) {
            refresh();
        }
    };
    NewLiferayPluginProjectOp op = _op();
    op.getLocation().attach(listener);
    op.getProjectName().attach(listener);
}
Also used : FilteredListener(org.eclipse.sapphire.FilteredListener) PropertyContentEvent(org.eclipse.sapphire.PropertyContentEvent) FilteredListener(org.eclipse.sapphire.FilteredListener) Listener(org.eclipse.sapphire.Listener) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)

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