3131import dataTool .annotations .LinkAnnotation ;
3232import dataTool .annotations .ProgramNavigationPainter ;
3333import dataTool .annotations .SuggestedSelectionAnnotation ;
34- import dataTool .ui .NavigationDownBox ;
35- import dataTool .ui .NavigationUpBox ;
3634import edu .pdx .cs .multiview .jdt .util .JDTUtils ;
3735import edu .pdx .cs .multiview .jface .annotation .AnnTransaction ;
3836import edu .pdx .cs .multiview .jface .annotation .AnnotationPainter ;
@@ -45,7 +43,7 @@ public class AnnotationManager implements ISelectionChangedListener {
4543 private LinkAnnotation linkAnnotation = new LinkAnnotation ();
4644 private SourceViewer sourceViewer ;
4745 private ProgramNavigationPainter painter ;
48- private boolean isActive ;
46+ private static boolean isActive = false ;
4947 private IBreadcrumb dataBreadcrumb ;
5048
5149 // the visitor for the editor
@@ -67,58 +65,48 @@ public AnnotationManager(AbstractDecoratedTextEditor anEditor) {
6765 painter = new ProgramNavigationPainter (sourceViewer );
6866 painter .addSelectionChangedListener (this );
6967 sourceViewer .addPainter (painter );
70- isActive = false ;
68+ // isActive = false;
7169 selectionChanged ((ITextSelection ) painter .getSelection ());
7270 }
7371
7472 public void selectionChanged (ITextSelection selection ) {
7573 painter .removeAllAnnotations ();
7674 try {
7775 DataNode one = getNode (selection .getOffset ());
76+ System .out .println (one );
7877 Finder finder = Finder .getInstance ();
79- // System.out.println("myData2");
80- // System.out.println(one.getValue());
81- // System.out.println(one.getBinding());
82- // System.out.println(one.getSignature());
83- // System.out.println(one.getDeclarationMethod());
84- // System.out.println(one.getInvocationMethod());
85- // System.out.println(one.isParameterSelected(selection.getOffset()));
86- // System.out.println(finder.downSearch(one));
87- // System.out.println(finder.upSearch(one));
88- // System.out.println(finder.declarationToInvocationMapDown.entrySet());
89- // System.out.println(finder.invocationToDeclarationMapUp.entrySet());
90- // System.out.println(finder.map.entrySet());
9178 if (one != null ) {
9279 addAnnotation (one );
9380 currentSearch = one .getValue ();
81+ System .out .println (isActive +" isActive" );
82+ IWorkbenchPage activePage = PlatformUI .getWorkbench ().getActiveWorkbenchWindow ().getActivePage ();
83+ IEditorPart activeEditor = activePage .getActiveEditor ();
84+ System .out .println (activeEditor .getTitle ()+" tidal" );
85+ JavaEditor j = (JavaEditor ) activeEditor ;
86+ dataBreadcrumb = j .getBreadcrumb ();
9487 if (!isActive ) {
9588 isActive = true ;
96- IWorkbenchPage activePage = PlatformUI .getWorkbench ().getActiveWorkbenchWindow ().getActivePage ();
97- IEditorPart activeEditor = activePage .getActiveEditor ();
98- JavaEditor j = (JavaEditor ) activeEditor ;
99- dataBreadcrumb = j .getBreadcrumb ();
10089 ShowDataInBreadcrumbAction crumbs = new ShowDataInBreadcrumbAction (j , activePage );
10190 crumbs .run ();
10291 }
10392 DataCallHierarchy call = new DataCallHierarchy ();
10493 Set <IMethod > searchUp = null ;
105- Set <IMethod > searchDown = null ;
106- System .out .println (one .getBinding ()+" " +one .getDeclarationMethod () +" " +one .getInvocationMethod ());
107- //System.out.println(one.getBinding());
94+ //Set<IMethod> searchDown = null;
95+ //System.out.println(one.getBinding()+" "+one.getDeclarationMethod() +" "+one.getInvocationMethod());
10896 if ((finder .upSearch (one ) != null || finder .downSearch (one ) != null ) && currentSearch != null ) {
10997 searchUp = call .searchProject (one , Finder .UP );
110- searchDown = call .searchProject (one , Finder .DOWN );
111- System .out .println ("search " +one .getValue ());
98+ // searchDown = call.searchProject(one, Finder.DOWN);
99+ // System.out.println("search "+one.getValue()+" "+searchUp+" "+one.getDeclarationMethod ());
112100 if (one .isParameterSelected (selection .getOffset ())) {
113- linkAnnotation .searchResultsDown = searchDown ;
101+ // linkAnnotation.searchResultsDown = searchDown;
114102 linkAnnotation .searchResultsUp = searchUp ;
115103 linkAnnotation .setDataNode (one );
116104 addLinkAnnotation (one );
117105 }
118106 }
119107 Set <String > test = new HashSet <String >();
120108 test .add (one .getValue ());
121- // dataBreadcrumb.setText(test );
109+ dataBreadcrumb .setText (searchUp );
122110 //Adds all occurrences of data node off screen
123111 for (DataNode dn : finder .getOccurrences (one .getValue (), new Position (one .getStartPosition (), one .getLength ()))) {
124112 if (dn .getStartPosition () < sourceViewer .getTopIndexStartOffset ()) {
@@ -136,15 +124,6 @@ else if(dn.getStartPosition() > sourceViewer.getBottomIndexEndOffset()) {
136124 }
137125 } catch (Exception e ) {
138126 Activator .logError (e );
139- if (isActive ) {
140- try {
141- NavigationUpBox .getInstance ().setText (null );
142- NavigationDownBox .getInstance ().setText (null );
143- } catch (Exception e1 ) {
144- // Auto-generated catch block
145- //e.printStackTrace();
146- }
147- }
148127 removeAnnotations ();
149128 }
150129 }
@@ -154,23 +133,24 @@ else if(dn.getStartPosition() > sourceViewer.getBottomIndexEndOffset()) {
154133 * @param node: Current node selected by the user
155134 * @returns String method name
156135 */
157- /*private String getMethod(DataNode one) {
136+ private String getMethod (DataNode one ) {
137+
158138 //TODO Function that could come in handy later to get current method mouse is clicked in
159- ASTNode temp = one.;
139+ /* ASTNode temp = one.;
160140 while(!(temp instanceof MethodDeclaration) && temp != null) {
161141 temp = temp.getParent();
162142 }
163143 if(temp == null) {
164144 return null;
165145 }
166- return ((MethodDeclaration) temp).getName().getIdentifier();
146+ return ((MethodDeclaration) temp).getName().getIdentifier();*/
167147 //System.out.println(one.getValue()+" get "+one.getMethod().getName());
168148 //System.out.println(one.getBinding());
169149 //if(one.getMethod() != null) {
170150 //return one.getMethod().getName().toString();
171151 //}
172- // return null;
173- }*/
152+ return null ;
153+ }
174154
175155 private void addAnnotation (DataNode node ) {
176156 int start = node .getStartPosition ();
@@ -271,8 +251,8 @@ public void removeAnnotations() {
271251
272252 public void dispose () {
273253 painter .dispose ();
274- dataBreadcrumb .dispose ();
275- isActive = false ;
254+ // dataBreadcrumb.dispose();
255+ // isActive = false;
276256 currentSearch = null ;
277257 }
278258
0 commit comments