hi Robert ,

Do you implement your own IndexingVisitor?
btw,does it make sense if we pass requestor(IIndexingRequestor) to
PhpIndexingVisitorExtension ?


2011/6/25 Robert Gründler <[email protected]>

> sorry for spamming the list, but there's really not much information in the
> net available concerning PDT indexing.
>
> I've followed the "contributing to index" chapter in the wiki
> http://wiki.eclipse.org/Extending_PDT_2.2#Contributing_to_index
> but i'm not sure if this is still up-to-date, because when i contribute
> additional fields to a TypeDeclaration,
> nothing appears in code assist for $this-> in that class.
>
> What confuses me is that a PDT Indexing Extension needs to subclass
> PhpIndexingVisitorExtension
> and provide declarationinfos using modifyDeclaration() calls.
>
> However, the modifyDeclaration() method in the PhpIndexingVisitorExtension
> is completely empty,
> as apposed to the PhpIndexingVisitor which calls
> requestor.addDeclaration(info) in this method.
>
> The requestor is not available to extensions though.
>
> My IndexingVisitor does basically the same like the one in the Wiki (inside
> the endVisit(TypeDeclaration) method):
>
>                 DeclarationInfo info = new
> DeclarationInfo(IModelElement.FIELD,
>                         Modifiers.AccPublic, start, length, start, length,
> name,
>                         null, null, namespace.getName(),
> currentClass.getName());
>
>                 modifyDeclaration(field, info);
>
> Do i need to specify an implementation for the modifyDeclaration() method
> in my indexer as well?
>
>
> thanks!
>
> -robert
>
>
>
>
>
> 2011/6/24 Robert Gründler <[email protected]>
>
>> Hi,
>>
>> a lot of PHP Frameworks implement the MVC pattern, and i'm wondering
>> what's the
>> best way to provide codeassist for PHP variables in files that have been
>> declared
>> in other SourceModules.
>>
>> Let's say you have the class UserController with the method showUser() (in
>> /UserController.php)
>>
>> ... class declaration
>>
>> public function showUser() {
>>
>>   $user = UserDAO::retrieveUserByID($id)**;
>>   return array('showUser.php', array('user' => $user'))
>>
>> }
>>
>> The framework then renders the file 'showUser.php' and passes in the $user
>> object
>> as a variable named $user.
>>
>> What i have done right now is the following:
>>
>> 1. In the SourceElementRequestor extension i visit the ReturnStatements of
>> methods in Controller
>> classes.
>> 2. I detect the variables returned by that method and store it in some
>> custom Singleton.
>> 3. Register a completionContext/Strategy which retrieves the correct
>> variables for the current php file from the Singleton.
>>
>> This approach works, though it doesn't feel properly integrated into the
>> DLTK/PDT model, as
>>
>> 1. I'm simply storing the ViewVariable in-memory in my singleton, so after
>> Eclipse relaunches, the whole project needs to be rebuilt for completion to
>> work.
>> 2. I'm getting ConcurrentModificationExceptio**ns in my Singleton class
>> during the BuildPhase as apparently the SourceParsing
>> takes place in multiple threads.
>>
>> So my question is, is there a way to contribute those Variables which are
>> being passed to the View-Templates properly to the DLTK/PDT model ?
>>
>>
>> regards,
>>
>> -robert
>>
>>
>>
>>
>
> _______________________________________________
> pdt-dev mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/pdt-dev
>
>


-- 

Thanks!

Best Regards!

Zhao
_______________________________________________
pdt-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/pdt-dev

Reply via email to