DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Coding
  3. Frameworks
  4. Eclipse Global Preferences

Eclipse Global Preferences

Erich Styger user avatar by
Erich Styger
·
May. 12, 12 · Interview
Like (1)
Save
Tweet
Share
16.82K Views

Join the DZone community and get the full member experience.

Join For Free
rate this

eclipse is good, but like any other tool: it gets better after i have it customized for my special needs. eclipse stores a lot of settings in the workspace, see my article about copy my workspace settings . but is there a way to apply some settings to every workspace? at least to the new ones? because importing/exporting the settings can get really tedious as i have many workspace.  and indeed, there are global settings in eclipse. and i want to have them changed…

warning: changing eclipse global preferences might break an eclipse installation. so better have a backup of the changed files at hand!

i’m using here the eclipse based codewarrior for mcu10.2 , but things are pretty much the same for any eclipse based product (see the documentation in defining your own global preferences ).

question: where are the global preferences stored? the first thing to check is the eclipse\configuration\.settings folder: here some plugins store their global preferences. for example: the recent workspace settings are in org.eclipse.ui.ide.prefs.

#fri apr 06 16:46:14 cest 2012
recent_workspaces_protocol=3
max_recent_workspaces=10
show_workspace_selection_dialog=true
eclipse.preferences.version=1
recent_workspaces=c\:\\tmp\\wsp_test\nc\:\\tmp\\wsp_10.2

but what about all the other settings? looking at the codewarrior installation, inside the eclipse folder, i find the cwide.ini file.

cwide.ini file

cwide.ini file

this file defines the eclipse startup options for launching the ide (cwide.exe for codewarrior). the interesting part is this line:

-declipse.plugincustomization=cwide.properties

this tells eclipse to use the cwide.properties as a default configuration file. if i inspect that file, it has the following content:

org.eclipse.debug.ui/org.eclipse.debug.ui.switch_perspective_on_suspend=always
org.eclipse.debug.ui/org.eclipse.debug.ui.switch_to_perspective=always
org.eclipse.ui.editors/spellingengine=org.eclipse.cdt.internal.ui.text.spelling.cspellingengine

ok, that gives me an idea how settings could look like. but the question is: how to know the settings and syntax? what works (most of the time) is following approach:

  1. launch eclipse with a new workspace
  2. export the settings using file > export > general > preferences to a file
  3. change the setting in window > preferences
  4. export the settings using file > export > general > preferences to a different file
  5. compare/inspect the exported information and find the settings
  6. apply the settings to the cwide.properties file, without the /instance/ part
  7. restart the ide and check if it works with a new workspace

the last check is necessary as not all settings might work that way, see this forum post .

this is maybe best illustrated with an example. i have configured my workspace to use 2 for tab width and to insert spaces for tabs:

changed preferences for tabs

changed preferences for tabs

if i compare the two exported .epf files, this gives me:

diffing eclipse preference files

diffing eclipse preference files

that means the two following lines are configuring what i have changed:

/instance/org.eclipse.ui.editors/tabwidth=2
/instance/org.eclipse.ui.editors/spacesfortabs=true

for the cwide.properties file i need to cut off the /instance/ part, so i have this added to the cwide.properties :

# set tab width to 2
org.eclipse.ui.editors/tabwidth=2
# using spaces for tabs
org.eclipse.ui.editors/spacesfortabs=true

note: preferences are applied in following order: global preferences, then local (workspace) preferences

this does not overwrite an existing setting of my workspace. as i can see from above diff, my initial workspace settings do not have any settings for tabwidth and spacesfortabs. creating a new workspace use and apply my new settings. but once i have the them, they will not be overwritten with new global ones. which makes sense: the local settings are winning.

note: post a comment if you know an elegant way how to enforce/overwrite workspace settings with global ones.

Eclipse Workspace

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Java Code Review Solution
  • Secure APIs: Best Practices and Measures
  • Custom Validators in Quarkus
  • A Beginner's Guide to Infrastructure as Code

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: