Deprecated Settings Management (before DVT 3.5)
DVT settings use the Eclipse Platform settings mechanism. By settings we refer to every option that can be configured by users and are restored between different invocations of DVT.
There are 3 types of settings:
Workspace Settings
Project Settings
Other Settings
Workspace Settings
Workspace settings are mainly those that can be set in Window > Preferences dialog. These settings are persisted in the <workspace>/.metadata/.plugins/org.eclipse.core.runtime/.settings/
There are also other settings that can be stored under <workspace>/.metadata/ directory and can be considered workspace settings. Some of them are:
The paths of the imported workspace projects
The last position of different dialogs
The settings of different views (e.g. column order)
Project Settings
These settings are always correlated to the project and are saved under the project directory. It is very important to understand that every Eclipse plugin can create and maintain its own set of files with settings related to that plugin.
.project file
By default, the Eclipse Platform creates in every project directory a .project file that can contain the following information:
Project name
Project Natures (what kind of project is that and what are the plugins that should handle this project)
Linked resources information (files or directories from outside the project that are linked into the project’s tree)
.dvt directory
This directory is used to keep all the settings needed for a DVT project. Some of the files stored in this directory are:
*_top_files or default.build used for compilation configuration. (See Build Configurations)
*_linter_waivers.xml and *_linter_ruleset.xml used for linter configuration
Other Settings
There are another two places where DVT can store information.
$HOME/.dvt.gtkrc file is used to store GTK Theme settings on linux platforms. Since Eclipse Platform 3.x doesn’t support themes, the feature uses this file to store the information about the colors. This file exists because the GTK hooks are done in the scripts before the platform is up. Be aware that GTK Theme settings are common between all DVT instances of that user.
$HOME/.eclipse directory can hold two things:
The Eclipse key ring settings, in case that any passwords are saved in DVT (e.g. CVS, SVN,… plugins can use passwords that can be protected with a master password).
User installed plugins when it uses a global installation (DVT directory is read only)
Importing Preferences From a Different Workspace
Workspace Settings can be migrated between workspaces using different methods
Using Import/Export Wizard
Using dvt.sh Script
Manually
Using Import/Export Wizard
The recommended way to migrate workspace settings is through the Preferences Import/Export Wizard.
To export the settings, start DVT in the workspace containing the settings, go to File > Export > General > Preferences, select Export All and choose the name of the file.
To import the preferences, start DVT in the new workspace, go to File > Import > General > Preferences, select Import All and choose the name of the file.
Using dvt.sh Script
Another way to import the settings from an old workspace into a new one is to use the dvt.sh script to start DVT.
Argument |
Description |
---|---|
workspace <dir> |
Path to the workspace directory. |
import_workspace_settings <dir> |
Path to the workspace from where the settings will be imported. |
force_import_workspace_settings <dir> |
Same as -import_workspace_settings, but it will overwrite target workspace settings. |
Manually
To import workspace settings from an old workspace to a new one can be done just by copying the settings directory
mkdir -p <new_workspace>/.metadata/.plugins/org.eclipse.core.runtime/
cp -r <old_workspace>/.metadata/.plugins/org.eclipse.core.runtime/.settings/ <new_workspace>/.metadata/.plugins/org.eclipse.core.runtime/
Customizing Default Settings Using dvt.ini
Eclipse Platform supports setting the default preferences for every new workspace. This option is useful in many situations:
The user wants to use the same preferences in every new workspace, and using the export/import is an overhead
The DVT application administrator wants to put a set of default settings for company wide deployment.
The easiest way to customize the default settings is to set them in clean workspace and save them using the Show Changed Preferences Dialog in the distribution’s dvt.ini file.
The required steps to do this are:
Open DVT in a new workspace
Change the preferences
Use the Window > Show Changed Preferences dialog to identify the changed preferences
Add those in the dvt_eclipse/misc/dvt.ini file
Now every new workspace will have those preferences.
Show Changed Preferences Dialog
To open the Show Changed Preferences Dialog go to Window > Show Changed Preferences
The dialog allows the user to inspect the modified preferences and save them in a file.
Changing the Default dvt.ini
To add new settings to the default settings provided with the distribution and to make them available by default for everyone who starts in a new workspace, the settings saved in the Show Changed Preferences Dialog should be added in the dvt_eclipse/misc/dvt.ini file.
The dvt.ini file already contains some settings as distribution default. The user’s settings should be appended to this file.
Some of the default settings already present in the dvt.ini file are:
Name |
Description |
---|---|
org.eclipse.ui/SHOW_MEMORY_MONITOR=true |
Enables the JVM memory monitor. |
org.eclipse.ui/ENABLE_ANIMATIONS=false |
Disables the minimize/maximize animations. |
org.eclipse.ui.editors/lineNumberRuler=true |
Shows line numbers by default in editors. |
org.eclipse.debug.ui/org.eclipse.debug.ui.UseContextualLaunch=false |
Activates “Always launch previously launched application. |
ro.amiq.dvt/spelling_user_dictionary=$DVT_HOME/misc/dvt_dictionary.txt |
Sets the path to the distribution dictionary for DVT editors. |
Using a User Customized dvt.ini
After creating a preferences file the user can replace the distribution’s dvt.ini file to make them widely deployed or he or she can start DVT with a different file for default settings using the dvt.sh script:
dvt.sh [any other argument] -eclipse_args -pluginCustomization <path_to_settings_file>