Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 183904 Details for
Bug 264036
[Contributions] support menu contributions for page book view toolbars
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch v01
PageBookContribution 01.txt (text/plain), 4.27 KB, created by
Prakash Rangaraj
on 2010-11-26 03:13:07 EST
(
hide
)
Description:
Patch v01
Filename:
MIME Type:
Creator:
Prakash Rangaraj
Created:
2010-11-26 03:13:07 EST
Size:
4.27 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/part/Page.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/Page.java,v >retrieving revision 1.9 >diff -u -r1.9 Page.java >--- Eclipse UI/org/eclipse/ui/part/Page.java 8 May 2006 20:55:33 -0000 1.9 >+++ Eclipse UI/org/eclipse/ui/part/Page.java 26 Nov 2010 08:11:18 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -10,12 +10,17 @@ > *******************************************************************************/ > package org.eclipse.ui.part; > >+import org.eclipse.jface.action.IContributionItem; > import org.eclipse.jface.action.IMenuManager; > import org.eclipse.jface.action.IStatusLineManager; > import org.eclipse.jface.action.IToolBarManager; >+import org.eclipse.jface.action.MenuManager; >+import org.eclipse.jface.action.ToolBarManager; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; > import org.eclipse.ui.IActionBars; >+import org.eclipse.ui.menus.IMenuService; >+import org.eclipse.ui.menus.MenuUtil; > > /** > * Abstract base superclass for pages in a pagebook view. >@@ -49,11 +54,24 @@ > * The site which contains this page > */ > private IPageSite site; >+ private final String id; >+ private ToolBarManager dummyToolBarManager; >+ private MenuManager dummyMenuManager; > > /* > * Creates a new page for a pagebook view. > */ > protected Page() { >+ this(null); >+ } >+ >+ /** >+ * Creates a new page for a pagebook view with an id. >+ * >+ * @since 3.7 >+ */ >+ protected Page(String id) { >+ this.id = id; > } > > /* (non-Javadoc) >@@ -67,6 +85,13 @@ > * been disposed). Subclasses may extend. > */ > public void dispose() { >+ >+ if (id != null) { >+ IMenuService menuService = (IMenuService) site.getService(IMenuService.class); >+ menuService.releaseContributions(dummyMenuManager); >+ menuService.releaseContributions(dummyToolBarManager); >+ } >+ > Control ctrl = getControl(); > if (ctrl != null && !ctrl.isDisposed()) { > ctrl.dispose(); >@@ -108,13 +133,52 @@ > */ > public void init(IPageSite pageSite) { > site = pageSite; >+ populateContributions(); > } > >- /** >- * Returns the site which contains this page. >- * >- * @return the site which contains this page >- */ >+ private void populateContributions() { >+ >+ if (id == null) >+ return; >+ >+ IMenuService menuService = (IMenuService) site.getService(IMenuService.class); >+ >+ populateToolBarManager(menuService); >+ populateMenuManager(menuService); >+ >+ } >+ >+ private void populateToolBarManager(IMenuService menuService) { >+ >+ dummyToolBarManager = new ToolBarManager(); >+ menuService.populateContributionManager(dummyToolBarManager, MenuUtil.toolbarUri(id)); >+ IContributionItem[] items = dummyToolBarManager.getItems(); >+ >+ IToolBarManager actualToolBarManager = site.getActionBars().getToolBarManager(); >+ for (int i = 0; i < items.length; i++) { >+ actualToolBarManager.add(items[i]); >+ } >+ actualToolBarManager.update(true); >+ } >+ >+ private void populateMenuManager(IMenuService menuService) { >+ >+ dummyMenuManager = new MenuManager(); >+ menuService.populateContributionManager(dummyMenuManager, MenuUtil.menuUri(id)); >+ IContributionItem[] items = dummyMenuManager.getItems(); >+ >+ IMenuManager actualMenuManager = site.getActionBars().getMenuManager(); >+ for (int i = 0; i < items.length; i++) { >+ actualMenuManager.add(items[i]); >+ } >+ actualMenuManager.update(true); >+ } >+ >+ /** >+ * Returns the site which contains this page. >+ * >+ * @return the site which contains this page >+ */ > public IPageSite getSite() { > return site; > } >@@ -124,4 +188,13 @@ > * does nothing. Subclasses must implement. > */ > public abstract void setFocus(); >+ >+ /** >+ * @return Returns the id. >+ * @since 3.7 >+ * >+ */ >+ public String getId() { >+ return id; >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 264036
: 183904