RE: [pdt-dev] How to add code-completion for PHP Framework

2009-11-02 Thread Roy Ganor
Your context resolver (ICompletionContextResolver) should add a new a new 
context that detects the application view files (ICompletionContext) and then 
applies the strategy that provides these fields that were defined in the 
controller.

 

Roy

From: pdt-dev-boun...@eclipse.org [mailto:pdt-dev-boun...@eclipse.org] On 
Behalf Of Robert Gruendler
Sent: Monday, November 02, 2009 8:30 PM
To: pdt-dev@eclipse.org
Subject: Re: [pdt-dev] How to add code-completion for PHP Framework

 

Hi Roy,

i managed to add existing IMethods to the php code assistance using the 
completionStrategyFactory.

However, when adding types to ICompletionReporter using reporter.reportXXX(), 
the type i'm adding
must already exist in the model as far as i've understood.

I have a use case, where variables are added to view templates by the 
framework, using FrameworkController::set('a', 'b').

So basically this would look like this:

In the Controller:

$myObject = new MyObject();
$this->set('foo', $myObject);

In the view file:

$ | <-- in this completeion context, there should be a variable $foo
$foo-> | << in this context, foo should offer possible completions for the type 
MyObject.


Do i need to add additional ModelElements using some extensionPoint like 
PHPMixinVisitor during
the build, so i can add them later in the completionStrategy for this kind of 
completion?

best

-robert




On 10/29/2009 6:08 AM, Roy Ganor wrote: 

Hi Robert,
org.eclipse.php.core.completionStrategyFactories and 
org.eclipse.php.core.completionContextResolvers are good starting points.
 
Roy
-Original Message-
From: pdt-dev-boun...@eclipse.org [mailto:pdt-dev-boun...@eclipse.org] On 
Behalf Of Robert Gruendler
Sent: Thursday, October 29, 2009 10:58 PM
To: pdt-dev@eclipse.org
Subject: Re: [pdt-dev] How to add code-completion for PHP Framework
 
Hi again,
 
one more question regarding code completion extensions:
 
Some framework classes use "components", which are declared
in a class variable, like this:
 
$components = array('Foo', 'Bar');
 
After declaring those components, the fields 'Foo' and 'Bar',
are accessible via $this->Foo and $this->Bar.
 
Any hint which extension point i should use to add those fields
to the code completion of classes which declare the $components
array ?
 
 
thanks!
 
-robert
On 10/28/2009 7:45 AM, rob...@dubture.com wrote:
  

Hi Michael,
 
thanks a lot, this got me started, it's working fine now.
 
best
 
-robert
 
On Wed, 28 Oct 2009 13:08:58 +0200, Michael Spector 
<mailto:spek...@gmail.com> 
wrote:
   


Hi Robert,
 
I think goalEvaluatorFactories extension point would be 
sufficient for
 
  

this
   


specific purpose.
You just need to add a rule that evaluates structures like:
ClassRegistry::init('MyObject'), and returns type (MyObject) 
for such
cases.
Take a look at
 
 
  


org.eclipse.php.internal.core.typeinference.evaluators.InstanceCreationEvaluator
   


as an example, which evaluates structures like: new MyObject().
 
Best regards,
Michael
 
On Wed, Oct 28, 2009 at 1:03 PM, 
<mailto:rob...@dubture.com>   wrote:
 
 
  

Hi all,
 
i'm trying to write an eclipse plugin for the Cakephp
framework, and i'd like to start off with some
additional framework-specific code assistance.
 
The framework uses a central "ClassRegistry" factory
for object instantiation. So, there's no "new" keyword 
for
some objects, for example:
 
$myObject = ClassRegistry::init('MyObject');
 
Basically i would like to give a hint to PDT that
the variable "$myObject" is an instance of the 
"MyObject"
class, which has already been loaded into the PDT Model,
so i guess i would simply point to the "MyObject" IType 
in
the Model somehow.
 
Could anyone give me a hint what would be the best 
method
to accomplish this? I'

Re: [pdt-dev] How to add code-completion for PHP Framework

2009-11-02 Thread Robert Gruendler

Hi Roy,

