Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] I want to avoid reparsing by the AbstractASTFoldingStructureProvider...


  ok - i just committed a fix for this so the base class will use SourceParserUtils to retrieve the ModuleDeclaration (i also updated the tcl and ruby implementations to do the same), so you should be able to remove your overriden method.

  i also added a protected accessor for the IModelElement object in the event someone needs it for something else.

On Sun, Apr 5, 2009 at 6:35 PM, Jae Gangemi <jgangemi@xxxxxxxxx> wrote:

 i think that may be a bug - i've noticed the same behavior and i think the base class just needs to be changed to check the cache first. i'll look into this tonight or tomorrow unless someone else beats me to it.


On Sun, Apr 5, 2009 at 6:16 PM, Gabriel Petrovay <gabriel.petrovay@xxxxxxxxxx> wrote:
Hi all,

Is there a good reason (I am sure there is but I did not get it) why
the AbstractASTFoldingStructureProvider is forcing a reparse of the
document? (The document has just been parsed a moment ago and saved
into the cache.) With the current implementation I have to to this
(the ugly way) to stop the reparsing:

       @Override
       protected CodeBlock[] getCodeBlocks(String code, int offset) {
               ModuleDeclaration decl = null;
               IModelElement element = fMyEditor.getInputModelElement();
               if (element instanceof ISourceModule) {
                       decl = SourceParserUtil.getModuleDeclaration((ISourceModule)element);
               }
               return buildCodeBlocks(decl, offset);
       }

where fMyEditor is another field just like the fEditor in
AbstractASTFoldingStructureProvider  which unfortunatelly is private
and has no getter method.

Am I doing something wrong in my implementation? If not, could you
please either:
1. create a getter for the fEditor field in the
AbstractASTFoldingStructureProvider class
or
2. make the fEditor field protected
or.
3. (My preferred solution) make the getInputElement method protected.

Although, I would combine 3 + (1 or 2)

Regards,
Gabriel

--
MSc Gabriel Petrovay
MCSA, MCDBA, MCAD
Mobile: +41(0)787978034
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev



--
-jae



--
-jae

Back to the top