Posts Tagged: ‘eclipse’

Remote Debug an IBM Notes client from Eclipse

18. April 2015 Posted by Ralf Petter

Normally the easiest way to debug Notes plugins is to start the Notes client directly from eclipse. I have explained how to do this in my tutorial: "Configure Eclipse 4.3 to develop plugins for Notes Part 1 and Part2". But sometimes problems are specific to a special client environment or user configuration and can not be debugged in a test environment. Yesterday i had such a problem with a feature which works great, when i launched the client from eclipse, but fails when i start the client like a user will do.

Fortunately the JVM of the Notes client has a built in remote debugging facility. It can be activated with some small modifications in the JVM.properties configuration file:

Locate the JVM.properties of the Notes client installation you want to debug. You can find it in the  "..frameworkrcpdeploy" directory in your IBM Notes program path.


Open the file with an Editor with admin access rights or copy the file to the desktop before your open it in your favorite text editor.

Add the "vmarg.Xss1m=-Xss1m" directive to the beginning of the VM arguments. It will increase the stack size so that the increased need for storage in the stack while debugging will be provided.

Mark the "vmarg.Xnolinenumbers=-Xnolinenumbers" directive as a comment because when this performance optimization is active, eclipse is not able to set breakpoints.

Add the "vmarg.debug=-Xdebug" and "vmarg.Xrunjdwp=Xrunjdwp:transport=dt_socket,server=y,address=8765" to the end of the VM arguments. The first will activate the debug functionality in the VM. The second makes the debugger listening on port 8765 and the server=y tells the jvm to stop the execution on startup and wait for a debugger to connect.


Save the modified jvm.properties file to the deploy folder of your Notes installation.

Then prepare a remote debug session in your eclipse IDE.

Please be sure that you choose the correct host and the port number you have chosen in the jvm.properties file. I you want to debug a remote host, be sure to deactivate or configure the windows firewall so that a connection to the port is possible.


Start the Notes client. and then click debug in Eclipse. The Notes client will start as soon as the Eclipse debugger is successfully connected to the jvm of notes. The execution of the JVM will stop on every breakpoint you have set in your code the same way as if you had started the client directly from eclipse.

If you liked this tutorial please share it on your favorite social network and if you have problems please leave a comment. Thanks in advance.

How tell Notes that it should roam the preferences of your own plugins too.

17. April 2015 Posted by Ralf Petter

One of the best things about Notes is that it can synchronize your settings on different devices. So you have for example the same settings on your Desktop and on your Laptop. This feature is called roaming. This works really great for all IBM provided Features, but when you have deployed your own or third party eclipse features to your Notes client the settings of them will not roam to your other clients as the IBM Features do. This is very annoying for your users. So i have analyzed the whole roaming process in the client and discovered, that IBM has already implemented an mechanism to activate the roaming feature for 3rd Party Plugins. I have not found any documentation for this on the internet, but it works without any problems.

So let's have a look how the roaming of Preferences in the Notes Standard client works. If roaming is enabled for your user you will have a "roamingdata.nsf" on your client and on the server. In this database there is one document for every plugin which contains the preferences. On the client start this database is replicated with the server and then the settings in your notes data/workspace folder gets updated with the settings in the documents in "roamingdata.nsf". When you end the client every setting you have changed will be updated in the corresponding document in "roamingdata.nsf" and all changed documents will be replicated to the server.

Follow this easy steps to enable the roaming of the settings for your own plugins:

The first step is to retrieve the existing configuration file for the roaming service from the "com.ibm.notes.roaming.provider" plugin. To do this copy the plugin from the "C:Program Files (x86)IBMLotusNotesframeworksharedeclipseplugins" to your desktop and change the extension of the plugin from ".jar" to ".zip" Then open this archive file and extract the roamingconfiguration.xml file in the configuration folder to a local folder. This file contains the complete configuration of the roaming service


You can edit this file with your preferred editor. I use Notespad++ because it is xml aware. Simply add an "roamingbundle" directive in this file for every plugin for which you want that notes should roam the settings.


If you do not know which plugins have settings have a look in the notes "..workspace.metadata.pluginsorg.eclipse.core.runtime.settings" folder. Every file in this folder is potential candidate for your list.

Then deploy your customized "roamingconfiguration.xml" file to every workstation for example with a windows group policy or other software distribution tool.

To tell Notes that it should use your customized file and not the built in file in the plugin simply add the "roaming.config.url=file://c:/Program Files (x86)/IBM/Lotus/Notes/roamingconfiguration.xml" to the com.ibm.rcp.roaming.service preferences. Be sure to update the path of the file to the correct path where you have deployed your configuration file. In my example i have used the Notes program directory. You can set this preferences with a desktop policy or you can set it in the plugin_customization.ini of your Notes installation.


