Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Retrieve the Epsilon Simulink preferences programatically
Retrieve the Epsilon Simulink preferences programatically [message #1793193] Wed, 01 August 2018 12:27 Go to next message
Stuart Hutchesson is currently offline Stuart HutchessonFriend
Messages: 9
Registered: September 2011
Junior Member
I am successfully running an ETL transformation from an EMF model to Simulink as an Eclipse plug-in - however I have to provide the "Library Path" and "Engine Jar Path" properties programatically at the point I load the model. I have hard-coded them in my example and it works fine.

	    StringProperties properties = new StringProperties();
	    properties.put(SimulinkModel.PROPERTY_NAME, "Simulink");
	    properties.put(SimulinkModel.PROPERTY_FILE, genFolder+modelName+".slx");
	    properties.put(SimulinkModel.PROPERTY_READONLOAD, false + "");
	    properties.put(SimulinkModel.PROPERTY_STOREONDISPOSAL,  true + "");
	    properties.put(SimulinkModel.PROPERTY_SHOW_IN_MATLAB_EDITOR,  true + "");
	    properties.put(SimulinkModel.PROPERTY_CACHED, false+"");
	    properties.put(SimulinkModel.PROPERTY_LIBRARY_PATH,"C:\\matlab\\2016b\\bin\\win64");
	    properties.put(SimulinkModel.PROPERTY_ENGINE_JAR_PATH,"C:\\matlab\\2016b\\extern\\engines\\java\\jar\\engine.jar");	    

	    try {
			simulinkModel.load(properties);
		} catch (EolModelLoadingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}


However I have now moved to a different machine where Matlab is installed on a different path, and the model load obviously fails. Rather then providing my own Preferences Dialog to store the machine configuration I would prefer to read the "Epsilon->Simulink" preference values.

I have tried the following without success :

		IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode("org.eclipse.epsilon.common.dt");
		String val = preferences.get("engine_jar_path", "default");


Would it be possible to provide a code snippet that shows how to retrieve the preferences?
Re: Retrieve the Epsilon Simulink preferences programatically [message #1793197 is a reply to message #1793193] Wed, 01 August 2018 12:45 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Stuart,

The following seems to be doing the trick:

ScopedPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.epsilon.common.dt");
String engineJarPath = store.getString("engine_jar_path");
String libraryPath = store.getString("library_path");


Cheers,
Dimitris
Re: Retrieve the Epsilon Simulink preferences programatically [message #1793205 is a reply to message #1793197] Wed, 01 August 2018 13:35 Go to previous message
Stuart Hutchesson is currently offline Stuart HutchessonFriend
Messages: 9
Registered: September 2011
Junior Member
Dimitris,

That works perfectly :)

As ever thank you for your speedy response.

Cheers,
Stuart
Previous Topic:Links to source code broken
Next Topic:Programmatically using EML
Goto Forum:
  


Current Time: Thu Apr 25 21:00:41 GMT 2024

Powered by FUDForum. Page generated in 0.10194 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top