What's the format of an Eclipse preferences export? - eclipse

An export of the Eclipse preferences looks a lot like a Properties file. Is this correct?
I'd like to share preferences with my team and for that, I need to filter the data (update/remove local paths, etc). Does anyone know any tools for this?

You might want to have a look at Workspace Mechanic for Eclipse:
The Workspace Mechanic automates maintenance of your Eclipse environment by tweaking preferences, adding extension locations, and so on. You can use it to:
Create a consistent environment among groups as large as the entire company, your local team, or even among your own many workspaces
Save time setting up new workspaces
Create tasks that ensure your favorite new preferences are applied to all your current and future workspaces. (This is one of our favorite features!)

If you have project-specific preferences, they will be stored in the .settings directory of you project.
That means you can add them directly in your VCS and share them through version control.
There is no native tool for filter them, but if you are using a Git repo, you can add filter drivers for making sure you ignore any path-specific changes.

Yes.
Preferences in Eclipse are implemented by org.eclipse.core.internal.preferences.EclipsePreferences. The save(IPath location) method will convert the internal structure to a Properties instance using convertToProperties() and then write the result to disk.

Related

What files in Eclipse contains code templates and keyboard bindings?

I have three common workplaces where I use the Eclipse IDE.
A nice trick when using multiple common workplaces is to copy certain configuration files to Dropbox, and link to them in the original configuration location. This way, all settings and changes are instantly available in your other workplaces.
You've got your workspace with a whopping 100 megabytes of files. You've got your .eclipse which is closing in on 200 megabytes.
I would like to know which specific files contain my custom javascript code templates, and which contains my keyboard shortcuts, so I can share these, and only these, with myself through Dropbox.
Ideally, I'd like a list of of certain settings and their locations so I can choose to share more. But I haven't found something like this on Google.
Why am I not just sharing my entire workspace and configuration directory? Well, first, it is crazy big. Second, Eclipse is modular. In some places I use certain modules that I don't use elsewhere. And you all know that modules/plugins are a crazy mess of files and configuration from which there is no escape.
You can try to export Eclipse preferences from one workspace and export them to other workspace. If it doesn't work for your, enter a bug against corresponding Eclipse project.
I figured it out.
You can copy your ~/workspace/eclipse/.metadata to somewhere. Change a preference, and sync your workspace to your backup in order to find out what files are changed.
You'll find that a lot of settings are in ~/workspace/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/. The javascript templates and other javascript options are in ~/workspace/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.wst.jsdt.ui.prefs
org.eclipse.wst.jsdt.ui.prefs = Code Templates
org.eclipse.jdt.ui.prefs = Syntax Coloring
org.eclipse.ui.editors.prefs = Text Editors

How Do You Set Eclipse's Default Settings for When You Create New Workspaces?

