Lines 165-175
Link Here
|
165 |
|
165 |
|
166 |
IJavaProject javaProject = JavaCore.create(project); |
166 |
IJavaProject javaProject = JavaCore.create(project); |
167 |
if(javaProject.exists()){ |
167 |
if(javaProject.exists()){ |
168 |
IType type; |
168 |
IType type = null; |
169 |
try { |
169 |
try { |
170 |
type = javaProject.findType( name ); |
170 |
//if name is null then can't get type |
171 |
ICompilationUnit cu = type.getCompilationUnit(); |
171 |
if(name != null) { |
172 |
EditorUtility.openInEditor(cu); |
172 |
type = javaProject.findType( name ); |
|
|
173 |
} |
174 |
|
175 |
//if type is null then can't open its editor, so open editor for the resource |
176 |
if(type != null) { |
177 |
ICompilationUnit cu = type.getCompilationUnit(); |
178 |
EditorUtility.openInEditor(cu); |
179 |
} else{ |
180 |
openAppropriateEditor(resource); |
181 |
} |
173 |
} catch (JavaModelException e) { |
182 |
} catch (JavaModelException e) { |
174 |
J2EEUIPlugin.logError(-1, e.getMessage(), e); |
183 |
J2EEUIPlugin.logError(-1, e.getMessage(), e); |
175 |
} catch (PartInitException e) { |
184 |
} catch (PartInitException e) { |