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 172855 Details for
Bug 316303
[Compatibility] turn actionSets into MenuContributions
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]
actionSet visibleWhen v05
as-v05.txt (text/plain), 28.65 KB, created by
Paul Webster
on 2010-06-27 10:55:44 EDT
(
hide
)
Description:
actionSet visibleWhen v05
Filename:
MIME Type:
Creator:
Paul Webster
Created:
2010-06-27 10:55:44 EDT
Size:
28.65 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.e4.ui.workbench >Index: src/org/eclipse/e4/ui/internal/workbench/ContributionsAnalyzer.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ContributionsAnalyzer.java,v >retrieving revision 1.8 >diff -u -r1.8 ContributionsAnalyzer.java >--- src/org/eclipse/e4/ui/internal/workbench/ContributionsAnalyzer.java 25 Jun 2010 18:03:50 -0000 1.8 >+++ src/org/eclipse/e4/ui/internal/workbench/ContributionsAnalyzer.java 27 Jun 2010 14:53:48 -0000 >@@ -138,7 +138,7 @@ > } > } > >- private static boolean processAddition(final MMenu menuModel, >+ public static boolean processAddition(final MMenu menuModel, > final ArrayList<MMenuElement> menuContributionsToRemove, > MMenuContribution menuContribution, final HashSet<String> existingMenuIds, > HashSet<String> existingSeparatorNames) { >#P org.eclipse.e4.ui.workbench.renderers.swt >Index: src/org/eclipse/e4/ui/workbench/renderers/swt/MenuRenderer.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuRenderer.java,v >retrieving revision 1.3 >diff -u -r1.3 MenuRenderer.java >--- src/org/eclipse/e4/ui/workbench/renderers/swt/MenuRenderer.java 16 Jun 2010 01:03:55 -0000 1.3 >+++ src/org/eclipse/e4/ui/workbench/renderers/swt/MenuRenderer.java 27 Jun 2010 14:53:49 -0000 >@@ -10,17 +10,26 @@ > *******************************************************************************/ > package org.eclipse.e4.ui.workbench.renderers.swt; > >+import java.util.ArrayList; >+import java.util.HashMap; >+import java.util.HashSet; > import org.eclipse.e4.core.contexts.IEclipseContext; >+import org.eclipse.e4.core.contexts.RunAndTrack; >+import org.eclipse.e4.ui.internal.workbench.ContributionsAnalyzer; >+import org.eclipse.e4.ui.model.application.MApplication; > import org.eclipse.e4.ui.model.application.ui.MElementContainer; > import org.eclipse.e4.ui.model.application.ui.MUIElement; > import org.eclipse.e4.ui.model.application.ui.basic.MWindow; > import org.eclipse.e4.ui.model.application.ui.menu.MMenu; >+import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; > import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; > import org.eclipse.e4.ui.model.application.ui.menu.MMenuSeparator; > import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuFactoryImpl; >-import org.eclipse.e4.ui.workbench.swt.modeling.MenuServiceFilter; >+import org.eclipse.e4.ui.workbench.modeling.ExpressionContext; > import org.eclipse.emf.ecore.EObject; > import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.DisposeEvent; >+import org.eclipse.swt.events.DisposeListener; > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Decorations; > import org.eclipse.swt.widgets.Menu; >@@ -31,20 +40,33 @@ > * Create a contribute part. > */ > public class MenuRenderer extends SWTPartRenderer { >+ private MApplication application; >+ private HashMap<MMenu, ArrayList<ArrayList<MMenuElement>>> pendingCleanup = new HashMap<MMenu, ArrayList<ArrayList<MMenuElement>>>(); >+ >+ @Override >+ public void init(IEclipseContext context) { >+ super.init(context); >+ application = context.get(MApplication.class); >+ } > > public Object createWidget(final MUIElement element, Object parent) { > if (!(element instanceof MMenu)) > return null; > >- MMenu menuModel = (MMenu) element; >+ final MMenu menuModel = (MMenu) element; > > Menu newMenu = null; > if (parent instanceof Decorations) { > MUIElement container = (MUIElement) ((EObject) element) > .eContainer(); >- if (container instanceof MWindow) >+ if (container instanceof MWindow) { > newMenu = new Menu((Decorations) parent, SWT.BAR); >- else { >+ newMenu.addDisposeListener(new DisposeListener() { >+ public void widgetDisposed(DisposeEvent e) { >+ cleanUp(menuModel); >+ } >+ }); >+ } else { > newMenu = new Menu((Decorations) parent, SWT.POP_UP); > } > } else if (parent instanceof Menu) { >@@ -71,27 +93,95 @@ > */ > @Override > public void processContents(MElementContainer<MUIElement> container) { >- Object obj = container.getWidget(); >- Object menuModel = container; >- if ((obj instanceof Menu) && (((Menu) obj).getStyle() & SWT.BAR) != 0 >- && (menuModel instanceof MMenu)) { >- if (container.getChildren().isEmpty()) { >- return; >- } >- // this is a crazy fill and run >- IEclipseContext ctx = getContext(container); >- MenuServiceFilter filter = ctx.get(MenuServiceFilter.class); >- filter.showMenu(null, (Menu) obj, (MMenu) menuModel); >- return; >- } > if (container.getChildren().size() == 0) { > MMenuSeparator sep = MenuFactoryImpl.eINSTANCE > .createMenuSeparator(); >- sep.setElementId("placeholder"); //$NON-NLS-1$ >+ sep.setElementId("menu.placeholder"); //$NON-NLS-1$ > container.getChildren().add(sep); > } > > super.processContents(container); >+ >+ Object obj = container.getWidget(); >+ Object menuObj = container; >+ if ((obj instanceof Menu) && (((Menu) obj).getStyle() & SWT.BAR) != 0 >+ && (menuObj instanceof MMenu)) { >+ MMenu menuModel = (MMenu) menuObj; >+ IEclipseContext ctx = getContext(container); >+ ExpressionContext eContext = new ExpressionContext(ctx); >+ ArrayList<MMenuContribution> toContribute = new ArrayList<MMenuContribution>(); >+ ContributionsAnalyzer.gatherMenuContributions(menuModel, >+ application.getMenuContributions(), >+ menuModel.getElementId(), toContribute, eContext, false); >+ addMenuBarContributions(menuModel, toContribute, ctx, eContext); >+ } >+ } >+ >+ // this is similar in nature to: >+ // org.eclipse.e4.ui.internal.workbench.ContributionsAnalyzer.addMenuContributions(MMenu, >+ // ArrayList<MMenuContribution>, ArrayList<MMenuElement>) >+ // the difference is it needs to add all the contributions and manage their >+ // visiblility through a RAT >+ private void addMenuBarContributions(final MMenu menuModel, >+ ArrayList<MMenuContribution> toContribute, >+ final IEclipseContext ctx, final ExpressionContext eContext) { >+ HashSet<String> existingMenuIds = new HashSet<String>(); >+ HashSet<String> existingSeparatorNames = new HashSet<String>(); >+ for (MMenuElement child : menuModel.getChildren()) { >+ String elementId = child.getElementId(); >+ if (child instanceof MMenu && elementId != null) { >+ existingMenuIds.add(elementId); >+ } else if (child instanceof MMenuSeparator && elementId != null) { >+ existingSeparatorNames.add(elementId); >+ } >+ } >+ >+ boolean done = toContribute.size() == 0; >+ while (!done) { >+ ArrayList<MMenuContribution> curList = new ArrayList<MMenuContribution>( >+ toContribute); >+ int retryCount = toContribute.size(); >+ toContribute.clear(); >+ >+ for (final MMenuContribution menuContribution : curList) { >+ final ArrayList<MMenuElement> menuContributionsToRemove = new ArrayList<MMenuElement>(); >+ if (!ContributionsAnalyzer.processAddition(menuModel, >+ menuContributionsToRemove, menuContribution, >+ existingMenuIds, existingSeparatorNames)) { >+ toContribute.add(menuContribution); >+ } else { >+ if (menuContribution.getVisibleWhen() != null) { >+ ctx.runAndTrack(new RunAndTrack() { >+ @Override >+ public boolean changed(IEclipseContext context) { >+ if (!menuModel.isToBeRendered() >+ || !menuModel.isVisible() >+ || menuModel.getWidget() == null) { >+ return false; >+ } >+ boolean rc = ContributionsAnalyzer.isVisible( >+ menuContribution, eContext); >+ for (MMenuElement element : menuContributionsToRemove) { >+ element.setToBeRendered(rc); >+ } >+ return true; >+ } >+ }); >+ } >+ ArrayList<ArrayList<MMenuElement>> lists = pendingCleanup >+ .get(menuModel); >+ if (lists == null) { >+ lists = new ArrayList<ArrayList<MMenuElement>>(); >+ pendingCleanup.put(menuModel, lists); >+ } >+ lists.add(menuContributionsToRemove); >+ } >+ } >+ // We're done if the retryList is now empty (everything done) or >+ // if the list hasn't changed at all (no hope) >+ done = (toContribute.size() == 0) >+ || (toContribute.size() == retryCount); >+ } > } > > private void setItemText(MMenu model, MenuItem item) { >@@ -145,4 +235,16 @@ > return super.getUIContainer(element); > } > >+ void cleanUp(MMenu menuModel) { >+ ArrayList<ArrayList<MMenuElement>> lists = pendingCleanup >+ .remove(menuModel); >+ if (lists == null) { >+ return; >+ } >+ for (ArrayList<MMenuElement> list : lists) { >+ for (MMenuElement item : list) { >+ menuModel.getChildren().remove(item); >+ } >+ } >+ } > } >#P org.eclipse.platform >Index: LegacyIDE.e4xmi >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.platform/Attic/LegacyIDE.e4xmi,v >retrieving revision 1.1.2.18 >diff -u -r1.1.2.18 LegacyIDE.e4xmi >--- LegacyIDE.e4xmi 11 Jun 2010 13:08:00 -0000 1.1.2.18 >+++ LegacyIDE.e4xmi 27 Jun 2010 14:53:49 -0000 >@@ -1,8 +1,6 @@ > <?xml version="1.0" encoding="ASCII"?> > <application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xsi:schemaLocation="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic http://www.eclipse.org/ui/2010/UIModel/application#//ui/basic http://www.eclipse.org/ui/2010/UIModel/application/ui/menu http://www.eclipse.org/ui/2010/UIModel/application#//ui/menu" xmi:id="org.eclipse.e4.legacy.ide.application" elementId="org.eclipse.e4.legacy.ide.application"> > <children xsi:type="basic:TrimmedWindow" xmi:id="IDEWindow" elementId="IDEWindow" label="Eclipse SDK 4.0" width="1024" height="768"> >- <mainMenu xmi:id="_UW9TUPr3Ed6gmo7caOxU9g" elementId="org.eclipse.ui.main.menu"> >- </mainMenu> > <trimBars xmi:id="org.eclipse.ui.main.toolbar" elementId="org.eclipse.ui.main.toolbar"> > </trimBars> > </children> >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/PerspectiveExtensionReader.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/PerspectiveExtensionReader.java >diff -N Eclipse UI/org/eclipse/ui/internal/PerspectiveExtensionReader.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/PerspectiveExtensionReader.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,357 @@ >+package org.eclipse.ui.internal; >+ >+import java.util.HashSet; >+import java.util.Set; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker; >+import org.eclipse.ui.IPageLayout; >+import org.eclipse.ui.IViewLayout; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout; >+import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants; >+import org.eclipse.ui.internal.registry.RegistryReader; >+ >+/** >+ * A strategy to read perspective extension from the registry. >+ * A pespective extension is one of a view, viewAction, perspAction, >+ * newWizardAction, or actionSet. >+ */ >+public class PerspectiveExtensionReader extends RegistryReader { >+ private String targetID; >+ >+ private ModeledPageLayout pageLayout; >+ >+ private Set includeOnlyTags = null; >+ >+ private static final String VAL_LEFT = "left";//$NON-NLS-1$ >+ >+ private static final String VAL_RIGHT = "right";//$NON-NLS-1$ >+ >+ private static final String VAL_TOP = "top";//$NON-NLS-1$ >+ >+ private static final String VAL_BOTTOM = "bottom";//$NON-NLS-1$ >+ >+ private static final String VAL_STACK = "stack";//$NON-NLS-1$ >+ >+ private static final String VAL_FAST = "fast";//$NON-NLS-1$ >+ >+ private static final String VAL_TRUE = "true";//$NON-NLS-1$ >+ >+ // VAL_FALSE added by dan_rubel@instantiations.com >+ // TODO: this logic is backwards... we should be checking for true, but >+ // technically this is API now... >+ private static final String VAL_FALSE = "false";//$NON-NLS-1$ >+ >+ private IExtensionTracker tracker; >+ >+ /** >+ * PerspectiveExtensionReader constructor.. >+ */ >+ public PerspectiveExtensionReader() { >+ // do nothing >+ } >+ >+ /** >+ * Read the view extensions within a registry. >+ * >+ * @param extensionTracker the tracker >+ * @param id the id >+ * @param out the layout >+ */ >+ public void extendLayout(IExtensionTracker extensionTracker, String id, ModeledPageLayout out) { >+ tracker = extensionTracker; >+ targetID = id; >+ pageLayout = out; >+ readRegistry(Platform.getExtensionRegistry(), PlatformUI.PLUGIN_ID, >+ IWorkbenchRegistryConstants.PL_PERSPECTIVE_EXTENSIONS); >+ } >+ >+ /** >+ * Returns whether the given tag should be included. >+ */ >+ private boolean includeTag(String tag) { >+ return includeOnlyTags == null || includeOnlyTags.contains(tag); >+ } >+ >+ /** >+ * Process an action set. >+ */ >+ private boolean processActionSet(IConfigurationElement element) { >+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID); >+ if (id != null) { >+ pageLayout.addActionSet(id); >+ } >+ return true; >+ } >+ >+ /** >+ * Process an extension. >+ * Assumption: Extension is for current perspective. >+ */ >+ private boolean processExtension(IConfigurationElement element) { >+ IConfigurationElement[] children = element.getChildren(); >+ for (int nX = 0; nX < children.length; nX++) { >+ IConfigurationElement child = children[nX]; >+ String type = child.getName(); >+ if (includeTag(type)) { >+ boolean result = false; >+ if (type.equals(IWorkbenchRegistryConstants.TAG_ACTION_SET)) { >+ result = processActionSet(child); >+ } else if (type.equals(IWorkbenchRegistryConstants.TAG_VIEW)) { >+ result = processView(child); >+ } else if (type.equals(IWorkbenchRegistryConstants.TAG_VIEW_SHORTCUT)) { >+ result = processViewShortcut(child); >+ } else if (type.equals(IWorkbenchRegistryConstants.TAG_NEW_WIZARD_SHORTCUT)) { >+ result = processWizardShortcut(child); >+ } else if (type.equals(IWorkbenchRegistryConstants.TAG_PERSP_SHORTCUT)) { >+ result = processPerspectiveShortcut(child); >+ } else if (type.equals(IWorkbenchRegistryConstants.TAG_SHOW_IN_PART)) { >+ result = processShowInPart(child); >+ } else if (type.equals(IWorkbenchRegistryConstants.TAG_HIDDEN_MENU_ITEM)) { >+ result = processHiddenMenuItem(child); >+ } else if (type.equals(IWorkbenchRegistryConstants.TAG_HIDDEN_TOOLBAR_ITEM)) { >+ result = processHiddenToolBarItem(child); >+ } >+ if (!result) { >+ WorkbenchPlugin.log("Unable to process element: " + //$NON-NLS-1$ >+ type >+ + " in perspective extension: " + //$NON-NLS-1$ >+ element.getDeclaringExtension() >+ .getUniqueIdentifier()); >+ } >+ } >+ } >+ return true; >+ } >+ >+ /** >+ * Process a perspective shortcut >+ */ >+ private boolean processPerspectiveShortcut(IConfigurationElement element) { >+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID); >+ if (id != null) { >+ pageLayout.addPerspectiveShortcut(id); >+ } >+ return true; >+ } >+ >+ /** >+ * Process a show in element. >+ */ >+ private boolean processShowInPart(IConfigurationElement element) { >+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID); >+ if (id != null) { >+ pageLayout.addShowInPart(id); >+ } >+ return true; >+ } >+ >+ /** >+ * Process a hidden menu item >+ */ >+ private boolean processHiddenMenuItem(IConfigurationElement element) { >+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID); >+ if (id != null) { >+ pageLayout.addHiddenMenuItemId(id); >+ } >+ return true; >+ } >+ >+ /** >+ * Process a hidden toolbar item >+ */ >+ private boolean processHiddenToolBarItem(IConfigurationElement element) { >+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID); >+ if (id != null) { >+ pageLayout.addHiddenToolBarItemId(id); >+ } >+ return true; >+ } >+ >+ // processView(IConfigurationElement) modified by dan_rubel@instantiations.com >+ /** >+ * Process a view >+ */ >+ private boolean processView(IConfigurationElement element) { >+ // Get id, relative, and relationship. >+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID); >+ String relative = element.getAttribute(IWorkbenchRegistryConstants.ATT_RELATIVE); >+ String relationship = element.getAttribute(IWorkbenchRegistryConstants.ATT_RELATIONSHIP); >+ String ratioString = element.getAttribute(IWorkbenchRegistryConstants.ATT_RATIO); >+ boolean visible = !VAL_FALSE.equals(element.getAttribute(IWorkbenchRegistryConstants.ATT_VISIBLE)); >+ String closeable = element.getAttribute(IWorkbenchRegistryConstants.ATT_CLOSEABLE); >+ String moveable = element.getAttribute(IWorkbenchRegistryConstants.ATT_MOVEABLE); >+ String standalone = element.getAttribute(IWorkbenchRegistryConstants.ATT_STANDALONE); >+ String showTitle = element.getAttribute(IWorkbenchRegistryConstants.ATT_SHOW_TITLE); >+ >+ // Default to 'false' >+ String minVal = element.getAttribute(IWorkbenchRegistryConstants.ATT_MINIMIZED); >+ boolean minimized = minVal != null && VAL_TRUE.equals(minVal); >+ >+ float ratio; >+ >+ if (id == null) { >+ logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_ID); >+ return false; >+ } >+ if (relationship == null) { >+ logMissingAttribute(element, IWorkbenchRegistryConstants.ATT_RELATIONSHIP); >+ return false; >+ } >+ if (!VAL_FAST.equals(relationship) && relative == null) { >+ logError( >+ element, >+ "Attribute '" + IWorkbenchRegistryConstants.ATT_RELATIVE + "' not defined. This attribute is required when " + IWorkbenchRegistryConstants.ATT_RELATIONSHIP + "=\"" + relationship + "\"."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ >+ return false; >+ } >+ >+ // Get the ratio. >+ if (ratioString == null) { >+ // The ratio has not been specified. >+ ratio = IPageLayout.NULL_RATIO; >+ } else { >+ try { >+ ratio = new Float(ratioString).floatValue(); >+ } catch (NumberFormatException e) { >+ return false; >+ } >+ // If the ratio is outside the allowable range, mark it as invalid. >+ if (ratio < IPageLayout.RATIO_MIN || ratio > IPageLayout.RATIO_MAX) { >+ ratio = IPageLayout.INVALID_RATIO; >+ } >+ } >+ >+ // Get relationship details. >+ boolean stack = false; >+ boolean fast = false; >+ int intRelation = 0; >+ if (relationship.equals(VAL_LEFT)) { >+ intRelation = IPageLayout.LEFT; >+ } else if (relationship.equals(VAL_RIGHT)) { >+ intRelation = IPageLayout.RIGHT; >+ } else if (relationship.equals(VAL_TOP)) { >+ intRelation = IPageLayout.TOP; >+ } else if (relationship.equals(VAL_BOTTOM)) { >+ intRelation = IPageLayout.BOTTOM; >+ } else if (relationship.equals(VAL_STACK)) { >+ stack = true; >+ } else if (relationship.equals(VAL_FAST)) { >+ fast = true; >+ } else { >+ return false; >+ } >+ >+ if (visible) { >+ // If adding a view (not just a placeholder), remove any existing placeholder. >+ // See bug 85948 [Perspectives] Adding register & expressions view by default to debug perspective fails >+ pageLayout.removePlaceholder(id); >+ } >+ >+ // If stack .. >+ if (stack) { >+ if (visible) { >+ pageLayout.stackView(id, relative, true); >+ } else { >+ pageLayout.stackView(id, relative, false); >+ } >+ } >+ >+ // If the view is a fast view... >+ else if (fast) { >+ if (ratio == IPageLayout.NULL_RATIO) { >+ // The ratio has not been specified. >+ pageLayout.addFastView(id); >+ } else { >+ pageLayout.addFastView(id, ratio); >+ } >+ } else { >+ >+ // The view is a regular view. >+ // If the ratio is not specified or is invalid, use the default ratio. >+ if (ratio == IPageLayout.NULL_RATIO >+ || ratio == IPageLayout.INVALID_RATIO) { >+ ratio = IPageLayout.DEFAULT_VIEW_RATIO; >+ } >+ >+ if (visible) { >+ if (VAL_TRUE.equals(standalone)) { >+ pageLayout.addStandaloneView(id, !VAL_FALSE >+ .equals(showTitle), intRelation, ratio, relative); >+ } else { >+ pageLayout.addView(id, intRelation, ratio, relative, minimized); >+ } >+ } else { >+ // Fix for 99155, CGross (schtoo@schtoo.com) >+ // Adding standalone placeholder for standalone views >+ if (VAL_TRUE.equals(standalone)) { >+ pageLayout.addStandaloneViewPlaceholder(id, intRelation, >+ ratio, relative, !VAL_FALSE.equals(showTitle)); >+ } else { >+ pageLayout.addPlaceholder(id, intRelation, ratio, relative); >+ } >+ } >+ } >+ IViewLayout viewLayout = pageLayout.getViewLayout(id); >+ // may be null if it's been filtered by activity >+ if (viewLayout != null) { >+ if (closeable != null) { >+ viewLayout.setCloseable(!VAL_FALSE.equals(closeable)); >+ } >+ if (moveable != null) { >+ viewLayout.setMoveable(!VAL_FALSE.equals(moveable)); >+ } >+ } >+ >+ return true; >+ } >+ >+ /** >+ * Process a view shortcut >+ */ >+ private boolean processViewShortcut(IConfigurationElement element) { >+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID); >+ if (id != null) { >+ pageLayout.addShowViewShortcut(id); >+ } >+ return true; >+ } >+ >+ /** >+ * Process a wizard shortcut >+ */ >+ private boolean processWizardShortcut(IConfigurationElement element) { >+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID); >+ if (id != null) { >+ pageLayout.addNewWizardShortcut(id); >+ } >+ return true; >+ } >+ >+ protected boolean readElement(IConfigurationElement element) { >+ String type = element.getName(); >+ if (type.equals(IWorkbenchRegistryConstants.TAG_PERSPECTIVE_EXTENSION)) { >+ String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_TARGET_ID); >+ if (targetID.equals(id) || "*".equals(id)) { //$NON-NLS-1$ >+ if (tracker != null) { >+ tracker.registerObject(element.getDeclaringExtension(), new DirtyPerspectiveMarker(id), IExtensionTracker.REF_STRONG); >+ } >+ return processExtension(element); >+ } >+ return true; >+ } >+ return false; >+ } >+ >+ /** >+ * Sets the tags to include. All others are ignored. >+ * >+ * @param tags the tags to include >+ */ >+ public void setIncludeOnlyTags(String[] tags) { >+ includeOnlyTags = new HashSet(); >+ for (int i = 0; i < tags.length; i++) { >+ includeOnlyTags.add(tags[i]); >+ } >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.compatibility/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java,v >retrieving revision 1.58 >diff -u -r1.58 WorkbenchPage.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java 25 Jun 2010 11:43:56 -0000 1.58 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java 27 Jun 2010 14:53:49 -0000 >@@ -2220,6 +2220,8 @@ > perspective, this, true); > factory.createInitialLayout(modelLayout); > PerspectiveTagger.tagPerspective(modelPerspective, modelService); >+ PerspectiveExtensionReader reader = new PerspectiveExtensionReader(); >+ reader.extendLayout(getExtensionTracker(), perspective.getId(), modelLayout); > > if (lastPerspective != null) { > legacyWindow.firePerspectiveDeactivated(this, lastPerspective); >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.compatibility/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java,v >retrieving revision 1.37 >diff -u -r1.37 WorkbenchWindow.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java 25 Jun 2010 20:45:01 -0000 1.37 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java 27 Jun 2010 14:53:49 -0000 >@@ -75,7 +75,6 @@ > import org.eclipse.e4.ui.workbench.modeling.ISaveHandler; > import org.eclipse.e4.ui.workbench.modeling.IWindowCloseHandler; > import org.eclipse.e4.ui.workbench.renderers.swt.TrimmedPartLayout; >-import org.eclipse.e4.ui.workbench.swt.modeling.MenuServiceFilter; > import org.eclipse.jface.action.AbstractGroupMarker; > import org.eclipse.jface.action.ActionContributionItem; > import org.eclipse.jface.action.ContributionManager; >@@ -480,21 +479,12 @@ > mainMenu = MenuFactoryImpl.eINSTANCE.createMenu(); > mainMenu.setElementId("org.eclipse.ui.main.menu"); //$NON-NLS-1$ > >- model.setMainMenu(mainMenu); >- } >- >- if (mainMenu.getChildren().isEmpty()) { > fill(mainMenu, menuManager); >+ model.setMainMenu(mainMenu); >+ Menu menu = (Menu) engine.createGui(mainMenu, model.getWidget()); >+ shell.setMenuBar(menu); > } > >- Menu menu = (Menu) engine.createGui(mainMenu, model.getWidget()); >- shell.setMenuBar(menu); >- >- // this is a crazy fill and run >- IEclipseContext ctx = model.getContext(); >- MenuServiceFilter filter = ctx.get(MenuServiceFilter.class); >- filter.showMenu(null, menu, mainMenu); >- > createProgressIndicator(shell); > createHeapStatus(shell); > } >Index: Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.compatibility/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java,v >retrieving revision 1.22 >diff -u -r1.22 ModeledPageLayout.java >--- Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java 24 Jun 2010 19:55:44 -0000 1.22 >+++ Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java 27 Jun 2010 14:53:49 -0000 >@@ -136,9 +136,11 @@ > } > > public void addFastView(String viewId) { >+ E4Util.unsupported("addFastView: " + viewId); //$NON-NLS-1$ > } > > public void addFastView(String viewId, float ratio) { >+ E4Util.unsupported("addFastView: " + viewId); //$NON-NLS-1$ > } > > public void addNewWizardShortcut(String id) { >@@ -179,6 +181,14 @@ > insertView(viewId, relationship, ratio, refId, true, true); > } > >+ public void addView(String viewId, int relationship, float ratio, String refId, >+ boolean minimized) { >+ if (minimized) { >+ E4Util.unsupported("addView: use of minimized for " + viewId + " ref " + refId); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ insertView(viewId, relationship, ratio, refId, true, true); >+ } >+ > public IFolderLayout createFolder(String folderId, int relationship, > float ratio, String refId) { > MPartStack stack = insertStack(folderId, relationship, ratio, refId, >@@ -488,4 +498,38 @@ > MUIElement element = modelService.find(id, toSearch); > return element instanceof MPart ? (MPart) element : null; > } >+ >+ public void addHiddenMenuItemId(String id) { >+ E4Util.unsupported("addHiddenMenuItemId: " + id); //$NON-NLS-1$ >+ } >+ >+ public void addHiddenToolBarItemId(String id) { >+ E4Util.unsupported("addHiddenToolBarItemId: " + id); //$NON-NLS-1$ >+ } >+ >+ public void removePlaceholder(String id) { >+ MUIElement refModel = findElement(perspModel, id); >+ if (!(refModel instanceof MPlaceholder)) { >+ E4Util.unsupported("removePlaceholder: failed to find " + id + ": " + refModel); //$NON-NLS-1$ //$NON-NLS-2$ >+ return; >+ } >+ MElementContainer<MUIElement> parent = refModel.getParent(); >+ if (parent != null) { >+ parent.getChildren().remove(refModel); >+ } >+ } >+ >+ public void stackView(String id, String refId, boolean visible) { >+ MUIElement refModel = findElement(perspModel, refId); >+ if (refModel instanceof MPart || refModel instanceof MPlaceholder) { >+ refModel = refModel.getParent(); >+ } >+ if (!(refModel instanceof MPartStack)) { >+ E4Util.unsupported("stackView: failed to find " + refId + " for " + id); //$NON-NLS-1$//$NON-NLS-2$ >+ return; >+ } >+ MStackElement viewModel = createViewModel(application, id, visible, page, partService, >+ createReferences); >+ ((MPartStack) refModel).getChildren().add(viewModel); >+ } > }
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 316303
:
171886
|
172005
|
172179
|
172665
|
172806
| 172855