1 19 20 package org.netbeans.modules.subversion.ui.blame; 21 22 import org.netbeans.editor.SideBarFactory; 23 24 import javax.swing.*; 25 import javax.swing.text.JTextComponent ; 26 27 30 public class AnnotationBarManager implements SideBarFactory { 31 32 private static final Object BAR_KEY = new Object (); 33 34 38 public JComponent createSideBar(JTextComponent target) { 39 final AnnotationBar ab = new AnnotationBar(target); 40 target.putClientProperty(BAR_KEY, ab); 41 return ab; 42 } 43 44 47 public static AnnotationBar showAnnotationBar(JTextComponent target) { 48 AnnotationBar ab = (AnnotationBar) target.getClientProperty(BAR_KEY); 49 assert ab != null: "#58828 reappeared!"; ab.annotate(); 51 return ab; 52 } 53 54 57 public static void hideAnnotationBar(JTextComponent target) { 58 if (target == null) return; 59 AnnotationBar ab = (AnnotationBar) target.getClientProperty(BAR_KEY); 60 assert ab != null: "#58828 reappeared!"; ab.hideBar(); 62 } 63 64 67 public static boolean annotationBarVisible(JTextComponent target) { 68 if (target == null) return false; 69 AnnotationBar ab = (AnnotationBar) target.getClientProperty(BAR_KEY); 70 if (ab == null) { 71 return false; 72 } 73 return ab.getPreferredSize().width > 0; 74 } 75 } 76 77 | Popular Tags |