Search in sources :

Example 6 with Action

use of org.eclipse.wst.common.project.facet.core.IFacetedProject.Action in project liferay-ide by liferay.

the class SDKPluginFacetUtil method configureWebFacet.

public static void configureWebFacet(IFacetedProjectWorkingCopy fpjwc, IProjectFacet requiredFacet, IPreset preset) throws CoreException {
    Action action = fpjwc.getProjectFacetAction(requiredFacet);
    if (action != null) {
        IDataModel dm = (IDataModel) action.getConfig();
        if (preset.getId().contains("portlet")) {
            dm.setStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER, IPluginFacetConstants.PORTLET_PLUGIN_SDK_CONFIG_FOLDER);
            dm.setStringProperty(IWebFacetInstallDataModelProperties.SOURCE_FOLDER, IPluginFacetConstants.PORTLET_PLUGIN_SDK_SOURCE_FOLDER);
            _addDefaultWebXml(fpjwc, dm);
        } else if (preset.getId().contains("hook")) {
            dm.setStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER, IPluginFacetConstants.HOOK_PLUGIN_SDK_CONFIG_FOLDER);
            dm.setStringProperty(IWebFacetInstallDataModelProperties.SOURCE_FOLDER, IPluginFacetConstants.HOOK_PLUGIN_SDK_SOURCE_FOLDER);
            _addDefaultWebXml(fpjwc, dm);
        } else if (preset.getId().contains("ext")) {
            dm.setStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER, IPluginFacetConstants.EXT_PLUGIN_SDK_CONFIG_FOLDER);
            dm.setStringProperty(IWebFacetInstallDataModelProperties.SOURCE_FOLDER, IPluginFacetConstants.PORTLET_PLUGIN_SDK_SOURCE_FOLDER);
            _addDefaultWebXml(fpjwc, dm);
        } else if (preset.getId().contains("layouttpl")) {
            dm.setStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER, IPluginFacetConstants.LAYOUTTPL_PLUGIN_SDK_CONFIG_FOLDER);
            dm.setStringProperty(IWebFacetInstallDataModelProperties.SOURCE_FOLDER, IPluginFacetConstants.PORTLET_PLUGIN_SDK_SOURCE_FOLDER);
            ProjectUtil.setGenerateDD(dm, false);
        } else if (preset.getId().contains("theme")) {
            dm.setStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER, IPluginFacetConstants.THEME_PLUGIN_SDK_CONFIG_FOLDER);
            ProjectUtil.setGenerateDD(dm, false);
        } else if (preset.getId().contains("web")) {
            dm.setStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER, IPluginFacetConstants.WEB_PLUGIN_SDK_CONFIG_FOLDER);
            dm.setStringProperty(IWebFacetInstallDataModelProperties.SOURCE_FOLDER, IPluginFacetConstants.WEB_PLUGIN_SDK_SOURCE_FOLDER);
        }
    }
}
Also used : Action(org.eclipse.wst.common.project.facet.core.IFacetedProject.Action) IDataModel(org.eclipse.wst.common.frameworks.datamodel.IDataModel)

Example 7 with Action

use of org.eclipse.wst.common.project.facet.core.IFacetedProject.Action in project liferay-ide by liferay.

the class LiferayMavenProjectConfigurator method _getNewLiferayFacetInstallAction.

private Action _getNewLiferayFacetInstallAction(String pluginType) {
    Action retval = null;
    IProjectFacetVersion newFacet = null;
    IDataModelProvider dataModel = null;
    if (ILiferayMavenConstants.PORTLET_PLUGIN_TYPE.equals(pluginType)) {
        newFacet = IPluginFacetConstants.LIFERAY_PORTLET_PROJECT_FACET.getDefaultVersion();
        dataModel = new MavenPortletPluginFacetInstallProvider();
    } else if (ILiferayMavenConstants.HOOK_PLUGIN_TYPE.equals(pluginType)) {
        newFacet = IPluginFacetConstants.LIFERAY_HOOK_PROJECT_FACET.getDefaultVersion();
        dataModel = new MavenHookPluginFacetInstallProvider();
    } else if (ILiferayMavenConstants.EXT_PLUGIN_TYPE.equals(pluginType)) {
        newFacet = IPluginFacetConstants.LIFERAY_EXT_PROJECT_FACET.getDefaultVersion();
        dataModel = new MavenExtPluginFacetInstallProvider();
    } else if (ILiferayMavenConstants.LAYOUTTPL_PLUGIN_TYPE.equals(pluginType)) {
        newFacet = IPluginFacetConstants.LIFERAY_LAYOUTTPL_PROJECT_FACET.getDefaultVersion();
        dataModel = new MavenLayoutTplPluginFacetInstallProvider();
    } else if (ILiferayMavenConstants.THEME_PLUGIN_TYPE.equals(pluginType)) {
        newFacet = IPluginFacetConstants.LIFERAY_THEME_PROJECT_FACET.getDefaultVersion();
        dataModel = new MavenThemePluginFacetInstallProvider();
    } else if (ILiferayMavenConstants.WEB_PLUGIN_TYPE.equals(pluginType)) {
        newFacet = IPluginFacetConstants.LIFERAY_WEB_PROJECT_FACET.getDefaultVersion();
        dataModel = new MavenWebPluginFacetInstallProvider();
    }
    if (newFacet != null) {
        IDataModel config = DataModelFactory.createDataModel(dataModel);
        retval = new Action(Action.Type.INSTALL, newFacet, config);
    }
    return retval;
}
Also used : Action(org.eclipse.wst.common.project.facet.core.IFacetedProject.Action) IProjectFacetVersion(org.eclipse.wst.common.project.facet.core.IProjectFacetVersion) IDataModelProvider(org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider) IDataModel(org.eclipse.wst.common.frameworks.datamodel.IDataModel)

Aggregations

Action (org.eclipse.wst.common.project.facet.core.IFacetedProject.Action)7 IDataModel (org.eclipse.wst.common.frameworks.datamodel.IDataModel)5 CoreException (org.eclipse.core.runtime.CoreException)3 IProjectFacet (org.eclipse.wst.common.project.facet.core.IProjectFacet)3 IProjectFacetVersion (org.eclipse.wst.common.project.facet.core.IProjectFacetVersion)3 ILibraryProvider (org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider)2 LibraryInstallDelegate (org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate)2 IFacetedProject (org.eclipse.wst.common.project.facet.core.IFacetedProject)2 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Plugin (org.apache.maven.model.Plugin)1 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)1 WorkspaceJob (org.eclipse.core.resources.WorkspaceJob)1 IPath (org.eclipse.core.runtime.IPath)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 Path (org.eclipse.core.runtime.Path)1 Status (org.eclipse.core.runtime.Status)1 Job (org.eclipse.core.runtime.jobs.Job)1