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 129616 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 v02
ToolbarContribution v01.txt (text/plain), 12.70 KB, created by
Prakash Rangaraj
on 2009-03-23 13:01:07 EDT
(
hide
)
Description:
Patch v02
Filename:
MIME Type:
Creator:
Prakash Rangaraj
Created:
2009-03-23 13:01:07 EDT
Size:
12.70 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.tests >Index: Eclipse UI Tests/org/eclipse/ui/tests/api/workbenchpart/TextWidget.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/workbenchpart/TextWidget.java,v >retrieving revision 1.4 >diff -u -r1.4 TextWidget.java >--- Eclipse UI Tests/org/eclipse/ui/tests/api/workbenchpart/TextWidget.java 16 Mar 2007 18:00:00 -0000 1.4 >+++ Eclipse UI Tests/org/eclipse/ui/tests/api/workbenchpart/TextWidget.java 23 Mar 2009 16:57:35 -0000 >@@ -42,7 +42,7 @@ > /* (non-Javadoc) > * @see org.eclipse.jface.action.ControlContribution#createControl(org.eclipse.swt.widgets.Composite) > */ >- protected Control createControl(Composite parent) { >+ public Control createControl(Composite parent) { > Composite textHolder = new Composite(parent, SWT.NONE); > textHolder.setLayout(new Layout() { > protected Point computeSize(Composite composite, int wHint, >Index: Eclipse UI Tests/org/eclipse/ui/tests/menus/MenuBuilder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/menus/MenuBuilder.java,v >retrieving revision 1.7 >diff -u -r1.7 MenuBuilder.java >--- Eclipse UI Tests/org/eclipse/ui/tests/menus/MenuBuilder.java 16 Mar 2007 18:00:01 -0000 1.7 >+++ Eclipse UI Tests/org/eclipse/ui/tests/menus/MenuBuilder.java 23 Mar 2009 16:57:35 -0000 >@@ -102,7 +102,7 @@ > additions.addContributionItem(item, null); > WorkbenchWindowControlContribution widget = new WorkbenchWindowControlContribution( > "org.eclipse.ui.tests.menus.itemX26") { >- protected Control createControl(Composite parent) { >+ public Control createControl(Composite parent) { > Text textCtrl = new Text(parent, SWT.BORDER); > textCtrl.setText("ABCDEFGHI"); > return textCtrl; >#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 23 Mar 2009 16:57:45 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2008 IBM Corporation and others. >+ * Copyright (c) 2006, 2009 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 >@@ -14,10 +14,8 @@ > > import java.util.ArrayList; > import java.util.HashMap; >-import java.util.HashSet; > import java.util.List; > import java.util.Map; >-import java.util.Set; > > import org.eclipse.core.expressions.Expression; > import org.eclipse.core.expressions.ExpressionConverter; >@@ -37,13 +35,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; > >@@ -53,16 +48,6 @@ > */ > public class MenuAdditionCacheEntry extends AbstractMenuAdditionCacheEntry { > >- // Caches >- >- /** >- * If an {@link IConfigurationElement} is in the Set then we have already >- * tried (and failed) to load the associated ExecutableExtension. >- * >- * This is used to prevent multiple retries which would spam the Log. >- */ >- Set failedLoads = new HashSet(); >- > /** > * Maps an IConfigurationElement to its parsed Expression > */ >@@ -284,33 +269,13 @@ > private IContributionItem createControlAdditionContribution( > final IServiceLocator locator, > final IConfigurationElement widgetAddition) { >- 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); >+ if (inToolbar()) { >+ return new DynamicToolBarContributionItem(getId(widgetAddition), locator, widgetAddition); > } >- >- return loadedWidget; >+ >+ return null; >+ > } > > private IContributionItem createCommandAdditionContribution( >Index: Eclipse UI/org/eclipse/ui/menus/WorkbenchWindowControlContribution.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/menus/WorkbenchWindowControlContribution.java,v >retrieving revision 1.1 >diff -u -r1.1 WorkbenchWindowControlContribution.java >--- Eclipse UI/org/eclipse/ui/menus/WorkbenchWindowControlContribution.java 2 Feb 2007 20:35:55 -0000 1.1 >+++ Eclipse UI/org/eclipse/ui/menus/WorkbenchWindowControlContribution.java 23 Mar 2009 16:57:45 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >+ * Copyright (c) 2007 - 2009 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 >@@ -13,6 +13,8 @@ > > import org.eclipse.jface.action.ControlContribution; > import org.eclipse.swt.SWT; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.internal.menus.InternalControlContribution; > >@@ -82,4 +84,6 @@ > > return SWT.HORIZONTAL; > } >+ >+ public abstract Control createControl(Composite parent) ; > } >Index: Eclipse UI/org/eclipse/ui/internal/menus/DynamicToolBarContributionItem.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/menus/DynamicToolBarContributionItem.java >diff -N Eclipse UI/org/eclipse/ui/internal/menus/DynamicToolBarContributionItem.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/menus/DynamicToolBarContributionItem.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,183 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 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.IContributionItem; >+import org.eclipse.jface.action.IContributionManager; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.CoolBar; >+import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants; >+import org.eclipse.ui.internal.util.Util; >+import org.eclipse.ui.menus.IWorkbenchContribution; >+import org.eclipse.ui.menus.WorkbenchWindowControlContribution; >+import org.eclipse.ui.services.IServiceLocator; >+ >+/** >+ * A contribution item which proxies a dynamic tool contribution. >+ * <p> >+ * It currently supports placement in menus. >+ * </p> >+ * <p> >+ * >+ * @author Prakash G.R. >+ * >+ * @since 3.5 >+ * >+ */ >+public class DynamicToolBarContributionItem extends WorkbenchWindowControlContribution { >+ >+ private final IConfigurationElement dynamicAddition; >+ private final IServiceLocator locator; >+ private boolean alreadyFailed; >+ private WorkbenchWindowControlContribution loadedDynamicContribution; >+ >+ /** >+ * Creates a DynamicToolBarContributionItem >+ * >+ * @param id >+ * - Id of the menu item >+ * @param locator >+ * - The Service Locator >+ * @param dynamicAddition >+ * - The Configuration Element defined in the plugin.xml >+ * >+ */ >+ public DynamicToolBarContributionItem(String id, IServiceLocator locator, >+ IConfigurationElement dynamicAddition) { >+ super(id); >+ >+ this.locator = locator; >+ this.dynamicAddition = dynamicAddition; >+ } >+ >+ /* >+ * (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 >+ * .CoolBar, int) >+ */ >+ public void fill(CoolBar parent, int index) { >+ IContributionItem contributionItem = getContributionItem(); >+ if (contributionItem != null) >+ contributionItem.fill(parent, index); >+ } >+ >+ private WorkbenchWindowControlContribution getContributionItem() { >+ if (loadedDynamicContribution == null && !alreadyFailed) >+ createContributionItem(); >+ return loadedDynamicContribution; >+ } >+ >+ private void createContributionItem() { >+ >+ loadedDynamicContribution = (WorkbenchWindowControlContribution) Util >+ .safeLoadExecutableExtension(dynamicAddition, >+ IWorkbenchRegistryConstants.ATT_CLASS, >+ WorkbenchWindowControlContribution.class); >+ >+ 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); >+ } >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.jface.action.ControlContribution#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ public Control createControl(Composite parent) { >+ >+ WorkbenchWindowControlContribution contributionItem = getContributionItem(); >+ if (contributionItem != null) >+ return contributionItem.createControl(parent); >+ return null; >+ } >+ >+}
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