Author: dgeraskov
Date: 2008-10-24 10:16:21 -0400 (Fri, 24 Oct 2008)
New Revision: 11161
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/Utils.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2937
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/Utils.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/Utils.java 2008-10-24
14:15:47 UTC (rev 11160)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/Utils.java 2008-10-24
14:16:21 UTC (rev 11161)
@@ -62,19 +62,14 @@
IProject[] projects = root.getProjects();
ICompilationUnit resCompilationUnit = null;
for (int i = 0; i < projects.length; i++) {
- IJavaProject javaProject = JavaCore.create(projects[i]);
- IType lwType = null;
- try {
- lwType = javaProject.findType(fullyQualifiedName);
- } catch (JavaModelException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException: ",
e); //$NON-NLS-1$
+ if (projects[i].exists()){/*It is not required project be opened, so use exists
method*/
+ IJavaProject javaProject = JavaCore.create(projects[i]);
+ resCompilationUnit = findCompilationUnit(javaProject, fullyQualifiedName);
+
+ if (resCompilationUnit != null) {
+ break;
+ }
}
- if (lwType != null) {
- resCompilationUnit = lwType.getCompilationUnit();
- }
- if (resCompilationUnit != null) {
- break;
- }
}
return resCompilationUnit;
}