@Override public IServerWorkingCopy createWorkingCopy() { // TODO Auto-generated method stub return server.createWorkingCopy(); }
/** * ModifyModulesWizard constructor. * * @param server a server */ public ModifyModulesWizard(IServer server) { super(Messages.wizModuleWizardTitle, new ModifyModulesWizard2()); if (server != null) getTaskModel().putObject(TaskModel.TASK_SERVER, server.createWorkingCopy()); } }
public IServer getServer(IModule module, IModuleArtifact moduleArtifact, IProgressMonitor monitor) throws CoreException { if (!ServerUIPlugin.isCompatibleWithLaunchMode(finalServer, launchMode)) return null; if (!ServerUtil.containsModule(finalServer, module, monitor)) { IServerWorkingCopy wc = finalServer.createWorkingCopy(); try { ServerUtil.modifyModules(wc, new IModule[] { module }, new IModule[0], monitor); wc.save(false, monitor); } catch (CoreException ce) { throw ce; } } return finalServer; } };
public void serverSelected(IServer server) { wizard.setMessage(null, IMessageProvider.NONE); // check for compatibility if (server != null && module != null) { IStatus status = isSupportedModule(server, module); if (status != null) { if (status.getSeverity() == IStatus.ERROR) wizard.setMessage(status.getMessage(), IMessageProvider.ERROR); else if (status.getSeverity() == IStatus.WARNING) wizard.setMessage(status.getMessage(), IMessageProvider.WARNING); else if (status.getSeverity() == IStatus.INFO) wizard.setMessage(status.getMessage(), IMessageProvider.INFORMATION); server = null; } } if (existingWC != null) { if (server != null && server.equals(existingWC.getOriginal())) return; existingWC = null; } if (server != null) existingWC = server.createWorkingCopy(); updateTaskModel(); } }, module, launchMode);
public IStatus doDeleteModules(final Collection<IModule> deletedModules) { IServerWorkingCopy wc = getServer().createWorkingCopy(); try { deleteServicesOnModuleRemove.set(Boolean.FALSE);
/** * Execute the command. * * @param monitor a progress monitor * @param info * @throws CoreException */ public void execute(IProgressMonitor monitor, IAdaptable info) throws CoreException { IServerWorkingCopy wc = null; IServer server2 = (IServer) getTaskModel().getObject(TaskModel.TASK_SERVER); if (server2 instanceof IServerWorkingCopy) wc = (IServerWorkingCopy) server2; else wc = server2.createWorkingCopy(); TomcatServer server = (TomcatServer) wc.loadAdapter(TomcatServer.class, monitor); TomcatConfiguration configuration = server.getTomcatConfiguration(); if (configuration.getWebModules().size() <= index) return; module = (WebModule) configuration.getWebModules().get(index); if (contextRoot != null && !contextRoot.startsWith("/") && contextRoot.length() > 0) contextRoot = "/" + contextRoot; if (!contextRoot.equals(module.getPath())) { configuration.modifyWebModule(index, module.getDocumentBase(), contextRoot, module.isReloadable()); wc.save(true, monitor); } }
wc = (ServerWorkingCopy)server; else { wc = (ServerWorkingCopy)server.createWorkingCopy(); createdWC = true;
if (!newName.equals(editedServer.getName())) { try { IServerWorkingCopy wc = editedServer.createWorkingCopy(); wc.setName(newName); wc.save(false, null);
server = ServerCore.findServer(id); if (server != null) info.wc = server.createWorkingCopy(); info.isDirty = false; info.isReadOnly = false;
public static void addModule(IModule module, TaskModel taskModel, IProgressMonitor monitor) throws CoreException { if (module == null) return; IServer server = (IServer) taskModel.getObject(TaskModel.TASK_SERVER); IModule parentModule = null; try { IModule[] parents = server.getRootModules(module, monitor); if (parents != null && parents.length > 0) parentModule = parents[0]; } catch (Exception e) { Trace.trace(Trace.WARNING, "Could not find parent module", e); } if (parentModule == null) { // use the original module since no parent module is available parentModule = module; } IModule[] modules = server.getModules(); int size = modules.length; for (int i = 0; i < size; i++) { if (parentModule.equals(modules[i])) return; } IServerWorkingCopy workingCopy = server.createWorkingCopy(); workingCopy.modifyModules(new IModule[] { parentModule }, new IModule[0], monitor); taskModel.putObject(TaskModel.TASK_SERVER, workingCopy.save(false, monitor)); }
/** * Reload the command manager for a given id. * * @param id an id */ public void reload(String id) { try { CommandManagerInfo info = getExistingCommandManagerInfo(id); if (info != null) { IServer server = null; if (id != null) server = ServerCore.findServer(id); if (server != null) info.wc = server.createWorkingCopy(); firePropertyChangeEvent(PROP_RELOAD, id, null); } clearUndoList(id); clearRedoList(id); undoSaveIndex = undoList.size(); setDirtyState(id, false); updateTimestamps(id); } catch (Exception e) { Trace.trace(Trace.SEVERE, "Could not release command manager", e); } }
/** * Invoked when an action occurs. */ public void run() { if (MessageDialog.openConfirm(shell, Messages.defaultDialogTitle, Messages.dialogRemoveModuleConfirm)) { try { IServerWorkingCopy wc = server.createWorkingCopy(); wc.modifyModules(null, new IModule[] { module }, null); server = wc.save(true, null); if (server.getServerState() != IServer.STATE_STOPPED && ((Server)server).getAutoPublishSetting() != Server.AUTO_PUBLISH_DISABLE) { PublishServerJob publishJob = new PublishServerJob(server); publishJob.schedule(); } } catch (Exception e) { Trace.trace(Trace.WARNING, "Could not remove module", e); } } } }
if (modules != null && modules.length == 1) { try { IServerWorkingCopy wc = server.createWorkingCopy(); IModule[] parents = wc.getRootModules(modules[0], null); if (parents == null || parents.length == 0)
protected static void tempSaveServer(TaskModel taskModel, IProgressMonitor monitor) throws CoreException { IServer server = (IServer) taskModel.getObject(TaskModel.TASK_SERVER); if (server != null && server instanceof IServerWorkingCopy) { IServerWorkingCopy workingCopy = (IServerWorkingCopy) server; if (!workingCopy.isDirty()) return; IFile file = ((Server)workingCopy).getFile(); if (file != null) { IProject project = file.getProject(); if (!file.getProject().exists()) EclipseUtil.createNewServerProject(null, project.getName(), null, monitor); ProjectProperties pp = ServerPlugin.getProjectProperties(project); if (!pp.isServerProject()) pp.setServerProject(true, monitor); } IRuntime runtime = workingCopy.getRuntime(); server = workingCopy.save(false, monitor); workingCopy = server.createWorkingCopy(); workingCopy.setRuntime(runtime); if (workingCopy.getServerType().hasServerConfiguration()) ((ServerWorkingCopy)workingCopy).importRuntimeConfiguration(runtime, null); taskModel.putObject(TaskModel.TASK_SERVER, workingCopy); } }
for (int i = 0; i < server.length; i++) { try { wc = server[i].createWorkingCopy(); List list = Arrays.asList(server[i].getModules()); if (list.contains(originalModule)) {
IServerWorkingCopy wc = server.createWorkingCopy(); try { ServerUtil.modifyModules(wc, new IModule[] { module }, new IModule[0], monitor);