Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Getting IType of a class in jar file.
Getting IType of a class in jar file. [message #185435] Fri, 12 November 2004 16:54 Go to next message
Eclipse UserFriend
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
Eclipse UserFriend
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;
>
>}
>
>
>
>
Previous Topic:How to create a standalone command line tool that successfully uses ASTParser.setResolveBindings(tru
Next Topic:Enabling Java projects
Goto Forum:
  


Current Time: Fri Aug 23 11:15:34 GMT 2024

Powered by FUDForum. Page generated in 0.02318 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top