Mindoo Blog - Cutting edge technologies - About Java, Lotus Notes and iPhone

  • Lotusphere announcement: LS2Eclipse - Leverage Eclipse/Expeditor features in your Lotusscript code!

    Karsten Lehmann  January 11 2010 13:53:17
    If one of the following questions sound familiar, this blog article may be interesting for you:
    • You have Notes applications and want to bring them to the 21st century without rewriting everything in Java/JavaScript?
    • Your users often sit at their desk waiting for your Notes application because of a long running Lotusscript operation?
    • Composite Application technology looks interesting, but the Lotusscript APIs are not dynamic / powerful enough?
    • As a Lotusscript developer, you always hated it to hear those Java guys saying "That's easy. All you have to do is call this Eclipse API..." :-)
    During our own Notes/Domino development in the past years, we often needed Eclipse API functionality in places where it was not available, like a classic view action, a form or an agent.
    New features always got added to the "outside world", the Eclipse/Expeditor framework, but the classic Notes client and the Lotusscript language nearly stayed the same over the years.
    While Java development for Eclipse/Expeditor has many advantages compared to classic form/view development of Lotus Notes, it surely makes development more complex and you loose the rapid application development approach that Lotus Notes made so successful.
    In addition, long-time Notes users have an existing code base of thousands of lines of code, that they cannot simply rewrite in Java/JavaScript to create a new Java UI or XPages based application.


    We think that there is a missing piece between classic Notes and the Expeditor framework of Lotus Notes R8.x. This is our main use case for Mindoo LS2Eclipse.

    Mindoo LS2Eclipse is a bridging technology that makes Eclipse APIs accessible from Lotusscript code.

    The following image is a rough overview of the LS2Eclipse architecture:

    Image:Lotusphere announcement: LS2Eclipse - Leverage Eclipse/Expeditor features in your Lotusscript code!

    The installation kit contains an Eclipse plugin (packaged as a widget for easy deployment) and a set of Lotusscript libraries.
    Those libraries with a rich set of about 50 object-oriented Lotusscript classes give you access to many powerful Eclipse features, divided into the following 7 areas:

    JobTools
    The JobTools area is a key feature of the LS2Eclipse API. It is the key to running your application code in multiple threads, thus making it possible to keep the user interface responsive even if a long-running operation (e.g. storing an email in a CRM system on a Domino server) is active.
    Your Lotusscript code runs as a so called Eclipse Job, a background process that can optionally display a progress dialog with status/progress information.

    Feature overview:
    • Bridge between the Eclipse job framework and Notes agents
    • schedule the execution of an agent as an Eclipse background job
    • pass parameters to the job
    • jobs can report progress and can be cancelled on user request
    • Notes UI is responsive when job is running, job may change the UI during execution (e.g. to present the result)
    PlatformUI
    The PlatformUI area let's you read and interact with the Eclipse workbench, which is the graphical framework that is displaying the Lotus Notes client.

    Feature overview:
    • Read the structure of open windows, tabs and their contents (Eclipse views)
    • focus tabs, show/hide/minimize/maximize views
    • Access the side shelf, show/hide shelf views and toggle the shelf between collapsed, thin and expanded
    • show text in the status bar of the Notes client and show message boxes (e.g. to display information from a background agent job)
    ComponentTools
    The ComponentTools contain a set of tool classes to make Composite Applications more dynamic.

    Feature overview:
    • call Composite Application actions of components manually without a CA wire
    • dynamically create and show content like Notes data or a web browser view
    • modify the properties of components
    • read and modify the structure of a Composite Application (component/page preferences)
    • toggle between CA pages in your code (e.g. to create a custom navigator)
    • locate open views in the workbench based on their internal ids
    NotesUITools
    This area contains features of the new Java UI API in Lotus Notes 8.5.1. With it you can interact with the Notes client user interface, even if your code is running in a background job, where the standard NotesUIWorkspace is not available. In addition, you are no longer restricted to the active area of the screen to read/write data from/to a view or a document.

    Feature overview:
    • gives you access to the Notes UI even when your code is running in a background job
    • get a NotesUIDocument/NotesUIView handle for any area (IWorkbenchPart) of the screen, not just the active one
    • modify the NotesUIDocument's content, read the current selection from a NotesUIView
    • activate a view/document in the current page
    PerspectiveTools
    In the Notes client, an Eclipse perspective is the content of a main tab. The perspective tools give you access to all registered tabs in the system and they even allow for the creation of completely new tab layouts.

    Feature overview
    • get list of registered Eclipse perspectives (IPerspectiveRegistry)
    • clone existing perspectives
    • create and display your own Eclipse tab layouts (IPerspectiveFactory/IPageLayout etc.) on the fly
    ProgramTools
    The program tools contain platform independent APIs to registered file extensions in the OS.

    Feature overview
    • find associated programs by file extension
    • get list of registered file extensions in the system
    • launch files and urls
    ExtensionRegistryTools
    Experts can use the ExtensionRegistryTools to add new Eclipse extensions to the IExtensionRegistry of the Eclipse framework.

    How does the code look like?

    We tried to name the Lotusscript objects similar to their corresponding Eclipse API objects. That way, you already know most of the important Eclipse APIs if you start coding in Java later on and searching for code snippets on the internet is made easier.
    To get a feeling for the API, here is a small code snippet:

    To create a new API connection, you use this syntax:

    Dim connection As EclipseConnection
    Set connection=EclipseConnectionManager.createConnection()

    To access the PlatformUI, type in this:

    Dim platfUI As PlatformUI
    Set platfUI=PlatformUIFactory.getInstance(connection)

    The IPartService is a class to get the currently active area (IWorkbenchPart) of the screen:

    Dim partService As IPartService
    Dim part As IWorkbenchPart
    Dim vpart as IViewPart
    Dim classes as EclipseAPIClasses
    Dim partTitle as String
    Dim partId as String
    Dim partSecondaryId as String

    Set classes=connection.EclipseAPIClasses 'helper to cast an object to another API object
    Set partService=platfUI.getWorkbench().getActiveWorkbenchWindow().getPartService()
    Set part=partService.getActivePart()
    If classes.IViewPart.isInstance(part) then
            'part is a IViewPart; this gives us additional properties
            Set vpart=classes.IViewPart.cast(part)
            partTitle=vpart.getTitle()        
            partId=vpart.getId()
            partSecondaryId=vpart.getViewSite().getSecondaryId()
    End If


    Where to get the API

    The API is feature complete, but we still have some documentation to write. For example, I'm currently working on a database with test cases that may be handy to learn about the new features.
    It currently contains the following 12 cases:
    • Case 1 - Workbench information
    • Case 2 - PartService, get information about the active viewpart
    • Case 3 - Viewparts in the current page
    • Case 4 - Schedule background agent jobs
    • Case 5 - Change the UIDocument in another viewpart
    • Case 6 - Get the selection from a Notes view in another viewpart
    • Case 7 - Create new NSF viewparts in the current page
    • Case 8 - Create new NSF viewparts in a different tab
    • Case 9 - Manually call actions of CA components (change content of a document container)
    • Case 10 - Create a new Eclipse perspective layout with placeholders for new views
    • Case 11 - Compare selected documents in a new Eclipse perspective
    • Case 12 - Toggle the sidebar mode between collapsed/expanded/thin
    If you are interested and will be attending Lotusphere next week, come to our session about the new Java APIs of Lotus Notes 8.5.1 (BP203) on Wednesday from 3:00 until 4:00 pm or wake up early on Thursday to join us in our birds-of-a-feature session about "Application Architecture based on Composite Application technology" (BOF206) from 7:00 until 8:00 am.

    I will post an info in this blog, when a trial version of LS2Eclipse is available.

    Comments

    1Julian Buss  01/11/2010 17:45:27  Lotusphere announcement: LS2Eclipse - Leverage Eclipse/Expeditor features in your Lotusscript code!

    congratulations! Looks very interesting!

    2Brian Leonard  01/18/2010 3:07:47  Rock n Roll

    Hey Karsten,

    Just checking in and it looks like you are running with this stuff. Strong work.

    b

    3Karsten Lehmann  01/18/2010 4:11:03  Lotusphere announcement: LS2Eclipse - Leverage Eclipse/Expeditor features in your Lotusscript code!

    Hi Brian,

    thanks to the great work of you and your team!

    If you are in Orlando at Lotusphere (maybe for a different company), let's have a beer.

    If not, I hope everything is going with the new job!

    Karsten

    4Randy Park  02/15/2010 21:52:05  Trial Version

    Hello,

    I have been looking for this kind of integration for a long time. First and foremost, thank you. When can we expect to see the trial version?

    5Joerg S.  06/30/2010 16:04:04  Lotusphere announcement: LS2Eclipse - Leverage Eclipse/Expeditor features in your Lotusscript code!

    Hi Karsten,

    what's the current state of your LS2Eclipse project?

    Joerg

    6Karsten Lehmann  06/30/2010 16:28:33  Lotusphere announcement: LS2Eclipse - Leverage Eclipse/Expeditor features in your Lotusscript code!

    Hi Joerg,

    at the moment it's temporarily suspended due to very high project workload. I'm planning to work on it again in about 2 months from now.

    We had some trouble with the tool after Lotusphere, because we tried for a long time to use an alternative approach that we got from our fellows at Teamstudio, which would have been the best bridging solution between both worlds so far and supported on multiple platforms. Unfortunately, it turned out to be too instable to be used, so I focused again on two different approaches for Windows/Linux and Mac that I had created (As heavy Mac users, our goal is of course to be Mac compatible from the beginning)

    The Mac client was a bit tricky, because threading is different than on Windows and we also worked with IBM on some issues in the client and waited long time whether they will be fixed in 8.5.2 to make our Windows approach also work on the Mac.

    IBM now told us that they will look into the issues for 8.5.3.

    So finally, the last time I worked on LS2Eclipse, I was unifying the code of my different approaches for Windows/Linux and Mac to make deployment easier.

    Well, then a few projects crossed our road...

    If you're interested in the solution, please feel free to send me an email.

    Best regards,

    Karsten

    7Stephan H. Wissel  01/17/2011 7:57:56  Lotusphere announcement: LS2Eclipse - Leverage Eclipse/Expeditor features in your Lotusscript code!

    One year later.... what's your status? I have a rather unusual but interesting use case

    :-) ste

    8Karsten Lehmann  01/17/2011 9:00:15  Lotusphere announcement: LS2Eclipse - Leverage Eclipse/Expeditor features in your Lotusscript code!

    Still a bit bumpy but getting better. We had not looked into the code for the most part of the year, because we were buried with projects.

    In the last weeks, I now have worked on the code to make it compile again, unified the communication between LotusScript and Eclipse (it's now down to 1 synchronous communication channel to pass strings back and forth, currently implemented with 2 different technologies) and tried to launch the old test cases.

    Background LotusScript agents are still not 100% stable after the refactoring but with the new XPages2Eclipse codebase ( { Link } ), we would have a workaround for this as a worst case scenario (Javascript jobs instead of LotusScript jobs).

    Tell me about your use case!

    9Eric R.  07/13/2011 20:03:03  Lotusphere announcement: LS2Eclipse - Leverage Eclipse/Expeditor features in your Lotusscript code!

    Is LS2Eclipse available yet? I am looking for a way to reuse existing LotusScript code as sidebar plugins under Lotus Notes 8.5. I found it was fairly simple to create a plugin from a Lotus Notes form and use LotusScript agents within it, however, I, like many other frustrated developers, have found that the NotesUIWorkspace object does not have awareness of the main application view - so, for example, if I want to select a number of emails from my inbox and then hit a button in my plugin to perform an operation with the currently selected documents... I can't, because there is no way to get to the notesuiview object in the central frame of the notes client. I would be interested in using your LS2Eclipse library to see if it could get me around this issue.

    I know IBM wants us to start writing everything in Java now, but the fact of the matter is it takes me 2 weeks to write something in Java that takes me less than 1 day in LotusScript. And even then, it rarely runs without crashing the Notes Eclipse Client ("unable to create shelf view..."). It's very frustrating... definitely two steps backward in terms of ease of programming. I'd much rather use a bridge from LotusScript and save my sanity.

    10Karsten Lehmann  07/13/2011 21:09:52  Lotusphere announcement: LS2Eclipse - Leverage Eclipse/Expeditor features in your Lotusscript code!

    Hi Eric,

    no, I'm sorry, LS2Eclipse is not available yet and it's very unlikely that it will ever be officially available and supported.

    The reason is that we found too many things that produced issues in newer Notes versions than 8.5.1 (which we used for our Lotusphere demo about LS2Eclipse), which makes it too hard to support the product.

    Instead of waiting for LS2Eclipse, I would recommend trying XPages2Eclipse instead:

    X2E website: { Link }

    The XPages2Eclipse wiki contains a lot of sample applications and tutorials to get started.

    Among them, there is a sample how to put an XPage in the sidebar using a Composite Application and read the current view selection ( { Link } ).

    In 8.5.3, it will be even easier to use XPages in the sidebar, because they can be added directly as widget panels, like you do with classic Notes forms.

    We also have a tutorial how to call a Notes agent from server-side JavaScript and exchange data between the two ( { Link } ).

    Should not be too hard to produce a small sidebar application with a simple button that reads the current view selection and passes it to a Notes agent which uses your existing LotusScript code (even with access to NotesUIWorkspace).

    Best regards,

    Karsten

    11Karsten Lehmann  07/14/2011 13:59:32  Lotusphere announcement: LS2Eclipse - Leverage Eclipse/Expeditor features in your Lotusscript code!

    Sorry, I posted the German X2E website URL.

    Here is the English link:

    { Link }