If you like this How to or if you have problems with it, please leave a comment.

Notes client with embedded sametime 9 crashes when launched from eclipse

6. November 2014 Posted by Ralf Petter

I often start my Notes client from eclipse to debug our plugins in the client. I have described how to configure eclipse to start notes from eclipse in an older blog post. Yesterday our Admin has installed the sametime 9.0 embedded client in my Notes installation and after that Notes crashes when started from eclipse with the following error in the error log:

Unhandled exception
Type=Segmentation error vmState=0x00040000
J9Generic_Signal_Number=00000004 ExceptionCode=c0000005 ExceptionAddress=94601766 ContextFlags=0001007f
Handler1=001EA730 Handler2=003CC270 InaccessibleAddress=00000000
EDI=94693AC0 ESI=722F4A00 EAX=00000000 EBX=723F90A0
ECX=00000004 EDX=00000020
EIP=94601766 ESP=72D3FCD8 EBP=723F90BC EFLAGS=00010216
GS=002B FS=0053 ES=002B DS=002B
Module=C:UserspetterrAppDataLocalworkspacenotes.metadata.pluginsorg.eclipse.pde.coreIBM Notesorg.eclipse.osgibundles12141.cposwin32NativeNetInfo.dll
Module_base_address=94600000 Offset_in_DLL=00001766
Target=2_40_20131231_180656 (Windows 7 6.1 build 7601 Service Pack 1)
CPU=x86 (4 logical CPUs) (0x1f890d000 RAM)
----------- Stack Backtrace -----------
(0x94601766)
(0x94602039)
(0x9460288D)


I have tried to reload the target platform and activated all plugins in my launch configuration, but with no success. The client still crashes after my user is logged in the sametime community. So i have dug deeper and found out that you have to set some jvm parameters to prevent the crash.

The parameters are:

-Xjit:noResumableTrapHandler
-Xmaxt0.6
-Xmca8k
-Xminf0.1
-Xmn7m
-Xms48m
-Xmx1024m


and should be added to your launch configuration.






Extension Spy works now in Notes 8.5.x and 9.0 too

2. Juli 2014 Posted by Ralf Petter

The Extension Spy i presented in one of my latest posts had an dependency on Notes 9.0.1 so that it will not work in versions prior 9.0.1. I have removed this dependency and now the plugin should work in all Notes 8.5.x and 9.0.1 standard clients. If you had problems with the installation please remove the widget and reinstall the new version. I have tested it with 8.5.3 and 9.0.1. Please leave a comment,  if you have still  problems with the new version on your client.


A deep look under the hood of the Notes Standard client.

29. Juni 2014 Posted by Ralf Petter

The IBM Notes Standard client is an eclipse RCP (Rich client application) which has hundreds of extension points to extend the functionality of the application. This extension point allows you to extend notes in ways which were absolute impossible to do in versions prior Notes 8. The only problem is that the documentation of the extension points is still very weak and i have no hope that this will improve significantly in the next time.

So i have created a tool to graphically browse the extension registry of a running Notes client. It shows you all possible extension points with the defining plugin in in a tree structure. You can open every extension point and see which plugins extend this extension point with what parameters.

See the following screenshot for an example. I have opened the com.ibm.rcp.ui.shortcutButtonSet extension point in the com.ibm.rcp.ui (Marked with a red frame). This is the extension point which has to be used to extend the masthead in Notes 9 with your own icons. We see that all actions that are available in Notes are defined in the com.ibm.notes.client plugin (Marked in green) In the next level of the tree you can see what values the com.ibm.notes.client uses to extend the extension point. This can be very valuable source to find out how this extension point works and what to do to use this point for your own extension.


The extension spy is also a very good tool to find out the id of toolbars or menus to extend them. For example go to the org.eclipse.ui.menus extension point and see how the Notes client extends the menus to get an idea where to place your own menu points.


You can find all information's how to install the Extension Spy in your Notes client on the Extension Spy download page. Install it and leave a comment what you think about this tool.

Eclipse 4.4 Luna has been released

26. Juni 2014 Posted by Ralf Petter

Eclipse 4.4 the newest and greatest release of my preferred IDE and RCP Development platform has been released. After the very buggy start of the 4.x releases with 4.1 and 4.2 the 4.x code stream is now very stable and the performance is back to an acceptable level. So if you are still developing in Eclipse 3.x now is the time to step up and see how much eclipse has improved in the last years.
 

You can find details what's new and which projects are included in Eclipse 4.4 at https://projects.eclipse.org/releases/luna