i managed to add existing IMethods to the php code assistance using the 
completionStrategyFactory.


However, when adding types to ICompletionReporter using 
reporter.reportXXX(), the type i'm adding

must already exist in the model as far as i've understood.

I have a use case, where variables are added to view templates by the 
framework, using FrameworkController::set('a', 'b').


So basically this would look like this:

In the Controller:

$myObject = new MyObject();
$this->set('foo', $myObject);

In the view file:

$ | <-- in this completeion context, there should be a variable $foo
$foo-> | << in this context, foo should offer possible completions for 
the type MyObject.



Do i need to add additional ModelElements using some extensionPoint like 
PHPMixinVisitor during
the build, so i can add them later in the completionStrategy for this 
kind of completion?


best

-robert




On 10/29/2009 6:08 AM, Roy Ganor wrote:

Hi Robert,
org.eclipse.php.core.completionStrategyFactories and 
org.eclipse.php.core.completionContextResolvers are good starting points.

Roy
-Original Message-
From: pdt-dev-boun...@eclipse.org [mailto:pdt-dev-boun...@eclipse.org] On 
Behalf Of Robert Gruendler
Sent: Thursday, October 29, 2009 10:58 PM
To: pdt-dev@eclipse.org
Subject: Re: [pdt-dev] How to add code-completion for PHP Framework

Hi again,

one more question regarding code completion extensions:

Some framework classes use "components", which are declared
in a class variable, like this:

$components = array('Foo', 'Bar');

After declaring those components, the fields 'Foo' and 'Bar',
are accessible via $this->Foo and $this->Bar.

Any hint which extension point i should use to add those fields
to the code completion of classes which declare the $components
array ?


thanks!

-robert
On 10/28/2009 7:45 AM, rob...@dubture.com wrote:
   

Hi Michael,

thanks a lot, this got me started, it's working fine now.

best

-robert

On Wed, 28 Oct 2009 13:08:58 +0200, Michael Spector
wrote:

 

Hi Robert,

I think goalEvaluatorFactories extension point would be sufficient for

   

this

 

specific purpose.
You just need to add a rule that evaluates structures like:
ClassRegistry::init('MyObject'), and returns type (MyObject) for such
cases.
Take a look at


   

org.eclipse.php.internal.core.typeinference.evaluators.InstanceCreationEvaluator

 

as an example, which evaluates structures like: new MyObject().

Best regards,
Michael

On Wed, Oct 28, 2009 at 1:03 PM,   wrote:


   

Hi all,

i'm trying to write an eclipse plugin for the Cakephp
framework, and i'd like to start off with some
additional framework-specific code assistance.

The framework uses a central "ClassRegistry" factory
for object instantiation. So, there's no "new" keyword for
some objects, for example:

$myObject = ClassRegistry::init('MyObject');

Basically i would like to give a hint to PDT that
the variable "$myObject" is an instance of the "MyObject"
class, which has already been loaded into the PDT Model,
so i guess i would simply point to the "MyObject" IType in
the Model somehow.

Could anyone give me a hint what would be the best method
to accomplish this? I've already had a look at the extension
points "completionStrategyFactories"/"completionContextResolvers"
and "goalEvaluatorFactories", but i'm not sure what's the best
way to hook into PDT for this kind of thing.


Thanks!

-robert

___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev


 

___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev

 

___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev
   



___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev
   


___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev


RE: [pdt-dev] How to add code-completion for PHP Framework

2009-10-29 Thread Roy Ganor
Hi Robert,
org.eclipse.php.core.completionStrategyFactories and 
org.eclipse.php.core.completionContextResolvers are good starting points.

Roy
-Original Message-
From: pdt-dev-boun...@eclipse.org [mailto:pdt-dev-boun...@eclipse.org] On 
Behalf Of Robert Gruendler
Sent: Thursday, October 29, 2009 10:58 PM
To: pdt-dev@eclipse.org
Subject: Re: [pdt-dev] How to add code-completion for PHP Framework

Hi again,

one more question regarding code completion extensions:

Some framework classes use "components", which are declared
in a class variable, like this:

$components = array('Foo', 'Bar');

