Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » IScriptBuilder
IScriptBuilder [message #26721] Wed, 25 June 2008 17:58 Go to next message
Eclipse UserFriend
Originally posted by: tatianamur.gmail.com

Hi everyone,

I have a simple class implementing IScriptBuilder and noticed, that it
is being called 4 times on full project rebuild by DLTK's ScriptBuilder.
First time - with correct list of ISourceModule's and
IScriptBuilder.FULL_BUILD status and 3 more times with
IScriptBuilder.FULL_BUILD (1 time) and IScriptBuilder.INCREMENTAL_BUILD
(2 times) with empty list of ISourceModule's.
Is it a bug and if it is not, how IScriptBuilder implementing class
could understand a state it is in - how to differentiate a case, when
all modules were removed from the project from a case when it is just
being called for some reasons from ScriptBuilder with empty list of files?

Thanks
Tatiana
Re: IScriptBuilder [message #27915 is a reply to message #26721] Tue, 08 July 2008 08:59 Go to previous messageGo to next message
Andrei Sobolev is currently offline Andrei SobolevFriend
Messages: 72
Registered: July 2009
Member
Hi Tatiana,

Script builder worked using following scenario:
1) Find all resources
2) Find all external source modules
3) Check which resources are source modules
4) Build resources -> call IScriptBuilder.buildResources()
5) Build source modules with resources -> call IScriptBuilder.buildModelElements()
6) Build external and builtin source modules -> call IScriptBuilder.buildModelElements()

Also sometimes it incorrectly called with empty list.

Now It works with following scanario:
1) Find all resources
2) Find all external source modules
3) Check which resources are source modules
4) Build resources -> call IScriptBuilder.buildResources()
5) Build source modules -> call IScriptBuilder.buildModelElements()

No more calls with empty lists.

Fix are in HEAD.

Thanks,
Andrei.

> Hi everyone,
>
> I have a simple class implementing IScriptBuilder and noticed, that it
> is being called 4 times on full project rebuild by DLTK's ScriptBuilder.
> First time - with correct list of ISourceModule's and
> IScriptBuilder.FULL_BUILD status and 3 more times with
> IScriptBuilder.FULL_BUILD (1 time) and IScriptBuilder.INCREMENTAL_BUILD
> (2 times) with empty list of ISourceModule's.
> Is it a bug and if it is not, how IScriptBuilder implementing class
> could understand a state it is in - how to differentiate a case, when
> all modules were removed from the project from a case when it is just
> being called for some reasons from ScriptBuilder with empty list of files?
>
> Thanks
> Tatiana
>
Re: IScriptBuilder [message #28113 is a reply to message #27915] Fri, 11 July 2008 17:48 Go to previous messageGo to next message
Charles Doucette is currently offline Charles DoucetteFriend
Messages: 125
Registered: July 2009
Senior Member
What I'd like to know is when/how the project source modules are parsed and
turned into model elements. I know this happens via the reconciler, which
happens at least when you make changes to the working copy in the editor,
and via the indexer. I thought that perhaps this did or should happen via a
builder - but upon closer inspection this doesn't appear to be the case.
Thus, I am in the process of trying to write code for the builder to:

a) parse each source module element (and turn it into corresponding models)
b) run our custom semantic checker

Per your recommendation, I already moved the semantic checker into
ISourceElementParser.parseSourceModule (rather than ISourceParser.parse).
So, I thought I should call my existing method that already does what I
want.

When I looked at who called parseSourceModule, I found that it is called by
SourceParserUtil.parseSourceModule. That method is called by
AbstractSourceModule.buildStructure.

I have a few questions (besides the ones implied above):
0) Should my builder be doing parsing and model building - or is that
done automatically from something else?

1) How do I determine the nature ID for a project/source-module/parser?
I can get the list of nature ids for a project from its project
description.
Some methods I want to call take a nature id, and others take
IModelElement.
For example, I was calling DLTKLanguageManager.getProblemFactory().

2) Do I need to set the parser's (ISourceElementParser) problem
requestor?
If so, how do I create it?

Thanks,
Chuck

