.grab(false, true).create());
ts.setTopIndex(0);
final ToolItem ma = new ToolItem(t, SWT.DROP_DOWN);
controlDecoration = new ControlDecoration(ts, SWT.TOP
| SWT.LEFT);
FieldDecoration dec = FieldDecorationRegistry
.getDefault()
.getFieldDecoration(
FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
c.layout(true);
ma.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
if (e.detail == SWT.ARROW) {
MenuManager mc = new MenuManager();
if (getType() == Key.class
&& keyKind != null
&& keyKind.length() > 0
&& keyKindDetails == null) {
mc.add(new EnableDetailFormatting(
"Enable detail formatting"));
}
if (getType() == Key.class
&& keyKind != null
&& keyKind.length() > 0
&& keyKindDetails != null) {
mc.add(new Action(
"Disable detail formatting") {
public void run() {
disableDetailFormatting();
}
});
}
final Menu createContextMenu = mc
.createContextMenu(ma.getParent());
Point cursorLocation = Display.getCurrent()
.getCursorLocation();
createContextMenu
.setLocation(cursorLocation);
createContextMenu.setVisible(true);
createContextMenu
.addMenuListener(new MenuListener() {
public void menuShown(
MenuEvent e) {
}
public void menuHidden(
MenuEvent e) {
Display.getCurrent()
.asyncExec(
new Runnable() {
public void run() {
createContextMenu
.dispose();
}
});
}
});
} else {
resync();
}
}
public void widgetDefaultSelected(SelectionEvent e) {
resync();
}
});
ma.setToolTipText("Refilter");
controlDecoration.setImage(dec.getImage());
ma.setImage(DataViewPart.choose);
} finally {
c.setRedraw(true);
}