Eclipse selection and when to process or not

I heard from a user of the Attachment Viewer today that when a large ZIP was selected the client appeared to hang.  He explained that the attachment viewer was not even showing yet it looks like it still processed the selection.  Well, he was right.  After looking at the code, it was actually processing the ZIP file every time – whether the viewer was showing or not.  So I made a simple change and he is checking it out (testing it for me).  I did my small unit tests but I figured giving him a patch and testing his large ZIP file attachment would also be good – a second set of tests is always welcome in software.  🙂

So what did I do?

In the selectionChanged() event I had to determine if the view was visible or open.  This was an interesting problem because the view itself does not contain this state.  What I had to do was register the view with the workbench as an IPartListener2.  Why the “2” and not just IPartListener?  The key event we need is actually partHidden()!

The description of the event is here:

Notifies this listener that the given part is hidden or obscured by another part.

What I do is have a class level property named “_closed” and set it to true or false in the different events for IPartListener2.  This allows me to not process the selection if its “_closed” and just return out of the selectionChanged() callback.

I scoured the SWT and Eclipse world and I could not see another way to do this so if anyone has any input please let me know.  I will be updated the OpenNTF project with the fix in a few days.  I am sure one of the Eclipse guru’s reading would know if this is correct or not.

Advertisements

Do you want XPage components in the side bar?

Looks like I lost two posts when they moved my blog between servers!  I am going to post these back here.  For this specific one,  if you answered prior that you would like this can you please do it again.  There was a request for what customers would want such a thing.

One of the biggest wins for Lotus Notes at Lotusphere was the fact that XPages can run in the 8.5.1 client.  You can, in that release, also have XPages as components in composite applications.  This also means you can have XPage components in the side bar and somewhat standardize XPage technology as your component UI technology but it needs to be in a composite currently.  This is all great but one piece of feedback was “How do I just put an XPage widget in the side bar without being in a composite?”.  The question was intriguing because it also exposed another gotcha.

There are two primary use cases for having something always live in the side bar:

  1. Just live there and be available for a specific function.
  2. Interact with the currently selected context – ie. respond or show information based on a view selection or tie an event into a Live Text action.

The first one would work fine, the second one would not work today.  The problem is, there is no “Workbench Selection” or “Selection” event in an XPage today.  We would also have to standardize on serialized workbench selections – objects that can be sent over a pipe or use JSON.  As for Live Text integration – this would also be a feature request to get this integration into Widgets (or Toolbox).

I would like to hear the thoughts of my readers on this.  I do understand many are just getting into XPages and components but it would be interesting to hear from the community their take on this.