Generative AI for Technical Writer or Information Developers
Plug yourself in and your app will never be the same (2 hr editon)
1. LSBG Vårseminar, maj 2011 Larvik, Norge Plug yourself in and your applications will never be the same! (An introduction to plugin development for Lotus Notes, Domino and Sametime)
44. Eclipse architecture Workbench JFace SWT Core Extension Point Framework Service Framework Rich Client Platform Plug-in Plug-in Extension Pt. Plug-in Extension Point Extension Point Extension Point A software component in Eclipse Extension Point declares contract to extend plug-in functionality Extension code extends this functionality RCP allows you to build GUI apps on multiple OS SWT provides uniform UI API across multiple OS that calls OS UI API for native look and feel JFace provides components to make it easier to write a GUI e.g. wizards, preference pages, actions, dialogs Workbench is desktop UI and customizable Service Framework supports registration and lifecycle management of plug-ins
45. IBM Lotus Clients – built on Eclipse Sametime Expeditor Apps and Plug-ins (ISV + Customer) Notes Symphony Industry knowledge and experience ecosystem of partners open and extensible collaborative services Integrated applications Portal Browser Desktop Mobile Multiplatform support Scalability Security
133. Attempts to access the UI (i.e. set the text of a label) outside the UI thread will fail with an exception
134.
135. Using Job in code public void fireOnTheEmpire(int initDelay, final String jediName) { // create recurring job to poll web service new Job("Poll the Force!") { protected IStatus run(IProgressMonitor monitor) { // invoke endpoint using input String srvc = “http://moon5.tatooine.com/JediFinder”; WSFacade facade = new WSFacade(srvc); String result = facade.fire(jediName); // do something with the result ... // reschedule this job (in 5 mintues) this.schedule(5 * 60 * 1000); // return return Status.OK_STATUS; } }.schedule(initialDelay * 60 * 1000); } final
136. Using UIJob in code final List lstJedis = new List(parent, SWT.NONE); ... public void psssst(final String[] jedis) { // since we're called in a background process // use that UIJob we learned about to update the UI new UIJob("Load Jedis") { public IStatus runInUIThread(IProgressMonitor monitor) { // update UI for (String jedi : jedis) { lstJedis.add(jedi); } // return status return Status.OK_STATUS; } }.schedule(); }
137. Avoid Spinning Wheel of Death public void createPartControl(Composite parent) { final Label txt = new Label(parent, SWT.NONE); new UIJob("Indicate job starting") { public IStatus runInUIThread(IProgressMonitor monitor) { txt.setText("Turning star cruiser (" + new Date() + ")..."); // do long running task == BAD!! try { Thread.sleep(5000); } catch (Exception e) {} txt.setText("Done turning star cruiser (" + new Date() + ")..."); // reschedule and return this.schedule(5000); return Status.OK_STATUS; } }.schedule(5000); }
138.
139.
140. You perform some background operation (e.g. load data from a web service or similar)
143. Do it right! public void widgetSelected(SelectionEvent event) { list.add("Starting to run code (" + new Date() + ")...", 0); new Job("Long running job") { protected IStatus run(IProgressMonitor monitor) { downloadEntireGoogleSearchIndex(); // call back into UI to tell user we're done new UIJob("Update UI") { public IStatus runInUIThread(IProgressMonitor monitor) { list.add("Done running code (" + new Date() + ")...", 0); return Status.OK_STATUS; } }.schedule(); return Status.OK_STATUS; } }.schedule(); }
187. Installing the feature into the clients either manually or using a widget descriptor Feature Plug-in Plug-in . . . Feature Plug-in Plug-in . . . Update Site . . .
196. XPages Extensibility Library ” A new project has been created which contains a simple sample for how to to develop a 'native' XPages control via the Java extensibility API. This control can be deployed globally as an OSGi bundle/plugin to Lotus Domino and Lotus Notes/Domino Designer and then used in all NSFs without having to put the code in all NSFs redundantely. The new control shows up in the palette in Designer as other out of the box controls.”
197.
198. HIGHLY recommended article on the Job API >> http://www.eclipse.org/articles/Article-Concurrency/jobs-api.html