Eclipse 4 RPC - converting IEclipsePreferences to IPreferenceStore? - eclipse

Why Eclipse has org.eclipse.jface.preference.PreferenceStore and if i want to use Eclipse 4 RCP, which is based on jface and some eclipse runtime, than i need to use org.osgi.service.prefs.Preferences instances accessible via ConfigurationScope.INSTANCE?
I need to save some config for my jface based UI (SourceViewer), which is already implemented and is using IPreferenceStore.
So how i should save my config? Save it via ConfigurationScope.INSTANCE and than implement custom IPreferenceStore on top of it or how?
I was even thinking about using my own .properties file and than pass it to the PreferenceStore constructor, but i am not sure than where i should place that .properties file (in what directory?)
That Eclipse 4 looks for me a bit incompatible with it self.

It is not all that clear what your question is, here is some relevant information
ConfigurationScope.INSTANCE.getNode("node id")
gives you IEclipsePreference stored in the 'configuration' subdirectory of the RCP installation directory.
InstanceScope.INSTANCE.getNode("node id")
gives the preferences stored in the instance location in the .metadata/plugins/org.eclipse.core.runtime/.settings directory. The instance location is what Eclipse 3.x calls the workspace.
In Eclipse 3.x the IPreferenceStore for a plugin is actually
new ScopedPreferenceStore(InstanceScope.INSTANCE, "plugin id");
but ScopedPreferenceStore is not available in e4 (unless you copy the source code).

Related

Eclipse RCP config.ini

Is it possible to call and use the confi.ini file generated by RCP product in RCP plugin project ?
In the Configuration tab i've added two properies that i want to call and use in my RCP plugin project .
The two properties are an URL adress and a KEY. I've added them in the config.ini so when I export my RCP product and deploy it later, other users could modify the KEY or the URL.
I hope that my post is clear enough !
Thanks in advance.
Ismail
Properties you define in the config.ini can be accessed using the standard System.getProperty("property-name") call.
When you are testing an RCP in Eclipse using a Run Configuration you can either specify the property in the Arguments tab, VM arguments part, using the format:
-Dproperty=value
Or you can specify a config.ini template on the Configuration tab. In either case you still use System.getProperty to access the value.

Netbeans, get the right javadoc for EclipseLink

In Netbeans 7.2.1 i've created a new java project
In the project properties, in the libraries section, i've added "EclipseLink (JPA 2.0)" that is a library that ships with Netbeans (at least with this version).
But javadoc isn't provided so, for example, when i try to instantiate an EntityManagerFactory:
Persistence.createEntityManagerFactory(String string Map map)
i can't get support, so eventually i don't know what i am expected to pass into the map argument.
How can i determine the correct javadoc file/s to add and where can i find it?
Solution attempt 1
As far as i can see, there is no reference to the url of the project inside the library, so you are supposed to get this information in other places.
Once i've got the information (http://www.eclipse.org/eclipselink/api/2.5/index.html), i downloaded the zip file and i put in a local directory:
/home/homersimpson/NetBeansLibraries/EclipseLink (JPA 2.0)/eclipselink-javadocs.zip
Then, in NetBeans Ant Libraries, i've added, for the "EclipseLink (JPA 2.0)" the zip file to the sources.
I still cannot get help for class: javax.persistence.Persistence
but in the .zip file i have:
javax/persistence/Persistence.html
I assume NetBeans needs to source to show you the java docs. So ensure you include the source code jar for JPA.
For online java docs see,
http://www.eclipse.org/eclipselink/api/2.5/index.html

How to manage build.<username>.properties file content with Liferay IDE?

