Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Code completion assistant
Code completion assistant [message #64851] Tue, 22 January 2008 02:33 Go to next message
Eclipse UserFriend
Originally posted by: onkr.op.pl

Hi

Is there a way to tell eclipse that certain variable is actually an
object of class xyz so code completion assistant can suggest methods.
I guess the best way to explain what I'm referring to is an example:

//Class A and B are implementing the same interface or abstract class.

class A extends AbstractClass{
function method1(){...}
function method2(){...}
function method3(){...}
}

class A extends AbstractClass {
function method1(){...}
function method2(){...}
function method3(){...}
}

//Factory class

class FAC{

public static function Create($something){
if($something){
return new A();
}else{
return new B();
}
}

}

$example = FAC::Create(1);

Now when I use $example eclipse code completion assistant is not
suggesting anything to me. Is there a way to tell Eclipse that the
$example is object of class A or B?

Ralph
Re: Code completion assistant [message #64874 is a reply to message #64851] Tue, 22 January 2008 08:13 Go to previous messageGo to next message
Georg Nagel is currently offline Georg NagelFriend
Messages: 3
Registered: July 2009
Junior Member
Ralph wrote:
> Hi
>
> Is there a way to tell eclipse that certain variable is actually an
> object of class xyz so code completion assistant can suggest methods.
> I guess the best way to explain what I'm referring to is an example:
>
> //Class A and B are implementing the same interface or abstract class.
>
> class A extends AbstractClass{
> function method1(){...}
> function method2(){...}
> function method3(){...}
> }
>
> class A extends AbstractClass {
> function method1(){...}
> function method2(){...}
> function method3(){...}
> }
>
> //Factory class
>
> class FAC{
>
> public static function Create($something){
> if($something){
> return new A();
> }else{
> return new B();
> }
> }
>
> }
>
> $example = FAC::Create(1);
>
> Now when I use $example eclipse code completion assistant is not
> suggesting anything to me. Is there a way to tell Eclipse that the
> $example is object of class A or B?
>
> Ralph

try phpdoc comments:

/**
*
* @return AbstractClass
*/

public static function Create($something){
Re: Code completion assistant [message #64895 is a reply to message #64874] Tue, 22 January 2008 14:32 Go to previous message
Eclipse UserFriend
Originally posted by: onkr.op.pl

Hi

WORKS !!!

Thank you!
Previous Topic:Information about Eclipse 1.0.2
Next Topic:Variables in code templates
Goto Forum:
  


Current Time: Mon Jan 30 12:36:31 GMT 2023

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

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

Back to the top