Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] how to programmatically change the language settings providers?

Hi
Does AbstractCPropertyTab support enabling/disabling the OK and Enable button?
I need that for my project.
Best regards
Jantje

On 15-Jan-14 15:02, Andrew Gvozdev wrote:
Hi Justin,
This happens because when user opens project properties CDT gets its own writeable configuration description to work with properties. If you get your own copy after that and save it it is going to be overwritten by that CDT configuration when user uses Apply or OK buttons. You need to apply your changes to the CDT configuration. You can get hold of it using call getResDesc() provided that your page extends AbstractCPropertyTab.

Thanks,
Andrew


On Tue, Jan 14, 2014 at 8:57 PM, Justin You <justin.you@xxxxxxxxxxxx> wrote:

Hi Andrew:

 

Yes, this code get called from the our own plug in when any options change its value on the project properties. If I change any option’s value on the project properties, this code will be fired and store the file language.settings.xml on the disk as I wish. But I click OK to close the Properties, I lost the file language.settings.xml immediately. But I click cancel to close the Properties, Although I don’t store the option value that I changed, I keep the file language.settings.xml as I wish and scanner starts working.

 

Thanks, Justin.

 

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Andrew Gvozdev
Sent: Wednesday, January 15, 2014 5:02 AM
To: CDT General developers list.
Subject: Re: [cdt-dev] how to programmatically change the language settings providers?

 

Where does this code get called from? From project preferences UI?

 

Andrew

 

On Tue, Jan 14, 2014 at 1:16 PM, Justin You <justin.you@xxxxxxxxxxxx> wrote:

Hi All:

 

I am trying to programmatically change the language settings providers of the IProject, Could someone help me find what’s issue of my code? My code can set new language settings providers and store language.settings.xml file on disk during I debug the code and step one by one. but if I change some other settings on Windows -> Preferences, the file language.settings.xml just disappear and language settings providers change to null by default.

 

                IProject prj = getCurrentSelectedProject();

                ICProjectDescriptionManager manager = CoreModel.getDefault().getProjectDescriptionManager();

                ICProjectDescription prjDescriptionWritable = manager.getProjectDescription(prj, true);

                ICConfigurationDescription cfgDescriptionWritable = prjDescriptionWritable.getActiveConfiguration();

 

 

                ((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable).getDefaultLanguageSettingsProvidersIds();

                ((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable).getLanguageSettingProviders();

 

                String[] providersId = new String[4];

                providersId[0] = "id0";

                providersId[1] = "id1";

                providersId[2] = "id2";

                providersId[3] = "id3";

                ((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable).setDefaultLanguageSettingsProvidersIds(providersId);               

                List<ILanguageSettingsProvider> providers = LanguageSettingsManager.createLanguageSettingsProviders(providersId);

                ((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable).setLanguageSettingProviders(providers);

               

                

                ((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable).getDefaultLanguageSettingsProvidersIds();

                ((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable).getLanguageSettingProviders();

                try {

                           manager.setProjectDescription(prj, prjDescriptionWritable);

                    } catch (CoreException e) {

                                 // TODO Auto-generated catch block

                                 e.printStackTrace();

                    }    


_______________________________________________
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