I am new to Java and I am using Eclipse for writing code and when I began I made a lot of adjustments to make Eclipse better to me, like changing the font and font size, toggling line numbers apparition and all these things.
I wanna know if is there a way for me to share these preferences, in a file or directory for example, so when I need to use another computer I can just enable my preferences and not have to do all manual tweaks again.
Thanks in advance!
It is pity that eclipse stores its preferences in the workspace so when switching to another one all the settings are lost.
You can first Export the preferences from the original workspace using File -> Export -> Preferences file. Then after the switch they can be imported back using File -> Import -> Preferences.
In case of another computer the only solution is to save the preferences file to a shared folder or use some service such as Dropbox to have the file under the auto-sync.
Related
I have java code style formatter of Eclipse (for that matter it can be formatter of the other language also). When I import he format then it is saved in the workspace and that is applicable for that workspace.
I want code format/style imported and saved in the Eclipse setting itself so that this Eclipse used by anyone gets the format whatever workspace they use.
Is it possible to override the default format? Do I have to write my own plugin?
Thanks,
I can suggest the following in the Java perspective, Eclipse version Indigo...
click Window -> Preferences
expand Java -> Code Style
click Formatter
This will get you to the Formatter screen below. Follow the link on the top right
and see if this provides you with what you are requesting.
Configure Project Specific Settings screen
I wanted settings to be present in the eclipse packaging itself so that these settings (code format, template, spacing strategy etc.) are not repeated at every project and workspace level.
I got a way (at least it works on Linux with neon version). Here are the steps
Open eclipse with some workspace location
Apply all the settings like code formatting, template, Editor
preferences and all other preferred settings present in Window ->
Preferences Press OK. it will save the preferences.
Go to File -> Export -> General -> Preferences and press Next
Make sure Export all is checked and then provide the To
Preference File location and then Click Finish
Now open the exported file in you favorite editor
You will observe it is like a properties file with each property prefixed with /instance/ or /configuration/ (these are preference scopes). Remove all these prefixes (after that all the properties will look like org.* or net.* etc.). You will also see some workspace path related properties are present in this file, either remove them or change to appropriate one.
Save this file with some name say my-eclipse-preference.epf and copy
this file to your eclipse location (where eclipse start file is
present, say ECLIPSE_HOME)
Open $ECLIPSE_HOME/configuration/config.ini and add a line with
the property puluginCoustomization=my-eclipse-preference.epf at the end and save config.ini.
Restart the eclipse, you will find your settings are present even if you open with empty/new workspace. If you are starting from terminal then got to
the ECLIPSE_HOME directory first and then start.
If you want to start from the terminal but you want to avoid going
to the directory to start (i.e. starting from any location) then you should store the file my-eclipse-preference.epf at some standard location and have the value of puluginCoustomization with full path in config.ini.
Hope this helps.
Was finding this problem with Eclipse(Kepler) over the last week, so downloaded Eclipse (Luna) and checked out the relevent project into an entirely new workspace.
I'm using *.str files for a particular project (they are standard editor files anyway - short for 'string'). But Eclipse wants to open such files as macVim files:
I have NO file associations set for *.str files:
...althought I do use macVim to open them in the underlying operating system. So I change the system editor to TextEdit and Eclipse happily now wants them to open in TextEdit - but I want to open them in the eclipse editor! (appart from anything else, I've got to develop an editor plugin for *.str files.
How can I convince Eclipse that it can open *.str in it's own editors without having to resort to the system editor?
EDIT - follow the answers - my understanding is this. If Eclipse doens't know what the file is, it will ask the system. If you ask it to open in a particular editor it will overlay that information on that particular file, and to make it happen in general (and change the icon) you need to add a file association.
You can add a a File Associations for '*.str' and set the Associated Editor to 'Text Editor'. Eclipse will use this for files that you have not yet opened.
For files that you have already opened Eclipse will be remembering the editor you last used, so for these right click on the file and use 'Open With > Text Editor'. You should only have to do this once.
Right click on the file, select open with, and there should be three options (Text Editor/System Editor/Default). Selecting text editor should associate it with eclipse (from within eclipse only) in future.
It is possible to Import+Export Clean Up setting as xml file at Preferences->Java->Code Style->Clean Up.
I want these setting to be applied on the code each time I save a file.
Unfortunately, when I go to Preferences->Java->Editor->Save Actions I don't have an option to Import+Export Clean Up settings (even though I have the option to configure them manually).
Is there a way to Import+Export these settings?
Clarification: My goal is to create Clean Up setting xml that I can share with my team members so that if any of us saves a file these Clean Up settings will be automatically applied on the code.
I am using Eclipse 4.3 Kepler.
These settings are included in the Export Preferences but only when you specify 'Export all'.
There does not seem to be any export that just exports these settings.
The settings are stored in the workspace in the file .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs but again they are mixed in with lots of other settings.
Open the old ".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs" workspace file.
Copy all "sp_cleanup.*" properties from the old workspace file and paste into the new one (replacing the old same properties).
I just ran some diffs with the generated preferences file (.epf) and identified the specific entries that need to be added to your preferences file to enable Post Save Actions
They are as follows (Tested in Eclipse Mars.1):
/instance/org.eclipse.jdt.ui/sp_cleanup.format_source_code=true
/instance/org.eclipse.jdt.ui/sp_cleanup.organize_imports=true
/instance/org.eclipse.jdt.ui/editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
/instance/org.eclipse.jdt.ui/sp_cleanup.on_save_use_additional_actions=false
They will translate into:
Window > Preferences > Java > Editor > Save Actions
Perform the selected actions on save (checked)
Format source code (checked)
Format edited lines (unchecked)
Organize imports (checked)
Additional Actions (unchecked)
When I change a setting in a window like in the screenshot below, where are those settings actually stored?
Bonus: Is there any way, using Java, Eclipse RCP etc, to access the settings programmatically?
Thanks!
Source : Eclipse wiki
If you want to keep preferences from one version to the other, export them using File/Export/Preferences.
Preferences are stored in various places (this applies to Eclipse 3.1)
for each installation (but this may vary for multi-user installations), in files stored in:
<eclipse_home>/eclipse/configuration/.settings/
There is typically one file per plugin, with a prefs extension. Note that very few plug-ins use installation-wide preferences.
for each workspace, in files stored in <workspace>/.metadata/.plugins/org.eclipse.core.runtime/.settings .
There is typically one file per plugin, with a prefs extension.
for each project --for project-level settings -- in files stored in a .settings sub-directory of your project folder.
Here's the article to access preferences using java code.
The preferences are stored in prefs files in the workspace at .metadata/.plugins/org.eclipse.core.runtime/.settings. There is one prefs-file for each plugin contributing preferences.
The programmatical access to the entire preferences is done with IPreferencesService the which you may obtain using Platform.getPreferencesService().
You may find more information and examples on how to use them in the Runtime preferences Eclipse help page.
Search for it:
Change some setting in Eclipse then run:
find ~ -type f -mmin -5 | grep "\.settings"
This will discover files modified in last 5 minutes.
Mine was in workspace, literally...
~/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs
You can see most of the relevant eclipse settings (mainly for JDT) in the saneclipse project from Lars Vogel.
See the vogellacompany/com.vogella.saneclipse repo, which will tweak and fine-tune the settings of:
com.vogella.saneclipse.preferences/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.preferences/.settings/org.eclipse.core.runtime.prefs
com.vogella.saneclipse.preferences/.settings/org.eclipse.core.resources.prefs
com.vogella.saneclipse.templates/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.fileextensions/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.fileextensions/.settings/org.eclipse.pde.core.prefs
We use Eclipse with projects in CVS. It has proven to be the simplest to create a new workspace when having to deal with another branch or application, and then use Team -> Import project set to get all the needed projects from CVS.
Unfortunately, I then have to do the following each and every time:
Change text font to Consolas 11 pt
Disable spell checking in text editors
Run everything in the background
plus some more of the same.
I'd like to change the standard values once and for all in the Eclipse distribution files after having unzipped the distribution (Windows). Where are these defaults located inside Eclipse?
EDIT: For now we just have a preference file which must be read in. An extra step, but works...
EDIT 2014: I've ended up creating a workspace with the settings I want, and then creating a new copy everytime I need a new one. Also handles Maven Central information etc. Accepted the oldest answer saying essentially this.
You can export your settings from a workspace and import them into any other (this basically does what VonC's answer says, but with some measure of error checking).
To do so, in the source workspace select File->Export...->General->Preferences, then select Export All and enter a file to export to, then Finish.
You can then import the preferences into any workspace by doing File->Import...->General->Preferences, browse to the preferences file and hitting Finish.
I have created a clean workspace with all settings i want to have. This workspace i have copied into a save folder i will never delete ;)
When i want to create a workspace for a new project, i copy the confugured workspace and thats it.
I have than configured the svn repository path, code format (you also can import preferences in eclipse for this), view configuration and so on.
Try checking:
<workspace>\.metadata\.plugins\org.eclipse.core.runtime\.settings
Some .prefs files could be interesting to copy from one workspace to the next.
(like org.eclipse.team.cvs.ui.prefs which contains any non-default value for CVS settings)
I want to fix the defaults inside Eclipse so the workspace is created with the defaults I want every time.
Hard core solution:
Change the .options file within <eclipse-SDK-3.5-win32>\eclipse\plugins\org.eclipse.team.cvs.core_3.3.200.I20090430-0408.jar (that is the name I have for eclipse3.5)
That is the file with the default values, at least for CVS.
Here's what I do:
Start up Eclipse
Without importing or starting any projects, edit the workspace and make all the config changes you want
Open up the workspace in windows explorer and create a copy of the folder.
Then, any time you wish to use it, copy this folder to your new workspace folder location - you may need to create the new workspace folder first (and definitely call it something different.)
This is what I do anyway. Yes, it's very dirty but it does get what I want pretty quickly!
When importing preferences (Rich Seller's approach above), especially those that were created by someone else, make sure you backup your Eclipse environment first. That's easy, since it's portable - just copy it to a temporary location.
I've totally hosed my Eclipse environment importing preferences in the past, and importing my own preferences, which I exported just prior to importing, did not fix my issues.
Fix the defaults inside Eclipse so the workspace is created with the defaults, If you want every time suggestions, then
Go to eclipse extract path -eclipse\configuration\.settings -> Edit -org.eclipse.ui.ide ->
Change value to true: SHOW_WORKSPACE_SELECTION_DIALOG=true
Similarly in this file you can directly change other default settings.
I find a way to do that:
open <eclipse>\plugins\org.eclipse.cpp.package.cpp_1.4.2.201210131-1456\plugin_customization.ini
and add
folding
org.eclipse.cdt.ui/editor_folding_enabled=true
org.eclipse.cdt.ui/editor_folding_preprocessor_enabled=true
then new project will enable folding by default.
So
You need to know where your prefer locate, in my case, folding is under org.eclipse.cdt.ui, you can try on an project then check <workspace>\.metadata\.plugins\org.eclipse.core.runtime\.settings to find it
"org.eclipse.cpp.package.cpp_1.4.2.201210131-1456" should be variable depends on what version you use. whatever it's, you should find "plugin_customization.ini "