@Nullable @Override public String getToolTip(int line, Editor editor) { VcsRevisionNumber revisionNumber = annotation.getLineRevisionNumber(line); if (revisionNumber == null) { return null; } if (devMotivePanel == null) { return "Dev Motive closed"; } Collection<WorkItem> workItems = devMotivePanel.getWorkItemsByRevisionNumber(revisionNumber, true); if (workItems == null) { if (loadRevisionNumber(revisionNumber)) { return "Loading association information..."; } else { return "Revision not found"; } } else if (!workItems.isEmpty()) { StringBuffer buf = new StringBuffer(); for (WorkItem workItem : workItems) { if (buf.length() > 0) { buf.append("\n\n"); } buf.append(getWorkItemToolTip(workItem)); } return buf.toString(); } else { return null; } }
@Nullable @Override public String getLineText(int line, Editor editor) { VcsRevisionNumber revisionNumber = annotation.getLineRevisionNumber(line); if (revisionNumber == null) { return null; } if (devMotivePanel == null) { return "---"; } Collection<WorkItem> workItems = devMotivePanel.getWorkItemsByRevisionNumber(revisionNumber, false); if (workItems == null) { return unknownLine; } StringBuffer buf = new StringBuffer(); for (WorkItem workItem : workItems) { if (buf.length() > 0) { buf.append(", "); } switch (workItem.getType()) { case DEFECT: buf.append("D: "); break; case USER_STORY: buf.append("U: "); break; } buf.append(workItem.getId()); } return buf.toString(); }
@Override public EditorFontType getStyle(int line, Editor editor) { VcsRevisionNumber revisionNumber = annotation.getLineRevisionNumber(line); if (revisionNumber != null && revisionNumber.equals(annotation.getCurrentRevision())) { return EditorFontType.BOLD_ITALIC; } else { return EditorFontType.ITALIC; } }
@Override public void doAction(int line) { if (devMotivePanel == null) { return; } VcsRevisionNumber revisionNumber = annotation.getLineRevisionNumber(line); if (revisionNumber != null) { devMotivePanel.selectRevision(revisionNumber); } }
@Override public Cursor getCursor(int line) { if (devMotivePanel == null) { return Cursor.getDefaultCursor(); } VcsRevisionNumber revisionNumber = annotation.getLineRevisionNumber(line); if (revisionNumber != null) { Collection<WorkItem> workItems = devMotivePanel.getWorkItemsByRevisionNumber(revisionNumber, true); if (workItems != null && !workItems.isEmpty()) { return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); } } return Cursor.getDefaultCursor(); }