RCPTT – set a file from the workspace dynamically

I’m quite amazed how powerful RCPTT is!
https://www.eclipse.org/rcptt

Recently, I’ve encountered a problem. The task was to set the path of a file into the file selection dialog, but it should be independent of the currently used test system. The first try was to set the file directly, but the path is hardcoded:


set-dialog-result File "/home/testman/rcptt/HelloWorld.txt"
get-window -class WizardDialog | get-button "Select *.txt" | click

Hence, a better way is to clear the workspace and import the needed files into the workspace before running the tests. Therefore, a context can be created within RCPTT. The workspace is resolved by “workspace:/” in RCPTT. This could be a solution, cause the workspace is created independently – different systems, different locations. Hence, we could try:


set-dialog-result File "workspace:/com.acme.rcptt/HelloWorld.txt"
get-window -class WizardDialog | get-button "Select *.txt" | click

But this won’t work. We should have a look at the ECL commands:

http://download.xored.com/q7/docs/ecl-api/latest

Instead, we can get the workspace location by using the ECL command “get-workspace-location” and concatenate it with the path to our file in the workspace:


set-dialog-result File [concat [get-workspace-location] "/com.acme.rcptt/HelloWorld.txt"]
get-window -class WizardDialog | get-button "Select *.txt" | click

Tadaaa, that’s it!

Posted in Uncategorized | 2 Comments

Eclipse Hackathon Hamburg – 2015 Q41

Last Friday we had again an Eclipse Hackathon in Hamburg! Folks do Hackathons, it’s a great experience to be a part of the Eclipse Community!
https://wiki.eclipse.org/Hackathon_Hamburg_2015_Q41

Hackathon-Q41-1

Hackathon-Q41-2

Posted in Uncategorized | Leave a comment

OpenChrom 1.0.0 “Aston” GA

I proudly announce the official release of OpenChrom 1.0.0 “Aston”.
Some new data converters and a lot of improvements have been added.

https://www.openchrom.net/download
https://en.wikipedia.org/wiki/OpenChrom

OpenChrom 1.0.0 Aston

Posted in Uncategorized | 4 Comments

Eclipse Hackathon Hamburg – 2015 Q3

Yesterday, we had our third Eclipse Hackathon (2015) in Hamburg, Germany. It was a great meeting:-).
https://wiki.eclipse.org/Hackathon_Hamburg_2015_Q3

Eclipse Hackathon Hamburg Q3 2015
* Foto (C) by Tobias Baumann

Stay tuned, the next Hackathon will be in approx. three month.
https://wiki.eclipse.org/Hackathon_Hamburg_2015_Q4

Posted in Uncategorized | Leave a comment

OpenChrom 1.0.0 “Aston” Preview

I proudly announce the preview release of OpenChrom 1.0.0 “Aston”.
Some new data converters and a lot of improvements have been added. Stay tuned.

https://www.openchrom.net/download
https://en.wikipedia.org/wiki/OpenChrom

OpenChrom 1.0.0 Preview

Posted in Uncategorized | 2 Comments

Eclipse Hackathon Hamburg – Greetings

Yesterday, we had our second Eclipse Hackathon in Hamburg, Germany. It was a great meeting:-).

Hackathon-2015-Q2

Stay tuned, the next Hackathon will be in approx. three month.

Posted in Uncategorized | 1 Comment

Setting profiles in the preferences dialog

I wondered if it’s possible to allow users to work with different profile settings. That would be beneficial, cause users then don’t have to remember different plug-in settings for various analytical scenarios. Eclipse offers to export/import *.epf files, hence there should be a way to automate this. Here’s the solution:

Profiles

The preference service allows to export the currently used preferences:

public static void exportProfile(File file, IPreferenceFilter[] preferenceFilters) throws FileNotFoundException, CoreException {

	FileOutputStream fileOutputStream = new FileOutputStream(file);
	IPreferencesService preferencesService = Platform.getPreferencesService();
	preferencesService.exportPreferences(preferencesService.getRootNode(), preferenceFilters, fileOutputStream);
}

Importing stored preferences works similarly:

public static IStatus importProfile(File file) throws FileNotFoundException, CoreException {

	FileInputStream fileInputStream = new FileInputStream(file);
	IPreferencesService preferencesService = Platform.getPreferencesService();
	return preferencesService.importPreferences(fileInputStream);
}

It depends on you where to store the preference profiles. There’s only a small drawback when loading a profile within the preferences dialog. All pages are displaying the old and not updated profile values. Hence, the dialog needs to be restarted. This can be automated too from within a page.

IPreferencePageContainer preferencePageContainer = getContainer();
if(preferencePageContainer instanceof PreferenceDialog) {
	PreferenceDialog preferenceDialog = (PreferenceDialog)preferencePageContainer;
	preferenceDialog.close();
	preferenceDialog = PreferencesUtil.createPreferenceDialogOn(null, null, null, null);
	preferenceDialog.open();
}

The more better it would be reload all page values without re-opening the preference dialog. But I didn’t find a way how to do it. Anyhow, it works so far.

Posted in Uncategorized | Leave a comment