Extending : Widget extension : Advanced topics : Adding different type of actions to a widget
  
Adding different type of actions to a widget
UNICOM® Digital Transformation Toolkit (UDTT™) supports a widget with a single action tab on the Properties panel. On the action tab, you can select the type of action and action details. You can extend the action and define more than one actions associated to a widget.
This graphic is described in the surrounding text.
1 Add the following properties in the widget configuration file:
<property name="action_ext01" showInEditor="false" default="NO_ACTION" isLink="false"/>
<property name="action_ext02" showInEditor="false" default="NO_ACTION" isLink="false"/>
2 Add an extension that points to org.eclipse.ui.views.properties.tabbed.propertyTabs and org.eclipse.ui.views.properties.tabbed.propertySections for the UNICOM® Digital Transformation Toolkit (UDTT™) XUI editor, set com.ibm.btt.rcp.xui.editor2.XUIEditor as the contributorId field.
3 Add propertyTabs, for example, add "ActionTab01" and "ActionTab02", set other attributes like bellow, the afterTab is to define which tab do you want to put after.
This graphic is described in the surrounding text.
4 Add propertySection, ActionSection01 and ActionSection02, set the customized class and filter for them.
This graphic is described in the surrounding text.
ExtActionPropertySection01.java extends ActionPropertySection and overrides the getActionName() method.
public class ExtActionPropertySection01 extends ActionPropertySection{
@Override
protected String getActionName() {
if (getWidgetModel().getDefinition().getProperty("action_ext01") != null) {
return "action_ext01";
}else {
return super.getActionName();
}
}
ExtActionSectionFilter01.java extends ActionSectionFilter and overrides isAvailableForAction(IWidgetModel widget).
public class ExtActionSectionFilter01 extends ActionSectionFilter {
@Override
protected boolean isAvailableForAction(IWidgetModel widget) {
boolean hasAction01 = widget.getDefinition().getProperty("action_ext01") != null;
return hasAction01;
}
}
See also
Showing or hiding the action tab
Advanced topics