Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] symbols added don't appear in UI?

Thanks James for the response. Yes, I'am trying to add pre-processor symbols. I created a plugin based on custom C project with given
makefiles. The problem is, when the project is created, some symbols defined in makefile are desired to be added to this project before the compilation for example.  

IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject[] projects = workspace.getRoot().getProjects();
ICProjectDescription prjDesc;
for (IProject project : projects) {
prjDesc = CoreModel.getDefault().getProjectDescription(project);
ICConfigurationDescription[] descs = prjDesc.getConfigurations();
ITool[] tools = iConfig.getToolChain().getTools();
IOption newSymbol = null;
for (ITool tool: tools) {
newSymbol = tool.createOption(null, "symbolTest","SymbolTestName",
true);
newSymbol.setValueType(IOption.STRING);
try {
newSymbol.setValue("symbolTestValue");
} catch (BuildException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Merci pour les aides.


> Date: Wed, 26 May 2010 10:15:08 +0100
> Subject: Re: [cdt-dev] symbols added don't appear in UI?
> From: jamesblackburn@xxxxxxxxx
> To: cdt-dev@xxxxxxxxxxx
>
> Are you trying to add pre-processor symbols?
>
> There's not enough context in the snippet you've provided, but you
> need to create options expected by the tool / toolchain you're
> extending.
>
> An alternative is to go through the project model. Any symbols + paths
> you add there will be automatically stored by the MBS and added to the
> correct tool options. You can do this by:
> 1) ICConfigurationDescription#getResourceDescriptions()
> This will return all the 'resource descriptions' which are some
> path in the project + custom settings. It's assumed that if a resource
> doesn't have a description it inherits from the parent in the resource
> tree. So for most projects there'll be just one of these corresponding
> to the settings stored on the project.
> 2) Get the language specific settings from the resource description:
> ICFileDescription#getLanguageSetting()
> ICFolderDescription#getLanguageSettings()
> 3) If the ICLanguageSetting#supportsEntryKind(ICSettingEntry#MACRO)
> [if macros are what you're trying to add]
> then:
> ICSettingEntry[] oldEntries =
> ICLanguageSetting#getSettingEntries(ICSettingEntry#MACRO)
> ICSettingEntry[] newEntries = oldEntries + my_new_entries;
> ICLanguageSetting#setSettingsEntries(ICSettingEntry#MACRO, newEntries);
> 4) Save the project description.
>
> Your macros / paths / whatever will now be available to the core model
> and visible in the MBS UI.
>
> Hope this helps.
>
> Cheers,
> James
>
>
> On 26 May 2010 09:07, Flo Menier <josieenfrance@xxxxxxxxxxx> wrote:
> > I don't know if it's a question about UI or not, so I send to all.
> > apparently, symbols are added sucessfully, but when I check it in the
> > property of project, no symbol appeared in UI.
> > newSymbol = tool.createOption(null, "symbolTest","SymbolTestName",
> > true);
> > newSymbol.setValueType(IOption.STRING);
> > try {
> > newSymbol.setValue("symbolTestValue");
> > } catch (BuildException e) {
> > // TODO Auto-generated catch block
> > e.printStackTrace();
> > }
> > IOption symbolCheck= ManagedBuildManager.getExtensionOption("symbolTest");
> > System.out.println("symbol value: "+symbolCheck.getValue());
> > UI can detect the changes automatically, if not, how can do it?
> > thanks in advance,
> > cheers
> > ________________________________
> > Votre messagerie et bien plus où que vous soyez. Passez à Windows Live
> > Hotmail, c'est gratuit ! Inscrivez-vous
> > _______________________________________________
> > 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


Hotmail : une messagerie fiable avec une protection anti-spam performante Inscrivez-vous

Back to the top