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