The downloads are available at http://www.eclipse.org/downloads/

If you like eclipse please donate some money to the eclipse foundation to support their great work.

Launch the Domino Designer from Eclipse to debug your custom Designer extensions.

25. Juni 2014 Posted by Ralf Petter

Cameron Gregor asked me in a comment whether it is possible to launch the Domino Designer from eclipse in the same way like the Notes client and the answer is yes this is possible. In this post i will describe what you have to change in your existing notes launch config to start the Designer from eclipse. This enables you to debug Extensions for the designer or XPages. To follow the steps you need a working Notes plugin target and a launch config for the notes client. If you need help with this you can learn how to do this in my tutorial "How to configure Eclipse 4.3 to develop plugins for Notes Part 1 and Part2".


The goal is to have a full working Domino Designer, launched in Debug mode from eclipse.


The first step is go to your eclipse and open the "Debug Configurations" dialog.


In there duplicate your existing notes launch config.


Then change the Name and the "run a product" field to Domino Designer and com.ibm.designer.domino.product.dde.


Switch to the "Arguments" Tab and change the Program arguments to

-vm ${rcp.home}/../jvm/bin\j9vm\jvm.dll
-personality com.ibm.designer.domino.personality
-product com.ibm.designer.domino.product.dde
-debug
-console
-nl en_US


Save your changes with the "Apply" button. Then click the debug button to launch Designer. Be sure that you have no open instance of Notes/Designer because only one instance can be open at the same time.


When everything works, you will get a designer window with a welcome screen. To close the welcome screen, choose "Close Perspective" from the Window menu.


Then you should see your normal Designer UI. Maybe you get many error message in the Problem view that some Java elements cannot be resolved. No problem we will fix this in the next step. 


Open the Preferences of Designer and navigate to "Plug-in Development" -> Target Platform. Change the location from "NotesProgDir\framework\eclipse" to "NotesProgDir\framework\rcp\eclipse". Click Apply and "Ok". Eclipse will reload the target platform.


After reload all error message will be solved automatically in the background. Now you can try or debug your extensions in  Designer.


Eclipse.org got a new beautiful design

11. Juni 2014 Posted by Ralf Petter

The Eclipse.org website got a complete overhaul. It has now a responsive design and looks fresh and beautiful compared to the old one. If you have not visited it lately, give it a try.



Howto use Xulrunner instead of Internet explorer as browser component in a Notes RCP

5. Juni 2014 Posted by Ralf Petter

One of the coolest features in Notes RCP applications is, that you can embed a browser widget in your application. You can use the browser widget as a document viewer, to view an interactive map for example with openlayer, or to visualize your data as a chart with dojo chart running inside the browser widget.


The browser widget in a Notes RCP application uses the built in browser of your operating system. For example on Windows this is always the internet explorer no matter what browser you have chosen as default in windows or Notes. IE has some serious disadvantages compared to other rendering engines:
  • IE is very slow when you are using Openlayer maps with many features.
  • Maybe your application will break if IE is updated by an automatic software update from MS.
  • IE can not render .BMP files.
  • IE does not support web standards.
Fortunately there is a XULRunner (rendering engine from Mozilla Firefox) built into Notes and with some tricks you can create a XULRunnner browser widget instead of the IE one. Here is the code with a fallback to IE if something went wrong.

 
    //Get built in XULRunner of Notes for Windows
Bundle bundle = Platform.getBundle("com.ibm.rcp.xulrunner.runtime.win32.x86");
boolean xulRunnerAvailable = false;
if (bundle != null) {
URL resourceUrl = bundle.getResource("xulrunner");
if (resourceUrl != null) {
try {
URL fileUrl = FileLocator.toFileURL(resourceUrl);
File file = new File(fileUrl.getFile().substring(1));
//Set the XULRunnerPath to the built in runtime.
System.setProperty("org.eclipse.swt.browser.XULRunnerPath", file.getAbsolutePath());
xulRunnerAvailable = true;
} catch (IOException e) {
e.printStackTrace();
}
}
}
//If XulRunner is available get an Instance of Mozilla or if not fallback to IE.
if (xulRunnerAvailable)
browser = new Browser(parentComposite, SWT.MOZILLA);
else
browser = new Browser(parentComposite, SWT.NONE);


The only drawback of the Xulrunner of Notes is, that it is a little bit dated. So i really hope that IBM will update the instance of XULRunner in future service packs of the Notes client. This is especially important because this Xulrunner runs xPages in the Notes client too.

Eclipse 4.4 Luna – Release Teaser

3. Juni 2014 Posted by Ralf Petter

