[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-dev] Antwort: Re: API to add Settings provider to Preprocessor Include path Entries
|
I have the same issue. Solved it to some
degree with the following code.
The provider is added and moved to the
top (first position of the array). Only this way, the provided symbols
can override existing ones
The snipplet is executed in a SetCommandOperation
provided by the org.eclipse.cdt.managedbuilder.ui.newWizardPages extension
point (see operationClass).
HOWEVER: Sometimes, the provider gets
deselected again. I am not sure why and when. I am still searching for
a solution.
I hope this will help you
Best regards
Jens
// Manually add the language provider
--- it is not activated and set to the top position despite the correct
entry in the toolchain ....
ICProjectDescriptionManager manager
= CoreModel.getDefault().getProjectDescriptionManager();
ICProjectDescription prjDescriptionWritable
= manager.getProjectDescription(project, true);
ICConfigurationDescription cfgDescriptionWritable
= prjDescriptionWritable.getActiveConfiguration();
String[] oldProviderIDs = ((ILanguageSettingsProvidersKeeper)
cfgDescriptionWritable).getDefaultLanguageSettingsProvidersIds();
List<ILanguageSettingsProvider>
provider = ((ILanguageSettingsProvidersKeeper) cfgDescriptionWritable).getLanguageSettingProviders();
String[] newProvidersId = Arrays.copyOf(oldProviderIDs,oldProviderIDs.length
+ 1);
// add the new provider in front
newProvidersId[0] = PxCToolchainBuiltinSpecsDetector.PROVIDER_ID;
for (int i = 0; i < oldProviderIDs.length;
i++) {
newProvidersId[i+1]
= oldProviderIDs[i];
}
((ILanguageSettingsProvidersKeeper)
cfgDescriptionWritable).setDefaultLanguageSettingsProvidersIds(newProvidersId);
List<ILanguageSettingsProvider>
providers = LanguageSettingsManager.createLanguageSettingsProviders(newProvidersId);
((ILanguageSettingsProvidersKeeper)
cfgDescriptionWritable).setLanguageSettingProviders(providers);
((ILanguageSettingsProvidersKeeper)
cfgDescriptionWritable).getDefaultLanguageSettingsProvidersIds();
((ILanguageSettingsProvidersKeeper)
cfgDescriptionWritable).getLanguageSettingProviders();
try {
manager.setProjectDescription(project,
prjDescriptionWritable);
} catch (CoreException e) {
e.printStackTrace();
}
ManagedBuildManager.saveBuildInfo(project,
true);
__________________________________________
Fraunhofer-Institut für Entwurfstechnik Mechatronik IEM
M.Sc. Jens Frieben
Wissenschaftlicher Mitarbeiter
Fraunhofer-Einrichtung für Entwurfstechnik
Mechatronik IEM
Softwaretechnik
Zukunftsmeile 1
33102 Paderborn
Telefon: +49 5251 5465 -121
Fax: +49 5251 5465 -6121
jens.frieben@xxxxxxxxxxxxxxxxx
https://www.iem.fraunhofer.de
__________________________________________
http://www.wissenschafts-und-industrieforum.de |
Von:
Marc-André Laperle
<marc-andre.laperle@xxxxxxxxxxxx>
An:
cdt General developers
list. <cdt-dev@xxxxxxxxxxx>
Datum:
11.05.2017 15:58
Betreff:
Re: [cdt-dev]
API to add Settings provider to Preprocessor Include path
Entries
Gesendet von:
cdt-dev-bounces@xxxxxxxxxxx
Maybe you can look at the Cross GCC toolchain
as a simple example? If I look quickly at the plugin.xml, it looks like
there's a "languageSettingsProviders" field in the toolchain
definition.
Marc-André
From: cdt-dev-bounces@xxxxxxxxxxx
<cdt-dev-bounces@xxxxxxxxxxx> on behalf of Vincent GUIGNOT <Vincent.GUIGNOT@xxxxxxxxxxxx>
Sent: Thursday, May 11, 2017 7:38:36 AM
To: cdt General developers list.
Subject: [cdt-dev] API to add Settings provider to Preprocessor Include
path Entries
Hello
I'm trying to set by default my own LanguageSettingsProvider.
I've created a ext point, I can see it in the prefs. When I check the preprocessorInclude
path properties of my project, my provider is available as provider, but
not checked.
Is there any API to check it by default ?
I remark also, when I check manually my provider to have
is in the Settings Entries, A new file appears in the root of the project
in .settings/language.settings.xml which contains the provider.
Thanks for your help
Regards
Vincent
This email and its content belong to Ingenico Group. The
enclosed information is confidential and may not be disclosed to any unauthorized
person. If you have received it by mistake do not forward it and delete
it from your system. Cet email et son contenu sont la propriété du Groupe
Ingenico. L’information qu’il contient est confidentielle et ne peut
être communiquée à des personnes non autorisées. Si vous l’avez reçu par
erreur ne le transférez pas et supprimez-le. _______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev