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 41713 Details for
Bug 137091
[KeyBindings] Toggle Mark Occurrences shortcut is broken
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]
editor action bar patch v05 - no API
bug137091-ui.workbench-v05.txt (text/plain), 10.21 KB, created by
Paul Webster
on 2006-05-17 08:04:09 EDT
(
hide
)
Description:
editor action bar patch v05 - no API
Filename:
MIME Type:
Creator:
Paul Webster
Created:
2006-05-17 08:04:09 EDT
Size:
10.21 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/EditorReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java,v >retrieving revision 1.14 >diff -u -r1.14 EditorReference.java >--- Eclipse UI/org/eclipse/ui/internal/EditorReference.java 4 Apr 2006 18:12:56 -0000 1.14 >+++ Eclipse UI/org/eclipse/ui/internal/EditorReference.java 17 May 2006 12:05:18 -0000 >@@ -405,7 +405,7 @@ > > EditorSite site = new EditorSite(this, part, manager.page, descr); > >- site.setActionBars(new EditorActionBars(manager.page, site, getId())); >+ site.setActionBars(new EditorActionBars(manager.page, site.getWorkbenchWindow(), getId())); > try { > part.init(site, input); > } catch (PartInitException e) { >Index: Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java,v >retrieving revision 1.30 >diff -u -r1.30 EditorActionBars.java >--- Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java 24 Feb 2006 18:36:11 -0000 1.30 >+++ Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java 17 May 2006 12:05:18 -0000 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.ui.internal; > >+import org.eclipse.core.expressions.Expression; > import org.eclipse.jface.action.ActionContributionItem; > import org.eclipse.jface.action.ContributionManager; > import org.eclipse.jface.action.GroupMarker; >@@ -31,6 +32,7 @@ > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.SubActionBars2; > import org.eclipse.ui.actions.RetargetAction; >+import org.eclipse.ui.internal.expressions.LegacyEditorActionBarExpression; > import org.eclipse.ui.internal.misc.Policy; > import org.eclipse.ui.internal.provisional.presentations.IActionBarPresentationFactory; > import org.eclipse.ui.services.IServiceLocator; >@@ -89,6 +91,7 @@ > > private IActionBarPresentationFactory actionBarPresentation; > >+ > /** > * Constructs the EditorActionBars for an editor. > */ >@@ -197,6 +200,7 @@ > coolItemToolBarMgr.removeAll(); > } > coolItemToolBarMgr = null; >+ editorHandlerExpression = null; > } > > /** >@@ -327,7 +331,6 @@ > super.partChanged(part); > if (part instanceof IEditorPart) { > IEditorPart editor = (IEditorPart) part; >- setServiceLocator(editor.getEditorSite()); > if (editorContributor != null) { > editorContributor.setActiveEditor(editor); > } >@@ -470,4 +473,17 @@ > } > } > } >+ >+ private LegacyEditorActionBarExpression editorHandlerExpression = null; >+ >+ /** >+ * Returns the expression used for action handler activation. >+ * @return the expression used for action handler activation. >+ */ >+ public Expression getHandlerExpression() { >+ if (editorHandlerExpression == null) { >+ editorHandlerExpression = new LegacyEditorActionBarExpression(type); >+ } >+ return editorHandlerExpression; >+ } > } >Index: Eclipse UI/org/eclipse/ui/internal/EditorManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorManager.java,v >retrieving revision 1.109 >diff -u -r1.109 EditorManager.java >--- Eclipse UI/org/eclipse/ui/internal/EditorManager.java 30 Mar 2006 01:36:58 -0000 1.109 >+++ Eclipse UI/org/eclipse/ui/internal/EditorManager.java 17 May 2006 12:05:18 -0000 >@@ -301,7 +301,7 @@ > } > > // Create a new action bar set. >- actionBars = new EditorActionBars(page, site, type); >+ actionBars = new EditorActionBars(page, site.getWorkbenchWindow(), type); > actionBars.addRef(); > actionCache.put(type, actionBars); > >@@ -333,7 +333,7 @@ > > // Create a new action bar set. > // Note: It is an empty set. >- EditorActionBars actionBars = new EditorActionBars(page, site, type); >+ EditorActionBars actionBars = new EditorActionBars(page, site.getWorkbenchWindow(), type); > actionBars.addRef(); > actionCache.put(type, actionBars); > >Index: Eclipse UI/org/eclipse/ui/internal/PartSite.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java,v >retrieving revision 1.86 >diff -u -r1.86 PartSite.java >--- Eclipse UI/org/eclipse/ui/internal/PartSite.java 8 May 2006 20:55:36 -0000 1.86 >+++ Eclipse UI/org/eclipse/ui/internal/PartSite.java 17 May 2006 12:05:18 -0000 >@@ -536,6 +536,8 @@ > buffer.append(getPluginId()); > buffer.append(",registeredName="); //$NON-NLS-1$ > buffer.append(getRegisteredName()); >+ buffer.append(",hashCode="); //$NON-NLS-1$ >+ buffer.append(hashCode()); > buffer.append(')'); > return buffer.toString(); > } >Index: Eclipse UI/org/eclipse/ui/SubActionBars.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/SubActionBars.java,v >retrieving revision 1.26 >diff -u -r1.26 SubActionBars.java >--- Eclipse UI/org/eclipse/ui/SubActionBars.java 8 May 2006 20:55:31 -0000 1.26 >+++ Eclipse UI/org/eclipse/ui/SubActionBars.java 17 May 2006 12:05:18 -0000 >@@ -33,6 +33,7 @@ > import org.eclipse.jface.util.PropertyChangeEvent; > import org.eclipse.ui.handlers.IHandlerActivation; > import org.eclipse.ui.handlers.IHandlerService; >+import org.eclipse.ui.internal.EditorActionBars; > import org.eclipse.ui.internal.WorkbenchPlugin; > import org.eclipse.ui.internal.handlers.IActionCommandMappingService; > import org.eclipse.ui.internal.services.SourcePriorityNameMapping; >@@ -504,9 +505,14 @@ > // the expression gives the setGlobalActionHandler() a > // priority. > final IHandler actionHandler = new ActionHandler(handler); >+ Expression handlerExpression = EXPRESSION; >+ //XXX add new API in next release to avoid down-casting (bug 137091) >+ if (this instanceof EditorActionBars) { >+ handlerExpression = ((EditorActionBars)this).getHandlerExpression(); >+ } > final IHandlerActivation activation = service > .activateHandler(commandId, actionHandler, >- EXPRESSION); >+ handlerExpression); > activationsByActionId.put(actionID, activation); > } > } >Index: Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorActionBarExpression.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorActionBarExpression.java >diff -N Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorActionBarExpression.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/expressions/LegacyEditorActionBarExpression.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,103 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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.expressions; >+ >+import org.eclipse.core.expressions.EvaluationResult; >+import org.eclipse.core.expressions.Expression; >+import org.eclipse.core.expressions.ExpressionInfo; >+import org.eclipse.core.expressions.IEvaluationContext; >+import org.eclipse.ui.ISources; >+import org.eclipse.ui.internal.services.SourcePriorityNameMapping; >+ >+/** >+ * <p> >+ * An expression representing the <code>part id</code> of the legacy editor >+ * action bar contribution. >+ * </p> >+ * <p> >+ * This class is not intended for use outside of the >+ * <code>org.eclipse.ui.workbench</code> plug-in. >+ * </p> >+ * >+ * @since 3.2 >+ */ >+public class LegacyEditorActionBarExpression extends Expression { >+ /** >+ * The seed for the hash code for all schemes. >+ */ >+ private static final int HASH_INITIAL = LegacyEditorActionBarExpression.class >+ .getName().hashCode(); >+ >+ /** >+ * The identifier for the editor that must be active for this expression to >+ * evaluate to <code>true</code>. This value is never <code>null</code>. >+ */ >+ private final String activeEditorId; >+ >+ /** >+ * Constructs a new instance of <code>LegacyEditorActionBarExpression</code> >+ * >+ * @param editorId >+ * The identifier of the editor to match with the active editor; >+ * must not be <code>null</code> >+ */ >+ public LegacyEditorActionBarExpression(final String editorId) { >+ >+ if (editorId == null) { >+ throw new IllegalArgumentException( >+ "The targetId for an editor contribution must not be null"); //$NON-NLS-1$ >+ } >+ activeEditorId = editorId; >+ } >+ >+ public final void collectExpressionInfo(final ExpressionInfo info) { >+ info.addVariableNameAccess(ISources.ACTIVE_EDITOR_ID_NAME); >+ info >+ .addVariableNameAccess(SourcePriorityNameMapping.LEGACY_LEGACY_NAME); >+ } >+ >+ protected final int computeHashCode() { >+ int hashCode = HASH_INITIAL * HASH_FACTOR + hashCode(activeEditorId); >+ return hashCode; >+ } >+ >+ public final boolean equals(final Object object) { >+ if (object instanceof LegacyEditorActionBarExpression) { >+ final LegacyEditorActionBarExpression that = (LegacyEditorActionBarExpression) object; >+ return activeEditorId.equals(that.activeEditorId); >+ } >+ >+ return false; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.core.expressions.Expression#evaluate(org.eclipse.core.expressions.IEvaluationContext) >+ */ >+ public final EvaluationResult evaluate(final IEvaluationContext context) { >+ final Object variable = context >+ .getVariable(ISources.ACTIVE_EDITOR_ID_NAME); >+ if (equals(activeEditorId, variable)) { >+ return EvaluationResult.TRUE; >+ } >+ return EvaluationResult.FALSE; >+ } >+ >+ public final String toString() { >+ final StringBuffer buffer = new StringBuffer(); >+ buffer.append("LegacyEditorActionBarExpression("); //$NON-NLS-1$ >+ buffer.append(activeEditorId); >+ buffer.append(')'); >+ return buffer.toString(); >+ } >+}
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 137091
:
41170
|
41357
|
41492
|
41588
|
41637
| 41713 |
42049