"Andrei Sobolev" <haiodo@xored.com> wrote in message
news:g4va9r$qfk$1@build.eclipse.org...
> Hi Tatiana,
>
> Script builder worked using following scenario:
> 1) Find all resources
> 2) Find all external source modules
> 3) Check which resources are source modules
> 4) Build resources -> call IScriptBuilder.buildResources()
> 5) Build source modules with resources -> call
> IScriptBuilder.buildModelElements()
> 6) Build external and builtin source modules -> call
> IScriptBuilder.buildModelElements()
>
> Also sometimes it incorrectly called with empty list.
>
> Now It works with following scanario:
> 1) Find all resources
> 2) Find all external source modules
> 3) Check which resources are source modules
> 4) Build resources -> call IScriptBuilder.buildResources()
> 5) Build source modules -> call IScriptBuilder.buildModelElements()
>
> No more calls with empty lists.
>
> Fix are in HEAD.
>
> Thanks,
> Andrei.
>
>> Hi everyone,
>>
>> I have a simple class implementing IScriptBuilder and noticed, that it is
>> being called 4 times on full project rebuild by DLTK's ScriptBuilder.
>> First time - with correct list of ISourceModule's and
>> IScriptBuilder.FULL_BUILD status and 3 more times with
>> IScriptBuilder.FULL_BUILD (1 time) and IScriptBuilder.INCREMENTAL_BUILD
>> (2 times) with empty list of ISourceModule's.
>> Is it a bug and if it is not, how IScriptBuilder implementing class could
>> understand a state it is in - how to differentiate a case, when all
>> modules were removed from the project from a case when it is just being
>> called for some reasons from ScriptBuilder with empty list of files?
>>
>> Thanks
>> Tatiana
>>
Re: IScriptBuilder [message #28151 is a reply to message #28113] Fri, 11 July 2008 18:45 Go to previous messageGo to next message
Charles Doucette is currently offline Charles DoucetteFriend
Messages: 125
Registered: July 2009
Senior Member
> 2) Do I need to set the parser's (ISourceElementParser) problem
> requestor?
> If so, how do I create it?

Apparently the issue to this question is yes I do - otherwise there is a
null pointer exception.

If I can't figure this out, then perhaps I will
a) get the ISourceParser instead and call parse (calling
SourceParserUtil.getModuleDeclaration)
b) call my semantic checker directly

Chuck

"Chuck Doucette" <cdoucette@vaultus.com> wrote in message
news:g586f8$s8l$1@build.eclipse.org...
> What I'd like to know is when/how the project source modules are parsed
> and turned into model elements. I know this happens via the reconciler,
> which happens at least when you make changes to the working copy in the
> editor, and via the indexer. I thought that perhaps this did or should
> happen via a builder - but upon closer inspection this doesn't appear to
> be the case. Thus, I am in the process of trying to write code for the
> builder to:
>
> a) parse each source module element (and turn it into corresponding
> models)
> b) run our custom semantic checker
>
> Per your recommendation, I already moved the semantic checker into
> ISourceElementParser.parseSourceModule (rather than ISourceParser.parse).
> So, I thought I should call my existing method that already does what I
> want.
>
> When I looked at who called parseSourceModule, I found that it is called
> by SourceParserUtil.parseSourceModule. That method is called by
> AbstractSourceModule.buildStructure.
>
> I have a few questions (besides the ones implied above):
> 0) Should my builder be doing parsing and model building - or is that
> done automatically from something else?
>
> 1) How do I determine the nature ID for a project/source-module/parser?
> I can get the list of nature ids for a project from its project
> description.
> Some methods I want to call take a nature id, and others take
> IModelElement.
> For example, I was calling DLTKLanguageManager.getProblemFactory().
>
> 2) Do I need to set the parser's (ISourceElementParser) problem
> requestor?
> If so, how do I create it?
>
> Thanks,
> Chuck
>
> "Andrei Sobolev" <haiodo@xored.com> wrote in message
> news:g4va9r$qfk$1@build.eclipse.org...
>> Hi Tatiana,
>>
>> Script builder worked using following scenario:
>> 1) Find all resources
>> 2) Find all external source modules
>> 3) Check which resources are source modules
>> 4) Build resources -> call IScriptBuilder.buildResources()
>> 5) Build source modules with resources -> call
>> IScriptBuilder.buildModelElements()
>> 6) Build external and builtin source modules -> call
>> IScriptBuilder.buildModelElements()
>>
>> Also sometimes it incorrectly called with empty list.
>>
>> Now It works with following scanario:
>> 1) Find all resources
>> 2) Find all external source modules
>> 3) Check which resources are source modules
>> 4) Build resources -> call IScriptBuilder.buildResources()
>> 5) Build source modules -> call IScriptBuilder.buildModelElements()
>>
>> No more calls with empty lists.
>>
>> Fix are in HEAD.
>>
>> Thanks,
>> Andrei.
>>
>>> Hi everyone,
>>>
>>> I have a simple class implementing IScriptBuilder and noticed, that it
>>> is being called 4 times on full project rebuild by DLTK's ScriptBuilder.
>>> First time - with correct list of ISourceModule's and
>>> IScriptBuilder.FULL_BUILD status and 3 more times with
>>> IScriptBuilder.FULL_BUILD (1 time) and IScriptBuilder.INCREMENTAL_BUILD
>>> (2 times) with empty list of ISourceModule's.
>>> Is it a bug and if it is not, how IScriptBuilder implementing class
>>> could understand a state it is in - how to differentiate a case, when
>>> all modules were removed from the project from a case when it is just
>>> being called for some reasons from ScriptBuilder with empty list of
>>> files?
>>>
>>> Thanks
>>> Tatiana
>>>
>
>
Re: IScriptBuilder [message #28190 is a reply to message #28113] Fri, 11 July 2008 18:59 Go to previous message
Charles Doucette is currently offline Charles DoucetteFriend
Messages: 125
Registered: July 2009
Senior Member
I determined the answer to this question:

> 1) How do I determine the nature ID for a project/source-module/parser?
> I can get the list of nature ids for a project from its project
> description.
> Some methods I want to call take a nature id, and others take
> IModelElement.
> For example, I was calling DLTKLanguageManager.getProblemFactory().

