Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] how to manage an MBS enumerated list option by another enumerated list option

> Please I need help about managing enumerated list options.
> I am a bit new to eclipse & I work with MBS.
> 
> In fact, I have to enable & disable 2 enumerated lists(combo Boxes) 
> according to a third one which has 2 enumerated values
> each value should activate one (combo box) & dis-activate the other.
> 
> I created for the 3 enumerated lists their respective classes which
> implements IOptionApplicability to use the "isOptionEnabled()"
> 
> Here is the code of the 1st combo box (manager) which manage the 2 others:
> ++++++++++ 1st combo box (manager)
> public boolean isOptionEnabled(IBuildObject buildinf,
> 			IHoldsOptions holder, IOption	option) {
>   try{
> 	String myStr= option.getSelectedEnum(); //returns ID if enum option
> 	if(myStr.equalsIgnoreCase("Toolchain.compiler.option.MorC.option1")){
> 				this.opt1=true;
> 				this.opt2=false;
>    	} else{
> 				this.opt2=false;
> 				this.opt1=true;
> 	}		
>    } catch (BuildException e) {}
> 			
> 		return true;
>    }
> 
> public boolean validateOption1(){	
> 	return this.opt1;
> }
> public boolean validateOption2(){	
> 	return this.opt2;
> }
> ++++++++++ 2 & 3 nd combo boxes (manageD)
> 
> 	manager CMLE= new manager();
> public boolean isOptionEnabled(IBuildObject configuration,
> 			IHoldsOptions holder, IOption option) {
> 	boolean flag=false;	    
> 	flag= CMLE.validateOptioni(); //i is option1 or option
> 	return flag;
> }
> ----
> without invoking the manager list the 2 combo boxes
> are enabled or disabled when I change statically true or false
> but when I invoke it or even change the value of the manager list
> it doesn't work.


If I understand the excerpt correctly the manager combo sets some
flags which are somehow passed to the applicability calculators of the
other combo boxes. It is not entirely clear to me how you pass them,
but a problem might be that the manager combo applicability calculator
is only called when the page containing it is actually selected by the
user, so if the other (managed) combos are on another page which is
selected before the manager page is selected flags may not have been
set correctly.

Another approach might be just to check the value of the manager combo
from the applicability calculators of the managed combos, something like:

++++++++++ 1st combo box (manager)
  no applicability calculator required
  (unless its state also depends on another option ofcourse)

++++++++++ 2 & 3 nd combo boxes (manageD)

public boolean isOptionEnabled(IBuildObject configuration,
			IHoldsOptions holder, IOption option) {
    if ( option == managedCombo2 )
        return managerCombo1.getValue() == combo2;
    else if ( option == managedCombo3 )
        return managerCombo1.getValue() == combo3;
}

Regards,
  Wieant


Back to the top