Java Code Examples for org.eclipse.swt.events.MenuEvent

The following are top voted examples for showing how to use org.eclipse.swt.events.MenuEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: typescript.java   File: RefactorActionGroup.java   View source code 6 votes vote down vote up
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);
}
 
Example 2
Project: PDFReporter-Studio   File: HandleDefaultsAction.java   View source code 6 votes vote down vote up
/**
 * 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;
}
 
Example 3
Project: mytourbook   File: ActionAddTourTag.java   View source code 6 votes vote down vote up
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;
	}
 
Example 4
Project: mytourbook   File: ActionAddTourTag.java   View source code 6 votes vote down vote up
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;
	}
 
Example 5
Project: mytourbook   File: ActionDeleteTourMenu2.java   View source code 6 votes vote down vote up
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;
	}
 
Example 6
Project: mytourbook   File: ActionDeleteTourMenu.java   View source code 6 votes vote down vote up
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;
	}
 
Example 7
Project: mytourbook   File: ActionMergeIntoMenu.java   View source code 6 votes vote down vote up
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;
	}
 
Example 8
Project: mytourbook   File: ActionReimportSubMenu.java   View source code 6 votes vote down vote up
@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;
}
 
Example 9
Project: mytourbook   File: ActionSetMarkerLabelPositionMenu.java   View source code 6 votes vote down vote up
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;
	}
 
Example 10
Project: mytourbook   File: ActionSetTourTypeMenu.java   View source code 6 votes vote down vote up
@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;
}
 
Example 11
Project: mytourbook   File: ActionSetPerson.java   View source code 6 votes vote down vote up
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;
	}
 
Example 12
Project: mytourbook   File: ActionCadenceSubMenu.java   View source code 6 votes vote down vote up
@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;
}
 
Example 13
Project: mytourbook   File: ColumnContextMenu.java   View source code 6 votes vote down vote up
@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;
}
 
Example 14
Project: Eclipse-Postfix-Code-Completion   File: RefactorActionGroup.java   View source code 6 votes vote down vote up
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);
}
 
Example 15
Project: Eclipse-Postfix-Code-Completion-Juno38   File: RefactorActionGroup.java   View source code 6 votes vote down vote up
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);
}
 
Example 16
Project: skin4eclipse   File: SaveSessionsPulldownMenu.java   View source code 5 votes vote down vote up
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);
        }
    });
}
 
Example 17
Project: skin4eclipse   File: LoadSessionsPulldownMenu.java   View source code 5 votes vote down vote up
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);
        }
    });
}
 
Example 18
Project: PDFReporter-Studio   File: PreviewFormatDropDownAction.java   View source code 5 votes vote down vote up
/**
 * 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));
			}
		}
	});
}
 
Example 19
Project: mytourbook   File: TourChartContextProvider.java   View source code 5 votes vote down vote up
@Override
public void onShowContextMenu(final MenuEvent menuEvent, final Control menuParentControl) {

	_tagMenuMgr.onShowMenu(//
			menuEvent,
			menuParentControl,
			Display.getCurrent().getCursorLocation(),
			null);
}
 
Example 20
Project: mytourbook   File: ActionMenuSetTagStructure.java   View source code 5 votes vote down vote up
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;
	}
 
Example 21
Project: mytourbook   File: ActionAddTourTag.java   View source code 5 votes vote down vote up
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;
		}
 
Example 22
Project: mytourbook   File: ActionRemoveTourTag.java   View source code 5 votes vote down vote up
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;
	}
 
Example 23
Project: mytourbook   File: ActionRemoveTourTag.java   View source code 5 votes vote down vote up
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;
	}
 
Example 24
Project: mytourbook   File: ActionMenuSetAllTagStructures.java   View source code 5 votes vote down vote up
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;
	}
 
Example 25
Project: mytourbook   File: TagMenuManager.java   View source code 5 votes vote down vote up
/**
 * This is called when the menu is displayed which contains the tag actions.
 * 
 * @param menuEvent
 * @param menuParentControl
 * @param menuPosition
 * @param toolTip
 */
public void onShowMenu(	final MenuEvent menuEvent,
						final Control menuParentControl,
						final Point menuPosition,
						final ToolTip toolTip) {

	_advancedMenuToAddTags.onShowParentMenu(//
			menuEvent,
			menuParentControl,
			_isTaggingAutoOpen,
			_isTaggingAnimation,
			_taggingAutoOpenDelay,
			menuPosition,
			toolTip);
}
 
Example 26
Project: mytourbook   File: CollatedToursView.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 27
Project: mytourbook   File: TourCompareResultView.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 28
Project: mytourbook   File: TourCatalogView.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 29
Project: mytourbook   File: TourBookView.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 30
Project: mytourbook   File: TaggingView.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 31
Project: mytourbook   File: RawDataView.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 32
Project: mytourbook   File: TourChartContextProvider.java   View source code 5 votes vote down vote up
@Override
public void onShowContextMenu(final MenuEvent menuEvent, final Control menuParentControl) {

	_tagMenuMgr.onShowMenu(//
			menuEvent,
			menuParentControl,
			Display.getCurrent().getCursorLocation(),
			null);
}
 
Example 33
Project: mytourbook   File: ColumnFormatSubMenu.java   View source code 5 votes vote down vote up
@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;
}
 
Example 34
Project: Eclipse-Postfix-Code-Completion   File: OccurrencesSearchMenuAction.java   View source code 5 votes vote down vote up
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);
		}
	});
}
 
Example 35
Project: Eclipse-Postfix-Code-Completion   File: SurroundWithTemplateMenuAction.java   View source code 5 votes vote down vote up
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);
		}
	});
}
 
Example 36
Project: jplot2d   File: MenuHandler.java   View source code 5 votes vote down vote up
public void menuShown(MenuEvent e) {
     /*
      * Update the internal status according to the point where the menu popup.
*/

     // undo/redo
     undoItem.setEnabled(env.canUndo());
     redoItem.setEnabled(env.canRedo());

 }
 
Example 37
Project: gef-gwt   File: PaletteStackEditPart.java   View source code 5 votes vote down vote up
/**
 * @see org.eclipse.swt.events.MenuListener#menuHidden(org.eclipse.swt.events.MenuEvent)
 */
public void menuHidden(MenuEvent e) {
	d.asyncExec(new Runnable() {
		public void run() {
			if (menu != null) {
				if (!menu.isDisposed())
					menu.dispose();
				menu = null;
			}
		}
	});
}
 
Example 38
Project: XPagesExtensionLibrary   File: ToolbarAction.java   View source code 5 votes vote down vote up
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);                
        }
    });
}
 
Example 39
Project: Eclipse-Postfix-Code-Completion-Juno38   File: OccurrencesSearchMenuAction.java   View source code 5 votes vote down vote up
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);
		}
	});
}
 
Example 40
Project: Eclipse-Postfix-Code-Completion-Juno38   File: SurroundWithTemplateMenuAction.java   View source code 5 votes vote down vote up
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);
		}
	});
}