use of com.intellij.cvsSupport2.errorHandling.CannotFindCvsRootException in project intellij-community by JetBrains.
the class CvsCommandOperation method doExecute.
private void doExecute(final CvsExecutionEnvironment executionEnvironment, boolean underReadAction) throws VcsException {
final VcsException[] exc = new VcsException[1];
final Runnable action = () -> {
try {
final ReadWriteStatistics statistics = executionEnvironment.getReadWriteStatistics();
final Collection<CvsRootProvider> allCvsRoots;
try {
allCvsRoots = getAllCvsRoots();
} catch (CannotFindCvsRootException e) {
throw createVcsExceptionOn(e, null);
}
final IProgressViewer progressViewer = new IProgressViewer() {
@Override
public void setProgress(double value) {
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
if (progressIndicator != null)
progressIndicator.setFraction(value);
}
};
int count = 0;
final double step = 1.0 / allCvsRoots.size();
for (CvsRootProvider cvsRootProvider : allCvsRoots) {
try {
final double lowerBound = step * count;
final RangeProgressViewer partialProgress = new RangeProgressViewer(progressViewer, lowerBound, lowerBound + step);
myLastProcessedCvsRoot = cvsRootProvider.getCvsRootAsString();
execute(cvsRootProvider, executionEnvironment, statistics, partialProgress);
count++;
} catch (IOCommandException e) {
LOG.info(e);
throw createVcsExceptionOn(e.getIOException(), cvsRootProvider.getCvsRootAsString());
} catch (CommandException e) {
LOG.info(e);
final Exception underlyingException = e.getUnderlyingException();
if (underlyingException != null) {
LOG.info(underlyingException);
}
throw createVcsExceptionOn(underlyingException == null ? e : underlyingException, cvsRootProvider.getCvsRootAsString());
}
}
} catch (VcsException e) {
exc[0] = e;
}
};
if (underReadAction) {
ApplicationManager.getApplication().runReadAction(action);
} else {
action.run();
}
if (exc[0] != null)
throw exc[0];
}
use of com.intellij.cvsSupport2.errorHandling.CannotFindCvsRootException in project intellij-community by JetBrains.
the class CvsRootOnFileSystem method createMeOn.
public static CvsRootOnFileSystem createMeOn(File file) throws CannotFindCvsRootException {
File nearestRoot = getRootFor(file);
if (nearestRoot == null)
throw new CannotFindCvsRootException(file);
CvsConnectionSettings cvsRoot = getCvsRootFor(nearestRoot);
if (cvsRoot == CvsInfo.getAbsentSettings())
throw new CannotFindCvsRootException(file);
File commonRoot = getCommonRoot(nearestRoot, cvsRoot);
return new CvsRootOnFileSystem(getCvsEntriesManager().getCvsConnectionSettingsFor(commonRoot), commonRoot);
}
Aggregations