Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-dev] Retrieving, instantiating an IType

Thanks for the response. I'm writing a plugin that allows a developer (or a oop learner) to create objects (and display them within a view) and play with them for instant gratification- this will later be rolled into creating JUnit scripts. It's similar to the scrapbook functionality, except it's visual. I figure that, if the scrapbook can instantiate objects, then so can I.

The more time I spend thinking about it and the more I research it, however, the more I think it's going to be harder than I thought. I'm wondering if I should create my own ClassLoader to create the classes which aren't in the classpath, and run things in a separate JVM, or if I should use the Scrapbook API directly, or there's another option or API I haven't considered yet. Any and all input is great.

Liam


David Saff wrote:

Liam,

The search engine is the way to go. You can just give it null for a Progress Monitor if it's not communicating with a GUI.

Instantiating an object of that type might be a challenge: there's no guarantee that the class is on Eclipse's own classpath. Why are you trying to do this?

   David Saff

Liam Morley wrote:

I'd like to go from a fully-qualified class name and retrieve an object of type IType. The class name could be any class within the classpath, or any Java class in any project. The class name is supplied as a string. What's the easiest way to get that? I was looking through the SearchEngine class, but I'm not sure what to supply for a progress monitor etc... I'm not looking to use this with the UI.

After retrieving an IType, I'd like to instantiate an object of that type. Should I go through the java reflection api, or is there some proper Eclipse way of doing this that I'm not aware of?


_______________________________________________
jdt-dev mailing list
jdt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/jdt-dev





Back to the top