Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Problems with ExternalSettingsProvider usage

Hi,
I found the reason for this behavior:
 
I am creating macros with this call "new CMacroEntry("name", "value", ICSettingEntry.MACRO)" then I face the mentioned problem.
When createing the macros like this "new CMacroEntry("name", "value", 0)" it works.
 
Greets Marko


Von: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] Im Auftrag von Tomljenovic Marko (CDG-SMT/EMT1)
Gesendet: Donnerstag, 14. Oktober 2010 15:31
An: CDT General developers list.
Betreff: Re: [cdt-dev] Problems with ExternalSettingsProvider usage --> BUG?

I tried it with CDT 7.0 and the problem still exists.
I will create a bugzilla entry.
 
Greets Marko


Von: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] Im Auftrag von James Blackburn
Gesendet: Donnerstag, 14. Oktober 2010 13:15
An: CDT General developers list.
Betreff: Re: [cdt-dev] Problems with ExternalSettingsProvider usage --> BUG?

On 14 October 2010 12:07, Tomljenovic Marko (CDG-SMT/EMT1) <Marko.Tomljenovic@xxxxxxxxxxxx> wrote:
Currently we are using 6.0.2.

Ok, that's quite old. I fixed a number of bugs in the external settings manager since then.

From my POV your best bet is using Eclipse 3.6, checkout sources from HEAD, add your plugins and try to reproduce the problem.
See: http://wiki.eclipse.org/CDT/contributing

Cheers,
James

 
I guess the master zip of 6.0.2 does not contain the tests.
Where can I get the tests from?
 
Greets Marko
 
Mit freundlichen Grüßen / Best regards

Marko Tomljenovic

Robert Bosch GmbH
Cross Divisional Group - Software, Methods and Tools, CDG-SMT/EMT1 (CR/PJ-TOP66)
Postfach 30 02 40
70442 Stuttgart

GERMANY

www.bosch.com

Tel. 0711-811-54830


Sitz: Stuttgart, Registergericht: Amtsgericht Stuttgart, HRB 14000;
Aufsichtsratsvorsitzender: Hermann Scholl; Geschäftsführung: Franz Fehrenbach, Siegfried Dais;
Bernd Bohr, Rudolf Colm, Volkmar Denner, Wolfgang Malchow, Peter Marks,
Peter Tyroller; Stefan Asenkerschbaumer, Uwe Raschke, Wolf-Henning Scheider


 


Von: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] Im Auftrag von James Blackburn
Gesendet: Donnerstag, 14. Oktober 2010 11:46

An: CDT General developers list.
Betreff: Re: [cdt-dev] Problems with ExternalSettingsProvider usage --> BUG?

What version of CDT are you using?

If you think you've found a bug in HEAD, please open a bug at bugs.eclipse.org, preferably with a test.
There are some tests for external settings providers in ExternalSettingsProviderTests to get you going.

Cheers,
James


On 14 October 2010 10:15, Tomljenovic Marko (CDG-SMT/EMT1) <Marko.Tomljenovic@xxxxxxxxxxxx> wrote:
I found out the following thing:

It looks like I found a bug. When the external setting provider returns an already existing macro but with a different value then this macro is still stored in the .cproject file. But it is located before the 'old' macro.
I assume then that this file is read like this: Read in all macros in the order like they are written in the .cproject file and store the macros in a hash map where the key is the macro name.
But now we have the same macro (regarding name) twice in the .cproject file. The new one comes before the old one and therefor the value of the old one always overwrites the new value. This would then lead to my mentioned problem.

Is this a bug or the wanted behaviour? I assume it is a bug!

Greets Marko

-----Ursprüngliche Nachricht-----
Von: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] Im Auftrag von Tomljenovic Marko (CDG-SMT/EMT1)
Gesendet: Donnerstag, 14. Oktober 2010 09:50
An: CDT General developers list.
Betreff: [cdt-dev] Problems with ExternalSettingsProvider usage

Hello guys,
Does anybody have some experience with the usage of the ExternalSettingsProvider extension point?
We are currently using CDT 6.0.2.

I have done the following things:
=================================

-I have registered an ExternalSettingProvider class
-In an example command I set the providers on the project, and when I execute the command the 2nd time I call the updateExternalSettingsProviders

Class ExternalSettingsProvider:
================================
 @Override
 public CExternalSetting[] getSettings(final IProject prj, final ICConfigurationDescription cfg) {
   // Create an example macro
   String value = new SimpleDateFormat("ssSSS").format(new Date());

   CExternalSetting setting =
       new CExternalSetting(new String[] { "org.eclipse.cdt.core.gcc", "org.eclipse.cdt.core.g++" }, new String[] {
           "org.eclipse.cdt.core.cSource", "org.eclipse.cdt.core.asmSource" }, null,
           new ICSettingEntry[] { new CMacroEntry("EXAMPLE_MACRO", value, ICSettingEntry.MACRO) });
   System.err.println("CExternalSettingProvider.getSettings() - " + value);
   return new CExternalSetting[] { setting };
 }


Command code to register/update the ExternalSettingsProvider
===============================================================
         ICConfigurationDescription activeConfiguration = null;
         String[] ids = new String[] { "bdom.cdt.settings.provider" };
         IProject prj = (IProject) obj;
         if (!set) {
           set = true;

           ICProjectDescription cProjectDescr = CCorePlugin.getDefault().getProjectDescription(prj, true);
           activeConfiguration = cProjectDescr.getActiveConfiguration();
           activeConfiguration.setExternalSettingsProviderIds(ids);

           try {
             CoreModel.getDefault().setProjectDescription(prj, cProjectDescr, true, new NullProgressMonitor());
           }
           catch (CoreException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
           }
         }
         else {

           ICProjectDescription projectDescription2 = CCorePlugin.getDefault().getProjectDescription(prj, true);
           activeConfiguration = projectDescription2.getActiveConfiguration();
           activeConfiguration.updateExternalSettingsProviders(ids);
           try {
             CoreModel.getDefault().setProjectDescription(prj, projectDescription2, true, new NullProgressMonitor());
           }
           catch (CoreException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
           }
         }

Problems with this implementation
==================================
The example macro is set properly when the external settings provider is called the first time. But when it is called the 2nd time the changed macro value is not visible in the project properties. In the .cproject file though the new macro value is stored somehow.


Does anybody has a clue on what I am doing wrong?

Greets Marko
_______________________________________________
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