Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How to restart the language provider scanner?

Andrew
On 08-Mar-13 00:41, Andrew Gvozdev wrote:
Hi Jantje,

On Thu, Mar 7, 2013 at 3:02 PM, Jan Baeyens <jan@xxxxxxxxxx> wrote:
Andrew
Thanks for the answer. It got me closer to understanding but not yet to the
answer to my question


What is the API code to force the language provider to rerun?

As you suggested I put a breakpoint in

AbstractBuiltinSpecsDetector.execute()

I learned from that when you do


[Clear Entries] and use [Apply] or [OK] button.

There is no scan because the value of isExecuted is true.
[Clear Entries] calls clear() method of the provider which sets
isExecuted to false. Did you override clear() by any chance?
I did not override clear. Clear does get called in my scenario. I put a breakpoint on change of isExecuted to be 100% sure.
     protected void execute() {

         if (isExecuted) {

             return;

         }

On the other hand when I do as I suggested isExecuted is false and a
recalculation is done.

As to


It is a bit more complicated than that. If you change project settings
in UI and rerun provider before saving the settings you are getting in
inconsistent state. Suppose the user cancels project settings changes.
You get old settings and provider results corresponding to
non-existent project state.

I action this when the user presses ok and I do not start a monitor so there
is no cancel.
I save all settings.
I delete the build folder (Because the outcome of previous build is
completely invalid )
I tell the language provider to rerun.

But I still don't know how to force the language provider to rerun.
It is done internally based on isExecuted flag after OK button is
pressed. Keep in mind that it happens in background thread. Do you use
UI from CDT or developing your own?
I have my own UI which is completely different as it focusses on Arduino development. When you change a board you may have changed the compiler as such I would like to force the language provider to rerun. The fact it is a background thread is not that harmful to me. After all the juno impleentation of the indexer is far better than the previous versions. But without the rerun I'm a bit stuck. I've come up with this code but there is still somewhere an issue (the first compile always fails. I'm not sure though to is related to this code.

// ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); // ICProjectDescription projectDescription = mngr.getProjectDescription(project, true);
        List<ILanguageSettingsProvider> providers;
// ICConfigurationDescription cfgDescription = projectDescription.getDefaultSettingConfiguration();
        if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
providers = new ArrayList<ILanguageSettingsProvider>(((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders());
            for (ILanguageSettingsProvider provider : providers) {
if ((provider instanceof AbstractBuiltinSpecsDetector)) { // basically check for working copy
                    // clear and reset isExecuted flag
                    ((AbstractBuiltinSpecsDetector) provider).clear();
                }
            }
        }
Thanks
Jan


Thanks,
Andrew

Best regards
Jantje



On 06-Mar-13 14:46, Andrew Gvozdev wrote:
Hi Jan,
It is a bit more complicated than that. If you change project settings
in UI and rerun provider before saving the settings you are getting in
inconsistent state. Suppose the user cancels project settings changes.
You get old settings and provider results corresponding to
non-existent project state.

So, in current UI to rerun provider you would [Clear Entries] and use
[Apply] or [OK] button. [Clear Entries] will create a temporary copy
of the provider which has not been executed yet. [OK] button will save
the project settings and trigger reruns of not-executed providers. You
can inspect stack trace if you set breakpoint in
AbstractBuiltinSpecsDetector.execute() method.

Thanks,
Andrew

On Tue, Mar 5, 2013 at 6:12 PM, Jan Baeyens <jan@xxxxxxxxxx> wrote:
Hi
In my eclipse plugin I have project settings that when I change them The
language provider needs to be rerun because I'm using another compiler.
I found a way in the gui to rerun the language provider (project
properties->C/C++ General->Code Analysis->Preprocessor Include Paths,
Maros
etc Select providers tab; select the provider;Select reset; select OK
Sometimes the reset is not enabled in which case you can change the
command
as work around.
Eclipse spy tells me the button is on LanguageSettingProviderPage but I
failed to find the code.
My question is: What is the API code to force the language provider to
rerun?
Best regards
Jantje
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

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




Back to the top