Search in sources :

Example 26 with IProjectFacet

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

the class ProjectCoreBase method createProject.

public IProject createProject(NewLiferayPluginProjectOp op, String projectName) {
    Status status = op.execute(ProgressMonitorBridge.create(new NullProgressMonitor()));
    assertNotNull(status);
    assertEquals(status.toString(), Status.createOkStatus().message().toLowerCase(), status.message().toLowerCase());
    if (projectName == null || op.getProjectProvider().content().getShortName().equalsIgnoreCase("ant")) {
        projectName = op.getFinalProjectName().content();
    }
    // if( op.getProjectProvider().content().getShortName().equalsIgnoreCase( "maven" ) )
    // {
    // if( op.getPluginType().content().equals( PluginType.ext ) )
    // {
    // projectName = projectName + "-ext";
    // }
    // else if( op.getPluginType().content().equals( PluginType.servicebuilder ) )
    // {
    // projectName = projectName + "-portlet";
    // }
    // }
    final IProject newLiferayPluginProject = project(projectName);
    assertNotNull(newLiferayPluginProject);
    assertEquals(true, newLiferayPluginProject.exists());
    final IFacetedProject facetedProject = ProjectUtil.getFacetedProject(newLiferayPluginProject);
    assertNotNull(facetedProject);
    final IProjectFacet liferayFacet = ProjectUtil.getLiferayFacet(facetedProject);
    assertNotNull(liferayFacet);
    final PluginType pluginTypeValue = op.getPluginType().content(true);
    if (pluginTypeValue.equals(PluginType.servicebuilder)) {
        assertEquals("liferay.portlet", liferayFacet.getId());
    } else {
        assertEquals("liferay." + pluginTypeValue, liferayFacet.getId());
    }
    return newLiferayPluginProject;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.sapphire.modeling.Status) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IFacetedProject(org.eclipse.wst.common.project.facet.core.IFacetedProject) IProjectFacet(org.eclipse.wst.common.project.facet.core.IProjectFacet) PluginType(com.liferay.ide.project.core.model.PluginType) IProject(org.eclipse.core.resources.IProject)

Example 27 with IProjectFacet

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

the class LiferayPublishHelper method prePublishModule.

public static boolean prePublishModule(ServerBehaviourDelegate delegate, int kind, int deltaKind, IModule[] moduleTree, IModuleResourceDelta[] resourceDelta, IProgressMonitor monitor) {
    boolean retval = true;
    if (ListUtil.isNotEmpty(moduleTree) && moduleTree[0].getProject() != null) {
        IProject project = moduleTree[0].getProject();
        IFacetedProject facetedProject = ServerUtil.getFacetedProject(project);
        if (facetedProject != null) {
            IProjectFacet liferayFacet = ServerUtil.getLiferayFacet(facetedProject);
            if (liferayFacet != null) {
                String facetId = liferayFacet.getId();
                IRuntime runtime = null;
                try {
                    runtime = delegate.getServer().getRuntime();
                    if (runtime != null) {
                        IPluginPublisher pluginPublisher = LiferayServerCore.getPluginPublisher(facetId, runtime.getRuntimeType().getId());
                        if (pluginPublisher != null) {
                            retval = pluginPublisher.prePublishModule(delegate, kind, deltaKind, moduleTree, resourceDelta, monitor);
                        }
                    }
                } catch (Exception e) {
                    // $NON-NLS-1$
                    LiferayServerCore.logError("Plugin publisher failed", e);
                }
            }
        }
    }
    return retval;
}
Also used : IFacetedProject(org.eclipse.wst.common.project.facet.core.IFacetedProject) IProjectFacet(org.eclipse.wst.common.project.facet.core.IProjectFacet) IPluginPublisher(com.liferay.ide.server.core.IPluginPublisher) IProject(org.eclipse.core.resources.IProject) IRuntime(org.eclipse.wst.server.core.IRuntime)

Example 28 with IProjectFacet

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

the class LiferayTomcatUtil method canAddModule.

public static IStatus canAddModule(IModule module, IServer currentServer) {
    IProject project = module.getProject();
    if (project != null) {
        IFacetedProject facetedProject = ProjectUtil.getFacetedProject(project);
        if (facetedProject != null) {
            IProjectFacet liferayFacet = ProjectUtil.getLiferayFacet(facetedProject);
            if (liferayFacet != null) {
                String facetId = liferayFacet.getId();
                IRuntime runtime = null;
                try {
                    runtime = ServerUtil.getRuntime(project);
                } catch (CoreException e) {
                }
                if (runtime != null) {
                    IPluginPublisher pluginPublisher = LiferayServerCore.getPluginPublisher(facetId, runtime.getRuntimeType().getId());
                    if (pluginPublisher != null) {
                        IStatus status = pluginPublisher.canPublishModule(currentServer, module);
                        if (!status.isOK()) {
                            return status;
                        }
                    }
                }
            }
        }
    }
    return Status.OK_STATUS;
}
Also used : IFacetedProject(org.eclipse.wst.common.project.facet.core.IFacetedProject) IStatus(org.eclipse.core.runtime.IStatus) CoreException(org.eclipse.core.runtime.CoreException) IProjectFacet(org.eclipse.wst.common.project.facet.core.IProjectFacet) IPluginPublisher(com.liferay.ide.server.core.IPluginPublisher) IProject(org.eclipse.core.resources.IProject) IRuntime(org.eclipse.wst.server.core.IRuntime)

Aggregations

IProjectFacet (org.eclipse.wst.common.project.facet.core.IProjectFacet)28 IFacetedProject (org.eclipse.wst.common.project.facet.core.IFacetedProject)17 CoreException (org.eclipse.core.runtime.CoreException)14 IProjectFacetVersion (org.eclipse.wst.common.project.facet.core.IProjectFacetVersion)10 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)7 HashSet (java.util.HashSet)6 IProject (org.eclipse.core.resources.IProject)6 IFacetedProjectWorkingCopy (org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy)5 IStatus (org.eclipse.core.runtime.IStatus)3 Action (org.eclipse.wst.common.project.facet.core.IFacetedProject.Action)3 IPluginPublisher (com.liferay.ide.server.core.IPluginPublisher)2 ArrayList (java.util.ArrayList)2 IFile (org.eclipse.core.resources.IFile)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 ILibraryProvider (org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider)2 LibraryInstallDelegate (org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate)2 IDataModel (org.eclipse.wst.common.frameworks.datamodel.IDataModel)2 IRuntime (org.eclipse.wst.server.core.IRuntime)2 MdwProgressMonitorDialog (com.centurylink.mdw.plugin.designer.dialogs.MdwProgressMonitorDialog)1 VcsRepository (com.centurylink.mdw.plugin.project.model.VcsRepository)1