Eclipse 4.4 Luna will be released soon. Watch this little teasers to get an idea how this fantastic new release will look like and what new features will be available.




Eclipse Quo Vadis?

4. November 2013 Posted by Ralf Petter

Heise hat heute einen sehr interessanten Kommentar zu der Lage der Entwicklung des Eclipse Ökosystems veröffentlicht. Ich bin auch der Meinung, dass Eclipse momentan ein relativ großes Problem hat Entwickler für die Arbeit an der Basis (SWT/jFace und dem gesamten darauf aufbauenden Technologiestack) zu begeistern. Es konnten die Ressourcen die IBM nicht mehr in dem Aussmaß wie früher zur Verfügung stellt nicht gleichwertig von anderen Eclipse Membern ersetzt werden.

Ich hoffe auch, dass die IBM aufgrund von Problemen die in Eclipse basierenden Rational Produkten auftreten sein Engagement wieder etwas hochfahren wird.

Contextsensitive help for Notesplugin developer in Eclipse

7. August 2013 Posted by Ralf Petter

When you develop plugins for the notes platform the target platform, does not contain any javadocs. So you do not get context sensitive help on java classes in Eclipse. This makes the development especially for beginners needlessly difficult and annoying.

Here is an example: You want to make a new SWT Text Field and get only a the Constructor signature with not very helpful parameter names. What the hell is arg1? So you have to open a browser go to the javadocs of SWT and search for the Text class and after reading the description go back to eclipse.

 

Wouldn't it be so much nicer if you can get useful parameter names and the javadoc direct in the syntax completion window like you get it when you develop plugins against the standard RCP target.


Follow this steps to teach the eclipse IDE that it shoukld search for the source in another place.

First go to your plugin in the package Explorer in your eclipse IDE. Open the  "Plugin Dependenices" and search for the plugin for which you want do add java source. In our example this is org.eclipse.swt.win32.win32.x86.versionNumber.



Download the Eclipse RCP source from the eclipse download archive page in the correct version. In our example the correct version is 3.6.2.

Unzip the "org.eclipse.swt.win32.win32.x86.source.version.jar" from the downloaded SDK to a new directory where you want to store all java source packages for Notes. Do not place this directory somewhere in the Notes program directory.

Right click the Notes plugin in package explorer and select "Properties" from the context menu. Paste the fully qualified path to the extracted source plugin in the Location path or select external File and browse to the source plugin file. Then finish the dialog with ok. Now your have context help for every SWT Class in your eclipse IDE.


You can repeat the above steps for other plugins in Notes which are eclipse based, for example jface, eclipse forms or the workbench. Be aware, that most other plugins are not version 3.6.2, but 3.4.2. So you have to download the 3.4.2 SDK from the download archive.

I think this is really a great step forward for every plugin developer for Notes.



Eclipse 4.3 Kepler has been released.

26. Juni 2013 Posted by Ralf Petter

Today the Eclipse Foundation has released Eclipse 4.3 (Kepler). Eclipse 4.3 is really a step in the right direction after the little bit disappointing 4.2 Version. Especially the performance of many functions like the switch to other editor parts has improved. Many other projects like WTP, RAP, BIRT has although seen great new features. So i really recommend, that every User of Eclipse 4.2 should upgrade their installation to 4.3. Users of the older 3.x code stream should wait till the first Service Release of 4.3 which i expect in September.

You can find all new features and bugfixes with screenshots in the "What's new" chapters of the online help of eclipse.

 

Tabris a cool way to reuse your Notes/Eclipse RCP skills in the mobile app development

16. April 2013 Posted by Ralf Petter

Today the final version of Tabris has been released. Tabris is a native peer client for a RAP (Remote Application Plattform formerly Rich Ajax Plattform) Server. RAP is a mature technology to run SWT/Jface Applications and Eclipse RCP Plugins on a server and render the UI to different clients like a webbrowser or native clients. The RAP Server and the Webclient are opensource. With the Tabris SDK they first commercial native client to RAP Server for Android and IOS is available. So you can reuse your existing SWT/Jface skills and build native apps for Android and IOS right like you are building Plugins for Notes today. Demos of the Tabris functionality are availabe on the google playstore. I think this is really a very cool technology and every Eclipse RCP developer should try this out.

Demos of RAP for Webclients


Lotusscript Code aus Java plugin aufrufen

16. Februar 2013 Posted by Ralf Petter

In bestehenden Notesanwendungen steckt jede Menge Lotusscript Code der über viele Jahre aufwendig entwickelt wurde, deshalb möchte man bei der Entwicklung von Plugins nicht das Rad neu erfinden, sondern bestehenden Code auch aus Eclipse plugins aufrufen. Wie dies geht möchte ich heute gerne zeigen:

