use of org.eclipse.egit.ui.internal.synchronize.model.GitModelWorkingFile in project egit by eclipse.
the class GitOpenInCompareAction method handleGitObjectComparison.
private void handleGitObjectComparison(GitModelBlob obj, boolean reuseEditor) {
ITypedElement left;
ITypedElement right;
if (obj instanceof GitModelWorkingFile) {
IPath location = obj.getLocation();
if (location == null) {
return;
}
IFile file = ResourceUtil.getFileForLocation(location, false);
if (file == null) {
Repository repository = null;
GitModelObject modelObject = obj;
while (modelObject != null) {
if (modelObject instanceof GitModelRepository) {
repository = ((GitModelRepository) modelObject).getRepository();
break;
}
modelObject = modelObject.getParent();
}
if (repository == null) {
return;
}
left = new LocalNonWorkspaceTypedElement(repository, location);
} else {
left = SaveableCompareEditorInput.createFileElement(file);
}
right = getCachedFileElement(obj);
} else if (obj instanceof GitModelCacheFile) {
left = getCachedFileElement(obj);
right = getHeadFileElement(obj);
if (right == null)
return;
} else {
oldAction.run();
return;
}
GitCompareFileRevisionEditorInput in = new GitCompareFileRevisionEditorInput(left, right, null);
IWorkbenchPage page = getWorkbenchPage(conf.getSite());
OpenInCompareAction.openCompareEditor(in, page, reuseEditor);
}
Aggregations