Add configuration file for rcp binary - eclipse-rcp

I created a .properties file in RCP application to specify the server address, so that I didn't need to modify the source code when the address is changed.
This works well when I run RCP from the .product file, but it didn't work when I exported the RCP to an executable app. I have included the conf.properties when exporting the RCP (add to build.properties of the feature).
I can't run the application by double clicking the .exe file. I have tried many methods to get the root path of rcp binary but every time it fails. So how to get this configuration file work in binary, or is there other way to do this?

Use
URL installURL = Platform.getInstallLocation().getURL();
to get a URL for the RCP installation directory.
An alternative is to set properties in the 'xxx.ini' file for your RCP ('console.ini') in your case.
You do this in the .product file editor by adding -Dpropery=value values to the 'VM Arguments' section on 'Launching' tab.
Note that during testing these values will not be used, in that case you can set properties in the 'Run Configuration' for the RCP.

Related

Running ANT targets using .launch file

In one of my legacy project ant target is invoved from *.launch file. This file contains <launchConfiguration> tag and one of the attribute name "type" is ant class org.eclipse.ant.ANTLaunchConfigurationType, different parameter are set using this tag. When this launch file is executed in eclipse, one of the ANT target is executed specified in launchConfiguration tag.
I am not able to find any information around this functionality of ANT. Only relevant thread found is, which is unanswered
Running eclipse ant targets from an external command
I am not able to understand how launch files are created and how to set parameter to launchConfiguration tag.
The .launch files are created by Eclipse for every Run Configuration you want to be saved:
Open Eclipse.
Select a build.xml file.
Through the context menu, execute Run as/Ant build.... A dialog appears.
If you want to pass parameters to the Ant script, you have to fulfil the Arguments area (in the Main tab) like this:
-Darg1=value1
-Darg2=value2
...
Then, go to the Common Tab and focus on the Share file field: With the Browse button, select your project. This will create the .launch file into your project, and let it available for further executions. (You should rename it).
Execute Run.
You can edit the .launch configuration in menu Run>External tools>External tools configuration.
Note: Within the Run Configuration, you'd better spend some minutes reading all the parameters available in all the tabs. For example, in the Build tab, you can set if you want a project to be build before your script is executed (If not, unchecking the checkbox may save you a lot of time). Or in the Refresh tab, you can select which project directories you want to be refreshed after the script is executed, etc.
Launch configurations for Ant Builds are created and managed using the 'Run > External Tools > External Tools Configurations...' dialog.
You can import existing .launch files using 'File > Import... > Run/Debug > Launch Configurations'

Adding Files to the Root of a Eclipse e4 rcp application

In order to add some configuration files to an Eclipse e4 rcp application, I have followed the steps from greg-449 in this link:
The application is featured based, and in the feature project folder I have attached the file "test_config_file.txt"
At featureĀ“s 'build.properties' file are the next lines:
bin.includes = feature.xml
root=file:test_config_file.txt
Basically it is what is stated at the above link.
When I run the product (via Run Configuration), the file is not copied to the folder where the Run Configuration locates the product.
The configuration in the feature is only used when you build / export a product.
When running the code using a Run Configuration you will have to put the files in the correct location manually. Alternatively your code could support a command line argument to specify the location of the file.

How to change Eclipse RCP product exe properties

I am using Maven with Tycho plugin to materialize the Eclipse RCP product. What I need is when I right-click the product exe file and choose properties I need some relevant information onthe Details tab (File Description, Product Name, Product Version...).
Now I have found so far, that this could be achieved with .rc file with VERSIONINFO statement
(see Comment 10 at this bug). I also found in tycho-user mailing list that rc file CAN be included in Tycho build to achieve the desired behavior. Nontheless I was unable to find out where to put the rc file, or how to name it or where to set its location.
Thanks
You are misreading the bugzilla discussion, as that is only possible by self-compiling the eclipse launcher source (with a modified rc file).
However, there is an alternative: You can patch the launcher executable manually (using any kind of resource editor) and then put it into your product as root file. This works with tycho, I use that approach. The drawback is of course that this executable will not be updated, if you change branding details in the product definition file.
Alternatively to a root file you could also overwrite the launcher executable during an installation creation (outside of Eclipse). E.g. we create an NSIS installer around an RCP app and can also modify it there.

How can I automatically validate the dependencies in my RCP .product file?

I'm a bit new to building Eclipse RCP applications, and I'm finding it necessary to validate the list of plugins in the Dependencies tab of the .product file. But Eclipse (Indigo) offers no tools to help. In the launch configurations, there are great tools in the Plug-ins tab (buttons Add Required Plug-ins and Validate Plug-ins). It seems like there are 2 really obvious solutions that just aren't available:
Add a new button (or something) to copy the exact list of plugins from a .launch into a .product file (I tried to manually copy the text of the backing files, but the xml formats differ), or
Put the same two buttons in the Dependencies tab of the .product file.
I'm only creating one simple plugin, and the dependency list has 300 entries... very tedious to manually compare with a .launch! Am I missing something, is there actually a way to validate these dependencies directly in the .product file? Thanks for your help.
Byron
Here are two posibilities to get what you want:
Create a new product configuration
In the New Product Configuration dialog under Initialize the file content select Use a launch configuration and choose your Plug-In's launch configuration
Open the *.product file, switch to the Dependencies tab and you can see all Plug-Ins which are required to run your defining Plug-In
Edit an existing product configuration
Open the *.product file, switch to the Overview tab and select your Plug-In's launch configuration under Product Definition / Application
Switch to the Dependencies tab and add your defining Plug-In via the Add button
Select the Include optional dependencies when computing required plug-ins checkbox (which you can find at the bottom)
Hit the Add Required Plug-Ins button and you can see all Plug-Ins which are required to run your defining Plug-In

how to export or copy java applet parameters on eclipse

I set a bunch of applet parameters on run/debug configurations on eclipse.
I would like to share these parameters with my co-workers, but I cannot find an easy way to copy these parameters. I looked through the plugin and project files to figure out where these parameters are stored, but I couldn't find them. Does anyone happen to know where these configurations are stored?
thanks in advance...
Launch configurations in Eclipse can be saved in the workspace in one of the projects and committed under source control. When the project is imported in Eclipse, the launch configuration will be found and automatically added in Eclipse.
To store the launch configuration in the workspace:
Run > Run Configurations... > Select the launch configuration > Common tab > Shared file
In the text field, you specify the location, where the configuration to be stored.