I have this file of following content
#Managed by Liferay IDE (remove this comment to prevent future updates)
#Tue Jan 24 22:42:39 MSK 2012
app.server.portal.dir = D:\\APPS\\liferay-portal-6.1.0-ce-ga1\\tomcat-7.0.23\\webapps\\ROOT
app.server.lib.global.dir = D:\\APPS\\liferay-portal-6.1.0-ce-ga1\\tomcat-7.0.23\\lib\\ext
app.server.deploy.dir = D:\\APPS\\liferay-portal-6.1.0-ce-ga1\\tomcat-7.0.23\\webapps
app.server.type = tomcat
app.server.dir = D:\\APPS\\liferay-portal-6.1.0-ce-ga1\\tomcat-7.0.23
Hence I can either remove a comment and edit this file manually, or I can manage this file from Liferay IDE. Suppose I chose last option.
How to perform it? How to manage build.<username>.properties from within Liferay IDE (Eclipse)?
REPHRASE
In other words, under which circumstances the Liferay IDE writes paths into mentioned file, and where it takes these paths from?
AFAIK there's no specific UI for maintaining this file, but there are not too many items that typically get overridden. "Managed by Liferay IDE" means that Liferay IDE manages it by itself. If you want some changes in there by yourself, you can't have IDE manage it.
Remember: This is the file with the differences to build.properties. You should not change build.properties for better maintenance during upgrades - build.username.properties contains your private settings. Start from what Liferay IDE generates for you, then change it manually if required.
These values are written out from the configured Liferay Runtime that is set on a specific project. So before the SDK is used to perform a operation on a plugin, the values from the user's configured Runtime "Window > Prefs > Servers > Runtim environments" (specifically the liferay runtimes) are saved to the build..properties before the operation is invoked. That is if you have a project that is configured with Liferay Portal 6.1 runtime, then that path to the runtime will be used in the properties file.
See this code here.

How to simply add jar files, as libraries in a Netbeans module suite?

I'm a bit confused with NetBeans (versions 6.5 and 6.7). I have a NetBeans Module Suite application, which consists of several NetBeans Modules. I need to add some code in one of the modules. The new code is using a library, distributed as several jar files.
The problem is, that NetBeans does not allow me to add this library jars directly to the classpath. It wants to wrap all the jars in a new Library Wrapper Module, which is then added to the project and used from there. The effect is that all the original jars are combined into a single new jar automatically by NetBeans. This is a problem, because I can't just replace the jars later, without rebuilding this "Library Wrapper Module" and the original library is updated nightly.
I read some NetBeans forums, but I found nothing... I tried with simple java application, where it is possible to simply add jar(s) to the classpath using Project Properties -> Libraries -> Add JAR/Folder. If you use a NetBeans module instead of a simple application, the Libraries dialog looks different and does not have the "Add JAR/Folder" button.
Is it possible to add a plain normal jar in a NetBeans module and how?
It looks like the way a user can wrap a jar has changed in NetBeans 6.8.
Since this has been integrated into a property dialog of a project, the build process might be smarter, too. And it seems like that was your primary concern....

Spring Explorer not showing beans from bean definition file

I just downloaded the Springsource Tool Suite, and I created a simple bean configuration file called myDefinition.xml and placed it in the root directory of the Spring Project. However, the Spring Explorer is not showing any data. I'm using eclipse 3.5 and the latest SpringSource all-in-one installation.
Also, if I specify invalid property names in the configuration file, I get no error. Autocomplete, however, is working.
Thoughts?
In the Spring Explorer tab in Eclipse, right click on your project > properties. Then go to Spring > Beans Support and select the Config Files tab. You can then select files or scan a directory and that should add them. I haven't found a way to autoscan a directory so I don't have to do this whenever I add a new spring bean file. The beans that appear in that list are stored in the .springbeans file.
Just want to add that if you want to generate a diagram of a webflow of an existing project, you have to right-click said project in Eclipses Project Explorer and "Add Spring Project Nature" by using the Spring Tools entry of the context menu.
There currently (as of 2012-04-10) seem to be problems with the Spring Explorer view when using a purely annotation driven bean definition (i.e. using Java annotations to wire everything up instead of using XML files).
There is a workaround though, by providing a minimum XML file that declares scanning for components.
http://forum.springsource.org/showthread.php?118928-Spring-Explorer-with-Java-based-Web-Container-configuration
Unfortunately, this procedure is still flawed, missing some components.
Just to add Claudio030
Make sure you have JEE perspective selected for your project, otherwise it won't show in Java perspective.