Overview
Introduction
The Remote Workspace Preferences Plug-in basically provides functionality to import Eclipse preference files (EPF) from remote locations accessible by HTTP. Besides that it is able to detect new or unconfigured Eclipse workspaces and a simple variable substitution mechanism allows for localization of the preferences.
Workflow
The import process consists of three logical steps which are executed for each EPF file sequentially:
- Fetch the EPF file from a web server using HTTP.
- During the second (optional) step, variables are substituted by Java system properties bearing the same name.
- The preferences are imported into the Eclipse workspace.
The URLs of the EPF files can be configured in the preferences dialog and defaults can be set using an extension point provided in a (fragment) bundle.
Applying Remote Preferences
Manually applying the remote preferences
To manually start the import process run File > Import...
from the main menu. Then select General > Remote Preferences
.
The import wizard has two function modes:
- Import from URL: Lets the user paste an URL of an EPF file into the text field and imports it. No variable substitutions are performed in this case.
- Import from configured URL: Presents all URLs configured in the preference dialog to the user and gives the choice select which ones shall be imported. Variable substitutions are performed as configured on the preference page.
Autodetect unconfigured workspaces
If enabled in the configuration, the plug-in detects unconfigured workspaces during the start-up. It will then show the following dialog giving the user three options.
- No: The remote preferences are not imported and you are no longer bothered. However, you may still choose to start the import manually (see above).
- Ask again: The remote preferences are not imported, however the dialog will appear again next time the workspace is started.
- Yes: The remote preferences are imported right now. After a few seconds another dialog will give you the result of the import.
Creating a Remote Preference File
Create a reference Workspace
Create a reference workspace containing all the preferences as they are supposed to be including the code repository connections. It is recommended to use a separate workspace just for the reason of being the reference for all others. Do not checkout projects or work in this workspace regularly, as this might affect your well crafted reference preferences.
Export the preferences
Export the preferences of the workspace to a file using Eclipse's native export wizard. More information about this step can be found in the Eclipse Documentation.
Postprocess the preference file
There are two reasons for postprocessing the exported (epf) file:
1. Pick only a few settings
The Eclipse preferences export wizard exports all preferences of the workspace. If you just want to import some preferences, you will have to manually edit the epf file and remove all settings you don't want to distribute to other workspaces.
Example: /instance/org.eclipse.core.resources/encoding=ISO-8859-1
2. Do variable substitutions during the import process
During the import of the preference file, variable substitutions with Java system properties can be made. An example where this might be useful is to set the correct user names in CLASSPATH variables or code repository URLs.
Find the character sequences that shall be set during the import and replace them with the Java system property that shall be inserted instead. Make sure you prepend the system property name with a '$' character.
Example: /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.classpathVariable. ↵ M2_REPO=c\:/Documents and Settings/$user.name/.m2/repository
In this example, the location of the Maven local repository is user dependent and the $user.name
of the Eclipse classpath variable M2_REPO
will be substituted with the user name set in the Java system property user.name
.
Hint: Don't forget to configure the variable replacement in the plug-in's preferences.
Recorder
A very simple preference recorder/differ eases the task of picking the changed settings:
- Hit
ctrl+3
and typerecorder
, select the start command
- Open the preferences dialog and do all your changes
- Again, hit
ctrl+3
and typerecorder
, this time select the stop command. The following dialog outlining all removed, added and changed preferences. The contents can be selected and copied to serve as starting point for your tailored EPF file.
Publish the file on a web server
Publish the epf file on some web server to which all team members have access.
Getting the Configuration Status of a Workspace
The configuration status including the date and time of the last configuration process can be seen in the Configuration Tab of the Installation Details Dialog available from the About Dialog. To open that dialog select Help > About Eclipse SDK
, then hit the button Installation Details
and finally select the tab Configuration
.
Example: *** ! Remote Workspace Preferences Import Status: Workspace configuration status: configured on 2009-08-10 22:39:15
Preferences
Workspace Preferences
The behavior of the Remote Workspace Preference plug-in can be configured in the Eclipse preferences dialog. Open the dialog from the Window > Preferences
menu. The settings are located on the General > Workspace > Remote Preferences
page and contain the following options:
- Remote preference file URLs: Enter the URLs to the remote preference files.
- JRE system properties to replace during the import: This list contains all JRE system properties that are being replaced during the import. The variables you enter may not contain the character '#'.
- Check for unconfigured workspace on startup: This option switches the automatic workspace configuration check on or off.
Default Settings
There are no built-in default settings, but you may provide them using the extension point ch.netcetera.eclipse.workspace.defaultConfiguration
. The extension point supports the following configration elements:
EpfUrl:
used to configure a single static URL to an EPF file (1:1 replacement of what was previously configured in the properties file)EpfUrlProvider:
registers a class implemeneting IEpfUrlProvider that can be used to programmatically calculate/provide an URL to an EPF file.NewWorkspaceDetection:
used to switch on/off the detection of new and unconfigured workspaces. true wins in case this setting is provided several times.JavaSystemPropertyReplacement:
used to configure a JRE system property replacement.