Search in sources :

Example 11 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 12 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 13 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 14 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)

Example 15 with MenuItem

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

the class MenuItemProviders method autoResizeRowMenuItemProvider.

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

        public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
            MenuItem autoResizeRows = new MenuItem(popupMenu, SWT.PUSH);
            autoResizeRows.setText("Auto resize row");
            autoResizeRows.setEnabled(true);
            autoResizeRows.addSelectionListener(new SelectionAdapter() {

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

Aggregations

MenuItem (org.eclipse.swt.widgets.MenuItem)122 Menu (org.eclipse.swt.widgets.Menu)97 SelectionEvent (org.eclipse.swt.events.SelectionEvent)92 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)77 ArrayList (java.util.ArrayList)30 GridData (org.eclipse.swt.layout.GridData)24 MenuManager (org.eclipse.jface.action.MenuManager)22 Composite (org.eclipse.swt.widgets.Composite)22 SelectionListener (org.eclipse.swt.events.SelectionListener)20 Point (org.eclipse.swt.graphics.Point)20 Rectangle (org.eclipse.swt.graphics.Rectangle)18 GridLayout (org.eclipse.swt.layout.GridLayout)18 List (java.util.List)17 FocusEvent (org.eclipse.swt.events.FocusEvent)17 MenuEvent (org.eclipse.swt.events.MenuEvent)17 Map (java.util.Map)15 TableViewer (org.eclipse.jface.viewers.TableViewer)15 FocusAdapter (org.eclipse.swt.events.FocusAdapter)15 Label (org.eclipse.swt.widgets.Label)15 NatTable (net.sourceforge.nattable.NatTable)14