Apparently, I can call:
a) IDLTKLanguageToolkit toolkit =
DLTKLanguageManager.getLanguageToolkit(module);

b) String natureId = toolkit.getNatureId()

Chuck

"Chuck Doucette" <cdoucette@vaultus.com> wrote in message
news:g586f8$s8l$1@build.eclipse.org...
> What I'd like to know is when/how the project source modules are parsed
> and turned into model elements. I know this happens via the reconciler,
> which happens at least when you make changes to the working copy in the
> editor, and via the indexer. I thought that perhaps this did or should
> happen via a builder - but upon closer inspection this doesn't appear to
> be the case. Thus, I am in the process of trying to write code for the
> builder to:
>
> a) parse each source module element (and turn it into corresponding
> models)
> b) run our custom semantic checker
>
> Per your recommendation, I already moved the semantic checker into
> ISourceElementParser.parseSourceModule (rather than ISourceParser.parse).
> So, I thought I should call my existing method that already does what I
> want.
>
> When I looked at who called parseSourceModule, I found that it is called
> by SourceParserUtil.parseSourceModule. That method is called by
> AbstractSourceModule.buildStructure.
>
> I have a few questions (besides the ones implied above):
> 0) Should my builder be doing parsing and model building - or is that
> done automatically from something else?
>
> 1) How do I determine the nature ID for a project/source-module/parser?
> I can get the list of nature ids for a project from its project
> description.
> Some methods I want to call take a nature id, and others take
> IModelElement.
> For example, I was calling DLTKLanguageManager.getProblemFactory().
>
> 2) Do I need to set the parser's (ISourceElementParser) problem
> requestor?
> If so, how do I create it?
>
> Thanks,
> Chuck
>
> "Andrei Sobolev" <haiodo@xored.com> wrote in message
> news:g4va9r$qfk$1@build.eclipse.org...
>> Hi Tatiana,
>>
>> Script builder worked using following scenario:
>> 1) Find all resources
>> 2) Find all external source modules
>> 3) Check which resources are source modules
>> 4) Build resources -> call IScriptBuilder.buildResources()
>> 5) Build source modules with resources -> call
>> IScriptBuilder.buildModelElements()
>> 6) Build external and builtin source modules -> call
>> IScriptBuilder.buildModelElements()
>>
>> Also sometimes it incorrectly called with empty list.
>>
>> Now It works with following scanario:
>> 1) Find all resources
>> 2) Find all external source modules
>> 3) Check which resources are source modules
>> 4) Build resources -> call IScriptBuilder.buildResources()
>> 5) Build source modules -> call IScriptBuilder.buildModelElements()
>>
>> No more calls with empty lists.
>>
>> Fix are in HEAD.
>>
>> Thanks,
>> Andrei.
>>
>>> Hi everyone,
>>>
>>> I have a simple class implementing IScriptBuilder and noticed, that it
>>> is being called 4 times on full project rebuild by DLTK's ScriptBuilder.
>>> First time - with correct list of ISourceModule's and
>>> IScriptBuilder.FULL_BUILD status and 3 more times with
>>> IScriptBuilder.FULL_BUILD (1 time) and IScriptBuilder.INCREMENTAL_BUILD
>>> (2 times) with empty list of ISourceModule's.
>>> Is it a bug and if it is not, how IScriptBuilder implementing class
>>> could understand a state it is in - how to differentiate a case, when
>>> all modules were removed from the project from a case when it is just
>>> being called for some reasons from ScriptBuilder with empty list of
>>> files?
>>>
>>> Thanks
>>> Tatiana
>>>
>
>
Previous Topic:ASTNode sourceStart and sourceEnd - running offset?
Next Topic:Accessing org.eclipse.dltk.tcl.ui.editor.TclEditor
Goto Forum:
  


Current Time: Fri Sep 20 16:02:48 GMT 2024

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

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

Back to the top