private void refactorMenuShown(IMenuManager refactorSubmenu) { // we know that we have an MenuManager since we created it in // addRefactorSubmenu. Menu menu = ((MenuManager) refactorSubmenu).getMenu(); menu.addMenuListener(new MenuAdapter() { @Override public void menuHidden(MenuEvent e) { refactorMenuHidden(); } }); ITextSelection textSelection = (ITextSelection) fEditor.getSelectionProvider().getSelection(); // JavaTextSelection javaSelection= new // JavaTextSelection(getEditorInput(), getDocument(), // textSelection.getOffset(), textSelection.getLength()); for (Iterator<SelectionDispatchAction> iter = fActions.iterator(); iter.hasNext();) { SelectionDispatchAction action = iter.next(); action.update(textSelection); } refactorSubmenu.removeAll(); if (fillRefactorMenu(refactorSubmenu) == 0) refactorSubmenu.add(fNoActionAvailable); }
/** * Generate the contextual menu to manage the template set. The menu is empty and * it is initialized the first time it's opened */ @Override public Menu getMenu(Menu parent) { MenuItem root = new MenuItem(parent, SWT.CASCADE); menu = new Menu (parent); root.setMenu (menu); root.setText(Messages.HandleDefaultsAction_menuTitle); //Menu listener to show the current adapter highlighted on show menu.addMenuListener(new MenuAdapter() { @Override public void menuShown(MenuEvent e) { if (refreshItemList || menu.getItemCount() == 0 || !DefaultManager.INSTANCE.getAvailableElements().equals(values)){ for(MenuItem item : menu.getItems()){ item.dispose(); } initilizeItems(); refreshItemList = false; } } }); return menu; }
public Menu getMenu(final Control parent) { _isAdvancedMenu = true; dispose(); _menu = new Menu(parent); // Add listener to repopulate the menu each time _menu.addMenuListener(new MenuAdapter() { @Override public void menuShown(final MenuEvent e) { fillMenu((Menu) e.widget); } }); return _menu; }
public Menu getMenu(final Menu parent) { _isAdvancedMenu = false; _modifiedTags.clear(); dispose(); _menu = new Menu(parent); // Add listener to repopulate the menu each time _menu.addMenuListener(new MenuAdapter() { @Override public void menuShown(final MenuEvent e) { fillMenu((Menu) e.widget); } }); return _menu; }
public Menu getMenu(final Menu parent) { dispose(); _menu = new Menu(parent); // Add listener to repopulate the menu each time _menu.addMenuListener(new MenuAdapter() { @Override public void menuShown(final MenuEvent e) { // dispose old menu items for (final MenuItem menuItem : ((Menu) e.widget).getItems()) { menuItem.dispose(); } fillMenu(_menu); } }); return _menu; }
public Menu getMenu(final Menu parent) { dispose(); fMenu = new Menu(parent); // Add listener to repopulate the menu each time fMenu.addMenuListener(new MenuAdapter() { @Override public void menuShown(final MenuEvent e) { // dispose old menu items for (final MenuItem menuItem : ((Menu) e.widget).getItems()) { menuItem.dispose(); } fillMenu(fMenu); } }); return fMenu; }
@Override public Menu getMenu(final Menu parent) { dispose(); _menu = new Menu(parent); // Add listener to repopulate the menu each time _menu.addMenuListener(new MenuAdapter() { @Override public void menuShown(final MenuEvent e) { // dispose old menu items for (final MenuItem menuItem : ((Menu) e.widget).getItems()) { menuItem.dispose(); } fillMenu(_menu); } }); return _menu; }
@Override public Menu getMenu(final Menu parent) { dispose(); _menu = new Menu(parent); // Add listener to repopulate the menu each time _menu.addMenuListener(new MenuAdapter() { @Override public void menuShown(final MenuEvent e) { // dispose old menu items for (final MenuItem menuItem : ((Menu) e.widget).getItems()) { menuItem.dispose(); } fillMenu(_menu); enableActions(); } }); return _menu; }
@Override public Menu getMenu(final Menu parent) { dispose(); __categoryMenu = new Menu(parent); // Add listener to repopulate the menu each time __categoryMenu.addMenuListener(new MenuAdapter() { @Override public void menuShown(final MenuEvent e) { final Menu menu = (Menu) e.widget; // dispose old items final MenuItem[] items = menu.getItems(); for (final MenuItem item : items) { item.dispose(); } // add actions createColumnActions(__categoryMenu, __category); } }); return __categoryMenu; }
private void refactorMenuShown(IMenuManager refactorSubmenu) { // we know that we have an MenuManager since we created it in // addRefactorSubmenu. Menu menu= ((MenuManager)refactorSubmenu).getMenu(); menu.addMenuListener(new MenuAdapter() { @Override public void menuHidden(MenuEvent e) { refactorMenuHidden(); } }); ITextSelection textSelection= (ITextSelection)fEditor.getSelectionProvider().getSelection(); JavaTextSelection javaSelection= new JavaTextSelection(getEditorInput(), getDocument(), textSelection.getOffset(), textSelection.getLength()); for (Iterator<SelectionDispatchAction> iter= fActions.iterator(); iter.hasNext(); ) { SelectionDispatchAction action= iter.next(); action.update(javaSelection); } refactorSubmenu.removeAll(); if (fillRefactorMenu(refactorSubmenu) == 0) refactorSubmenu.add(fNoActionAvailable); }
protected void initMenu() { menu.addMenuListener(new MenuAdapter() { public void menuShown(MenuEvent e) { Menu m = (Menu) e.widget; MenuItem[] items = m.getItems(); for (int i = 0; i < items.length; i++) { items[i].dispose(); } fillMenu(m); } }); }
/** * Generate the list of all the previews output format * * @param parent */ private void createOutputMenu(Menu parent) { MenuItem root = new MenuItem(parent, SWT.CASCADE); menu = new Menu(parent); root.setMenu(menu); root.setText(Messages.ViewSettingsDropDownAction_previewFormatMenu); JrxmlEditor editor = getEditor(); PreviewContainer preview = (PreviewContainer) editor.getEditor(JrxmlEditor.PAGE_PREVIEW); viewFactory = preview.getViewFactory(); for (String key : viewFactory.getKeys()) { if (viewFactory.isSeparator(key)) { new MenuItem(menu, SWT.SEPARATOR); } else { creteItem(key, editor); } } menu.addMenuListener(new MenuAdapter() { @Override public void menuShown(MenuEvent e) { String actualPreview = getEditor().getDefaultViewerKey(); for (MenuItem item : menu.getItems()) { item.setSelection(item.getText().equals(actualPreview)); } } }); }
public Menu getMenu(final Menu parent) { dispose(); _menu = new Menu(parent); // Add listener to repopulate the menu each time _menu.addMenuListener(new MenuAdapter() { @Override public void menuShown(final MenuEvent e) { final Menu menu = (Menu) e.widget; // dispose old items for (final MenuItem menuItem : menu.getItems()) { menuItem.dispose(); } /* * create all expand types */ final int selectedExpandType = getSelectedExpandType(); int typeIndex = 0; for (final int expandType : TagManager.EXPAND_TYPES) { final ActionSetTagStructure actionTagStructure = new ActionSetTagStructure( expandType, TagManager.EXPAND_TYPE_NAMES[typeIndex++]); // check active expand type actionTagStructure.setChecked(selectedExpandType == expandType); addActionToMenu(actionTagStructure); } } }); return _menu; }
public Menu getMenu(final Menu parent) { dispose(); __categoryMenu = new Menu(parent); // Add listener to repopulate the menu each time __categoryMenu.addMenuListener(new MenuAdapter() { @Override public void menuShown(final MenuEvent e) { final Menu menu = (Menu) e.widget; // dispose old items final MenuItem[] items = menu.getItems(); for (final MenuItem item : items) { item.dispose(); } final TagCollection tagCollection = TourDatabase.getTagEntries(__tagCategory.getCategoryId()); // add actions __actionAddTourTag.createCategoryActions(tagCollection, __categoryMenu); __actionAddTourTag.createTagActions(tagCollection, __categoryMenu); } }); return __categoryMenu; }
public Menu getMenu(final Control parent) { dispose(); _menu = new Menu(parent); // Add listener to repopulate the menu each time _menu.addMenuListener(new MenuAdapter() { @Override public void menuShown(final MenuEvent e) { onFillMenu((Menu) e.widget); } }); return _menu; }
public Menu getMenu(final Menu parent) { dispose(); _menu = new Menu(parent); // Add listener to repopulate the menu each time _menu.addMenuListener(new MenuAdapter() { @Override public void menuShown(final MenuEvent e) { onFillMenu((Menu) e.widget); } }); return _menu; }
public Menu getMenu(final Menu parent) { dispose(); _menu = new Menu(parent); // Add listener to repopulate the menu each time _menu.addMenuListener(new MenuAdapter() { @Override public void menuShown(final MenuEvent e) { final Menu menu = (Menu) e.widget; // dispose old items for (final MenuItem menuItem : menu.getItems()) { menuItem.dispose(); } /* * create all expand types */ int typeIndex = 0; for (final int expandType : TagManager.EXPAND_TYPES) { final ActionSetTagStructure actionTagStructure = new ActionSetTagStructure( expandType, TagManager.EXPAND_TYPE_NAMES[typeIndex++]); addActionToMenu(actionTagStructure); } } }); return _menu; }
/** * create the views context menu */ private void createUI_20_ContextMenu() { final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { fillContextMenu(manager); } }); final Tree tree = (Tree) _tourViewer.getControl(); final Menu treeContextMenu = menuMgr.createContextMenu(tree); treeContextMenu.addMenuListener(new MenuAdapter() { @Override public void menuHidden(final MenuEvent e) { _tagMenuMgr.onHideMenu(); } @Override public void menuShown(final MenuEvent menuEvent) { _tagMenuMgr.onShowMenu(menuEvent, tree, Display.getCurrent().getCursorLocation(), _tourInfoToolTip); } }); _columnManager.createHeaderContextMenu(tree, treeContextMenu); }
/** * create the views context menu */ private void createUI_20_ContextMenu() { final Tree tree = (Tree) _tourViewer.getControl(); final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { fillContextMenu(manager); } }); final Menu treeContextMenu = menuMgr.createContextMenu(tree); treeContextMenu.addMenuListener(new MenuAdapter() { @Override public void menuHidden(final MenuEvent e) { _tagMenuMgr.onHideMenu(); } @Override public void menuShown(final MenuEvent menuEvent) { _tagMenuMgr.onShowMenu(menuEvent, tree, Display.getCurrent().getCursorLocation(), _tourInfoToolTip); } }); _columnManager.createHeaderContextMenu(tree, treeContextMenu); }
/** * create the views context menu */ private void createUI_20_ContextMenu() { final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { _tourInfoToolTip.hideToolTip(); fillContextMenu(manager); } }); final Tree tree = (Tree) _tourViewer.getControl(); final Menu treeContextMenu = menuMgr.createContextMenu(tree); treeContextMenu.addMenuListener(new MenuAdapter() { @Override public void menuHidden(final MenuEvent e) { _tagMenuMgr.onHideMenu(); } @Override public void menuShown(final MenuEvent menuEvent) { _tagMenuMgr.onShowMenu(menuEvent, tree, Display.getCurrent().getCursorLocation(), _tourInfoToolTip); } }); _columnManager.createHeaderContextMenu(tree, treeContextMenu); }
/** * create the views context menu */ private void createUI_20_ContextMenu() { final Tree tree = (Tree) _tagViewer.getControl(); final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { fillContextMenu(manager); } }); // add the context menu to the tree viewer final Menu treeContextMenu = menuMgr.createContextMenu(tree); treeContextMenu.addMenuListener(new MenuAdapter() { @Override public void menuHidden(final MenuEvent e) { _tagMenuMgr.onHideMenu(); } @Override public void menuShown(final MenuEvent menuEvent) { _tagMenuMgr.onShowMenu(menuEvent, tree, Display.getCurrent().getCursorLocation(), _tourInfoToolTip); } }); _columnManager.createHeaderContextMenu(tree, treeContextMenu); }
/** * create the views context menu */ private void createUI_94_ContextMenu() { final Table table = (Table) _tourViewer.getControl(); final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { fillContextMenu(manager); } }); final Menu tableContextMenu = menuMgr.createContextMenu(table); tableContextMenu.addMenuListener(new MenuAdapter() { @Override public void menuHidden(final MenuEvent e) { _tagMenuMgr.onHideMenu(); } @Override public void menuShown(final MenuEvent menuEvent) { _tagMenuMgr.onShowMenu(menuEvent, table, Display.getCurrent().getCursorLocation(), _tourInfoToolTip); } }); getSite().registerContextMenu(menuMgr, _tourViewer); _columnManager.createHeaderContextMenu(table, tableContextMenu); }
@Override public Menu getMenu(final Menu parent) { dispose(); __formatsMenu = new Menu(parent); // Add listener to repopulate the menu each time __formatsMenu.addMenuListener(new MenuAdapter() { @Override public void menuShown(final MenuEvent e) { final Menu menu = (Menu) e.widget; // dispose old items final MenuItem[] items = menu.getItems(); for (final MenuItem item : items) { item.dispose(); } // add actions createFormatActions(__formatsMenu, __isDetailFormat); } }); return __formatsMenu; }
protected void initMenu(Menu menu) { menu.addMenuListener(new MenuAdapter() { @Override public void menuShown(MenuEvent e) { Menu m= (Menu) e.widget; MenuItem[] items= m.getItems(); for (int i= 0; i < items.length; i++) { items[i].dispose(); } fillMenu(m); } }); }
protected void initMenu() { fMenu.addMenuListener(new MenuAdapter() { @Override public void menuShown(MenuEvent e) { Menu m = (Menu)e.widget; MenuItem[] items = m.getItems(); for (int i=0; i < items.length; i++) { items[i].dispose(); } fillMenu(m); } }); }
private void initMenu(Menu fMenu) { fMenu.addMenuListener(new MenuAdapter() { public void menuShown(MenuEvent e) { Menu m = (Menu) e.widget; MenuItem[] items = m.getItems(); for (int i = 0; i < items.length; i++) { items[i].dispose(); } fillMenu(m); } }); }
public LocalObjectsMenu(AppWindow appWindow, Menu menulocal) { this.appwindow = appWindow; this.menulocal = menulocal; menulocal.addMenuListener(new MenuAdapter() { @Override public void menuShown(MenuEvent arg0) { localMenuShown(); } }); }
public Menu createContextMenu( final CalendarView calendarView, final Control control, final ArrayList<Action> localActions) { createActions(calendarView); // final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ final MenuManager menuMgr = new MenuManager(); final TagMenuManager tagMenuMgr = new TagMenuManager(calendarView, true); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { // hide tour tooltip when opened calendarView.getTourInfoTooltip().hideToolTip(); fillContextMenu(manager, calendarView, localActions); } }); final Menu contextMenu = menuMgr.createContextMenu(control); contextMenu.addMenuListener(new MenuAdapter() { @Override public void menuHidden(final MenuEvent e) { tagMenuMgr.onHideMenu(); } @Override public void menuShown(final MenuEvent menuEvent) { // tagMenuMgr.onShowMenu(menuEvent, _control, Display.getCurrent().getCursorLocation(), _tourInfoToolTip); tagMenuMgr.onShowMenu(menuEvent, control, Display.getCurrent().getCursorLocation(), null); } }); menuMgr.add(_actionEditQuick); menuMgr.add(_actionEditTour); menuMgr.add(_actionOpenMarkerDialog); menuMgr.add(_actionOpenAdjustAltitudeDialog); menuMgr.add(_actionOpenTour); menuMgr.add(_actionDuplicateTour); menuMgr.add(_actionMergeTour); // menuMgr.add(_actionJoinTours); // until now we only allow single tour selection menuMgr.add(_actionComputeDistanceValuesFromGeoposition); menuMgr.add(_actionSetAltitudeFromSRTM); tagMenuMgr.fillTagMenu(menuMgr); // tour type actions menuMgr.add(new Separator()); menuMgr.add(_actionSetTourType); TourTypeMenuManager.fillMenuWithRecentTourTypes(menuMgr, calendarView, true); menuMgr.add(new Separator()); menuMgr.add(_actionExportTour); menuMgr.add(_actionPrintTour); menuMgr.add(new Separator()); menuMgr.add(_actionSetOtherPerson); return contextMenu; }