I created a simple window using JFace's ApplicationWindow, and tried adding a menu bar.
public MainWindow() {
super(null);
this.addMenuBar(); // Enable menu-bar.
}
@Override
protected Control createContents(Composite parent) {
MenuManager menuBar = this.getMenuBarManager();
// Create "File" menu.
MenuManager fileMenu = new MenuManager("&File");
menuBar.add(fileMenu);
// Create "File" > "Test" action.
Action testAction = new Action("&Test") {
@Override
public void run() {
System.out.println("Test");
}
};
fileMenu.add(testAction);
// Create contents.
Label text = new Label(parent, SWT.NONE);
text.setText("Lorem ipsum.");
return parent;
}
I must be overlooking something simple because it doesn't appear to work. The menu-bar simply does not show up. What am I doing wrong? (Please note that I have the global menu disabled in Ubuntu).
NOTE: I've tested this on Ubuntu 15.10 with GTK 3.16.7, and Arch Linux with GTK 3.22.18, both with SWT 3.105.3 and JFace 3.12.2.
