You should do
handleValue(..., IBuildObject configuration, ..){
...
if(configuration instanceof IConfiguration){
ManagedBuildManager.setOption((IConfiguration)configuration,
...);
} else if (configuration instanceof
IResourceConfiguration){
ManagedBuildManager.setOption((IResourceConfiguration)configuration,
...);
}
...
}
Mikhail
-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On
Behalf Of Derek Morris
Sent: Thursday, October 19, 2006 7:57 PM
To: CDT General developers list.
Subject: Re: [cdt-dev] MBS (IManagedOptionValueHandler) questions
Just tried that...
1. I had to add a dependency on org.eclipse.cdt.core and import
org.eclipse.cdt.core.AbstractCExtension to get ManagedBuildManager
correctly.
2. Where do I get an IConfiguration from? I get passed an IBuildObject
and
IOptionHolder and an IOption?
Thanks,
--
Derek
Sennikovsky, Mikhail wrote:
> Hi Derek,
>
>
>
> Please see my response embedded below.
>
>
>
> Mikhail
>
>
>
> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx
[mailto:cdt-dev-bounces@xxxxxxxxxxx]
> On Behalf Of Derek Morris
> Sent: Thursday, October 19, 2006 7:19 PM
> To: CDT General developers list.
> Subject: Re: [cdt-dev] MBS (IManagedOptionValueHandler) questions
>
>
>
> Hi Mikhail,
>
>
>
> I have written an IManagedOptionValueHandler. I have added a new
> optionCategory
>
> and options to that OptionCategory that uses the valueHandler and
>
> valueHandlerExtraArgument extension. I have added boolean and
string
> options.
>
>
>
> IManagedOptionValueHandler gets passed IOptionHolder and IOption.
>
>
>
> From within the valuehandler I am using IOption.setValue().
Using these
>
> interfaces I am almost getting the behaviour I want... If it
setValue()
> on the
>
> boolean option, the corresponding checkbox in the GUI is updated.
> However, if I
>
> setValue() on the string, the corresponding textbox in the GUI is
not
> updated
>
> until I interact with the GUI in some way (check the booleans
checkbox, for
>
> example).
>
> */[Mikhail] This seems like a bug. Try using the
ManagedBuildManager API
> instead of IOption (see my comment below) and if this does not
help
> please raise a bug./*
>
>
>
> I have no docs for ManagedBuildManager so I don't know when/how to
use
> it. As I
>
> am passed an IOption (and it is working - mostly - for me) I am
using that.
>
> */[Mikhail] The
org.eclipse.cdt.managedbuilder.core.ManagedBuildManager
> is the entry-point for all MBS core operations. It should be used
for
> setting option values as well. You should not call
IOption.setValue
> because it will not work for the case of extension options (i.e.
options
> whose values are not overridden by user settings)./*
>
> */The ManagedBuildManager contains the following methods that
should be
> used for option value modifications (see JavaDoc comments for
those
> methods for more detail):/*
>
> */ /*
>
> *public* *static* IOption
setOption(IConfiguration config,
> IHoldsOptions holder, IOption option, *boolean* value)
>
> *public* *static* IOption
setOption(IResourceConfiguration
> resConfig, IHoldsOptions holder, IOption option, *boolean* value)
>
> *public* *static* IOption
setOption(IConfiguration config,
> IHoldsOptions holder, IOption option, String value)
>
> *public* *static* IOption setOption(IResourceConfiguration
resConfig,
> IHoldsOptions holder, IOption option, String value)
>
> *public* *static* IOption
setOption(IConfiguration config,
> IHoldsOptions holder, IOption option, String[] value)
>
> *public* *static* IOption
setOption(IResourceConfiguration
> resConfig, IHoldsOptions holder, IOption option, String[] value)
>
> */ /*
>
> */The “IBuildObject configuration” argument passed to
your value handler
> is either an IConfiguration or an IResourceConfiguration. You
should do
> instanceof and call the proper ManagedBuildManager.setOption()
method.
> Please let me know if you have any questions with using the
> ManagedBuildManager.setOption()/*
>
> */ /*
>
> */Regards,/*
>
> */Mikhail/*
>
> */ /*
>
> --
>
> Derek
>
>
>
> Sennikovsky, Mikhail wrote:
>
>> Hi Derek,
>
>>
>
>> I did not fully understand how are you using the value
handler
>
>> mechanism. Could you elaborate a bit more on this (i.e.
where are you
>
>> calling the setValue from) so that I could understand
your issue.
>
>> BTW, you should not call the IOption.setValue directly.
You should use
>
>> the ManagedBuildManager.setOption() instead.
>
>>
>
>> Mikhail
>
>>
>
>> -----Original Message-----
>
>> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
>
>> On Behalf Of Derek Morris
>
>> Sent: Thursday, October 19, 2006 5:28 PM
>
>> To: CDT General developers
list.
>
>> Subject: Re: [cdt-dev] MBS (IManagedOptionValueHandler)
questions
>
>>
>
>> Mikhail,
>
>>
>
>> When I use option.setValue(boolean), then the UI
checkbox is updated
>
>> However, when I option.setvalue(string), the the UI
textbox is NOT
>
>> updated,
>
>> until I do something else in the UI (for example setting
a checkbox). Is
>
>> this I bug?
>
>>
>
>> --
>
>> Derek
>
>>
>
>> Sennikovsky, Mikhail wrote:
>
>> > Hi Derek,
>
>> >
>
>> >
>
>> >
>
>> > Please see my answers embedded below.
>
>> >
>
>> >
>
>> >
>
>> > Mikhail
>
>> >
>
>> >
>
>> >
>
>> > -----Original Message-----
>
>> > From: cdt-dev-bounces@xxxxxxxxxxx
[mailto:cdt-dev-bounces@xxxxxxxxxxx]
>
>>
>
>> > On Behalf Of Derek Morris
>
>> > Sent: Wednesday, October 18, 2006 3:20 PM
>
>> > To: CDT General developers
list.
>
>> > Subject: [cdt-dev] MBS (IManagedOptionValueHandler)
questions
>
>> >
>
>> >
>
>> >
>
>> > Hi,
>
>> >
>
>> >
>
>> >
>
>> > Note: I think you're going to hate this as I'm using this
extension in
>
>> a
>
>> > way
>
>> >
>
>> > that wasn't planned...
>
>> >
>
>> >
>
>> >
>
>> > In the plugin.xml have added an additional field to a
compilers
>
>> > optionCategory,
>
>> >
>
>> > like this:
>
>> >
>
>> > <option
>
>> >
>
>> > name='Paste area'
>
>> >
>
>> > category='compiler.exe.debug'
>
>> >
>
>> > id='paste'
>
>> >
>
>> > valueType='string'
>
>> >
>
>> > valueHandler='OptionValueHandler'
>
>> >
>
>> >
valueHandlerExtraArgument="paste"
>
>> >
>
>> > ></option>
>
>> >
>
>> >
>
>> >
>
>> > I am using the OptionValueHandler to allow a user to
paste tool
>
>> options
>
>> > into a
>
>> >
>
>> > field which is then parsed to set the tool options in the
properties
>
>> > GUI. This
>
>> >
>
>> > means I can copy and paste options between configurations
and
>
>> correctly
>
>> > set the
>
>> >
>
>> > properties GUI to match. This is working.
>
>> >
>
>> >
>
>> >
>
>> > The first question is that I would like to add this field
to the main
>
>> > compiler
>
>> >
>
>> > page (under 'expert settings'), rather than one of the
sub-pages. Is
>
>> > there a way
>
>> >
>
>> > to do this?
>
>> >
>
>> > */[Mikhail] It is not possible to extend/contribute to
the main
>
>> compiler
>
>> > page currently./*
>
>> >
>
>> >
>
>> >
>
>> >
>
>> >
>
>> > The second question is that after I have parsed the
options, I wish to
>
>>
>
>> > clear the
>
>> >
>
>> > entry field in the GUI. I am able to clear the value
using
>
>> >
>
>> > (option.setValue("")), but this is not
reflected in the GUI until I
>
>> > switch from
>
>> >
>
>> > the page and switch back again. Is there a way to get the
entry field
>
>> to be
>
>> > refreshed?
>
>> >
>
>> > */[Mikhail] The MBS functionality does not have the
change
>
>> notification
>
>> > mechanism currently. That is why MBS GUI has to refresh
contents of
>
>> each
>
>> > page to ensure that proper "live" values are
displayed. Currently the
>
>> > refresh is performed in the following situations:/*
>
>> >
>
>> > */1. /**/the page/tab becomes visible/*
>
>> >
>
>> > */2. /**/the value of some UI property
of the page gets changed/*
>
>> >
>
>> > */ /*
>
>> >
>
>> > */If you need some more flexible mechanism of UI contents
update we
>
>> > might consider changing/enhancing the current MBS UI
refresh
>
>> mechanism./*
>
>> > */ /*
>
>> >
>
>> > */Regards,/*
>
>> >
>
>> > */Mikhail/*
>
>> >
>
>> >
>
>> >
>
>> > TIA
>
>> >
>
>> >
>
>> >
>
>> > --
>
>> >
>
>> > Derek
>
>> >
>
>> > _______________________________________________
>
>> >
>
>> > 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
>
>> _______________________________________________
>
>> 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
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev