use of org.eclipse.swt.widgets.MenuItem in project eclipse.platform.swt by eclipse.
the class ImageAnalyzer method createAlphaMenu.
void createAlphaMenu(Menu menuBar) {
// Alpha menu
MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
item.setText(bundle.getString("Alpha"));
Menu alphaMenu = new Menu(shell, SWT.DROP_DOWN);
item.setMenu(alphaMenu);
// Alpha -> K
item = new MenuItem(alphaMenu, SWT.PUSH);
item.setText("K");
item.addSelectionListener(widgetSelectedAdapter(event -> menuComposeAlpha(ALPHA_CONSTANT)));
// Alpha -> (K + x) % 256
item = new MenuItem(alphaMenu, SWT.PUSH);
item.setText("(K + x) % 256");
item.addSelectionListener(widgetSelectedAdapter(event -> menuComposeAlpha(ALPHA_X)));
// Alpha -> (K + y) % 256
item = new MenuItem(alphaMenu, SWT.PUSH);
item.setText("(K + y) % 256");
item.addSelectionListener(widgetSelectedAdapter(event -> menuComposeAlpha(ALPHA_Y)));
}
use of org.eclipse.swt.widgets.MenuItem in project eclipse.platform.swt by eclipse.
the class ImageAnalyzer method createFileMenu.
void createFileMenu(Menu menuBar) {
// File menu
MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
item.setText(bundle.getString("File"));
Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
item.setMenu(fileMenu);
// File -> Open File...
item = new MenuItem(fileMenu, SWT.PUSH);
item.setText(bundle.getString("OpenFile"));
item.setAccelerator(SWT.MOD1 + 'O');
item.addSelectionListener(widgetSelectedAdapter(event -> menuOpenFile()));
// File -> Open URL...
item = new MenuItem(fileMenu, SWT.PUSH);
item.setText(bundle.getString("OpenURL"));
item.setAccelerator(SWT.MOD1 + 'U');
item.addSelectionListener(widgetSelectedAdapter(event -> menuOpenURL()));
// File -> Reopen
item = new MenuItem(fileMenu, SWT.PUSH);
item.setText(bundle.getString("Reopen"));
item.addSelectionListener(widgetSelectedAdapter(event -> menuReopen()));
new MenuItem(fileMenu, SWT.SEPARATOR);
// File -> Load File... (natively)
item = new MenuItem(fileMenu, SWT.PUSH);
item.setText(bundle.getString("LoadFile"));
item.setAccelerator(SWT.MOD1 + 'L');
item.addSelectionListener(widgetSelectedAdapter(event -> menuLoad()));
new MenuItem(fileMenu, SWT.SEPARATOR);
// File -> Save
item = new MenuItem(fileMenu, SWT.PUSH);
item.setText(bundle.getString("Save"));
item.setAccelerator(SWT.MOD1 + 'S');
item.addSelectionListener(widgetSelectedAdapter(event -> menuSave()));
// File -> Save As...
item = new MenuItem(fileMenu, SWT.PUSH);
item.setText(bundle.getString("Save_as"));
item.addSelectionListener(widgetSelectedAdapter(event -> menuSaveAs()));
// File -> Save Mask As...
item = new MenuItem(fileMenu, SWT.PUSH);
item.setText(bundle.getString("Save_mask_as"));
item.addSelectionListener(widgetSelectedAdapter(event -> menuSaveMaskAs()));
new MenuItem(fileMenu, SWT.SEPARATOR);
// File -> Print
item = new MenuItem(fileMenu, SWT.PUSH);
item.setText(bundle.getString("Print"));
item.setAccelerator(SWT.MOD1 + 'P');
item.addSelectionListener(widgetSelectedAdapter(event -> menuPrint()));
new MenuItem(fileMenu, SWT.SEPARATOR);
// File -> Exit
item = new MenuItem(fileMenu, SWT.PUSH);
item.setText(bundle.getString("Exit"));
item.addSelectionListener(widgetSelectedAdapter(event -> shell.close()));
}
use of org.eclipse.swt.widgets.MenuItem in project eclipse.platform.swt by eclipse.
the class JavaViewer method createMenuBar.
void createMenuBar() {
Menu bar = new Menu(shell, SWT.BAR);
shell.setMenuBar(bar);
MenuItem fileItem = new MenuItem(bar, SWT.CASCADE);
fileItem.setText(resources.getString("File_menuitem"));
fileItem.setMenu(createFileMenu());
}
use of org.eclipse.swt.widgets.MenuItem in project eclipse.platform.swt by eclipse.
the class JavaViewer method createFileMenu.
Menu createFileMenu() {
Menu bar = shell.getMenuBar();
Menu menu = new Menu(bar);
MenuItem item;
// Open
item = new MenuItem(menu, SWT.PUSH);
item.setText(resources.getString("Open_menuitem"));
item.setAccelerator(SWT.MOD1 + 'O');
item.addSelectionListener(widgetSelectedAdapter(event -> openFile()));
// Exit
item = new MenuItem(menu, SWT.PUSH);
item.setText(resources.getString("Exit_menuitem"));
item.addSelectionListener(widgetSelectedAdapter(e -> menuFileExit()));
return menu;
}
use of org.eclipse.swt.widgets.MenuItem in project eclipse.platform.swt by eclipse.
the class TreeTab method specialPopupMenuItems.
@Override
protected void specialPopupMenuItems(Menu menu, Event event) {
MenuItem item = new MenuItem(menu, SWT.PUSH);
item.setText("getItem(Point) on mouse coordinates");
final Tree t = (Tree) event.widget;
menuMouseCoords = t.toControl(new Point(event.x, event.y));
item.addSelectionListener(widgetSelectedAdapter(e -> {
eventConsole.append("getItem(Point(" + menuMouseCoords + ")) returned: " + t.getItem(menuMouseCoords));
eventConsole.append("\n");
}));
}
Aggregations