/** * 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); }
/** * 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); }