<Composite ...> <ToolBar x:style="SWT.NONE" x:Class="MyToolbar"> <ToolItem x:style="SWT.PUSH" text="A" selectionEvent="onSelectionA"> </ToolItem> <ToolItem x:style="SWT.PUSH" text="B" ></ToolItem> </ToolBar> public class MyToolbar extends XWTStaticPart { public void onSelectionA(Object object, Event event) { // ... } }
Report message to a moderator
<Composite x:Class="MyView"> <ToolBar > <ToolItem x:name="Name1" x:style="SWT.PUSH" ></ToolItem> </ToolBar> </Composite> public void onSelection(Object object, Event event) { Object name1 = XWT.findElementByName( event.widget, "Name1"); if (w != null && w instanceof ToolItem ) { System.out.println("NAME1 OK"); } }