Als erstes muss man die Notes API (com.ibm.notes.java.api und com.ibm.java.ui) dem Plugin als Abhängigkeit hinzufügen.

Als Beispiel habe ich eine scriptlibrary mit einer Funktion getUmsatz mit den Parametern Kundennummer und Jahr hergenommen. In der Funktion der Scriptlibrary werden aufwendige Datenbankzugriffe und Berechnungen durchgeführt, die wir in java nicht nachprogrammieren wollen.

Da man von Java nicht direkt auf die Library zugreifen kann, braucht man als erstes einen kleinen Agent der als Brücke zwischen dem Plugin und der Scriptlibrary fungiert.



Option Public
Option Declare
Use "UmsatzScriptLibrary"
Sub Initialize
Dim ses As New NotesSession
Dim context As NotesDocument
Set context=ses.Documentcontext
Call context.Replaceitemvalue("umsatz", getUmsatz(context.Getitemvalue("kundenNummer")(0), context.getItemValue("jahr")(0)))
Print context.Getitemvalue("umsatz")(0)
context.save True,false
End Sub


Der Agent macht nichts anderes, als dass er ein in Memory Dokument über den Dokumentcontext holt. Die Aufrufparameter für die getUmsatz Funktion ausliest und das Ergebnis der Funktion in der Variable Umsatz speichert. Natürlich konnte man den Agent auch dahingehend erweitern, dass in dem in Memory Dokument auch ein Parameter für die auzurufende Funktion mitgegeben wird und er dann die richtige Funktion aus der Scriptlibrary aufruft.

Wichtig bei dem Agent ist, dass man das Ziel auf "None" setzt. Sonst funktioniert der Zugriff auf das übergebene Dokument nicht zuverlässig.


Der Javateil ist etwas aufwendiger:


public static void berechneKundenUmsatz(String kundenNummer, int jahr) {
try {
// Starte den Zugriff auf den Workspace und erstelle ein
// NotesAgentDataobjekt mit unserem Brückenagent.
NotesUIWorkspace ws = new NotesUIWorkspace();
NotesAgentData data = new NotesAgentData(new NotesDatabaseData("",
"test.nsf"), "agent");
// Füge die Aufrufparameter für die Scriptlibrary dem data Objekt
// hinzu. Diese werden später im documentcontext als Items
// verfügbar.
data.addItem("kundenNummer", kundenNummer);
data.addItem("jahr", new Integer(jahr).toString());
// Erstelle ein Callback Objekt. die Methode done dieses Objekts
// wird nach Ausführung des Brücken Agent aufgerufen.
NotesDocumentDataCallback callBack = new NotesDocumentDataCallback() {
@Override
public void done(final NotesDocumentDataEvent event) {
// Erstelle einen Notessessionjob in dem wir auf das
// zurückgegebene Dokument zugreifen können.
NotesSessionJob job = new NotesSessionJob(
"verarbeite Ergebnis") {
@Override
protected IStatus runInNotesThread(Session session,
IProgressMonitor arg1) throws NotesException {
// Lade das Dokument, dass der Agent mit dem
// Ergebnis befüllt hat.
Document doc = event.getDocumentData()
.open(session);
// Speichere das Resultat in einer Finalen Variable,
// dass wir es im UIThread weiterverwenden können.
final double result = doc
.getItemValueDouble("umsatz");
// Mache irgendetwas im UI mit dem Resultat. In
// unserem Beispiel eine Dialogbox anzeigen.
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
MessageBox box = new MessageBox(PlatformUI
.getWorkbench()
.getActiveWorkbenchWindow()
.getShell());
box.setMessage("Das Ergebnis ist: "
+ result);
box.open();
}
});
return Status.OK_STATUS;
}
};
// starte den Notesjob
job.schedule();
}
};
// Führe den Agent mit dem data und callback Objekt aus. Der letzte
// Parameter bedeutet, das der UIContext keine Rolle spielt. Das
// heißt es ist egal auf welches Dokument im UI derzeit geöffnet
// ist.
ws.runAgent(data, callBack, false);
} catch (NotesException e) {
e.printStackTrace();
}

}
Das ist jetzt natürlich nur ein kleines Beispiel, bei dem der Aufwand vielleicht nicht dafür steht, aber in dem Lotusscript agent kann auch auf das UI zugegriffen werden. Das heißt der Agent kann Dialoge anzeigen und er kann auch mehrere Werte oder eine ganze Liste als Ergebnis zurückliefern. Damit kann man auch bei der Entwicklung von Plugins sehr leicht bestehenden Code wieder verwenden.