private String getFileRevisionLabel(FileRevisionTypedElement element) { IFileRevision fileObject = element.getFileRevision(); if (fileObject instanceof LocalFileRevision) { return NLS.bind( Messages.GitCompareFileRevisionEditorInput_localRevision, new Object[] {element.getName(), element.getTimestamp()}); } return NLS.bind( Messages.GitCompareFileRevisionEditorInput_repository, new Object[] {element.getName(), element.getContentIdentifier()}); }
private String getContentIdentifier(ITypedElement element) { if (element instanceof FileRevisionTypedElement) { FileRevisionTypedElement fileRevisionElement = (FileRevisionTypedElement) element; Object fileObject = fileRevisionElement.getFileRevision(); if (fileObject instanceof LocalFileRevision) { try { IStorage storage = ((LocalFileRevision) fileObject).getStorage(new NullProgressMonitor()); if (Utils.getAdapter(storage, IFileState.class) != null) { // local revision return Messages.GitCompareFileRevisionEditorInput_0; } else if (Utils.getAdapter(storage, IFile.class) != null) { // current revision return Messages.GitCompareFileRevisionEditorInput_1; } } catch (CoreException e) { GitUIPlugin.logError( Messages.GitCompareFileRevisionEditorInput_ProblemGettingContent_Error, e); } } else { return fileRevisionElement.getContentIdentifier(); } } return Messages.GitCompareFileRevisionEditorInput_2; }