Getting IType of a class in jar file. [message #185435] |
Fri, 12 November 2004 16:54 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: roadspeed2002.yahoo.com
Hi All,
The following code below gives me an IType for a class in the workspace. I
am working in a J2EE workspace and the interested class resides in a jar
file in the ear folder. How do I can the IType of the class in the jar file.
Thanks in advance.
private static IType findTypeInWorkspace(String typeName) throws
JavaModelException {
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
IJavaProject[] projects= JavaCore.create(root).getJavaProjects();
for (int i= 0; i < projects.length; i++) {
IType type= findType(projects[i], typeName);
if (type != null) {
return type; }}
return null;
}
|
|
|
Re: Getting IType of a class in jar file. [message #185582 is a reply to message #185435] |
Mon, 15 November 2004 14:16 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: daniel.megert.gmx.net
Roadway wrote:
>Hi All,
>
>The following code below gives me an IType for a class in the workspace. I
>am working in a J2EE workspace and the interested class resides in a jar
>file in the ear folder. How do I can the IType of the class in the jar file.
>Thanks in advance.
>
>
Take a look at JavaModelUtil.findType(IPackageFragmentRoot, String)
Dani
>private static IType findTypeInWorkspace(String typeName) throws
>JavaModelException {
>
>IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
>
>IJavaProject[] projects= JavaCore.create(root).getJavaProjects();
>
>for (int i= 0; i < projects.length; i++) {
>
>IType type= findType(projects[i], typeName);
>
>if (type != null) {
>
>return type; }}
>
>return null;
>
>}
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02318 seconds