Search in sources :

Example 1 with ILiferayServerBehavior

use of com.liferay.ide.server.core.ILiferayServerBehavior in project liferay-ide by liferay.

the class ThemePluginPublisher method addThemeModule.

protected void addThemeModule(ServerBehaviourDelegate delegate, IModule module) throws CoreException {
    IProject project = module.getProject();
    // check to make sure they have a look-and-feel.xml file
    // IDE-110 IDE-648
    IWebProject webproject = LiferayCore.create(IWebProject.class, project);
    if ((webproject != null) && (webproject.getDefaultDocrootFolder() != null)) {
        IFolder webappRoot = webproject.getDefaultDocrootFolder();
        if ((webappRoot != null) && webappRoot.exists()) {
            if (!(webappRoot.exists(new Path("WEB-INF/" + ILiferayConstants.LIFERAY_LOOK_AND_FEEL_XML_FILE))) || !(webappRoot.exists(new Path("css")))) {
                ThemeCSSBuilder.compileTheme(project);
                ((ILiferayServerBehavior) delegate).redeployModule(new IModule[] { module });
            }
        } else {
            ThemeCore.logError("Could not add theme module: webappRoot not found");
        }
    }
}
Also used : Path(org.eclipse.core.runtime.Path) ILiferayServerBehavior(com.liferay.ide.server.core.ILiferayServerBehavior) IWebProject(com.liferay.ide.core.IWebProject) IProject(org.eclipse.core.resources.IProject) IFolder(org.eclipse.core.resources.IFolder)

Example 2 with ILiferayServerBehavior

use of com.liferay.ide.server.core.ILiferayServerBehavior in project liferay-ide by liferay.

the class OpenDeployedFolderHandler method getDeployFolderPath.

private IPath getDeployFolderPath(Object selected) {
    IPath retval = null;
    ModuleServer moduleServer = null;
    if (selected != null) {
        if (selected instanceof ModuleServer) {
            moduleServer = (ModuleServer) selected;
            moduleServer.getModule()[0].getProject();
            final ILiferayServerBehavior liferayServerBehavior = (ILiferayServerBehavior) moduleServer.getServer().loadAdapter(ILiferayServerBehavior.class, null);
            if (liferayServerBehavior != null) {
                retval = liferayServerBehavior.getDeployedPath(moduleServer.getModule());
            }
        }
    }
    return retval;
}
Also used : ILiferayServerBehavior(com.liferay.ide.server.core.ILiferayServerBehavior) IPath(org.eclipse.core.runtime.IPath) ModuleServer(org.eclipse.wst.server.ui.internal.view.servers.ModuleServer)

Example 3 with ILiferayServerBehavior

use of com.liferay.ide.server.core.ILiferayServerBehavior in project liferay-ide by liferay.

the class OpenDeployedFolderAction method getDeployFolderPath.

private IPath getDeployFolderPath() {
    IPath retval = null;
    if (selectedModule != null) {
        selectedModule.getModule()[0].getProject();
        final ILiferayServerBehavior liferayServerBehavior = (ILiferayServerBehavior) selectedModule.getServer().loadAdapter(ILiferayServerBehavior.class, null);
        if (liferayServerBehavior != null) {
            retval = liferayServerBehavior.getDeployedPath(selectedModule.getModule());
        }
    }
    return retval;
}
Also used : ILiferayServerBehavior(com.liferay.ide.server.core.ILiferayServerBehavior) IPath(org.eclipse.core.runtime.IPath)

Example 4 with ILiferayServerBehavior

use of com.liferay.ide.server.core.ILiferayServerBehavior in project liferay-ide by liferay.

the class RedeployHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    final List<ModuleServer> modules = new ArrayList<ModuleServer>();
    final ISelection selection = HandlerUtil.getCurrentSelection(event);
    if (!selection.isEmpty()) {
        if (selection instanceof IStructuredSelection) {
            List selectedObj = ((IStructuredSelection) selection).toList();
            for (Object object : selectedObj) {
                if (object instanceof ModuleServer) {
                    ModuleServer moduleServer = (ModuleServer) object;
                    modules.add(moduleServer);
                }
            }
        }
    }
    for (ModuleServer moduleServer : modules) {
        final ILiferayServerBehavior liferayServerBehavior = (ILiferayServerBehavior) moduleServer.getServer().loadAdapter(ILiferayServerBehavior.class, null);
        if (liferayServerBehavior != null) {
            try {
                liferayServerBehavior.redeployModule(moduleServer.getModule());
            } catch (CoreException e) {
                throw new ExecutionException(e.getMessage(), e.getCause());
            }
        }
    }
    return null;
}
Also used : ILiferayServerBehavior(com.liferay.ide.server.core.ILiferayServerBehavior) CoreException(org.eclipse.core.runtime.CoreException) ModuleServer(org.eclipse.wst.server.ui.internal.view.servers.ModuleServer) ArrayList(java.util.ArrayList) ISelection(org.eclipse.jface.viewers.ISelection) List(java.util.List) ArrayList(java.util.ArrayList) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 5 with ILiferayServerBehavior

use of com.liferay.ide.server.core.ILiferayServerBehavior in project liferay-ide by liferay.

the class RedeployAction method run.

public void run(IAction action) {
    if (selectedModules == null) {
        // can't do anything if server has not been selected
        return;
    }
    if (selectedModules != null) {
        for (ModuleServer moduleServer : selectedModules) {
            final ILiferayServerBehavior liferayServerBehavior = (ILiferayServerBehavior) moduleServer.getServer().loadAdapter(ILiferayServerBehavior.class, null);
            if (liferayServerBehavior != null) {
                Job redeployJob = new Job("Redeploying " + moduleServer.getModuleDisplayName()) {

                    @Override
                    protected IStatus run(IProgressMonitor monitor) {
                        try {
                            liferayServerBehavior.redeployModule(moduleServer.getModule());
                        } catch (CoreException e) {
                            LiferayServerCore.logError("Error redeploying " + moduleServer.getModuleDisplayName(), e);
                        }
                        return Status.OK_STATUS;
                    }
                };
                redeployJob.setUser(true);
                redeployJob.schedule();
            }
        }
    }
}
Also used : ILiferayServerBehavior(com.liferay.ide.server.core.ILiferayServerBehavior) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CoreException(org.eclipse.core.runtime.CoreException) ModuleServer(org.eclipse.wst.server.ui.internal.view.servers.ModuleServer) Job(org.eclipse.core.runtime.jobs.Job)

Aggregations

ILiferayServerBehavior (com.liferay.ide.server.core.ILiferayServerBehavior)5 ModuleServer (org.eclipse.wst.server.ui.internal.view.servers.ModuleServer)3 CoreException (org.eclipse.core.runtime.CoreException)2 IPath (org.eclipse.core.runtime.IPath)2 IWebProject (com.liferay.ide.core.IWebProject)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 IFolder (org.eclipse.core.resources.IFolder)1 IProject (org.eclipse.core.resources.IProject)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Path (org.eclipse.core.runtime.Path)1 Job (org.eclipse.core.runtime.jobs.Job)1 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1