Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] Extending the ScriptModel

Hi Robert,

Actually we missed one step.
For model elements to be available in the ModelAccess search results they should be indexed.
Indexing is done by the IIndexingParser, which is retrieved from IIndexerParticipant.

This is how it works now. Probably it needs some improvements for wider adoption of h2 indexing.

Regards,
Alex

----- Original Message -----
From: "Robert Gruendler" <robert@xxxxxxxxxxx>
To: "DLTK Developer Discussions" <dltk-dev@xxxxxxxxxxx>
Sent: Friday, March 5, 2010 2:12:43 PM GMT +06:00 Almaty, Novosibirsk
Subject: Re: [Dltk-dev] Extending the ScriptModel

I've managed to extend the PHPSourceElementParser and enter types
from yaml files, which is implemented roughly like this:

* In public void parseSourceModule(IModuleSource module) i parse the yaml file
* call ISourceElementRequestor.enterModule()
* for every type in the yaml file, call requestor.enterType(IType), requestor.exitType(somePosition)
* call requestor.exitModule()

When doing this, i get all the types in the yml file presented in the outline, and i can open
the yaml sourcemodule in the project explorer tree and see the child nodes. For some reason though, 
PHPModelAccess won't return the types when i search for them:

PhpModelAccess access = PhpModelAccess.getDefault();
IDLTKSearchScope scope = SearchEngine.createWorkspaceScope(PHPLanguageToolkit.getDefault());
IType[] types = access.findTypes(name, MatchRule.EXACT, 0, 0,scope, null);

I've also tried to search using ModelAccess, but i got no results either.


Anyone an idea what i'm missing?



thanks!

-robert




On Mar 2, 2010, at 1:06 PM, Alex Panchenko wrote:

It depends on the input objects your have.
If you have source file you can use ISourceModule.getType(String)
Or if you want all your types - use search like Zhao suggested (you can set special flags for your types and filter by it).

On the other side, if your types are reported as model elements - PDT will find them even without your help.

Regards,
Alex

----- Original Message -----
From: "赵忠伟" <
zhaozhongwei@xxxxxxxxxxxxxxxx>
To: "DLTK Developer Discussions" <
dltk-dev@xxxxxxxxxxx>
Sent: Tuesday, March 2, 2010 6:02:25 PM GMT +06:00 Almaty, Novosibirsk
Subject: Re: [Dltk-dev] Extending the ScriptModel

try PhpModelAccess/ModelAccess

2010/3/2 Robert Gründler <doobre@xxxxxxxxx>
Hi again,

i think i managed to use the enterModule() / enterType() etc methods to report a new Module/Type, but
how can i access it in the CompletionStragety?

Ie, how can i retrieve the type that i previously entered to pass it to 
ICompletionReporter.report(IType) ?

thanks,

-robert


On Mar 2, 2010, at 11:13 AM, Alex Panchenko wrote:

At the moment (as a quick hack) I can suggest only extending from PHP parser, handle .yaml files yourself and passing everything else to super.

Regards,
Alex

----- Original Message -----
From: "Robert Gründler" <
doobre@xxxxxxxxx>
To: "DLTK Developer Discussions" <
dltk-dev@xxxxxxxxxxx>
Sent: Tuesday, March 2, 2010 4:15:44 PM GMT +06:00 Almaty, Novosibirsk
Subject: Re: [Dltk-dev] Extending the ScriptModel


How about implementing org.eclipse.dltk.core.ISourceElementParser and generating appropriate model elements using enterType()/exitType() and enterMethod()/exitMethod() calls?

I've tried this, but my SourceElementParser gets only called for php sources, here's how i defined it:

   <extension
         point="org.eclipse.dltk.core.sourceElementParsers">
      <parser
            class="com.dubture.symfony2.internal.core.model.SymfonySourceElementParser"
            nature="org.eclipse.php.core.PHPNature"
            priority="0">
      </parser>
   </extension>


For .yml files, the parser is not being called. I've tried to set the nature to the nature of
my plugin, but then it doesn't get called at all.

Do i need to create a yaml content type and associate it with my nature for the parser to recognize .yml files
as source elements ? 


regards

-robert

_______________________________________________ dltk-dev mailing list 
dltk-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/dltk-dev
_______________________________________________


_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev




--
 

Thanks!

Best Regards!

Zhao

_______________________________________________ dltk-dev mailing list
 dltk-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/dltk-dev
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


_______________________________________________ dltk-dev mailing list dltk-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/dltk-dev

Back to the top