3939import dataTool .DataNode ;
4040import dataTool .EnableNavigationAction ;
4141import dataTool .Finder ;
42- import dataTool .ui .NavigationDownBox ;
43- import dataTool .ui .NavigationUpBox ;
42+
4443import edu .pdx .cs .multiview .jdt .util .JDTUtils ;
4544import edu .pdx .cs .multiview .jface .annotation .ISelfDrawingAnnotation ;
4645
@@ -104,23 +103,14 @@ else if(linkNode.getDeclarationMethod() != null) {
104103 try {
105104 search = searchResultsUp .toArray ();
106105 im = (IMethod )search [0 ];
107- try {
108- if ( im . getSource () == null ) {
109- JOptionPane . showMessageDialog ( null , INVALID , "Error" , JOptionPane . ERROR_MESSAGE );
110- }
111- } catch ( HeadlessException | JavaModelException e1 ) {
112- // Auto-generated catch block
113- e1 . printStackTrace () ;
106+ searchMethod = linkNode . getDeclarationMethod (). getName (). getIdentifier ();
107+ editor = JavaUI . openInEditor ( im , true , true );
108+ if ( editor != null ) {
109+ String code = JDTUtils . getCUSource (( AbstractTextEditor ) editor );
110+ lineSearch ( code . toCharArray (), im );
111+ goToLine ( editor );
112+ load = true ;
114113 }
115- searchMethod = linkNode .getDeclarationMethod ().getName ().getIdentifier ();
116- load = false ;
117- editor = JavaUI .openInEditor (im , true , true );
118- if (editor != null ) {
119- String code = JDTUtils .getCUSource ((AbstractTextEditor ) editor );
120- lineSearch (code .toCharArray (), im );
121- goToLine (editor );
122- load = true ;
123- }
124114 } catch (Exception e ) {
125115 // Auto-generated catch block
126116 e .printStackTrace ();
@@ -131,31 +121,7 @@ else if(linkNode.getDeclarationMethod() != null) {
131121 });
132122 }
133123
134- /**
135- * Searches for line of where method is invoked in new file
136- * @param source: char[] of code
137- * @param method: IMethod we're searching for
138- */
139- <<<<<<< HEAD
140- public static void openLink (IMethod i ) {
141- IEditorPart editor = null ;
142- try {
143- editor = JavaUI .openInEditor (i , true , true );
144- } catch (JavaModelException | PartInitException e ) {
145- // Auto-generated catch block
146- e .printStackTrace ();
147- }
148- if (editor != null ) {
149- String code = JDTUtils .getCUSource ((AbstractTextEditor ) editor );
150- lineSearch (code .toCharArray (), i );
151- goToLine (editor );
152- }
153- }
154-
155- private static void lineSearch (char [] source , IMethod method ) {
156- =======
157124 private void lineSearch (char [] source , IMethod method ) {
158- >>>>>>> 9e7430d 02 c6f5eb51c986bd85f19126c29bb5e91
159125 ASTParser parser = ASTParser .newParser (AST .JLS3 );
160126 parser .setSource (source );
161127 parser .setKind (ASTParser .K_COMPILATION_UNIT );
0 commit comments