@Override public void showRevisionInformation(RevisionInformation info, String quickDiffProviderId) { if (info.getHoverControlCreator() == null) info.setHoverControlCreator(new RevisionHoverInformationControlCreator(false)); if (info.getInformationPresenterControlCreator() == null) info.setInformationPresenterControlCreator(new RevisionHoverInformationControlCreator(true)); showChangeInformation(true); if (fLineColumn != null) fLineColumn.showRevisionInformation(info, quickDiffProviderId); }
/** * Adjusts the revision information to the given diff information. Any previous diff information * is discarded. <strong>Note:</strong> This is an internal framework method and must not be * called by clients. * * @param hunks the diff hunks to adjust the revision information to * @since 3.3 * @noreference This method is not intended to be referenced by clients. */ public void applyDiff(Hunk[] hunks) { fRanges= null; // mark for recomputation for (Revision revision : getRevisions()) revision.applyDiff(hunks); }
public void showRevisionInformation(RevisionInformation info, String quickDiffProviderId) { if (info.getHoverControlCreator() == null) info.setHoverControlCreator(new RevisionHoverInformationControlCreator(false)); showChangeInformation(true); if (fLineColumn != null) fLineColumn.showRevisionInformation(info, quickDiffProviderId); }
/** * Gets all change ranges of the revisions in the revision model and adapts them * to the current quick diff information. The list is cached. * * @return the list of all change regions, with diff information applied */ private synchronized List<RevisionRange> getRangeCache() { if (fRevisionRanges == null) { if (fRevisionInfo == null || fLineDiffer == null) { fRevisionRanges = Collections.emptyList(); } else { Hunk[] hunks = HunkComputer.computeHunks(fLineDiffer, fViewer.getDocument().getNumberOfLines()); fRevisionInfo.applyDiff(hunks); fRevisionRanges = fRevisionInfo.getRanges(); // updateOverviewAnnotations(); // informListeners(); } } return fRevisionRanges; }
public void execute(IProgressMonitor monitor) throws CoreException { final RevisionInformation info = new RevisionInformation(); info.setHoverControlCreator(new BlameInformationControlCreator(false)); info.setInformationPresenterControlCreator(new BlameInformationControlCreator( true)); revision.setCommit(commit); revisions.put(commit, revision); info.addRevision(revision);
@Override public IInformationControlCreator getHoverControlCreator() { RevisionInformation revisionInfo= fRevisionInfo; if (revisionInfo != null) { IInformationControlCreator creator= revisionInfo.getHoverControlCreator(); if (creator != null) return creator; } return new HoverInformationControlCreator(false); }
@Override public IInformationControlCreator getInformationPresenterControlCreator() { RevisionInformation revisionInfo= fRevisionInfo; if (revisionInfo != null) { IInformationControlCreator creator= revisionInfo.getInformationPresenterControlCreator(); if (creator != null) return creator; } return new HoverInformationControlCreator(true); } }
/** * Gets all change ranges of the revisions in the revision model and adapts them to the current * quick diff information. The list is cached. * * @return the list of all change regions, with diff information applied */ private synchronized List<RevisionRange> getRangeCache() { if (fRevisionRanges == null) { if (fRevisionInfo == null) { fRevisionRanges= Collections.emptyList(); } else { Hunk[] hunks= HunkComputer.computeHunks(fLineDiffer, fViewer.getDocument().getNumberOfLines()); fRevisionInfo.applyDiff(hunks); fRevisionRanges= fRevisionInfo.getRanges(); updateOverviewAnnotations(); informListeners(); } } return fRevisionRanges; }
@Override public IInformationControlCreator getHoverControlCreator() { RevisionInformation revisionInfo= fRevisionInfo; if (revisionInfo != null) { IInformationControlCreator creator= revisionInfo.getHoverControlCreator(); if (creator != null) return creator; } return new HoverInformationControlCreator(false); }
@Override public IInformationControlCreator getInformationPresenterControlCreator() { RevisionInformation revisionInfo= fRevisionInfo; if (revisionInfo != null) { IInformationControlCreator creator= revisionInfo.getInformationPresenterControlCreator(); if (creator != null) return creator; } return new HoverInformationControlCreator(true); } }
/** * Gets all change ranges of the revisions in the revision model and adapts them to the current * quick diff information. The list is cached. * * @return the list of all change regions, with diff information applied */ private synchronized List<RevisionRange> getRangeCache() { if (fRevisionRanges == null) { if (fRevisionInfo == null) { fRevisionRanges= Collections.emptyList(); } else { Hunk[] hunks= HunkComputer.computeHunks(fLineDiffer, fViewer.getDocument().getNumberOfLines()); fRevisionInfo.applyDiff(hunks); fRevisionRanges= fRevisionInfo.getRanges(); updateOverviewAnnotations(); informListeners(); } } return fRevisionRanges; }
/** * Adjusts the revision information to the given diff information. Any previous diff information * is discarded. <strong>Note:</strong> This is an internal framework method and must not be * called by clients. * * @param hunks the diff hunks to adjust the revision information to * @since 3.3 * @noreference This method is not intended to be referenced by clients. */ public void applyDiff(Hunk[] hunks) { fRanges= null; // mark for recomputation for (Iterator<Revision> revisions= getRevisions().iterator(); revisions.hasNext();) revisions.next().applyDiff(hunks); }
/** * Sets the revision information, which is needed to compute the relative age of a revision. * * @param info the new revision info, <code>null</code> for none. */ public void setInfo(RevisionInformation info) { fRevisions= null; fColors.clear(); fFocusColors.clear(); if (info == null) return; List<Long> revisions= new ArrayList<>(); for (Revision revision : info.getRevisions()) { revisions.add(Long.valueOf(computeAge(revision))); } Collections.sort(revisions); fRevisions= revisions; }
/** * Sets the revision information, which is needed to compute the relative age of a revision. * * @param info the new revision info, <code>null</code> for none. */ public void setInfo(RevisionInformation info) { fRevisions= null; fColors.clear(); fFocusColors.clear(); if (info == null) return; List<Long> revisions= new ArrayList<>(); for (Iterator<Revision> it= info.getRevisions().iterator(); it.hasNext();) { Revision revision= it.next(); revisions.add(new Long(computeAge(revision))); } Collections.sort(revisions); fRevisions= revisions; }
/** * Returns the width in chars required to display information. * * @return the width in chars required to display information * @since 3.3 */ public int getRequiredWidth() { if (fRequiredWidth == -1) { if (hasInformation() && (fShowRevision || fShowAuthor)) { int revisionWidth= 0; int authorWidth= 0; for (Iterator<Revision> it= fRevisionInfo.getRevisions().iterator(); it.hasNext();) { Revision revision= it.next(); revisionWidth= Math.max(revisionWidth, revision.getId().length()); authorWidth= Math.max(authorWidth, revision.getAuthor().length()); } fRevisionIdChars= revisionWidth + 1; if (fShowAuthor && fShowRevision) fRequiredWidth= revisionWidth + authorWidth + 2; else if (fShowAuthor) fRequiredWidth= authorWidth + 1; else fRequiredWidth= revisionWidth + 1; } else { fRequiredWidth= 0; } } return fRequiredWidth; }
/** * Handles the selection of a revision id and informs listeners * * @param id the selected revision id */ void handleRevisionSelected(String id) { Assert.isLegal(id != null); if (fRevisionInfo == null) return; for (Iterator<Revision> it= fRevisionInfo.getRevisions().iterator(); it.hasNext();) { Revision revision= it.next(); if (id.equals(revision.getId())) { handleRevisionSelected(revision); return; } } // clear selection if it does not exist handleRevisionSelected((Revision) null); }
/** * Returns the width in chars required to display information. * * @return the width in chars required to display information * @since 3.3 */ public int getRequiredWidth() { if (fRequiredWidth == -1) { if (hasInformation() && (fShowRevision || fShowAuthor)) { int revisionWidth= 0; int authorWidth= 0; for (Revision revision : fRevisionInfo.getRevisions()) { revisionWidth= Math.max(revisionWidth, revision.getId().length()); authorWidth= Math.max(authorWidth, revision.getAuthor().length()); } fRevisionIdChars= revisionWidth + 1; if (fShowAuthor && fShowRevision) fRequiredWidth= revisionWidth + authorWidth + 2; else if (fShowAuthor) fRequiredWidth= authorWidth + 1; else fRequiredWidth= revisionWidth + 1; } else { fRequiredWidth= 0; } } return fRequiredWidth; }
/** * Handles the selection of a revision id and informs listeners * * @param id the selected revision id */ void handleRevisionSelected(String id) { Assert.isLegal(id != null); if (fRevisionInfo == null) return; for (Revision revision : fRevisionInfo.getRevisions()) { if (id.equals(revision.getId())) { handleRevisionSelected(revision); return; } } // clear selection if it does not exist handleRevisionSelected((Revision) null); }