After declaring those components, the fields 'Foo' and 'Bar',
are accessible via $this->Foo and $this->Bar.

Any hint which extension point i should use to add those fields
to the code completion of classes which declare the $components
array ?


thanks!

-robert
On 10/28/2009 7:45 AM, rob...@dubture.com wrote:
> Hi Michael,
>
> thanks a lot, this got me started, it's working fine now.
>
> best
>
> -robert
>
> On Wed, 28 Oct 2009 13:08:58 +0200, Michael Spector
> wrote:
>
>> Hi Robert,
>>
>> I think goalEvaluatorFactories extension point would be sufficient for
>>  
> this
>
>> specific purpose.
>> You just need to add a rule that evaluates structures like:
>> ClassRegistry::init('MyObject'), and returns type (MyObject) for such
>> cases.
>> Take a look at
>>
>>  
> org.eclipse.php.internal.core.typeinference.evaluators.InstanceCreationEvaluator
>
>> as an example, which evaluates structures like: new MyObject().
>>
>> Best regards,
>> Michael
>>
>> On Wed, Oct 28, 2009 at 1:03 PM,  wrote:
>>
>>  
>>> Hi all,
>>>
>>> i'm trying to write an eclipse plugin for the Cakephp
>>> framework, and i'd like to start off with some
>>> additional framework-specific code assistance.
>>>
>>> The framework uses a central "ClassRegistry" factory
>>> for object instantiation. So, there's no "new" keyword for
>>> some objects, for example:
>>>
>>> $myObject = ClassRegistry::init('MyObject');
>>>
>>> Basically i would like to give a hint to PDT that
>>> the variable "$myObject" is an instance of the "MyObject"
>>> class, which has already been loaded into the PDT Model,
>>> so i guess i would simply point to the "MyObject" IType in
>>> the Model somehow.
>>>
>>> Could anyone give me a hint what would be the best method
>>> to accomplish this? I've already had a look at the extension
>>> points "completionStrategyFactories"/"completionContextResolvers"
>>> and "goalEvaluatorFactories", but i'm not sure what's the best
>>> way to hook into PDT for this kind of thing.
>>>
>>>
>>> Thanks!
>>>
>>> -robert
>>>
>>> ___
>>> pdt-dev mailing list
>>> pdt-dev@eclipse.org
>>> https://dev.eclipse.org/mailman/listinfo/pdt-dev
>>>
>>>
> ___
> pdt-dev mailing list
> pdt-dev@eclipse.org
> https://dev.eclipse.org/mailman/listinfo/pdt-dev
>

___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev
___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev


Re: [pdt-dev] How to add code-completion for PHP Framework

2009-10-29 Thread Robert Gruendler

Hi again,

one more question regarding code completion extensions:

Some framework classes use "components", which are declared
in a class variable, like this:

$components = array('Foo', 'Bar');

After declaring those components, the fields 'Foo' and 'Bar',
are accessible via $this->Foo and $this->Bar.

Any hint which extension point i should use to add those fields
to the code completion of classes which declare the $components
array ?


thanks!

-robert
On 10/28/2009 7:45 AM, rob...@dubture.com wrote:

Hi Michael,

thanks a lot, this got me started, it's working fine now.

best

-robert

On Wed, 28 Oct 2009 13:08:58 +0200, Michael Spector
wrote:
   

Hi Robert,

I think goalEvaluatorFactories extension point would be sufficient for
 

this
   

specific purpose.
You just need to add a rule that evaluates structures like:
ClassRegistry::init('MyObject'), and returns type (MyObject) for such
cases.
Take a look at

 

org.eclipse.php.internal.core.typeinference.evaluators.InstanceCreationEvaluator
   

as an example, which evaluates structures like: new MyObject().

Best regards,
Michael

On Wed, Oct 28, 2009 at 1:03 PM,  wrote:

 

Hi all,

i'm trying to write an eclipse plugin for the Cakephp
framework, and i'd like to start off with some
additional framework-specific code assistance.

The framework uses a central "ClassRegistry" factory
for object instantiation. So, there's no "new" keyword for
some objects, for example:

$myObject = ClassRegistry::init('MyObject');

