本文整理汇总了Java中org.eclipse.swt.events.MenuEvent类的典型用法代码示例。如果您正苦于以下问题:Java MenuEvent类的具体用法?Java MenuEvent怎么用?Java MenuEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MenuEvent类属于org.eclipse.swt.events包,在下文中一共展示了MenuEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refactorMenuShown
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
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);
}
示例2: getMenu
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
/**
* 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;
}
示例3: getMenu
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
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;
}
示例4: getMenu
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
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;
}
示例5: getMenu
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
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;
}
示例6: getMenu
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
@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;
}
示例7: getMenu
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
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;
}
示例8: getMenu
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
@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;
}
示例9: getMenu
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
@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;
}
示例10: refactorMenuShown
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
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);
}
示例11: initMenu
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
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);
}
});
}
示例12: createOutputMenu
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
/**
* 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));
}
}
});
}
示例13: onShowContextMenu
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
@Override
public void onShowContextMenu(final MenuEvent menuEvent, final Control menuParentControl) {
_tagMenuMgr.onShowMenu(//
menuEvent,
menuParentControl,
Display.getCurrent().getCursorLocation(),
null);
}
示例14: getMenu
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
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;
}
示例15: getMenu
import org.eclipse.swt.events.MenuEvent; //导入依赖的package包/类
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;
}