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 120917 Details for
Bug 259048
[Contributions] toolbar control contributions cause plugin startup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch v01
Dynamic Control Proxy 01.txt (text/plain), 9.64 KB, created by
Prakash Rangaraj
on 2008-12-19 03:56:05 EST
(
hide
)
Description:
Patch v01
Filename:
MIME Type:
Creator:
Prakash Rangaraj
Created:
2008-12-19 03:56:05 EST
Size:
9.64 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java,v >retrieving revision 1.53 >diff -u -r1.53 MenuAdditionCacheEntry.java >--- Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java 24 Nov 2008 18:43:07 -0000 1.53 >+++ Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java 19 Dec 2008 08:29:35 -0000 >@@ -24,6 +24,7 @@ > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IConfigurationElement; > import org.eclipse.core.runtime.InvalidRegistryObjectException; >+import org.eclipse.jface.action.ContributionItem; > import org.eclipse.jface.action.GroupMarker; > import org.eclipse.jface.action.IContributionItem; > import org.eclipse.jface.action.MenuManager; >@@ -37,12 +38,10 @@ > import org.eclipse.ui.internal.provisional.presentations.IActionBarPresentationFactory; > import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants; > import org.eclipse.ui.internal.services.IWorkbenchLocationService; >-import org.eclipse.ui.internal.util.Util; > import org.eclipse.ui.menus.CommandContributionItem; > import org.eclipse.ui.menus.CommandContributionItemParameter; > import org.eclipse.ui.menus.IContributionRoot; > import org.eclipse.ui.menus.IMenuService; >-import org.eclipse.ui.menus.IWorkbenchContribution; > import org.eclipse.ui.menus.WorkbenchWindowControlContribution; > import org.eclipse.ui.plugin.AbstractUIPlugin; > import org.eclipse.ui.services.IServiceLocator; >@@ -269,15 +268,12 @@ > return new GroupMarker(getName(sepAddition)); > } > >- /** >- * @return >- */ > private IContributionItem createDynamicAdditionContribution( > final IServiceLocator locator, > final IConfigurationElement dynamicAddition) { > >- return new DynamicMenuContributionItem(getId(dynamicAddition), locator, >- dynamicAddition); >+ return new DynamicContributionItem(getId(dynamicAddition), locator, >+ dynamicAddition, ContributionItem.class); > > } > >@@ -287,30 +283,9 @@ > if (!inToolbar()) { > return null; > } >- // If we've already tried (and failed) to load the >- // executable extension then skip this addirion. >- if (failedLoads.contains(widgetAddition)) >- return null; >- >- // Attempt to load the addition's EE (creates a new instance) >- final WorkbenchWindowControlContribution loadedWidget = (WorkbenchWindowControlContribution) Util >- .safeLoadExecutableExtension(widgetAddition, >- IWorkbenchRegistryConstants.ATT_CLASS, >- WorkbenchWindowControlContribution.class); >- >- // Cache failures >- if (loadedWidget == null) { >- failedLoads.add(widgetAddition); >- return null; >- } >- >- // explicitly set the id >- loadedWidget.setId(getId(widgetAddition)); >- if (loadedWidget instanceof IWorkbenchContribution) { >- ((IWorkbenchContribution)loadedWidget).initialize(locator); >- } >- >- return loadedWidget; >+ >+ return new DynamicContributionItem(getId(widgetAddition), locator, >+ widgetAddition, WorkbenchWindowControlContribution.class); > } > > private IContributionItem createCommandAdditionContribution( >Index: Eclipse UI/org/eclipse/ui/internal/menus/DynamicContributionItem.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/menus/DynamicContributionItem.java >diff -N Eclipse UI/org/eclipse/ui/internal/menus/DynamicContributionItem.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/menus/DynamicContributionItem.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,215 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.menus; >+ >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.jface.action.ContributionItem; >+import org.eclipse.jface.action.IContributionItem; >+import org.eclipse.jface.action.IContributionManager; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.CoolBar; >+import org.eclipse.swt.widgets.Menu; >+import org.eclipse.swt.widgets.ToolBar; >+import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants; >+import org.eclipse.ui.internal.util.Util; >+import org.eclipse.ui.menus.IWorkbenchContribution; >+import org.eclipse.ui.services.IServiceLocator; >+ >+/** >+ * A contribution item which proxies a dynamic menu or tool contribution. >+ * <p> >+ * It currently supports placement in menus. >+ * </p> >+ * <p> >+ * >+ * @author Prakash G.R. >+ * >+ * @since 3.5 >+ * >+ */ >+public class DynamicContributionItem extends ContributionItem { >+ >+ private final IConfigurationElement dynamicAddition; >+ private final IServiceLocator locator; >+ private boolean alreadyFailed; >+ private ContributionItem loadedDynamicContribution; >+ private final Class classSpec; >+ >+ /** >+ * Creates a DynamicMenuContributionItem >+ * >+ * @param id >+ * - Id of the menu item >+ * @param locator >+ * - The Service Locator >+ * @param dynamicAddition >+ * - The Configuration Element defined in the plugin.xml >+ * @param classSpec >+ * - The castable class of the expected contribution item >+ * >+ */ >+ public DynamicContributionItem(String id, IServiceLocator locator, >+ IConfigurationElement dynamicAddition, Class classSpec) { >+ super(id); >+ >+ this.locator = locator; >+ this.dynamicAddition = dynamicAddition; >+ this.classSpec = classSpec; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.action.ContributionItem#isDynamic() >+ */ >+ public boolean isDynamic() { >+ if (loadedDynamicContribution != null) { >+ return loadedDynamicContribution.isDynamic(); >+ } >+ return true; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.action.ContributionItem#isDirty() >+ */ >+ public boolean isDirty() { >+ if (loadedDynamicContribution != null) { >+ return loadedDynamicContribution.isDirty(); >+ } >+ return super.isDirty(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets >+ * .Composite) >+ */ >+ public void fill(Composite parent) { >+ IContributionItem contributionItem = getContributionItem(); >+ if (contributionItem != null) >+ contributionItem.fill(parent); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets >+ * .CoolBar, int) >+ */ >+ public void fill(CoolBar parent, int index) { >+ IContributionItem contributionItem = getContributionItem(); >+ if (contributionItem != null) >+ contributionItem.fill(parent, index); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets >+ * .Menu, int) >+ */ >+ public void fill(Menu menu, int index) { >+ IContributionItem contributionItem = getContributionItem(); >+ if (contributionItem != null) >+ contributionItem.fill(menu, index); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets >+ * .ToolBar, int) >+ */ >+ public void fill(ToolBar parent, int index) { >+ IContributionItem contributionItem = getContributionItem(); >+ if (contributionItem != null) >+ contributionItem.fill(parent, index); >+ } >+ >+ private IContributionItem getContributionItem() { >+ if (loadedDynamicContribution == null && !alreadyFailed) >+ createContributionItem(); >+ return loadedDynamicContribution; >+ } >+ >+ private void createContributionItem() { >+ >+ loadedDynamicContribution = (ContributionItem) Util >+ .safeLoadExecutableExtension(dynamicAddition, >+ IWorkbenchRegistryConstants.ATT_CLASS, >+ classSpec); >+ >+ if (loadedDynamicContribution == null) { >+ alreadyFailed = true; >+ return; >+ } >+ >+ loadedDynamicContribution.setId(getId()); >+ loadedDynamicContribution.setParent(getParent()); >+ if (loadedDynamicContribution instanceof IWorkbenchContribution) { >+ ((IWorkbenchContribution) loadedDynamicContribution) >+ .initialize(locator); >+ } >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.action.ContributionItem#dispose() >+ */ >+ public void dispose() { >+ if (loadedDynamicContribution != null) { >+ loadedDynamicContribution.dispose(); >+ loadedDynamicContribution = null; >+ } >+ super.dispose(); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.action.ContributionItem#update() >+ */ >+ public void update() { >+ if (loadedDynamicContribution != null) { >+ loadedDynamicContribution.update(); >+ } >+ } >+ >+ public void update(String id) { >+ if (loadedDynamicContribution != null) { >+ loadedDynamicContribution.update(id); >+ } >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.jface.action.ContributionItem#setParent(org.eclipse.jface >+ * .action.IContributionManager) >+ */ >+ public void setParent(IContributionManager parent) { >+ super.setParent(parent); >+ if (loadedDynamicContribution != null) { >+ loadedDynamicContribution.setParent(parent); >+ } >+ } >+ >+}
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 259048
:
120711
|
120917
|
129616
|
149331