Basically i would like to give a hint to PDT that
the variable "$myObject" is an instance of the "MyObject"
class, which has already been loaded into the PDT Model,
so i guess i would simply point to the "MyObject" IType in
the Model somehow.

Could anyone give me a hint what would be the best method
to accomplish this? I've already had a look at the extension
points "completionStrategyFactories"/"completionContextResolvers"
and "goalEvaluatorFactories", but i'm not sure what's the best
way to hook into PDT for this kind of thing.


Thanks!

-robert

___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev

   

___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev
   


___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev


Re: [pdt-dev] How to add code-completion for PHP Framework

2009-10-28 Thread robert
Hi Michael, 

thanks a lot, this got me started, it's working fine now.

best

-robert

On Wed, 28 Oct 2009 13:08:58 +0200, Michael Spector 
wrote:
> Hi Robert,
> 
> I think goalEvaluatorFactories extension point would be sufficient for
this
> specific purpose.
> You just need to add a rule that evaluates structures like:
> ClassRegistry::init('MyObject'), and returns type (MyObject) for such
> cases.
> Take a look at
>
org.eclipse.php.internal.core.typeinference.evaluators.InstanceCreationEvaluator
> as an example, which evaluates structures like: new MyObject().
> 
> Best regards,
> Michael
> 
> On Wed, Oct 28, 2009 at 1:03 PM,  wrote:
> 
>> Hi all,
>>
>> i'm trying to write an eclipse plugin for the Cakephp
>> framework, and i'd like to start off with some
>> additional framework-specific code assistance.
>>
>> The framework uses a central "ClassRegistry" factory
>> for object instantiation. So, there's no "new" keyword for
>> some objects, for example:
>>
>> $myObject = ClassRegistry::init('MyObject');
>>
>> Basically i would like to give a hint to PDT that
>> the variable "$myObject" is an instance of the "MyObject"
>> class, which has already been loaded into the PDT Model,
>> so i guess i would simply point to the "MyObject" IType in
>> the Model somehow.
>>
>> Could anyone give me a hint what would be the best method
>> to accomplish this? I've already had a look at the extension
>> points "completionStrategyFactories"/"completionContextResolvers"
>> and "goalEvaluatorFactories", but i'm not sure what's the best
>> way to hook into PDT for this kind of thing.
>>
>>
>> Thanks!
>>
>> -robert
>>
>> ___
>> pdt-dev mailing list
>> pdt-dev@eclipse.org
>> https://dev.eclipse.org/mailman/listinfo/pdt-dev
>>
___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev


Re: [pdt-dev] How to add code-completion for PHP Framework

2009-10-28 Thread Michael Spector
Hi Robert,

I think goalEvaluatorFactories extension point would be sufficient for this
specific purpose.
You just need to add a rule that evaluates structures like:
ClassRegistry::init('MyObject'), and returns type (MyObject) for such cases.
Take a look at
org.eclipse.php.internal.core.typeinference.evaluators.InstanceCreationEvaluator
as an example, which evaluates structures like: new MyObject().

Best regards,
Michael

On Wed, Oct 28, 2009 at 1:03 PM,  wrote:

> Hi all,
>
> i'm trying to write an eclipse plugin for the Cakephp
> framework, and i'd like to start off with some
> additional framework-specific code assistance.
>
> The framework uses a central "ClassRegistry" factory
> for object instantiation. So, there's no "new" keyword for
> some objects, for example:
>
> $myObject = ClassRegistry::init('MyObject');
>
> Basically i would like to give a hint to PDT that
> the variable "$myObject" is an instance of the "MyObject"
> class, which has already been loaded into the PDT Model,
> so i guess i would simply point to the "MyObject" IType in
> the Model somehow.
>
> Could anyone give me a hint what would be the best method
> to accomplish this? I've already had a look at the extension
> points "completionStrategyFactories"/"completionContextResolvers"
> and "goalEvaluatorFactories", but i'm not sure what's the best
> way to hook into PDT for this kind of thing.
>
>
> Thanks!
>
> -robert
>
> ___
> pdt-dev mailing list
> pdt-dev@eclipse.org
> https://dev.eclipse.org/mailman/listinfo/pdt-dev
>
___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev