As eclipse is going to get more popular with Actionscript developers with the advent of Flex 2. I thought I’d post some info about setting up eclipse with multiple contexts and plugins but still making sure there is control over ‘plugin pollution’ and conflicts.
For the greater part installing plugins for most eclipse users is just a matter of extracting a compressed archive and copying the extracted folders and files to the relevant directories within the eclipse directory. However…if like me you have a multitude of plugins and contexts installed you probably have your copy of eclipse configured slightly differently from the norm.
If you don’t, feel free to read on and see if you this could help…
On one hand you may have multiple eclipse installs thus separating your various configurations from each other. This leads to the cleanest setups of all, but does mean you tend to have lots of eclipse directories on your system taking up lots of disk space. However the benefit is you can also run all of your eclipse configurations simultaneously as well as shielding your individual plugins / features from each separate instance of eclipse.
One issue that this brings up though is that if you wish to install a generic plugin you’d need to place it in each of the recipient eclipse folders so they can utilize them. This can be alleviated by incorporating another setup process which for clarity I’ll refer to as externalized configurations, (I use this particular setup myself), keeping your additional features / plugins separate from the default ones that come with eclipse. To do this you’ll need to create a folder external to your eclipse(s) folder(s). You can call this whatever you want but something to do with eclipse will probably make sense. I called mine eclipse_configs.
So the process would follow something like this*:
- Create an eclipse folder (c:\eclipse_configs\eclipse)
- Create an eclipse features folder (c:\eclipse_configs\eclipse\features)
- Create an eclipse plugin folder (c:\eclipse_configs\eclipse\plugins
- Create an extension descriptor file (c:\eclipse_configs\eclipse\.eclipseextension)
*Full details of how to achieve this can be found on Matt Conway’s blog (it is orientated for Linux but is fairly easy to follow if you use Windows)
The last step required is the creation of a file called .eclipseextension now this can cause issues on a Windows box as Windows XP, (and I suspect 2000 et al), really doesn’t like renaming files that appear to have no extension, or in this case no valid name. So you’ll need to create the file with the correct name first time round to avoid this headache. To do this open Notepad and add in the details below. Make sure to change the version value to your actual eclipse version (this is different to Matt’s recommendations – see the next paragraph for the reason for doing this).
Now save the file in the directory as detailed above by selecting ‘All (*.*)’ from Notepad’s ‘Save as type:’ drop down. The reason we needed to add these details into this file is that if you leave it with generic information in it some plugins will not install properly into them via an eclipse update site download.
Now the structure we have is our eclipse_config directory with a folder called ‘eclipse’ inside of it, but how does this really differ from the default directories in our eclipse installs? Well it doesn’t at the moment but we will rectify that now.
Say you wished to install the PHPEclipse context, create another folder inside your configuration directory and give it a meaningful name. For example my path is:
Now copy the eclipse folder inside our configuration directory and paste it inside our new PHPEclipse folder. This is a time saving tip, as this folder is still empty apart from the directories and the .eclipseextension file we made so we can save a bit of time with a cut and paste :P.
Now download and extract the PHPEclipse archive and copy the files into the relvant directories within the eclipse folder. Again my path is:
Now we need to configure Eclipse’s shortcut with our workspace. This you can read up on in Matt’s guide, specifically see step 5. The bit you’re looking for is -data xxxx. If you don’t want to create multiple shortcuts with the workspaces as part of the -data switch no problem. I would however recommend upping the memory thresholds at least if you have the ram as this makes for a far smoother ‘ride’: -Xms256M -Xmx512M
Below is my shortcut properties panel for eclipse – as you can see I have the memory set to 256MB.
We’ve almost finished the last part of this process is to add our new configuration into our eclipse IDE. To do this we need to add in our external configuration path. We can do this by selecting: Help > Software Updates > Manage Configuration.
This will open a dialog showing our eclipse SDK with the general configuration path below it, if it isn’t open you can click the expander (+/- box) to see it. We need to add our external configuration here. Make sure the Eclipse SDK entry is highlighted and then just open the contexct menu and select: Add > Extension Location.
This will open a ‘browse for folder’ dialog allowing you to locate the eclipse folder in our external directory, in this example it would be:
Click OK and you’ll see it appear underneath the default entry. You may wish to restart the IDE at this point.
So by now you may be thinking why on earth go through all this aggro, well it allows the simple enable / disable of features that aren’t required all of the time. More importantly it allows you to keep potential conflicts separated in different configs. Especially when a plugin is in the process of maturing. If you had placed it into the general plugin / feature folders it can be a real devil getting the files back out again. Plus as Matt points out, when you upgrade eclipse it’s just a matter of adding the external locations back in and off you go again.
Thanks for sharing this! Eclipse seems to be useful tool for programming As/RoR/Java etc.
Thanks for the article,
You touched on the problem winxp with invalid file name like
.eclipseextension. It seems you did not conclede that point.
I followwed along but at the last stage i get message “Invalid Extension- Selected location does not contain a product extension…..
Pse assist with this.
Hi P.K, actually I did say that you need to create the file straight off the bat in Notepad and save it as .eclipseplugin otherwise you get the error:
“…So you’ll need to create the file with the correct name first time round to avoid this headache. To do this open Notepad and add in the details below. Make sure to change the version value to your actual eclipse version (this is different to Matt’s recommendations – see the next paragraph for the reason for doing this).
Now save the file in the directory as detailed above by selecting ‘All (*.*)’ from Notepad’s ‘Save as type:’ drop down…”
For clarity I should have really indicated that you need to put .eclipseplguin as the file name at this point (you shouldn’t have a .txt extension at this point).
If you are still having problems reply to my comment and I’ll post up my version for you to use.
How do you delete an extension location from the eclipse registry. I have a feature which can’t be uninstalled. If I delete the entire folder of the extension location I can’t add the same feature again properly
I know, this is a old post and eclipse version is different. I am using Eclipse 3.5.2, and don’t see any option to specify directory of plugin, while installing a plugin. Can you help ?