Search in sources :

Example 1 with IPluginPublisher

use of com.liferay.ide.server.core.IPluginPublisher 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 2 with IPluginPublisher

use of com.liferay.ide.server.core.IPluginPublisher 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

IPluginPublisher (com.liferay.ide.server.core.IPluginPublisher)2 IProject (org.eclipse.core.resources.IProject)2 IFacetedProject (org.eclipse.wst.common.project.facet.core.IFacetedProject)2 IProjectFacet (org.eclipse.wst.common.project.facet.core.IProjectFacet)2 IRuntime (org.eclipse.wst.server.core.IRuntime)2 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1