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)); } }
public IStatus execute( IProgressMonitor monitor, IAdaptable adaptable ) { IStatus status = Status.OK_STATUS; if(sampleServerInstanceId != null){ sampleExistingServer = ServerCore.findServer(sampleServerInstanceId); if (sampleExistingServer != null) sampleServerTypeID = sampleExistingServer.getServerType().getId(); } return status; }
/** * Returns the label of an IServer given its id * @param instanceId id of an IServer * @return String label of the IServer with an id equal to instanceId. */ public static String getServerInstanceLabelFromInstanceId( String instanceId ) { IServer server = ServerCore.findServer( instanceId ); return server.getName(); }
protected boolean isExistingServer() { if (module == null || launchMode == null) return false; IServer[] servers = ServerCore.getServers(); if (servers != null) { int size = servers.length; for (int i = 0; i < size; i++) { IModuleType mt = module.getModuleType(); if (ServerUIPlugin.isCompatibleWithLaunchMode(servers[i], launchMode) && ServerUtil.isSupportedModule(servers[i].getServerType().getRuntimeType().getModuleTypes(), mt)) return true; } } return false; }
public int getServerTargetIndexFromItems(IRuntime serverTarget) { if (items != null && items.length > 0) { String serverTargetLabel = serverTarget.getName() + " (" + serverTarget.getRuntimeType().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ for (int i = 0; i < items.length; i++) { String label = items[i]; if (label.equals(serverTargetLabel)) { return i; } } } return -1; }
public String getServerTypeId() { return server.getServerType().getId(); }
/** * Returns true if the given server type can launch the module. */ protected boolean isValidServerType(IServerType type, IModule module) { try { IRuntimeType runtimeType = type.getRuntimeType(); ServerUtil.isSupportedModule(runtimeType.getModuleTypes(), module.getModuleType()); } catch (Exception e) { return false; } return true; } }
public String getLabel(Object o) { if (o instanceof IServer) return ((IServer) o).getName(); return null; }
/** * Return the key to use for the given server type. * * @param type the server type * @param isLocalhost true if the server is local * @return the key */ private String getKey(IServerType type, boolean isLocalhost) { return type.getId() + "|" + isLocalhost + "|"; }
@Override public String getHost() { // TODO Auto-generated method stub return server.getHost(); }
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { try { server.modifyModules(null, new IModule[] { module }, monitor); } catch (Exception e) { // ignore } return Status.OK_STATUS; }
@Override public List<String> getAttribute(String attributeName, List<String> defaultValue) { // TODO Auto-generated method stub return server.getAttribute(attributeName, defaultValue); }
/** * Execute the command. */ public void execute() { oldRuntime = server.getRuntime(); server.setRuntime(runtime); }
@Override public IStatus canStop() { // TODO Auto-generated method stub return server.canStop(); }
@Override public void startModule(IModule[] module, IOperationListener listener) { // TODO Auto-generated method stub server.startModule(module, listener); }
@Override public void synchronousStart(String launchMode, IProgressMonitor monitor) throws CoreException { // TODO Auto-generated method stub server.synchronousStart(launchMode, monitor); }
@Override public void synchronousStop(boolean force) { // TODO Auto-generated method stub server.synchronousStop(force); }
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()); } }
/** * @see AbstractTreeLabelProvider#getTextImpl(Object) */ public String getTextImpl(Object element) { IServer server = (IServer) element; return server.getName(); } }