use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class CopiesPanel method getSupportedFormats.
@NotNull
private List<WorkingCopyFormat> getSupportedFormats() {
List<WorkingCopyFormat> result = ContainerUtil.newArrayList();
ClientFactory factory = myVcs.getFactory();
ClientFactory otherFactory = myVcs.getOtherFactory(factory);
try {
result.addAll(factory.createUpgradeClient().getSupportedFormats());
result.addAll(SvnFormatWorker.getOtherFactoryFormats(otherFactory));
} catch (VcsException e) {
LOG.info(e);
}
return result;
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SetPropertyDialog method fillPropertyNames.
private void fillPropertyNames(File[] files) {
final Collection<String> names = new TreeSet<>();
if (files.length == 1) {
File file = files[0];
try {
PropertyConsumer handler = new PropertyConsumer() {
public void handleProperty(File path, PropertyData property) {
String name = property.getName();
if (name != null) {
names.add(name);
}
}
public void handleProperty(SVNURL url, PropertyData property) {
}
public void handleProperty(long revision, PropertyData property) {
}
};
PropertyClient client = myVCS.getFactory(file).createPropertyClient();
client.list(SvnTarget.fromFile(file, SVNRevision.WORKING), SVNRevision.WORKING, Depth.EMPTY, handler);
} catch (VcsException e) {
LOG.info(e);
}
}
fillProperties(names);
for (final String name : names) {
myPropertyNameBox.addItem(name);
}
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SetPropertyDialog method getProperty.
@Nullable
private PropertyValue getProperty(@NotNull File file, @NotNull String name) {
PropertyValue result;
try {
PropertyClient client = myVCS.getFactory(file).createPropertyClient();
result = client.getProperty(SvnTarget.fromFile(file, SVNRevision.WORKING), name, false, SVNRevision.WORKING);
} catch (VcsException e) {
LOG.info(e);
result = null;
}
return result;
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class AnnotateRevisionActionBase method annotate.
public static void annotate(@NotNull VirtualFile file, @NotNull VcsFileRevision fileRevision, @NotNull AbstractVcs vcs, @Nullable Editor editor, int annotatedLine) {
final CharSequence oldContent = editor == null ? null : editor.getDocument().getImmutableCharSequence();
final AnnotationProvider annotationProvider = vcs.getAnnotationProvider();
assert annotationProvider != null;
final Ref<FileAnnotation> fileAnnotationRef = new Ref<>();
final Ref<Integer> newLineRef = new Ref<>();
final Ref<VcsException> exceptionRef = new Ref<>();
VcsAnnotateUtil.getBackgroundableLock(vcs.getProject(), file).lock();
Semaphore semaphore = new Semaphore(0);
AtomicBoolean shouldOpenEditorInSync = new AtomicBoolean(true);
ProgressManager.getInstance().run(new Task.Backgroundable(vcs.getProject(), VcsBundle.message("retrieving.annotations"), true) {
public void run(@NotNull ProgressIndicator indicator) {
try {
FileAnnotation fileAnnotation = annotationProvider.annotate(file, fileRevision);
int newLine = translateLine(oldContent, fileAnnotation.getAnnotatedContent(), annotatedLine);
fileAnnotationRef.set(fileAnnotation);
newLineRef.set(newLine);
shouldOpenEditorInSync.set(false);
semaphore.release();
} catch (VcsException e) {
exceptionRef.set(e);
}
}
@Override
public void onFinished() {
VcsAnnotateUtil.getBackgroundableLock(vcs.getProject(), file).unlock();
}
@Override
public void onSuccess() {
if (!exceptionRef.isNull()) {
AbstractVcsHelper.getInstance(myProject).showError(exceptionRef.get(), VcsBundle.message("operation.name.annotate"));
}
if (fileAnnotationRef.isNull())
return;
AbstractVcsHelper.getInstance(myProject).showAnnotation(fileAnnotationRef.get(), file, vcs, newLineRef.get());
}
});
try {
semaphore.tryAcquire(ProgressWindow.DEFAULT_PROGRESS_DIALOG_POSTPONE_TIME_MILLIS, TimeUnit.MILLISECONDS);
// This will remove blinking on editor opening (step 1 - editor opens, step 2 - annotations are shown).
if (shouldOpenEditorInSync.get()) {
CharSequence content = LoadTextUtil.loadText(file);
int newLine = translateLine(oldContent, content, annotatedLine);
OpenFileDescriptor openFileDescriptor = new OpenFileDescriptor(vcs.getProject(), file, newLine, 0);
FileEditorManager.getInstance(vcs.getProject()).openTextEditor(openFileDescriptor, true);
}
} catch (InterruptedException ignore) {
}
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class VcsAnnotationCachedProxy method annotate.
@Override
public FileAnnotation annotate(final VirtualFile file) throws VcsException {
final DiffProvider diffProvider = myVcs.getDiffProvider();
final VcsRevisionNumber currentRevision = diffProvider.getCurrentRevision(file);
return annotate(file, currentRevision, true, new ThrowableComputable<FileAnnotation, VcsException>() {
@Override
public FileAnnotation compute() throws VcsException {
return myAnnotationProvider.annotate(file);
}
});
}
Aggregations