I work on a couple of large projects and have different workspaces for different projects I'm working on, to help with the speed of searching in Eclipse. I also have other workspaces for the different branches of these works spaces. When I create new workspaces, I notice that I have to update things like display of line numbers, decrease font size, and change of wrapping length.
I'm hoping there is a way to globally change these default values, so each new workspace will automatically get my preferred settings.
Some settings can be exported/imported via wizard. Export/Import -> General -> Preferences.
Alot of your settings stored in: ../workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/*
(i.e.: org.eclipse.ui.editors contains the settings for line numbers)
You can copy&paste them.
Workspacemechanic can record any change you do in Eclipse preferences, and then it can apply those changes in other workspaces that doesn't meet them.
http://code.google.com/a/eclipselabs.org/p/workspacemechanic/
By using workspace mechanic you can effectively override the global default preferences of Eclipse.
I'm using it to keep consistent fonts/color setup between different workspaces.

Eclipse - Universal Preferences Across All Workspaces?

I like to use several different workspaces, so as to keep everything organized. However, its annoying to have to copy the .settings folder to all my workspaces just because I added a keyboard shortcut. I'm looking for a way to update the preferences of all my workspaces whenever I change the preferences in one workspace. The settings I care about are keyboard shortcuts, code style, fonts, etc.
I have found this plugin which might be useful, but doesn't seem to be exactly what I'm looking for.
Ideally, I could have my settings saved in the cloud somewhere. On startup, Eclipse will check if workspace settings and the settings in the cloud differ, and if so, import them from the cloud. If I change any settings, then these preferences should be exported to the cloud. This way I also have my preferences on my school's lab machines.
Does anybody know a way to make this work? I'm all ears.
Thanks
Short answer: no. The easiest thing is probably just manually configure your preferences on those two or three PCs where you use Eclipse, and move on.
Longer answer: yes, you can copy (and standardize) Eclipse settings (e.g. for a standard configuration across your development shop). Here's a good article explaining how:
http://www.javalobby.org/java/forums/t18678.html
Finally, there's still no easy way (AFAIK) to safely and reliably UNINSTALL plug-ins as of the latest/greatest version (Indigo, Eclipse 3.7). So if you find yourself experimenting with a lot of plug-ins .. some of which you might ultimately wish to get rid of ... then maybe your best bet is installing Eclipse on a VM (say, VBox or VMWare, running Linux or Windows). Use your VM as a little "sandbox" where you can try stuff out, and easily clone (if you like it) or blow it away (if you don't).
IMHO...

Multiple sub-workspaces in Eclipse

I write code in several languages (Python, C, C++, and Java) using Eclipse. Is it possible to designate a directory on my machine (say /home/workspace/) as the "primary" workspace for any Eclipse session, but then to have subfolders, /home/workspace/python, /home/workspace/java, etc., in which I can create new Eclipse projects.
I don't want to have to navigate menus and select different workspaces for each session of Eclipse that I start up. I would rather just always have permission to manipulate any projects from a variety of folders at any time, but I can't find a clear answer about whether this can be done and how to do it.
As I understand your question; You want to have one workspace, but be able to code in several different languages without switching workspace but at the same time keep the projects separated?
First I would suggest you consider several workspaces, I find it convenient to keep settings and projects in separate workspaces. I rarely have to switch language that often.
But. I think what you want to do is to keep several working sets. You create one java working set, one C++ set and associate your different projects with a working set. Then you can minimize the java working set when you are running C++. For working sets you dont need any subfolders on the harddrive.
You might also want to look into Mylyn. Its a great tool for those who often are switching context. It saves the context (eclipse perspective, open files, etc) as associated with a task.
How about setting Eclipse to prompt for the workspace at launch? It wouldn't allow you to work in two languages at once, but should do the trick otherwise.
An Eclipse workspace can contain projects slated for different languages and those projects can live anywhere on your hard drive. There are at least two ways to do what you want. When creating a new project, uncheck the Use default location checkbox and browse to or specify the folder where you want your project to live. If a project already exists import the project into the workspace using the File->Import menu option and then select Existing Projects into workspace. In the next screen make sure the checkbox for Copy projects into workspace is not selected. This will leave the source files in the original folder.
In the Project explorer view, all the projects are going to look like they live at the root level. However you can group related projects into working sets. Then select just the working set you're interested in and all the others will disappear from view.
A warning is in order if you make use of eclipse variables in external tools (and possibly elsewhere). The syntax you use for paths needs to be adjusted. For example with projects outside the workspace this syntax ${workspace_loc:/MyProject/MyFile.txt} is no longer the same as this syntax ${workspace_loc}/MyProject/MyFile.txt

How to automatically import eclipse editor preferences that were previously exported?

I have a similar problem to this guy: Importing/Exporting Project Preferences, but my problem is worse, I need to create a new workspace (i.e. new base directory) for every program or version that I work on. I have some common preferences (formatter, font size, etc) that I have exported to a file, which I then import every time I create a new workspace, but would like to skip the step of manually importing the .epf file. Has anybody seen an easy way to automate this?
EDIT: to help potential respondents answer the question, here is my workflow for handling a bug patch. Perhaps I'm doing something wrong in general that you could correct (since I've only been using Eclipse for a couple of years and tend to prefer emacs so I haven't spent a lot of time learning new Eclipse features)?
Create new directory for the workspace.
Start Eclipse editor and open clean workspace.
Check out a CVS directory containing .psf files for the various programs (necessary because of a pre-existing CVS tree structure that does not play nice with Eclipse).
Use team import on the .psf file associated with the program I'm working on to pull in the necessary projects.
Switch all projects to the branch tag associated with the release in question.
Work...
I think that Workspace Mechanic solves all your problems.
http://code.google.com/a/eclipselabs.org/p/workspacemechanic/
copy your original workspace. Easy, reliable, but will also copy all your projects.