Search in sources :

Example 1 with DisplayColumnStyleEditorCommand

use of net.sourceforge.nattable.style.editor.command.DisplayColumnStyleEditorCommand in project translationstudio8 by heartsome.

the class MenuItemProviders method columnStyleEditorMenuItemProvider.

public static IMenuItemProvider columnStyleEditorMenuItemProvider(final String menuLabel) {
    return new IMenuItemProvider() {

        public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
            MenuItem columnStyleEditor = new MenuItem(popupMenu, SWT.PUSH);
            columnStyleEditor.setText(menuLabel);
            columnStyleEditor.setImage(GUIHelper.getImage("preferences"));
            columnStyleEditor.setEnabled(true);
            columnStyleEditor.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent event) {
                    int rowPosition = getNatEventData(event).getRowPosition();
                    int columnPosition = getNatEventData(event).getColumnPosition();
                    natTable.doCommand(new DisplayColumnStyleEditorCommand(natTable, natTable.getConfigRegistry(), columnPosition, rowPosition));
                }
            });
        }
    };
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DisplayColumnStyleEditorCommand(net.sourceforge.nattable.style.editor.command.DisplayColumnStyleEditorCommand) NatTable(net.sourceforge.nattable.NatTable) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu)

Aggregations

NatTable (net.sourceforge.nattable.NatTable)1 DisplayColumnStyleEditorCommand (net.sourceforge.nattable.style.editor.command.DisplayColumnStyleEditorCommand)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Menu (org.eclipse.swt.widgets.Menu)1 MenuItem (org.eclipse.swt.widgets.MenuItem)1