Search in sources :

Example 51 with MenuItem

use of org.eclipse.swt.widgets.MenuItem in project translationstudio8 by heartsome.

the class MenuItemProviders method columnChooserMenuItemProvider.

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

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

                @Override
                public void widgetSelected(SelectionEvent e) {
                    natTable.doCommand(new DisplayColumnChooserCommand(natTable));
                }
            });
        }
    };
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) NatTable(net.sourceforge.nattable.NatTable) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) DisplayColumnChooserCommand(net.sourceforge.nattable.columnChooser.command.DisplayColumnChooserCommand)

Example 52 with MenuItem

use of org.eclipse.swt.widgets.MenuItem in project translationstudio8 by heartsome.

the class MenuItemProviders method clearToggleFilterRowMenuItemProvider.

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

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

                @Override
                public void widgetSelected(SelectionEvent e) {
                    natTable.doCommand(new ToggleFilterRowCommand());
                }
            });
        }
    };
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ToggleFilterRowCommand(net.sourceforge.nattable.filterrow.command.ToggleFilterRowCommand) SelectionEvent(org.eclipse.swt.events.SelectionEvent) NatTable(net.sourceforge.nattable.NatTable) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu)

Example 53 with MenuItem

use of org.eclipse.swt.widgets.MenuItem 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)

Example 54 with MenuItem

use of org.eclipse.swt.widgets.MenuItem in project translationstudio8 by heartsome.

the class MenuItemProviders method categoriesBasedColumnChooserMenuItemProvider.

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

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

                @Override
                public void widgetSelected(SelectionEvent e) {
                    natTable.doCommand(new ChooseColumnsFromCategoriesCommand(natTable));
                }
            });
        }
    };
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) NatTable(net.sourceforge.nattable.NatTable) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) ChooseColumnsFromCategoriesCommand(net.sourceforge.nattable.columnCategories.ChooseColumnsFromCategoriesCommand)

Example 55 with MenuItem

use of org.eclipse.swt.widgets.MenuItem in project translationstudio8 by heartsome.

the class MenuItemProviders method ungroupColumnsMenuItemProvider.

public static IMenuItemProvider ungroupColumnsMenuItemProvider() {
    return new IMenuItemProvider() {

        public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
            MenuItem columnStyleEditor = new MenuItem(popupMenu, SWT.PUSH);
            columnStyleEditor.setText("Ungroup columns");
            columnStyleEditor.setEnabled(true);
            columnStyleEditor.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    natTable.doCommand(new UngroupColumnCommand());
                }
            });
        }
    };
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) UngroupColumnCommand(net.sourceforge.nattable.group.command.UngroupColumnCommand) SelectionEvent(org.eclipse.swt.events.SelectionEvent) NatTable(net.sourceforge.nattable.NatTable) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu)

Aggregations

MenuItem (org.eclipse.swt.widgets.MenuItem)386 Menu (org.eclipse.swt.widgets.Menu)259 SelectionEvent (org.eclipse.swt.events.SelectionEvent)247 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)208 Event (org.eclipse.swt.widgets.Event)58 ArrayList (java.util.ArrayList)55 Point (org.eclipse.swt.graphics.Point)52 GridData (org.eclipse.swt.layout.GridData)49 Listener (org.eclipse.swt.widgets.Listener)48 SelectionListener (org.eclipse.swt.events.SelectionListener)46 Composite (org.eclipse.swt.widgets.Composite)43 GridLayout (org.eclipse.swt.layout.GridLayout)42 Rectangle (org.eclipse.swt.graphics.Rectangle)35 Label (org.eclipse.swt.widgets.Label)34 Shell (org.eclipse.swt.widgets.Shell)34 Table (org.eclipse.swt.widgets.Table)33 MenuEvent (org.eclipse.swt.events.MenuEvent)32 Button (org.eclipse.swt.widgets.Button)32 List (java.util.List)31 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)29