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 115395 Details for
Bug 249995
[Contexts] ContextAction's leak when hiding actions sets
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]
Context Activations v02
contexts-v02.txt (text/plain), 7.28 KB, created by
Paul Webster
on 2008-10-17 10:22:09 EDT
(
hide
)
Description:
Context Activations v02
Filename:
MIME Type:
Creator:
Paul Webster
Created:
2008-10-17 10:22:09 EDT
Size:
7.28 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.tests >Index: Eclipse UI Tests/org/eclipse/ui/tests/contexts/ContextsTestSuite.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/contexts/ContextsTestSuite.java,v >retrieving revision 1.9 >diff -u -r1.9 ContextsTestSuite.java >--- Eclipse UI Tests/org/eclipse/ui/tests/contexts/ContextsTestSuite.java 8 May 2006 20:51:34 -0000 1.9 >+++ Eclipse UI Tests/org/eclipse/ui/tests/contexts/ContextsTestSuite.java 17 Oct 2008 14:20:05 -0000 >@@ -39,5 +39,6 @@ > addTestSuite(Bug84763Test.class); > addTestSuite(ExtensionTestCase.class); > addTestSuite(PartContextTest.class); >+ addTestSuite(Bug249995Test.class); > } > } >Index: Eclipse UI Tests/org/eclipse/ui/tests/contexts/Bug249995Test.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/contexts/Bug249995Test.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/contexts/Bug249995Test.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/contexts/Bug249995Test.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,55 @@ >+/******************************************************************************* >+ * 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.tests.contexts; >+ >+import java.lang.reflect.Field; >+import java.util.Map; >+import java.util.Set; >+ >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.contexts.IContextService; >+import org.eclipse.ui.internal.contexts.SlaveContextService; >+import org.eclipse.ui.tests.harness.util.UITestCase; >+ >+/** >+ * @since 3.5 >+ * >+ */ >+public class Bug249995Test extends UITestCase { >+ public Bug249995Test(String test) { >+ super(test); >+ } >+ >+ public void testMultipleSlaveActivations() throws Exception { >+ IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow(); >+ IContextService cs = (IContextService) window >+ .getService(IContextService.class); >+ assertTrue(cs instanceof SlaveContextService); >+ Field localActivationsField = SlaveContextService.class >+ .getDeclaredField("fLocalActivations"); >+ localActivationsField.setAccessible(true); >+ Field parentActivationsField = SlaveContextService.class >+ .getDeclaredField("fParentActivations"); >+ parentActivationsField.setAccessible(true); >+ >+ Map local = (Map) localActivationsField.get(cs); >+ int localStart = local.size(); >+ Set parent = (Set) parentActivationsField.get(cs); >+ int parentStart = parent.size(); >+ for (int i = 0; i < 5; i++) { >+ window.getActivePage().hideActionSet( >+ "org.eclipse.ui.tests.contexts.Bug249995Test"); >+ assertEquals("on: " + i, localStart, local.size()); >+ assertEquals("on: " + i, parentStart, parent.size()); >+ } >+ } >+} >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java,v >retrieving revision 1.18 >diff -u -r1.18 ContextService.java >--- Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java 8 May 2006 20:55:32 -0000 1.18 >+++ Eclipse UI/org/eclipse/ui/internal/contexts/ContextService.java 17 Oct 2008 14:20:06 -0000 >@@ -49,6 +49,10 @@ > */ > private final ContextPersistence contextPersistence; > >+ private ContextActivation SEND_ACTIVATION; >+ >+ private ContextActivation DEFER_ACTIVATION; >+ > /** > * Constructs a new instance of <code>ContextService</code> using a > * context manager. >@@ -64,6 +68,8 @@ > this.contextManager = contextManager; > this.contextAuthority = new ContextAuthority(contextManager, this); > this.contextPersistence = new ContextPersistence(contextManager); >+ SEND_ACTIVATION = new ContextActivation(ContextAuthority.SEND_EVENTS, null, this); >+ DEFER_ACTIVATION = new ContextActivation(ContextAuthority.DEFER_EVENTS, null, this); > } > > /* >@@ -83,8 +89,14 @@ > */ > public final IContextActivation activateContext(final String contextId, > final Expression expression) { >- final IContextActivation activation = new ContextActivation(contextId, >- expression, this); >+ final IContextActivation activation; >+ if (ContextAuthority.SEND_EVENTS.equals(contextId)) { >+ activation = SEND_ACTIVATION; >+ } else if (ContextAuthority.DEFER_EVENTS.equals(contextId)) { >+ activation = DEFER_ACTIVATION; >+ } else { >+ activation = new ContextActivation(contextId, expression, this); >+ } > contextAuthority.activateContext(activation); > return activation; > } >Index: Eclipse UI/org/eclipse/ui/internal/contexts/SlaveContextService.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/contexts/SlaveContextService.java,v >retrieving revision 1.8 >diff -u -r1.8 SlaveContextService.java >--- Eclipse UI/org/eclipse/ui/internal/contexts/SlaveContextService.java 15 Aug 2006 17:00:38 -0000 1.8 >+++ Eclipse UI/org/eclipse/ui/internal/contexts/SlaveContextService.java 17 Oct 2008 14:20:06 -0000 >@@ -86,6 +86,10 @@ > */ > private Collection fRegisteredShells; > >+ private ContextActivation SEND_ACTIVATION; >+ >+ private ContextActivation DEFER_ACTIVATION; >+ > /** > * Construct the new slave. > * >@@ -109,6 +113,8 @@ > fContextManagerListeners = new ArrayList(); > fSourceProviders = new ArrayList(); > fRegisteredShells = new ArrayList(); >+ SEND_ACTIVATION = new ContextActivation(ContextAuthority.SEND_EVENTS, null, this); >+ DEFER_ACTIVATION = new ContextActivation(ContextAuthority.DEFER_EVENTS, null, this); > } > > /* >@@ -117,8 +123,15 @@ > * @see org.eclipse.ui.contexts.IContextService#activateContext(java.lang.String) > */ > public IContextActivation activateContext(String contextId) { >- ContextActivation activation = new ContextActivation(contextId, >- fDefaultExpression, this); >+ final ContextActivation activation; >+ if (ContextAuthority.SEND_EVENTS.equals(contextId)) { >+ activation = SEND_ACTIVATION; >+ } else if (ContextAuthority.DEFER_EVENTS.equals(contextId)) { >+ activation = DEFER_ACTIVATION; >+ } else { >+ activation = new ContextActivation(contextId, fDefaultExpression, >+ this); >+ } > return doActivateContext(activation); > } > >@@ -156,11 +169,17 @@ > andExpression.add(expression); > } > } >- if (fDefaultExpression!=null) { >+ if (fDefaultExpression != null) { > andExpression.add(fDefaultExpression); > } >- ContextActivation activation = new ContextActivation(contextId, >- andExpression, this); >+ final ContextActivation activation; >+ if (ContextAuthority.SEND_EVENTS.equals(contextId)) { >+ activation = SEND_ACTIVATION; >+ } else if (ContextAuthority.DEFER_EVENTS.equals(contextId)) { >+ activation = DEFER_ACTIVATION; >+ } else { >+ activation = new ContextActivation(contextId, andExpression, this); >+ } > return doActivateContext(activation); > } >
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 249995
:
114572
| 115395