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 80813 Details for
Bug 204495
[api] support populating mylyn context programatically using public API
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
clipboard.txt (text/plain), 7.39 KB, created by
Shawn Minto
on 2007-10-19 19:58:28 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Shawn Minto
Created:
2007-10-19 19:58:28 EDT
Size:
7.39 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.java.tests >Index: src/org/eclipse/mylyn/java/tests/ContextManagerTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.java.tests/src/org/eclipse/mylyn/java/tests/ContextManagerTest.java,v >retrieving revision 1.77 >diff -u -r1.77 ContextManagerTest.java >--- src/org/eclipse/mylyn/java/tests/ContextManagerTest.java 18 Oct 2007 18:26:45 -0000 1.77 >+++ src/org/eclipse/mylyn/java/tests/ContextManagerTest.java 19 Oct 2007 23:57:19 -0000 >@@ -35,6 +35,7 @@ > import org.eclipse.mylyn.internal.context.core.CompositeInteractionContext; > import org.eclipse.mylyn.internal.context.core.InteractionContext; > import org.eclipse.mylyn.internal.context.core.InteractionContextManager; >+import org.eclipse.mylyn.internal.context.core.InteractionContextScaling; > import org.eclipse.mylyn.internal.java.ui.InterestInducingProblemListener; > import org.eclipse.mylyn.internal.java.ui.JavaStructureBridge; > import org.eclipse.mylyn.monitor.core.InteractionEvent; >@@ -443,4 +444,17 @@ > assertEquals(1, listener.numDeletions); > } > >+ public void testEventProcessWithObject() throws JavaModelException { >+ InteractionContext context = new InteractionContext("global-id", new InteractionContextScaling()); >+ context.setContentLimitedTo(JavaStructureBridge.CONTENT_TYPE); >+ ContextCorePlugin.getContextManager().addGlobalContext(context); >+ >+ assertEquals(0, ContextCorePlugin.getContextManager().getActiveContext().getAllElements().size()); >+ assertEquals(0, context.getAllElements().size()); >+ ContextCorePlugin.getContextManager().processInteractionEvent(InteractionEvent.Kind.SELECTION, type1, context, >+ MOCK_ORIGIN); >+ assertEquals(6, context.getAllElements().size()); >+ assertEquals(0, ContextCorePlugin.getContextManager().getActiveContext().getAllElements().size()); >+ ContextCorePlugin.getContextManager().removeGlobalContext(context); >+ } > } >#P org.eclipse.mylyn.context.core >Index: src/org/eclipse/mylyn/internal/context/core/InteractionContextManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.context.core/src/org/eclipse/mylyn/internal/context/core/InteractionContextManager.java,v >retrieving revision 1.25 >diff -u -r1.25 InteractionContextManager.java >--- src/org/eclipse/mylyn/internal/context/core/InteractionContextManager.java 18 Oct 2007 21:02:10 -0000 1.25 >+++ src/org/eclipse/mylyn/internal/context/core/InteractionContextManager.java 19 Oct 2007 23:57:20 -0000 >@@ -38,6 +38,7 @@ > import org.eclipse.mylyn.context.core.IInteractionRelation; > import org.eclipse.mylyn.monitor.core.InteractionEvent; > import org.eclipse.mylyn.monitor.core.StatusHandler; >+import org.eclipse.mylyn.monitor.core.InteractionEvent.Kind; > > /** > * This is the core class resposible for context management. >@@ -137,7 +138,8 @@ > public void loadActivityMetaContext() { > if (ContextCorePlugin.getDefault().getContextStore() != null) { > File contextActivityFile = getFileForContext(CONTEXT_HISTORY_FILE_NAME); >- activityMetaContext = externalizer.readContextFromXML(CONTEXT_HISTORY_FILE_NAME, contextActivityFile, commonContextScaling); >+ activityMetaContext = externalizer.readContextFromXML(CONTEXT_HISTORY_FILE_NAME, contextActivityFile, >+ commonContextScaling); > if (activityMetaContext == null) { > resetActivityHistory(); > } else if (!ContextCorePlugin.getDefault().getPluginPreferences().getBoolean(PREFERENCE_ATTENTION_MIGRATED)) { >@@ -246,6 +248,26 @@ > } > } > >+ public IInteractionElement processInteractionEvent(Kind eventKind, Object object, IInteractionContext context, >+ String origin) { >+ AbstractContextStructureBridge structureBridge = ContextCorePlugin.getDefault().getStructureBridge(object); >+ if (structureBridge != null) { >+ String structureKind = structureBridge.getContentType(); >+ String handle = structureBridge.getHandleIdentifier(object); >+ >+ if (structureKind != null && handle != null) { >+ InteractionEvent event = new InteractionEvent(eventKind, structureKind, handle, origin); >+ List<IInteractionElement> interestDelta = internalProcessInteractionEvent(event, context, true); >+ >+ notifyInterestDelta(interestDelta); >+ >+ return context.get(event.getStructureHandle()); >+ } >+ } >+ return null; >+ >+ } >+ > public IInteractionElement processInteractionEvent(InteractionEvent event) { > return processInteractionEvent(event, true); > } >@@ -433,7 +455,8 @@ > previousInterest = previous.getInterest().getValue(); > } > IInteractionElement parentNode = addInteractionEvent(interactionContext, propagationEvent); >- if (kind.isUserEvent() && parentNode.getInterest().getEncodedValue() < commonContextScaling.getInteresting()) { >+ if (kind.isUserEvent() >+ && parentNode.getInterest().getEncodedValue() < commonContextScaling.getInteresting()) { > float parentOffset = ((-1) * parentNode.getInterest().getEncodedValue()) + 1; > addInteractionEvent(interactionContext, new InteractionEvent(InteractionEvent.Kind.MANIPULATION, > parentNode.getContentType(), parentNode.getHandleIdentifier(), SOURCE_ID_DECAY_CORRECTION, >@@ -642,11 +665,11 @@ > public InteractionContext loadContext(String handleIdentifier, InteractionContextScaling contextScaling) { > return loadContext(handleIdentifier, getFileForContext(handleIdentifier), contextScaling); > } >- >+ > public InteractionContext loadContext(String handleIdentifier, File file) { > return loadContext(handleIdentifier, file, InteractionContextManager.getCommonContextScaling()); > } >- >+ > private InteractionContext loadContext(String handleIdentifier, File file, InteractionContextScaling contextScaling) { > InteractionContext loadedContext = externalizer.readContextFromXML(handleIdentifier, file, contextScaling); > if (loadedContext == null) { >@@ -950,10 +973,11 @@ > if (!isContextActive()) { > return false; > } else { >- return manipulateInterestForElement(element, increment, forceLandmark, preserveUninteresting, sourceId, activeContext); >+ return manipulateInterestForElement(element, increment, forceLandmark, preserveUninteresting, sourceId, >+ activeContext); > } > } >- >+ > /** > * @return true if interest was manipulated successfully > */ >@@ -981,7 +1005,8 @@ > IInteractionElement childElement = getElement(childHandle); > if (childElement != null && childElement.getInterest().isInteresting() > && !childElement.equals(element)) { >- manipulateInterestForElement(childElement, increment, forceLandmark, preserveUninteresting, sourceId, context); >+ manipulateInterestForElement(childElement, increment, forceLandmark, preserveUninteresting, >+ sourceId, context); > } > } > } >@@ -990,8 +1015,7 @@ > changeValue = 0; > } else { > if (bridge.canBeLandmark(element.getHandleIdentifier())) { >- changeValue = (context.getScaling().getForcedLandmark()) >- - originalValue + 1; >+ changeValue = (context.getScaling().getForcedLandmark()) - originalValue + 1; > } else { > return false; > } >@@ -1066,7 +1090,7 @@ > public void delete(IInteractionElement element) { > delete(element, getActiveContext()); > } >- >+ > private void delete(IInteractionElement element, IInteractionContext context) { > if (element == null || context == null) { > return;
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 204495
: 80813 |
80814