Pages

about my opensource eclipse java applications recently i'm studying GWT and Android

Thursday, March 10, 2005

How to IAction Disable or Enable

when you something action.you hope disable other action.
at first i didn't found them. finally i found that.
I don't know ,is that right?
but i use that code.
you call this method from view,or change 'this'.
on id-String .use Action ID.
private void setEnabled(boolean bool,String id){
IContributionItem ic=this.getViewSite().getActionBars().getToolBarManager().find(id);
if(ic!=null && ic instanceof ActionContributionItem){
IAction iaction=((ActionContributionItem)ic).getAction();
iaction.setEnabled(bool);
}
}

No comments: