Much ado about scripting, Linux & Eclipse: card subject to change

2008-04-26

Synch View Magic

Earlier this week, I opened bug 228701 asking for Mylyn filtering on the Synch view. (Please vote if you agree.) This afternoon in #eclipse-dev, Eugene pinged to ask why I don't simply use the Change Sets presentation in the Synch view, and Boris chimed in to tell me about bug 143419, "Strange tree rendering in synchronize view". Strange indeed.

I agreed I'd document my experiences with this view, but because Bugzilla is undergoing maintenance at the moment (thanks to our tireless webmasters!) and I want to share it while it's fresh, here's my account of how to make files vanish from the Synch view, though Mylyn continues to track them.

DO try this at home, as magic tricks in Eclipse are rare (e4 demo at EclipseCON with spinning views & scriptable UI elements notwithstanding), and this one's pretty cool.

Steps to reproduce

  1. Install the latest Eclipse 3.4 I build (I've got eclipse-SDK-I20080422-0800-linux-gtk.tar.gz.)
  2. Install Mylyn from its update site (mylyn-2.3.2-e3.4.zip).
    DO NOT unpack it first, just give the URL to Eclipse's new p2 / Install Manager or download the zip and hand it that. If you unpack it first, p2 doesn't seem to know how to find the features therein. But I digress...

  3. Check out some CVS project into your workspace. I used :ext:nickb@dev.eclipse.org:/cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.releng, from HEAD.
  4. Open Mylyn's Task List view (Shift-Alt-Q, Q). Create a new Local Task or open an existing Bugzilla task. Enable the task.
  5. Unfilter the Package Explorer view.
    This is one of my *very* few complaints about Mylyn -- I'm starting a new task w/ no context, yet it insists on filtering my view to show me my non-existent context, so I can't start selecting files on which to work until I unfilter the view. But I digress again...
  6. Open the Synchronize View (Shift-Alt-Q, Y).
  7. Configure the view as shown below:

  8. In the Synchronize view, select the Change Sets presentation (the toolbar icon that looks like a file tree).
  9. Create a new Synchronization. Type CVS, Resources to synch: Workspace. Hit Finish.
  10. Open some files in the Package Explorer view, and edit them. Watch as they appear in the Synch view as items under your Change Set (ie., as changes for your Local or Bugzilla Task)
    It would be nice if the Change Set title included the bug number, or could be configured the same way that commit comments can be. Not crucial, just a handy enhancement. For now, the task's title is sufficient.
  11. Pick some file in the CVS-backed project and copy it within the same folder. Notice how it appears in the Synch view as an outgoing addition.



  12. Here's where the magic trick starts. Made sure your audience is still awake.

  13. Disable your Task.
  14. Copy some file (could be the same one as before, or a new one -- doesn't matter as long as it's in a CVS-backed project. The new file will appear in the Synchronize view under a new <Unassigned> Change Set.

  15. Re-enable your Task.
  16. In the synch view, select the new file from under the <Unassigned> Change Set.
  17. As you select the file, it will be added to Mylyn's context for that task, and appear in the filtered Package Explorer. Note however that it didn't change from the <Unassigned> Change Set to your Task's change set. So begins the magic.

  18. In the Synchronize view, select the Workspace presentation (the toolbar icon that looks like a file tree).
  19. When you expand the tree, you'll see that your new file does appear as you'd expect. This tree should mirror what's in the Package Explorer (as in previous screenshot).

  20. Switch back to the Change Sets presentation, and get ready for your exit with flourish.

  21. Lo, that new file has vanished!

Image from Happy Tree Friends - I Get a Trick Out of You.
Courtesy of Mondo Media / YouTube. Used without permission.

8 comments:

Eugene Kuleshov said...

Wau Nick! That is what I call detailed description. :)

steffenpingel said...

Here's another trick to make files disappear from the Synchronize view:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=212922

Denis Roy said...

I like your 'used without permission' honesty. Oh, and BTW, it's 'tireless webmaster[]'. I[] have exposed my collective long ago.

Kim Sullivan said...

Re:5 - you don't actually have to unfilter the view, just use alt-click to progressively unfilter the things you need. I actually prefer this to ufiltering everything, because "everything" can be quite overwhelming.

It's a bit more of a problem on linux than windows, since some linux window managers use alt-click to move windows (yes, there's a bug filed, but I don't think it will be possible to resolve because there just aren't enough modifiers for everything).

And there used to be problem when opening a file when using alt-click unfiltering (when you tried to doubleclick, mylyn started filtering faster than you could finish the doubleclick). This is also filed on bugzilla somewhere, maybe even resolved (lately, I haven't been able to track Mylyn development as closely as I would like)

nickb said...

@Kim: How can you alt-click a completely empty (entirely filtered) workspace?

(BTW, on my KDE-running linux, ctrl-right-arrow, shift-right-arrow, and alt-left-arrow all work to expand a filtered folder's children).

@Denis: Just trying to give props to Mondo for their great work.

Kim Sullivan said...

@Nick - Alt-clicking with the mouse in the empty package explorer view unfilters the top level elements, either projects or working sets.

But if you depend on the keyboard to unfilter things, it's probably impossible to unfilter the "root" elements because there's nothing to focus the keyboard on...

I agree that there should be a way to unfilter the root elements with the keyboard as well, so that people who don't use the mouse (or aren't willing to give up alt-click on linux for eclipse) don't have to turn off context filtering for the whole view.

Or have I misunderstood, and Mylyn filters the whole workspace including views, so the views themselves are hidden, not just their contents? It's never done that for me, activating a task just hides the contents, but keeps the perspective intact.

nickb said...

@Kim: Because I use Working Sets as my Top Level Elements, when I enable a new task, my Package Explorer goes from full of 12 Working Sets to utterly blank. There's nothing to alt-click on, just white space. (This doesn't seem to happen if I use Projects instead, but I have over 100 projects so I need Working Sets.)

So, with every activated new task, I have to turn off Focus on Active Task, select some files, and then turn it back on. From there, right-arrow does the trick.

I would argue that the better way, when starting a new task w/ an empty context, would be to NOT turn on filtering. Instead, show me a notification popup after a couple minutes reminding me to turn on filtering, once I've defined a context and some "interesting" files.

Or, make the 'Auto focus navigator views on task activation' preference configurable to either a time delay or # of interesting items. I could see a useful threshhold being between 1 and 5 minutes or 1 and 5 items.

Kim Sullivan said...

@Nick: "There's nothing to alt-click on, just white space."
You can alt-click on the whitespace (anywhere).

Unfortunately, you're right that it works like this only for projects as top level elements and not working sets (I don't use them, so that's why I couldn't understand your problem), but this is definitely a bug, it's not supposed to work differently from projects as top level elements.

I'm quite sure this is some kind of regression, I believe it used to work for working sets as well (alt-clicking in the white space to show top level elements).

Bugzilla seems to be up again, the issue is already reported as 222057 - Alt-clicking doesn't work in Package Explorer when Top Level Elements are Working Sets.

I don't have an opinion if your approach on filtering would be better, I'm used to alt-clicking the whitespace.