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");
}
}
}
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;
}
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;
}
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;
}
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();
}
}
}
}
Aggregations