| 
| MultiPageEditorPart with Tree page loses context menu on page change [message #333259] | Tue, 02 December 2008 10:57  |  | 
| Eclipse User  |  |  |  |  | Hello, 
 [Sorry if this is a repost... the Eclipse newsgroups were giving me
 errors on Dec 1st and it doesn't look like this was posted.]
 
 I'm working on an editor that extends MultiPageEditorPart. It has two
 pages, one contains a Tree from a TreeViewer and the other has a
 TextEditor. The Tree is on the default page, and the popup context menu
 displays properly, but when I switch to the page with the TextEditor and
 then back to the Tree page, the popup context menu doesn't display
 anymore. Note: It always works fine on the TextEditor page.
 
 When I hit ALT-SHIFT-F1 to display "The Plugin Spy," the popup context
 menu is somehow reinitialized and works again.
 
 I'm creating an empty popup context menu in my editor class, and
 populating it with Command Framework extensions in the plugin.xml.
 Here's the code that creates the empty context menu:
 
 MenuManager treeMenuManager = new MenuManager("#PopupMenu");
 treeMenuManager.add(
 new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
 
 Tree tree = treeViewer.getTree();
 Menu treeContextMenu =
 treeMenuManager.createContextMenu(tree);
 tree.setMenu(treeContextMenu);
 
 getEditorSite().registerContextMenu(
 treeMenuManager, treeViewer, false);
 
 I found the following bug that might be related to this issue. It
 highlights the fact that when a page change occurs, MultiPageEditorPart
 seems to do more behind-the-scenes work for pages consisting of Editors
 as opposed to pages composed of Components. (Be sure to take a look at
 activateSite() and deactivateSite() which are called by pageChange(int)
 and also do more for editors.)
 
 https://bugs.eclipse.org/bugs/show_bug.cgi?id=177333
 
 My questions are... is the problem I'm seeing a new bug or related to
 the above bug? How can I programmatically get my context menu to work
 again on my Tree page when I switch back to it? For example, what should
 I be doing in the overridden method pageChange(int) before/after I call
 super.pageChange(int)?
 
 Thanks for any help you can provide,
 
 Travis Haagen
 |  |  |  | 
|  | 
Powered by 
FUDForum. Page generated in 0.04462 seconds