6161
6262
6363public class SketchOutline {
64+ protected final JavaEditor editor ;
65+
6466 protected JFrame frmOutlineView ;
65- protected ErrorCheckerService errorCheckerService ;
6667 protected JScrollPane jsp ;
6768 protected DefaultMutableTreeNode soNode , tempNode ;
6869 protected final JTree soTree ;
6970 protected JTextField searchField ;
70- protected JavaEditor editor ;
7171 protected boolean internalSelection = false ;
7272
7373 ImageIcon classIcon , fieldIcon , methodIcon ;
7474
7575
76- public SketchOutline (DefaultMutableTreeNode codeTree , ErrorCheckerService ecs ) {
77- errorCheckerService = ecs ;
78- editor = ecs .getEditor ();
76+ public SketchOutline (JavaEditor editor , DefaultMutableTreeNode codeTree ) {
77+ this .editor = editor ;
7978 soNode = new DefaultMutableTreeNode ();
8079 generateSketchOutlineTree (soNode , codeTree );
8180 soNode = (DefaultMutableTreeNode ) soNode .getChildAt (0 );
@@ -95,7 +94,7 @@ private void createGUI(){
9594 frmOutlineView = new JFrame ();
9695 frmOutlineView .setAlwaysOnTop (true );
9796 frmOutlineView .setUndecorated (true );
98- Point tp = errorCheckerService . getEditor () .getTextArea ().getLocationOnScreen ();
97+ Point tp = editor .getTextArea ().getLocationOnScreen ();
9998
10099 int minWidth = (int ) (editor .getMinimumSize ().width * 0.7f );
101100 int maxWidth = (int ) (editor .getMinimumSize ().width * 0.9f );
@@ -130,10 +129,10 @@ private void createGUI(){
130129 frmOutlineView .add (panelBottom );
131130 frmOutlineView .setDefaultCloseOperation (JFrame .DISPOSE_ON_CLOSE );
132131 frmOutlineView .pack ();
133- frmOutlineView .setBounds (tp .x + errorCheckerService . getEditor () .getTextArea ().getWidth () - minWidth , tp .y , minWidth ,
132+ frmOutlineView .setBounds (tp .x + editor .getTextArea ().getWidth () - minWidth , tp .y , minWidth ,
134133 Math .min (editor .getTextArea ().getHeight (), frmOutlineView .getHeight ()));
135- frmOutlineView .setMinimumSize (new Dimension (minWidth , Math .min (errorCheckerService . getEditor () .getTextArea ().getHeight (), frmOutlineView .getHeight ())));
136- frmOutlineView .setLocation (tp .x + errorCheckerService . getEditor () .getTextArea ().getWidth ()/2 - frmOutlineView .getWidth ()/2 ,
134+ frmOutlineView .setMinimumSize (new Dimension (minWidth , Math .min (editor .getTextArea ().getHeight (), frmOutlineView .getHeight ())));
135+ frmOutlineView .setLocation (tp .x + editor .getTextArea ().getWidth ()/2 - frmOutlineView .getWidth ()/2 ,
137136 frmOutlineView .getY () + (editor .getTextArea ().getHeight () - frmOutlineView .getHeight ()) / 2 );
138137 addListeners ();
139138 }
@@ -221,7 +220,7 @@ private void updateSelection(){
221220 protected Object doInBackground () throws Exception {
222221 String text = searchField .getText ().toLowerCase ();
223222 tempNode = new DefaultMutableTreeNode ();
224- filterTree (text , tempNode , soNode );
223+ filterTree (text , tempNode , soNode ); // TODO: is using soNode thread-safe? [jv]
225224 return null ;
226225 }
227226
0 commit comments