Java Code Examples for org.eclipse.jface.action.MenuManager#setRemoveAllWhenShown()
The following examples show how to use
org.eclipse.jface.action.MenuManager#setRemoveAllWhenShown() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HistoryAction.java From Pydev with Eclipse Public License 1.0 | 6 votes |
@Override public Menu getMenu(Control parent) { if (fMenu != null) { fMenu.dispose(); } final MenuManager manager = new MenuManager(); manager.setRemoveAllWhenShown(true); manager.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager2) { fillMenuManager(new IActionsMenu() { @Override public void add(IAction action) { manager2.add(action); } }); } }); fMenu = manager.createContextMenu(parent); return fMenu; }
Example 2
Source File: BonitaProjectExplorer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void initContextMenu() { TreeViewer commonViewer = getCommonViewer(); Menu previousMenu = commonViewer.getTree().getMenu(); // Remove menu created by default if (previousMenu != null) { previousMenu.dispose(); } MenuManager menuMgr = new MenuManager(getNavigatorContentService().getViewerDescriptor().getPopupMenuId()); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(manager -> fillContextMenu(manager)); Menu menu = menuMgr.createContextMenu(commonViewer.getTree()); commonViewer.getTree().setMenu(menu); IEclipseContext e4Context = ((PartSite) getSite()).getContext(); new CustomPopupMenuExtender(ID, menuMgr, getSite().getSelectionProvider(), getSite().getPart(), e4Context, true); }
Example 3
Source File: LaunchConfigurationContent.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
private void createContextMenu() { MenuManager menuMgr = new MenuManager("#PopupMenu"); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { populateBrowserActions(launchConfiguration, manager); manager.add(new Separator()); manager.add(new Action("&Copy") { @Override public void run() { copySelectionToClipboard(); } }); } }); Menu menu = menuMgr.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); }
Example 4
Source File: MemoryEditor.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void createContextMenuFor ( StructuredViewer viewer ) { MenuManager contextMenu = new MenuManager ( "#PopUp" ); contextMenu.add ( new Separator ( "additions" ) ); contextMenu.setRemoveAllWhenShown ( true ); contextMenu.addMenuListener ( this ); Menu menu = contextMenu.createContextMenu ( viewer.getControl () ); viewer.getControl ().setMenu ( menu ); getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) ); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () }; viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) ); viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) ); }
Example 5
Source File: MarkerStatsView.java From eclipse-cs with GNU Lesser General Public License v2.1 | 6 votes |
/** * Adds the actions to the tableviewer context menu. * * @param actions * a collection of IAction objets */ private void hookContextMenu(final Collection<Object> actions, StructuredViewer viewer) { MenuManager menuMgr = new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { for (Iterator<Object> iter = actions.iterator(); iter.hasNext();) { Object item = iter.next(); if (item instanceof IContributionItem) { manager.add((IContributionItem) item); } else if (item instanceof IAction) { manager.add((IAction) item); } } manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); } }); Menu menu = menuMgr.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(menuMgr, viewer); }
Example 6
Source File: GraphStatsView.java From eclipse-cs with GNU Lesser General Public License v2.1 | 6 votes |
/** * Adds the actions to the tableviewer context menu. * * @param actions * a collection of IAction objets */ private void hookContextMenu(final Collection<Object> actions, StructuredViewer viewer) { MenuManager menuMgr = new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { for (Iterator<Object> iter = actions.iterator(); iter.hasNext();) { Object item = iter.next(); if (item instanceof IContributionItem) { manager.add((IContributionItem) item); } else if (item instanceof IAction) { manager.add((IAction) item); } } manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); } }); Menu menu = menuMgr.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(menuMgr, viewer); }
Example 7
Source File: ExtensionsEditor.java From ifml-editor with MIT License | 5 votes |
/** * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void createContextMenuFor(StructuredViewer viewer) { MenuManager contextMenu = new MenuManager("#PopUp"); contextMenu.add(new Separator("additions")); contextMenu.setRemoveAllWhenShown(true); contextMenu.addMenuListener(this); Menu menu= contextMenu.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); }
Example 8
Source File: MechanicStatusControlContribution.java From workspacemechanic with Eclipse Public License 1.0 | 5 votes |
/** * Creates and registers a new popup menu on the supplied control. * * <p> * When the menu is about to be shown the * {@link #fillContextMenu(IMenuManager)} method will be called. */ private void createContextMenu(Control control) { MenuManager mgr = new MenuManager("#PopupMenu"); mgr.setRemoveAllWhenShown(true); mgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { fillContextMenu(manager); } }); Menu menu = mgr.createContextMenu(control); control.setMenu(menu); }
Example 9
Source File: FlameGraphView.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private void createTimeEventContextMenu() { MenuManager eventMenuManager = new MenuManager(); eventMenuManager.setRemoveAllWhenShown(true); TimeGraphControl timeGraphControl = fTimeGraphViewer.getTimeGraphControl(); final Menu timeEventMenu = eventMenuManager.createContextMenu(timeGraphControl); timeGraphControl.addTimeGraphEntryMenuListener(event -> { /* * The TimeGraphControl will call the TimeGraphEntryMenuListener * before the TimeEventMenuListener. We need to clear the menu * for the case the selection was done on the namespace where * the time event listener below won't be called afterwards. */ timeGraphControl.setMenu(null); event.doit = false; }); timeGraphControl.addTimeEventMenuListener(event -> { Menu menu = timeEventMenu; if (event.data instanceof FlamegraphEvent) { timeGraphControl.setMenu(menu); return; } timeGraphControl.setMenu(null); event.doit = false; }); eventMenuManager.addMenuListener(manager -> { fillTimeEventContextMenu(eventMenuManager); eventMenuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); }); getSite().registerContextMenu(eventMenuManager, fTimeGraphViewer.getSelectionProvider()); }
Example 10
Source File: MethodsViewer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Attaches a contextmenu listener to the table * @param menuListener the menu listener * @param popupId the popup id * @param viewSite the view site */ public void initContextMenu(IMenuListener menuListener, String popupId, IWorkbenchPartSite viewSite) { MenuManager menuMgr= new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(menuListener); Menu menu= menuMgr.createContextMenu(getTable()); getTable().setMenu(menu); viewSite.registerContextMenu(popupId, menuMgr, this); }
Example 11
Source File: OutlinePage.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * @since 2.4 */ protected void configureContextMenu() { MenuManager menuManager = new MenuManager(CONTEXT_MENU_ID, CONTEXT_MENU_ID); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menuManager.setRemoveAllWhenShown(true); Menu contextMenu = menuManager.createContextMenu(getTreeViewer().getTree()); getTreeViewer().getTree().setMenu(contextMenu); getSite().registerContextMenu(MENU_ID, menuManager, getTreeViewer()); }
Example 12
Source File: LocationViewer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Attaches a context menu listener to the tree. * * @param menuListener the menu listener * @param popupId the id of the popup * @param viewSite the part site */ void initContextMenu(IMenuListener menuListener, String popupId, IWorkbenchPartSite viewSite) { MenuManager menuMgr= new MenuManager(); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(menuListener); Menu menu= menuMgr.createContextMenu(getControl()); getControl().setMenu(menu); viewSite.registerContextMenu(popupId, menuMgr, this); }
Example 13
Source File: EventQueryView.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private void hookContextMenu () { final MenuManager menuMgr = new MenuManager ( "#PopupMenu", VIEW_ID ); menuMgr.setRemoveAllWhenShown ( true ); menuMgr.addMenuListener ( new IMenuListener () { @Override public void menuAboutToShow ( final IMenuManager manager ) { fillContextMenu ( manager ); } } ); final Menu menu = menuMgr.createContextMenu ( this.viewer.getControl () ); this.viewer.getControl ().setMenu ( menu ); getSite ().registerContextMenu ( menuMgr, this.viewer ); }
Example 14
Source File: DialogPackageExplorer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public Control createControl(Composite parent) { fPackageViewer= new TreeViewer(parent, SWT.MULTI); fPackageViewer.setComparer(WorkingSetModel.COMPARER); fPackageViewer.addFilter(new PackageFilter()); fPackageViewer.setComparator(new ExtendedJavaElementSorter()); fPackageViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { Object element= ((IStructuredSelection)event.getSelection()).getFirstElement(); if (fPackageViewer.isExpandable(element)) { fPackageViewer.setExpandedState(element, !fPackageViewer.getExpandedState(element)); } else { if (element instanceof CPListElementAttribute) { CPListElementAttribute attribute= (CPListElementAttribute)element; if (attribute.getKey().equals(CPListElement.OUTPUT)) { fActionGroup.getEditOutputFolderAction().run(); } } } } }); MenuManager menuMgr= new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(this); fContextMenu= menuMgr.createContextMenu(fPackageViewer.getTree()); fPackageViewer.getTree().setMenu(fContextMenu); parent.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { fContextMenu.dispose(); } }); return fPackageViewer.getControl(); }
Example 15
Source File: FlameGraphView.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
@Override public void createPartControl(Composite parent) { super.createPartControl(parent); fTimeGraphViewer = new TimeGraphViewer(parent, SWT.NONE); FlameGraphContentProvider timeGraphContentProvider = new FlameGraphContentProvider(); fTimeGraphContentProvider = timeGraphContentProvider; fTimeGraphViewer.setTimeGraphContentProvider(timeGraphContentProvider); fTimeGraphViewer.setTimeGraphProvider(new FlameGraphPresentationProvider()); ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { traceSelected(new TmfTraceSelectedSignal(this, trace)); } contributeToActionBars(); loadSortOption(); loadContentPresentationOption(); TmfSignalManager.register(this); getSite().setSelectionProvider(fTimeGraphViewer.getSelectionProvider()); IMenuManager menuManager = getViewSite().getActionBars().getMenuManager(); MenuManager item = new MenuManager(Messages.FlameGraphView_ContentPresentation); item.setRemoveAllWhenShown(true); item.addMenuListener(manager -> { item.add(VIEW_BY_THREAD); item.add(VIEW_AGGREGATE); }); menuManager.add(item); createTimeEventContextMenu(); fTimeGraphViewer.getTimeGraphControl().addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { TimeGraphControl timeGraphControl = getTimeGraphViewer().getTimeGraphControl(); ISelection selection = timeGraphControl.getSelection(); if (selection instanceof IStructuredSelection) { for (Object object : ((IStructuredSelection) selection).toList()) { if (object instanceof FlamegraphEvent) { FlamegraphEvent event = (FlamegraphEvent) object; long startTime = event.getTime(); long endTime = startTime + event.getDuration(); getTimeGraphViewer().setStartFinishTimeNotify(startTime, endTime); break; } } } } }); }
Example 16
Source File: CheckoutWizardSelectionPage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public void createControl(Composite parent) { Composite outerContainer = new Composite(parent,SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 1; outerContainer.setLayout(layout); outerContainer.setLayoutData( new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); treeViewer = new TreeViewer(outerContainer, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER); RepositoryContentProvider contentProvider = new RepositoryContentProvider(); treeViewer.setContentProvider(contentProvider); treeViewer.addFilter(RepositoryFilters.FOLDERS_ONLY); treeViewer.setLabelProvider(new WorkbenchLabelProvider()); treeViewer.setInput(repositoryLocation); GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL); data.heightHint = LIST_HEIGHT_HINT; data.widthHint = LIST_WIDTH_HINT; treeViewer.getControl().setLayoutData(data); treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { CheckoutWizard wizard = (CheckoutWizard)getWizard(); ArrayList folderArray = new ArrayList(); IStructuredSelection selection = (IStructuredSelection)treeViewer.getSelection(); Iterator iter = selection.iterator(); while (iter.hasNext()) { Object object = iter.next(); if (object instanceof ISVNRemoteFolder || object instanceof ISVNRepositoryLocation) { if (object instanceof ISVNRepositoryLocation) folderArray.add(((ISVNRepositoryLocation)object).getRootFolder()); else folderArray.add(object); } } ISVNRemoteFolder[] remoteFolders = new ISVNRemoteFolder[folderArray.size()]; folderArray.toArray(remoteFolders); wizard.setRemoteFolders(remoteFolders); setPageComplete(!treeViewer.getSelection().isEmpty()); } }); final Action refreshAction = new Action(Policy.bind("RepositoriesView.refreshPopup"), SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_REFRESH)) { //$NON-NLS-1$ public void run() { refreshViewerNode(); } }; MenuManager menuMgr = new MenuManager(); Tree tree = treeViewer.getTree(); Menu menu = menuMgr.createContextMenu(tree); menuMgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { manager.add(refreshAction); } }); menuMgr.setRemoveAllWhenShown(true); tree.setMenu(menu); setMessage(Policy.bind("CheckoutWizardSelectionPage.text")); //$NON-NLS-1$ setControl(outerContainer); }
Example 17
Source File: PackageExplorerPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public void createPartControl(Composite parent) { final PerformanceStats stats= PerformanceStats.getStats(PERF_CREATE_PART_CONTROL, this); stats.startRun(); fViewer= createViewer(parent); fViewer.setUseHashlookup(true); initDragAndDrop(); setProviders(); JavaPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); MenuManager menuMgr= new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(this); fContextMenu= menuMgr.createContextMenu(fViewer.getTree()); fViewer.getTree().setMenu(fContextMenu); // Register viewer with site. This must be done before making the actions. IWorkbenchPartSite site= getSite(); site.registerContextMenu(menuMgr, fViewer); site.setSelectionProvider(fViewer); makeActions(); // call before registering for selection changes // Set input after filter and sorter has been set. This avoids resorting and refiltering. restoreFilterAndSorter(); fViewer.setInput(findInputElement()); initFrameActions(); initKeyListener(); fViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { fActionSet.handleDoubleClick(event); } }); fOpenAndLinkWithEditorHelper= new OpenAndLinkWithEditorHelper(fViewer) { @Override protected void activate(ISelection selection) { try { final Object selectedElement= SelectionUtil.getSingleElement(selection); if (EditorUtility.isOpenInEditor(selectedElement) != null) EditorUtility.openInEditor(selectedElement, true); } catch (PartInitException ex) { // ignore if no editor input can be found } } @Override protected void linkToEditor(ISelection selection) { PackageExplorerPart.this.linkToEditor(selection); } @Override protected void open(ISelection selection, boolean activate) { fActionSet.handleOpen(selection, activate); } }; IStatusLineManager slManager= getViewSite().getActionBars().getStatusLineManager(); fViewer.addSelectionChangedListener(new StatusBarUpdater(slManager)); fViewer.addTreeListener(fExpansionListener); // Set help for the view JavaUIHelp.setHelp(fViewer, IJavaHelpContextIds.PACKAGES_VIEW); fillActionBars(); updateTitle(); fFilterUpdater= new FilterUpdater(fViewer); ResourcesPlugin.getWorkspace().addResourceChangeListener(fFilterUpdater); // Sync'ing the package explorer has to be done here. It can't be done // when restoring the link state since the package explorers input isn't // set yet. setLinkingEnabled(isLinkingEnabled()); stats.endRun(); }
Example 18
Source File: BlockSelector.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
@Override public ViewerConfigurer createViewerConfigurer(CommonViewer cv){ this.cv = cv; cv.setSelectionChangedListener(selChangeListener); makeActions(); mgr = new MenuManager(); mgr.setRemoveAllWhenShown(true); mgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); mgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager){ Object selected = cv.getSelection()[0]; if (selected instanceof BlockTreeViewerItem) { manager.add(tvfa); manager.add(deleteAction); manager.add(copyAction); } addPopupCommandContributions(manager, cv.getSelection()); } }); cv.setContextMenu(mgr); FieldDescriptor<?>[] lbName = new FieldDescriptor<?>[] { new FieldDescriptor<ICodeElementBlock>("Name") }; // add keyListener to search field Listener keyListener = new Listener() { @Override public void handleEvent(Event event){ if (event.type == eventType) { if (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR) { slp.fireChangedEvent(); } } } }; for (FieldDescriptor<?> lbn : lbName) { lbn.setAssignedListener(eventType, keyListener); } slp = new SelectorPanelProvider(lbName, true); slp.addActions(createAction, exportAction, searchBlocksOnly, searchFilterMandator); ViewerConfigurer vc = new ViewerConfigurer(new BlockContentProvider(this, cv), new BlockTreeViewerItem.ColorizedLabelProvider(), slp, new ViewerConfigurer.DefaultButtonProvider(), new SimpleWidgetProvider( SimpleWidgetProvider.TYPE_TREE, SWT.NONE, null)); vc.addDragSourceSelectionRenderer(new GenericObjectDragSource.ISelectionRenderer() { @Override public List<Object> getSelection(){ IStructuredSelection selection = cv.getViewerWidget().getStructuredSelection(); if (!selection.isEmpty()) { return collectSelections(selection); } return Collections.emptyList(); } }); return vc.setContentType(ContentType.GENERICOBJECT); }
Example 19
Source File: ReferenceSearchViewPage.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public void createControl(Composite parent) { pagebook = new PageBook(parent, SWT.NULL); pagebook.setLayoutData(new GridData(GridData.FILL_BOTH)); busyLabel = new Table(pagebook, SWT.NONE); TableItem item = new TableItem(busyLabel, SWT.NONE); item.setText(Messages.ReferenceSearchViewPage_busyLabel); busyLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); control = new Composite(pagebook, SWT.NULL); control.setLayoutData(new GridData(GridData.FILL_BOTH)); control.setSize(100, 100); control.setLayout(new FillLayout()); viewer = new TreeViewer(control, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(contentProvider); viewer.setLabelProvider(labelProvider); viewer.setComparator(sorter); createOpenAndLinkWithEditorHandler(); IToolBarManager tbm = getSite().getActionBars().getToolBarManager(); fillToolbar(tbm); tbm.update(true); pagebook.showPage(control); isBusyShowing = false; queryListener = createQueryListener(); NewSearchUI.addQueryListener(queryListener); menu = new MenuManager("#PopUp"); //$NON-NLS-1$ menu.setRemoveAllWhenShown(true); menu.setParent(getSite().getActionBars().getMenuManager()); menu.addMenuListener(mgr -> { fillContextMenu(mgr); part.fillContextMenu(mgr); }); viewer.getControl().setMenu(menu.createContextMenu(viewer.getControl())); viewer.getControl().addKeyListener(KeyListener.keyPressedAdapter(e -> { if (e.keyCode == SWT.DEL) { removeSelectedMatchesAction.run(); } else if ((e.stateMask | SWT.COMMAND) != 0 && e.keyCode == 'c') { copyAction.run(); } })); }
Example 20
Source File: DatabaseMenu.java From olca-app with Mozilla Public License 2.0 | 4 votes |
private DatabaseMenu(IMenuManager manager) { MenuManager menu = new MenuManager(M.Database, "Database.Menu"); menu.setRemoveAllWhenShown(true); menu.addMenuListener(this); manager.add(menu); }