Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331172 - warn when copying context to a task that already has context
Summary: warn when copying context to a task that already has context
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: 3.5   Edit
Assignee: Sam Davis CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, noteworthy, plan
Depends on:
Blocks:
 
Reported: 2010-11-25 21:32 EST by Sam Davis CLA
Modified: 2012-03-21 12:14 EDT (History)
2 users (show)

See Also:


Attachments
Patch (10.70 KB, patch)
2011-01-05 16:33 EST, Sam Davis CLA
no flags Details | Diff
mylyn/context/zip (9.18 KB, application/octet-stream)
2011-01-05 16:34 EST, Sam Davis CLA
no flags Details
patch (10.63 KB, patch)
2011-01-13 15:03 EST, Sam Davis CLA
no flags Details | Diff
screenshot (14.94 KB, image/png)
2011-02-01 23:02 EST, Steffen Pingel CLA
no flags Details
moved to internal merge method and changed to merge in UI (11.70 KB, patch)
2011-02-17 19:00 EST, Sam Davis CLA
shawn.minto: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Davis CLA 2010-11-25 21:32:32 EST
It would be nice to get a warning when you're about to copy context to a task that already has context, both because it's easy to accidentally copy to the wrong task, and also because it's not obvious that it will _replace_ the existing context rather than simply add to it (which would be a useful feature).
Comment 1 Steffen Pingel CLA 2010-11-26 04:45:09 EST
Great suggestion. A popup dialog that asks to add or replace would be a nice enhancement.
Comment 2 Shawn Minto CLA 2010-12-07 12:42:54 EST
Sam, did you want to submit a patch for this?
Comment 3 Sam Davis CLA 2010-12-07 13:48:10 EST
I'll look into this.
Comment 4 Sam Davis CLA 2011-01-05 16:33:59 EST
Created attachment 186131 [details]
Patch

This adds the interaction events from the source task's context to the target context. This may result in the target context's events not being ordered by date, but I don't think that should matter.
Comment 5 Sam Davis CLA 2011-01-05 16:34:00 EST
Created attachment 186132 [details]
mylyn/context/zip
Comment 6 Sam Davis CLA 2011-01-13 15:03:39 EST
Created attachment 186773 [details]
patch

I just removed an unused empty method I had added by mistake.
Comment 7 Steffen Pingel CLA 2011-02-01 23:02:18 EST
Created attachment 188110 [details]
screenshot
Comment 8 Steffen Pingel CLA 2011-02-01 23:13:49 EST
That's an awesome patch! I wonder though we should make this API on IInteractionContext. To me it seems that this would allow working around the event processing in InteractionContextManager and make the interface inconsistent. What do you think about adding a merge() method to LocalContextStore or keeping this internal?

Shawn, do you have any thoughts on that?
Comment 9 Sam Davis CLA 2011-02-01 23:26:27 EST
Whatever you think makes sense.

One thing I didn't really realize until I tried using this is that after you merge 2 contexts, the elements in the merged context that are interesting might all come from only one of the original contexts. We could try to change the date stamps on events or somehow normalize interest levels between the 2 contexts, because the user might expect/want the set of interesting elements in the merged context to be roughly the union of the interesting elements in the 2 original contexts. Otherwise, the difference between Replace and Add might not be noticable in some cases.
Comment 10 Steffen Pingel CLA 2011-02-03 16:31:45 EST
On the call today it was suggested to rename "Add" to "Merge" in the UI.

I would propose to add an internal method to LocalContextStore that implements the merge operation.

(In reply to comment #9)
> One thing I didn't really realize until I tried using this is that after you
> merge 2 contexts, the elements in the merged context that are interesting might
> all come from only one of the original contexts. We could try to change the date
> stamps on events or somehow normalize interest levels between the 2 contexts,
> because the user might expect/want the set of interesting elements in the merged
> context to be roughly the union of the interesting elements in the 2 original
> contexts. Otherwise, the difference between Replace and Add might not be
> noticable in some cases.

That's very interesting. If there is an easy way to normalize that it sounds good to me, otherwise the current approach should be okay as well.
Comment 11 Sam Davis CLA 2011-02-03 16:37:59 EST
I'll try to look into that on Monday.
Comment 12 Sam Davis CLA 2011-02-17 19:00:00 EST
Created attachment 189246 [details]
moved to internal merge method and changed to merge in UI

Steffen, here's an updated patch.
Comment 13 Shawn Minto CLA 2011-02-21 15:07:46 EST
Great work on this Sam!  I have committed this patch.  Before committing, I updated this so that the editor memento is only copied if there wasn't already one for the active task.

Can you create a bug to improve this by normalizing the interest values?
Comment 14 Sam Davis CLA 2011-02-21 15:57:43 EST
337768: Normalize interest values when merging contexts
https://bugs.eclipse.org/bugs/show_bug.cgi?id=337768