/** * @see RuntimeDelegate#setDefaults(IProgressMonitor) */ public void setDefaults(IProgressMonitor monitor) { IRuntimeType type = getRuntimeWorkingCopy().getRuntimeType(); getRuntimeWorkingCopy().setLocation(new Path(TomcatPlugin.getPreference("location" + type.getId()))); }
protected static void saveRuntime(TaskModel taskModel, IProgressMonitor monitor) throws CoreException { IRuntime runtime = (IRuntime) taskModel.getObject(TaskModel.TASK_RUNTIME); if (runtime != null && runtime instanceof IRuntimeWorkingCopy) { IRuntimeWorkingCopy workingCopy = (IRuntimeWorkingCopy) runtime; if (workingCopy.isDirty()) taskModel.putObject(TaskModel.TASK_RUNTIME, workingCopy.save(false, monitor)); } }
protected static IRuntimeWorkingCopy getRuntimeFromDir(File dir, IProgressMonitor monitor) { for (int i = 0; i < runtimeTypes.length; i++) { try { IRuntimeType runtimeType = ServerCore.findRuntimeType(runtimeTypes[i]); String absolutePath = dir.getAbsolutePath(); String id = absolutePath.replace(File.separatorChar,'_').replace(':','-'); IRuntimeWorkingCopy runtime = runtimeType.createRuntime(id, monitor); runtime.setName(dir.getName()); runtime.setLocation(new Path(absolutePath)); ITomcatRuntimeWorkingCopy wc = (ITomcatRuntimeWorkingCopy) runtime.loadAdapter(ITomcatRuntimeWorkingCopy.class, null); wc.setVMInstall(JavaRuntime.getDefaultVMInstall()); IStatus status = runtime.validate(monitor); if (status == null || status.getSeverity() != IStatus.ERROR) return runtime; Trace.trace(Trace.FINER, "False runtime found at " + dir.getAbsolutePath() + ": " + status.getMessage()); } catch (Exception e) { Trace.trace(Trace.SEVERE, "Could not find runtime", e); } } return null; } }
return; WizardFragment sub = getWizardFragment(runtime.getRuntimeType().getId()); if (sub != null) list.add(sub); ServerWorkingCopy swc = (ServerWorkingCopy) server; try { if (swc != null && runtime != null && runtime.getLocation() != null && !runtime.getLocation().isEmpty()) swc.importRuntimeConfiguration(runtime, null); } catch (CoreException ce) {
public void runtimeFound(IRuntimeWorkingCopy runtime) { String runtimeTypeId = runtime.getRuntimeType().getId(); String serverTypeId = runtimeTypeId.substring(0, runtimeTypeId.length() - 8); IServerType serverType = ServerCore.findServerType(serverTypeId); try { IServerWorkingCopy server = serverType.createServer(serverTypeId, null, runtime, monitor); listener.serverFound(server); } catch (Exception e) { Trace.trace(Trace.WARNING, "Could not create Tomcat server", e); } } };
public void keyPressed(KeyEvent e) { if (e.character == 'l') { try { IRuntime runtime = getSelectedRuntime(); IRuntimeWorkingCopy wc = runtime.createWorkingCopy(); wc.setReadOnly(!runtime.isReadOnly()); wc.save(false, null); refresh(runtime); } catch (Exception ex) { // ignore } } }
protected void editRuntime(IRuntime runtime) { IRuntimeWorkingCopy runtimeWorkingCopy = runtime.createWorkingCopy(); if (showWizard(runtimeWorkingCopy) != Window.CANCEL) { try { runtimeWorkingCopy.save(false, null); } catch (Exception ex) { // ignore } } }
} else { title = Messages.wizEditRuntimeWizardTitle; final WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(runtimeWorkingCopy.getRuntimeType().getId()); if (fragment2 == null) { edit.setEnabled(false);
while (iterator.hasNext()) { IRuntimeWorkingCopy wc = (IRuntimeWorkingCopy) iterator.next(); wc.save(false, monitor);
protected int showWizard(final IRuntimeWorkingCopy runtimeWorkingCopy) { String title = Messages.wizEditRuntimeWizardTitle; final WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(runtimeWorkingCopy.getRuntimeType().getId()); if (fragment2 == null) return Window.CANCEL; TaskModel taskModel = new TaskModel(); taskModel.putObject(TaskModel.TASK_RUNTIME, runtimeWorkingCopy); WizardFragment fragment = new WizardFragment() { protected void createChildFragments(List list) { list.add(fragment2); list.add(WizardTaskUtil.SaveRuntimeFragment); } }; TaskWizard wizard = new TaskWizard(title, fragment, taskModel); wizard.setForcePreviousAndNextButtons(true); ClosableWizardDialog dialog = new ClosableWizardDialog(getEditorSite().getShell(), wizard); return dialog.open(); }
protected static void tempSaveRuntime(TaskModel taskModel, IProgressMonitor monitor) throws CoreException { IRuntime runtime = (IRuntime) taskModel.getObject(TaskModel.TASK_RUNTIME); if (runtime != null && runtime instanceof IRuntimeWorkingCopy) { IRuntimeWorkingCopy workingCopy = (IRuntimeWorkingCopy) runtime; if (!workingCopy.isDirty()) return; runtime = workingCopy.save(false, monitor); taskModel.putObject(TaskModel.TASK_RUNTIME, runtime.createWorkingCopy()); } }