Search in sources :

Example 1 with PluginsSDKBundleProject

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

the class ProjectUtil method is7xServerDeployableProject.

public static boolean is7xServerDeployableProject(IProject project) {
    ILiferayProject liferayProject = LiferayCore.create(project);
    if (liferayProject instanceof IBundleProject) {
        if (liferayProject instanceof PluginsSDKBundleProject) {
            PluginsSDKBundleProject sdkProject = (PluginsSDKBundleProject) liferayProject;
            SDK sdk = sdkProject.getSDK();
            if (sdk != null) {
                IPath location = sdkProject.getProject().getLocation();
                String projectType = getLiferayPluginType(location.toPortableString());
                Version version = new Version(sdk.getVersion());
                Version sdk70 = ILiferayConstants.V700;
                if ((CoreUtil.compareVersions(version, sdk70) >= 0) && !ISDKConstants.EXT_PLUGIN_PROJECT_FOLDER.equals(projectType)) {
                    return true;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        } else {
            return true;
        }
    } else {
        return false;
    }
}
Also used : IBundleProject(com.liferay.ide.core.IBundleProject) IPath(org.eclipse.core.runtime.IPath) PluginsSDKBundleProject(com.liferay.ide.project.core.PluginsSDKBundleProject) Version(org.osgi.framework.Version) IProjectFacetVersion(org.eclipse.wst.common.project.facet.core.IProjectFacetVersion) ILiferayProject(com.liferay.ide.core.ILiferayProject) SDK(com.liferay.ide.sdk.core.SDK)

Example 2 with PluginsSDKBundleProject

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

the class ThemePluginFacetInstall method execute.

@Override
public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor) throws CoreException {
    super.execute(project, fv, config, monitor);
    IDataModel model = (IDataModel) config;
    IDataModel masterModel = (IDataModel) model.getProperty(FacetInstallDataModelProvider.MASTER_PROJECT_DM);
    if ((masterModel != null) && masterModel.getBooleanProperty(CREATE_PROJECT_OPERATION)) {
        /*
			 * // get the template zip for theme and extract into the project
			 * SDK sdk = getSDK(); String themeName =
			 * this.masterModel.getStringProperty( THEME_NAME ); // FIX IDE-450
			 * if( themeName.endsWith( ISDKConstants.THEME_PLUGIN_PROJECT_SUFFIX
			 * ) ) { themeName = themeName.substring( 0, themeName.indexOf(
			 * ISDKConstants.THEME_PLUGIN_PROJECT_SUFFIX ) ); } // END FIX
			 * IDE-450 String displayName = this.masterModel.getStringProperty(
			 * DISPLAY_NAME ); IPath newThemePath = sdk.createNewThemeProject(
			 * themeName, displayName ); processNewFiles( newThemePath.append(
			 * themeName + ISDKConstants.THEME_PLUGIN_PROJECT_SUFFIX ) ); //
			 * cleanup files FileUtil.deleteDir( newThemePath.toFile(), true );
			 */
        // IDE-1122 SDK creating project has been moved to Class
        // NewPluginProjectWizard
        String themeName = this.masterModel.getStringProperty(THEME_NAME);
        IPath projectTempPath = (IPath) masterModel.getProperty(PROJECT_TEMP_PATH);
        processNewFiles(projectTempPath.append(themeName + ISDKConstants.THEME_PLUGIN_PROJECT_SUFFIX));
        FileUtil.deleteDir(projectTempPath.toFile(), true);
        // End IDE-1122
        // delete META-INF
        CoreUtil.deleteResource(project.findMember(ISDKConstants.DEFAULT_DOCROOT_FOLDER + "/META-INF"));
    } else if (shouldSetupDefaultOutputLocation()) {
        setupDefaultOutputLocation();
    }
    if (shouldConfigureDeploymentAssembly()) {
        // IDE-565
        configureDeploymentAssembly(IPluginFacetConstants.PORTLET_PLUGIN_SDK_SOURCE_FOLDER, DEFAULT_DEPLOY_PATH);
    }
    IWebProject lrproject = new PluginsSDKBundleProject(project, null);
    IResource libRes = lrproject.findDocrootResource(new Path("WEB-INF/lib"));
    if (FileUtil.exists(libRes)) {
        IFolder libFolder = (IFolder) libRes;
        IResource[] libFiles = libFolder.members(true);
        if (ListUtil.isEmpty(libFiles)) {
            libRes.delete(true, monitor);
        }
    }
    if (shouldUpdateBuildXml()) {
        updateBuildXml(project);
    }
    if (shouldInstallThemeBuilder()) {
        installThemeBuilder(this.project);
    }
    try {
        this.project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
    } catch (Exception e) {
        ThemeCore.logError(e);
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) PluginsSDKBundleProject(com.liferay.ide.project.core.PluginsSDKBundleProject) IWebProject(com.liferay.ide.core.IWebProject) IDataModel(org.eclipse.wst.common.frameworks.datamodel.IDataModel) IResource(org.eclipse.core.resources.IResource) CoreException(org.eclipse.core.runtime.CoreException) IOException(java.io.IOException) IFolder(org.eclipse.core.resources.IFolder)

Example 3 with PluginsSDKBundleProject

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

the class LayoutTplPluginFacetInstall method execute.

@Override
public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor) throws CoreException {
    super.execute(project, fv, config, monitor);
    IDataModel model = (IDataModel) config;
    IDataModel masterModel = (IDataModel) model.getProperty(FacetInstallDataModelProvider.MASTER_PROJECT_DM);
    if ((masterModel != null) && masterModel.getBooleanProperty(CREATE_PROJECT_OPERATION)) {
        String layoutTplName = this.masterModel.getStringProperty(LAYOUTTPL_NAME);
        IPath projectTempPath = (IPath) masterModel.getProperty(PROJECT_TEMP_PATH);
        processNewFiles(projectTempPath.append(layoutTplName + ISDKConstants.LAYOUTTPL_PLUGIN_PROJECT_SUFFIX));
        FileUtil.deleteDir(projectTempPath.toFile(), true);
    } else if (shouldSetupDefaultOutputLocation()) {
        setupDefaultOutputLocation();
    }
    removeUnneededClasspathEntries();
    IFolder folder = new PluginsSDKBundleProject(project, null).getDefaultDocrootFolder();
    if (FileUtil.exists(folder)) {
        IResource libRes = folder.findMember("WEB-INF/lib");
        if (FileUtil.exists(libRes)) {
            IFolder libFolder = (IFolder) libRes;
            IResource[] libFiles = libFolder.members(true);
            if (ListUtil.isEmpty(libFiles)) {
                libRes.delete(true, monitor);
            }
        }
    }
    try {
        this.project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
    } catch (Exception e) {
        LayoutTplCore.logError(e);
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) PluginsSDKBundleProject(com.liferay.ide.project.core.PluginsSDKBundleProject) IDataModel(org.eclipse.wst.common.frameworks.datamodel.IDataModel) IResource(org.eclipse.core.resources.IResource) CoreException(org.eclipse.core.runtime.CoreException) IFolder(org.eclipse.core.resources.IFolder)

Aggregations

PluginsSDKBundleProject (com.liferay.ide.project.core.PluginsSDKBundleProject)3 IPath (org.eclipse.core.runtime.IPath)3 IFolder (org.eclipse.core.resources.IFolder)2 IResource (org.eclipse.core.resources.IResource)2 CoreException (org.eclipse.core.runtime.CoreException)2 IDataModel (org.eclipse.wst.common.frameworks.datamodel.IDataModel)2 IBundleProject (com.liferay.ide.core.IBundleProject)1 ILiferayProject (com.liferay.ide.core.ILiferayProject)1 IWebProject (com.liferay.ide.core.IWebProject)1 SDK (com.liferay.ide.sdk.core.SDK)1 IOException (java.io.IOException)1 Path (org.eclipse.core.runtime.Path)1 IProjectFacetVersion (org.eclipse.wst.common.project.facet.core.IProjectFacetVersion)1 Version (org.osgi.framework.Version)1