Eclipse RCP config.ini - eclipse

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.

Related

Using variables in config.ini property OSGI.bundles

Config.ini file is having the property osgi.bundles which contains the list of plugins that needs to be started while launching my RCP. For Eg.:
osgi.bundles=reference\:file\:org.junit_4.8.2.v4_8_2_v20110321-1705/#4,reference\:file\:org.mortbay.jetty.server_6.1.23.v201012071420.jar#4,reference\:file\:org.mortbay.jetty.util_6.1.23.v201012071420.jar#4
Clarification :
I need to use the Java variables/Environment variables in the reference of the plugins. So that I can make my RCP more flexible. Please suggest a solution.
I need something like below:
osgi.bundles=reference\:file\:{ENV.USERDIR}/org.junit_4.8.2.v4_8_2_v20110321-1705/#4
Here when trying the load the bundles, JUNIT bundle should be loaded from the replaced from the environment variable USERDIR as.
c:/users/username/org.junit_4.8.2.v4_8_2_v20110321-1705
Any help is appreciated.
Thanks in advance,
Vikram
This is supported in org.eclipse.equinox.launcher_V1.3.0 or higher. You can use the environment variables like
$variable_name$/bundle-name.jar.
While parsing the config file, The launcher will substitute the value of the variable and start the bundle from the specified location.

Eclipse 4 RPC - converting IEclipsePreferences to IPreferenceStore?

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).

Eclipse RCP: Plugin does not start

I wrote a new plugin for my eclipse rcp application and added the plugin to the dependencies of my product. I also tried to set the auto-start value of the new plugin to true but it does not start. It shows up as resolved but not as started.
Basically the only thing that this plugin does is to add a help file (table of contents) via the extension point org.eclipse.help.toc.
Any idea why the plugin code isn't executed?
Also: the plugin adds its content if I execute it from inside eclipse. The problem occures after I export it.
Just to be clear ... you're not expecting 'code' to run, but when you launch the exported RCP application standalone, the help contents does not appear in the TOC, right?
How did you define your RCP product? As a feature or plug-in based product?
If based on plug-in's, did you define all the necessary plug-in's on the product dependencies tab?
If based on features, did you add the new plug-in to the feature?

URL issue with tomcat include project name

I am using Eclipse for J2EE project...
one device send request to my side and url like
http://myIP:myPort/corporationweb/Controller
/corporationweb/Controller is fixed we can't change it because it made on device
my project name in eclipse is "VirtualTest" but here tomcat include project name if i mapping any servlet, /corporationweb/Controller URL like
http://localhost:8080/VirtualTest/corporationweb/Controller
I need page open without change project name
any i can mapping servlet directly so URL like http://localhost:8080/corporationweb/Controller
any URL rewriting technique..
make as default application for my project
Rightclick project in Eclipse, choose Properties, go to Web Project Settings and set Context root to /.
This will let Eclipse deploy the project on context root instead of project name (which is the default).
Unrelated to the concrete problem, you really need to ensure that your application is written the way so that it does not care on which context path the application is been deployed. This is namely a server specific setting which is not controllable from inside your project. Make use of HttpServletRequest#getContextPath() the smart way.
If you want to make "VirtualTest" as default application for your project, and not showing this name in URL, you can simply change project name to "root", which is a special name for the default application.
Your URL will be like:
http://localhost:8080/corporationweb/Controller
If you are using Eclipse. Go to server and remove the unwanted project which are Synchronized, then restart your server. Worked for me

Issue making a Liferay Hook with Eclipse Liferay IDE - getting only empty project

I am using Eclipse Liferay IDE for making a hook to a Liferay native portlet. I mean a porlet that comes with default installation, eg. blogs, content management or similar.
I have done the steps like following:
Select new Liferay Project
Enter project name MyHook
Made configurations (found an SDK directory and Liferay Server instance for Runtime)
Selected Plugin type to Hook
My only option after that was Finish and I ended up having a project with certain structure without any class or properties file inside.
My problem is that I could only get an empty project and don't know how to make the modifications to the files of Liferay because no Liferay originated package names can be found if I make a new class file and try to start typing com.Liferay. or org.Liferay. Because this is a Liferay Hook project, I suppose some Liferay originating tips should normally pop up for my selection, but I didn't see any.
What I am making wrong? What I am missing? Should I know the filenames by myself or is there a trick somewhere to tell the IDE to give me some help?
I use Liferay 6.0 and my IDE version is 6.0.5. At least in my eyes they should match together.
In the IDE you first create a "Liferay Hook Project". This is indeed an empty project. Then you create a Hook, select the Hook project to create it in. You can do the second step manually, but there's a wizard helping you to do this. This might be what you've been missing
I made the same steps again and it worked! Somehow at first time I managed to do a Java project although the project should be interpreted as a Liferay project.
Maybe the IDE is not 100% working always. Whoever knows.