Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] How to manage one option from one holder(tool) by another option owned by another Holder(tool)

Thank you Wieant

In fact you gave me the clue to make more investigation to resolve my
problem.
I went in your way at the beginning but I found no solution,
That is why I used the original Option.
But with your clue and after reflection and more investigation
I found that I was confusing between CDT 3.0 and CDT 4.0.
In fact I shifted to the CDT 4.0 AND with this later version
THE "IBuildObject configuration" IS NO MORE "instanceOf" of either
"Iconfiguration" or "IResourceConfiguration" BUT OF "IFolderInfo".
(it is already mentioned in the CDT 4.0 architecture 
 but had not payed attention)
Once we detect that, we manage ALL resources in "Tool settings".
Here is the source I implemented to manage my options, 
it might be usefull for Others.
---------------------------------------------
public boolean isOptionEnabled(IBuildObject configuration,
			IHoldsOptions holder, IOption option) {
		 try {
			if (configuration instanceof IFolderInfo) {
				IFolderInfo folderInfo = (IFolderInfo)
configuration;
				IOption[] MlibOpt = folderInfo.getParent()
	
.getTargetTool().getOptions();
				for (int i = 0; i < MlibOpt.length; i++) {
					//here I use the "startsWith" to use
the original option
					//if it's not yet used or the
dynamic options once it's used
					if
(MlibOpt[i].getBaseId().startsWith(
							"myOptionId")) {
	
ManagedBuildManager.setOption(folderInfo
							.getParent(),
folderInfo.getParent()
							.getTargetTool(),
MlibOpt[i],
option.getBooleanValue());			
					}
				}
			}
		} catch (BuildException e) {
			e.printStackTrace();
		}
	Return true;
}
---------------------------------------------
Khaled ABDA
Software Developer at STMicroelectronics.




-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On
Behalf Of cdt-dev-request@xxxxxxxxxxx
Sent: Monday, October 08, 2007 6:00 PM
To: cdt-dev@xxxxxxxxxxx
Subject: cdt-dev Digest, Vol 32, Issue 15

----------------------------------------------------------------------

Message: 1
Date: Mon, 8 Oct 2007 12:43:01 +0200
From: wieant@xxxxxxxxx (Wieant Nielander)
Subject: Re: [cdt-dev] How to manage one option from one holder(tool)
	by	another option owned by another Holder(tool)
To: "CDT General developers list." <cdt-dev@xxxxxxxxxxx>
Message-ID: <20071008104301.GA4546@xxxxxxxxx>
Content-Type: text/plain; charset=us-ascii


> PLZ, I want to manage one boolean LINKER option 
> By another boolean COMPILER option.
> I implemented the applicability calculator of the COMPILER option to set
> The LINKER option : I used the code below: 
> -----------------
> public boolean isOptionEnabled(IBuildObject configuration,
> 			IHoldsOptions holder, IOption option) {
 ... 
> Return true;
> }
> -----------------------------
> This method works, as long as, the LINKER option is not set manually.
> Once this later is set manually the compiler option won't manage the
linker
> option any more.
> Another investigation, This method manages the linker option without
> registring the linker option in the ".cproject" But once the linker
> option is set manually this later is registered in the ".cproject"
> and I think that is why it won't be managed by the compiler option
> any more since this implemented Method uses the static IDs of the
> options and not the dynamic IDs in the ".cproject", and I don't find
> the way To manage the baseId in this file.


The problem might be that when you are in the properties dialog you
are working with a copy of the original project settings. Only when
you press 'Apply' or 'Ok' these working copy settings are transfered
to the actual '.cproject' project settings. So using

  IOption MlibOpt =
ManagedBuildManager.getProjectType("stxp.target.sx.w32.exe").getConfiguratio
n("...").getTool("...").getOptionBySuperClassId("...");

will get you the original project option, not the actual working
copy. To get the latter I think you should use the 'IBuildObject
configuration' parameter passed to 'isOptionEnabled()'. From that
value you can get the IConfiguration value which in turn can be used
to get the linker tool, and using ITool.getOptions() to get
the dynamic options (the ones with the random number, if changed).

-- Wieant


------------------------------

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


End of cdt-dev Digest, Vol 32, Issue 15
***************************************



Back to the top