Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[Dltk-dev] Re: IModelElement cache needs to be cleared when rebuilding a project AND Rebuilding not working triggered for opened source modules

Hi,

I have found also this solution that works for my scenario. Maybe you
can tell me if this is a proper solution.

In the case of  IScriptBuilder.FULL_BUILD, my IBuildParticipant
responsible for code parsing ignores the cache and parses everything.

This looks simple enough (no more delas and cachce clearing and custom
ModelOperation's). Is it a right way to do it?

Thanks!

Gabriel


On Sun, Apr 26, 2009 at 1:44 PM, Gabriel Petrovay
<gabriel.petrovay@xxxxxxxxxx> wrote:
> Hi Alex,
>
> Your solution is good but I don't see how can it work in my scenario.
> I don't know how to pass the changed properties down to the
> SourceParser that requires those properties.
>
> In my previous post I came to that problem because my preferences need
> to be saved because the rebuilding requires reparsing the code. But
> parsing the code is dependent on the project properties (the ones
> saved in the property page). In the rebuilding process the cache is
> populated with my modules and after a couple of property
> modifications, it doesn't work anymore because the source modules are
> taken from the cache. (Reparsing is not triggered anymore). In order
> to clear the cache I performed this in the performOK of my options
> block:
>
>                                IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
>                                        public void run(IProgressMonitor monitor) throws CoreException,
> OperationCanceledException {
>                                                SetPropertyOperation op = new
> SetPropertyOperation(DLTKCore.create(MyLanguagePreferencePage.this.getProject()));
>                                                op.runOperation(monitor);
>                                        }
>                                };
>                                WorkbenchRunnableAdapter op = new WorkbenchRunnableAdapter(runnable);
>                                op.runAsUserJob("Building project", null);
>
>
> The SetPropertyOperation class is a ModelOperation that deletes the
> modules from cache like this:
>
>                DeltaProcessor deltaProcessor =
> ModelManager.getModelManager().getDeltaProcessor();
>                for (IModelElement element : moduleCollector.fModules) {
>                        ModelElementDelta delta = new ModelElementDelta(element);
>                        delta.changed(element, IModelElementDelta.F_CONTENT);
>                        deltaProcessor.registerModelDelta(delta);
>                }
>                deltaProcessor.fire(null, DeltaProcessor.DEFAULT_CHANGE_EVENT);
>
>
>
> Moreover, having opened documents while changing those properties
> seems to have some more problems: the parsing occurs before the
> properties are saved and therefore the old properties are read. Thus,
> the editor remains out of sync, or delayed until one changes text in
> the editor.
>
>
> 1. Could you clear the cache during the rebuilding process?  Or, can I
> clear the cache for a certain project in another way (also other way
> than clearing the whole cache)?
> 2. The opened editors should also reflect the changes properties. This
> means saving the properties first. (The opened source modules are not
> built in the same way/or not built at all during a project rebuilt.)
>
>
> Best regards,
> Gabriel
>
> --
> MSc Gabriel Petrovay
> MCSA, MCDBA, MCAD
> Mobile: +41(0)787978034
>



-- 
MSc Gabriel Petrovay
MCSA, MCDBA, MCAD
Mobile: +41(0)787978034


Back to the top