Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » [PDT/PHP] Find superclass(es) for given class(How can I search for PHP superclasses using DLTK/PDT dev APIs?)
icon5.gif  [PDT/PHP] Find superclass(es) for given class [message #658435] Tue, 08 March 2011 09:05 Go to next message
Lorenzo is currently offline Lorenzo
Messages: 2
Registered: October 2009
Junior Member
Hi everyone. I'm developing a DLTK/PDT plugin (it's a goal evaluator extensions that do type hinting for Code Assist). I did something like:
http://wiki.eclipse.org/Extending_PDT_2.2#Type_inference_hin ting

Now I'm stucked because, after I succed to get the PHP class name I need, I can't find the way to check if that XXX class is a subclass of YYY. I can't figure out!
There's a way to explore the PHP Type Hierarchy? Or something, I don't know...

Thank you.
Lorenzo.
Re: [PDT/PHP] Find superclass(es) for given class [message #666823 is a reply to message #658435] Fri, 22 April 2011 16:27 Go to previous message
Daniel Mising name is currently offline Daniel Mising name
Messages: 9
Registered: April 2011
Junior Member
Hello Lorenzo.

I just had to do something similar but starting with an "ISourceModule" instance.

for (IType type : sourceModule.getTypes()) {
    String[] ancestors = type.getSuperClasses();
    // ancestors are only the immediate parent types, not the grand-parent types
    foreach (String superClass : ancestors) {
        System.out.println(superClass);
    }
}


Basically the key is in "IType#getSuperClasses()". Much easier than I expected it to be!
Previous Topic:Use DefaultProblem to put error marker in editor
Next Topic:[BUILD] I-I201104241621-201104241621
Goto Forum:
  


Current Time: Mon Jul 28 12:26:12 EDT 2014

Powered by FUDForum. Page generated in 0.10395 seconds