Settings Management in the DVT Eclipse IDE - How to Share Preferences

Description

DVT allows you to customize various settings, from memory allocation thresholds to run configurations or editor specific preferences like tab width and code templates.

When DVT is used in a team you may want to share specific settings with your colleagues.

This video shows how to share some common editing preferences, and illustrates the precedence mechanism of user-specific settings over common settings.

Transcript

Let's suppose you want to share a specific DVT preference with everyone in your group, namely to insert spaces instead of tabs with a tab size of 3 characters.

Setting Up a Shared Location for Settings

Pick a shared location where the settings will be stored. It must be writable by you and readable by all DVT users. Point the DVT_COMMON_SETTINGS environment variable to this location.

Modifying Preferences to Share

Start DVT and modify the preferences you wish to share. Go to Window > Preferences, then General > Editors > Text Editors. Check Insert Spaces for Tabs and modify the displayed tab width to 3.

Notice that in the DVT-Settings/user folder, a new file called preferences.ini has been created. This file contains the preferences we've just changed.

Sharing the Preferences File

Drag and drop this file into the DVT-Settings/common folder to share it. Note the actual location on disk is specified by the DVT_COMMON_SETTINGS environment variable.

Verifying Preferences for Another User

Now let's check that the preference is set for another user.

  1. Close DVT.
  2. Switch user.
  3. Point DVT_COMMON_SETTINGS to the same location as earlier and start DVT.

Go to the text editor's preference page and notice the preferences are taken from the common settings as expected.

Remember that anyone who wants to use the common settings must point DVT_COMMON_SETTINGS environment variable accordingly before starting DVT. The recommended way to do this is to wrap up the environment setup and the call to dvt.sh or dvt_cli.sh in a single wrapper script.

Overriding Common Settings with User Settings

Now let's assume the current user actually wishes to override some of these inherited common settings with a personal preference. For example, to keep the tab size but use tab characters instead of spaces.

After we change the preference, another preferences.ini file is created in the DVT-Settings/user folder. The user settings always have precedence over the common settings.

Let's open a file, show whitespace characters, and insert a tab. We see a tab character is inserted instead of spaces, as specified by the user settings, with a displayed tab width of 3 characters, as specified by the common settings.

Note the actual location on disk of the user settings folder is in the home_directory/.dvt/settings.