private void beginRTask(final IToolService r, final IProgressMonitor monitor) throws CoreException { synchronized (this) { while (fRProcess != null) { if (fRTask == 1) { monitor.subTask("Waiting for package check..."); try { wait(); } catch (final InterruptedException e) { if (monitor.isCanceled()) { throw new CoreException(Status.CANCEL_STATUS); } } } else { final Status status = new Status( IStatus.ERROR, RCore.PLUGIN_ID, NLS.bind( "Another package manager task for ''{0}'' is already running in ''{0}''", fREnv.getName(), fRProcess.getLabel(ITool.DEFAULT_LABEL))); // r.handleStatus(status, monitor); throw new CoreException(status); } } fRProcess = r.getTool(); fRTask = 2; } }
private boolean beginRTaskSilent(final IToolService r, final IProgressMonitor monitor) { synchronized (this) { if (fRProcess != null) { return false; } fRProcess = r.getTool(); fRTask = 1; return true; } }