Extending : Widget extension : Advanced topics : Adding different type of actions to a widget : Showing or hiding the action tab
  
Showing or hiding the action tab
1 Add the property in the widget configuration file.
<property name="showAction01" default="true" type="Boolean" refreshPropertyView="true"/>
<property name="showAction02" default="true" type="Boolean" refreshPropertyView="true"/>
2 Update the isAvailableForAction method:
@Override
protected boolean isAvailableForAction(IWidgetModel widget) {
boolean hasAction01 = widget.getDefinition().getProperty("action_ext01") != null;
boolean showAction01 = Boolean.parseBoolean(widget.getPropertyValue("showAction01"));
return hasAction01 && showAction01;
}
By default, there are four actions in the action tab, they are “No Action”, “Change Flow Event”, “Launch New Flow”, and “Launch New Operation”. If you want to hide or show any of the action type radio buttons in the Actions tab ( “Change Flow Event”, “Launch New Flow”, and “Launch New Operation”), you can override the setInput method in ExtActionPropertySection01.java. For Url, you can use the following two ways to set the action:
Set true or false to isLink. If isLink=true, it shows, if isLink=false, it hides
Same way with other actions
This graphic is described in the surrounding text.
@Override
  public void setInput(IWorkbenchPart part, ISelection selection) {
    super.setInput(part, selection);
    getLaunchOperationBtn().setLayoutData(new GridData(0, 0));
}
You can get other button by:
getLaunchNewFlowBtn()
getChangeFlowEventBtn()
getLaunchOperationBtn()
getLaunchUrlBtn()
getActionGroup()
Set Action Name for each action tab. Override createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) in ExtActionPropertySection01
This graphic is described in the surrounding text.
@Override
public void createControls(Composite parent,
TabbedPropertySheetPage aTabbedPropertySheetPage) {
Composite c = new Composite(parent,SWT.None);
c.setBackground(c.getDisplay().getSystemColor(SWT.COLOR_WHITE));
c.setLayout(new GridLayout(2, false));
c.setLayoutData(new GridData(GridData.FILL_BOTH));
Label actionName = new Label(c, SWT.None);
actionName.setText("Action Name:");
actionName.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
actionName.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLUE));
Label value = new Label(c, SWT.None);
value.setText("Action02");
value.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
value.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLACK));
super.createControls(parent, aTabbedPropertySheetPage);
}
Go up to
Adding different type of actions to a widget