Disable Eclipse plugins per workspace - eclipse

I use Eclipse for different projects, each with its own workspace. They need quite a different set of plugins (SVN vs hg vs git, AppEngine vs Tomcat vs OSGi, and so on), and I have all those plugins installed and active all the time, which clutters the workspace quite a bit. I'd like to selectively disable plugins for each workspace.

Eclipse (3.6/3.7) has a UI for disabling some plugins. It's under Window->Preferences->General->Startup and Shutdown->Plugins activated on startup. However not all plugins are listed here.
To disable other plugins:
It's possible to have separate configuration (osgi.configuration.area) directories:
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html%23osgiconfigurationarea
Simply copy eclipse_dir/configuration to a new location.
Make launchers for each of your workspace and add parameters to your workspace specific launcher, for example:
-data workspace_location -configuration new_location_for_configuration_dir .
You can disable osgi bundles (not same as plugins) by removing it's line from configuration_directory/org.eclipse.equinox.simpleconfigurator/bundles.info file.
The config.ini file in the custom configuration directory must contain this line:
osgi.configuration.cascaded=false

Another solution would be to define a perspective for each workspace, and customize that perspective.
In each one, you can deactivate menu and commands of plugin you do not want, even though those plugins remains loaded.
That help removing some of the "GUI cluttering" caused by the various plugin.
When you switch workspace, you will restore the perspective you were using with the new workspace.

Eclipse has a notion of local and global configuration that might help you. When you start Eclipse with the -local {localDir} argument, Eclipse uses a writable local configuration in {localDir} and treats the (global) install configuration as read-only. Thus, you can install common features in the global configuration (when not using the -local flag), and install local features into the local configuration. In your case, to get per-workspace configurations, you can adopt the convention that the local configuration is inside or beside your workspace directory (though if inside, not managed as an eclipse resource or project), and then always launch pointing at that directory (e.g., eclipse -data {workspaceDir} -local {workspaceDir}/localConfig).

I solved that problem by having two separate eclipse "installations". It isn't the most beautiful solution, but does the job.
Here it is suggested to use General -> Capabilities, but that doesn't seem to exist in 3.5

Related

Distributing eclipse with UI customizations

I would like to use Eclipse in an intro programming class. Is there some way I can make some kind of preferences file or some such that I can distribute with it that would set defaults for:
which buttons are in the toolbar
which menus are enabled in the application
which context-menus are enabled
what kinds of completions are available
I'd like it to start with only completing words from the current document
that is no Java API completions or code generation or whatever
This can be done using Eclipse Preferences File. All you need to do is import preferences into your workspace.
You can also export the workspace folder itself & publish Eclipse together with a default workspace folder, which will contain all the preferences.
Then create a shortcut to start eclipse with -data <path to your workspace> parameter
I'd try the following:
Install Eclipse
Put the configuration files and workspace under version control and commit.
Configure Eclipse as required.
Check all the changes in the version control to understand what configuration files are relevant to my changes.
Continue as Zilvinas is suggesting.
Look into Eclipse Oomph. It essentially automates all the tasks that you need to do to set up a fresh dev environment.
Also of interest are Yatta profiles which do a similar thing based off Oomph.
They're pretty easy to set up and publish. Get your local eclipse working, record to a profile, publish the profile, get your students to consume said profile. We've used these in a professional environment to more easily on-board new devs!

Creating custom redistributable Eclipse - issue with launcher.library

I am creating a custom version of Eclipse Neon, installing certain plugins, tweaking settings, etc. My plan is to redistribute this to everyone on my team. However I am just discovering that the plugins are being saved in a local user ~/.p2 directory that the Eclipse installer must have created or something. I would like a fully self contained Eclipse with no reference to user specific directories. I notice that in the eclipse.INI file there is indeed a reference to this local directory.
--launcher.library
C:\Users\zeroalpha\.p2\pool\plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444
When I delete it and try to launch Eclipse I get this error
How can I make a redistribute eclipse that doesn't rely on the local user ~/.p2 directory?
update: This is the error I get when launching after telling eclipse.INI to point to the launcher jar in the eclipse plugins directory instead of the local ~./p2
Modifying and "zipping up" an Eclipse installation is not the right approach for what you're trying to do. Instead, look at the capabilities of the Oomph project (the project behind Eclipse's own standard installer). Specifically, read up about Oomph Authoring to learn how to create your own installer package that includes exactly the plug-ins and configuration you want.
As #greg-449 pointed out in the coments, Lars Vogel's tutorial is also useful.

Moving eclipse installation directory causes problems

I've recently re-organised my Eclipse installation directories, to cater for various flavours of Eclipse (Helios, Indigo, Juno), but then this caused a problem as the ".eclipse" directory (that lives in my home directory) has sub folders that identify the eclipse version but end with a suffix that I think identifies the install directory
for example: org.eclipse.platform_3.6.1_12345678
So with changing the Eclipse install directory, and then booting up Eclipse, a new subfolder was created and the knowledge of my plugins installed is lost.
Why does Eclipse do this ? And how can I manage Eclipse such that I can tie the 2 directories together so I am free to move installation folder without breaking anything?
Is there any good practices of managing multiple Eclipse installations, with respect to configuration ( plugins ), and workspaces ?
By default, eclipse always stores its local configuration in the user's home .eclipse folder. You can override the default though.
In the eclipse.ini file for each of your different versions, you can add the following JVM parameter (make sure you add this line below the -vmargs line)
-Dosgi.configuration.area=#user.home/.eclipse<version>
where
<version>
is whatever identifier you choose for that particular version of eclipse.
This should help keep the different configurations separate and prevent them from stomping on each other.
Hope this helps.

Does Eclipse store any information out of its directory?

I have used Eclipse Indigo (C/C++) for sometime along with PyDev Plugin (for Python). As I messed up with the IDE (tried to tweak some core files, for fun!), I thought to install a fresh one and this time I downloaded Eclipse Indigo (for Java).
Eclipse (C/C++) was placed in C:/
Eclipse (Java) was even placed in C:/
Now when I opened Eclipse (Java), I observed two things:
The Eclipse's title bar still showing <C/C++ Eclipse>
There was a python's project file still opened up which I worked on Eclipse C/C++ IDE. Also, there was an PyDev's error popped up (mentioning it wasn't installed).
I have verified "Installed Plugins" list and didn't find any plugin related to C/C++ or python.
Now, I have got one question:
As I searched over google and found that Eclipse doesn't store anything beyond its directory, How does this above things are showing up??
There might be some Temp/ Cache files stored. However, I searched my drive with "Eclipse" and "PyDev" as keywords and found nothing.
I even searched for registry keys but couldn't find anything.
What exactly is happening and how do remove Eclipse completely?
TL;DR: using the new Eclipse (Java), select "File > Switch Workspace... > Other...", and create a new directory (e.g. java-wks) for all projects you will do using the new Eclipse.
The long explanantion is that Eclipse stores data in two locations:
The eclipse installation directory itself: contains the plug-ins you install (including the ones already installed in the package you downloaded) and some runtime configuration parameters (see eclipse/config.ini) related to how Eclipse itself should run (e.g. where to find the JRE to execute Eclipse itself, how much memory to allocate etc.)
The workspace(s), where your data (projects and source code) and all personal configuration parameters are stored. This is where Eclipse remembers where your source code is, which file(s) where opened when you last exited, which perspective was active (in your case C/C++ Eclipse), your preferences, launch configurations, breakpoints, etc.
For each Eclipse installation on your system (eclipse folder), you can have as many workspaces as you want (it helps to isolate work). There are various ways to select the workspace location: using the -data <path-to-workspace> option on the command-line, using the popup Eclipse normally shows when starting up (but you may have disabled it), or using "File > Switch Workspace...".
You can also use the same workspace from different Eclipse installations (though not at the same time), but things will not work well if you have different plug-ins installed in each: if one installation stores in the workspace "this is a Python project, and the current perspective is C/++", and the other installation does not have the Python and/or C++ plug-ins installed, it will not known what to do with these info. This is why you see the errors you reported.
For your case, my guess is that under Windows the default workspace location is somewhere in your home directory, and the new (Java) Eclipse is using that, but failing to make sense of the Python and C++ related preferences and projects the previous Eclipse stored there. You need to use a fresh workspace not "polluted" with Python and C++ stuff if you want the Java Eclipse to work without errors (or install the Python and C++ plug-ins in the new Eclipse). You may want to enable the Prompt for workspace on startup preference (in "General > Startup and Shutdown > Workspaces") if it is not to control this easily each time Eclipse starts.

Specific plugins per workspace

I came across this post and wondered if there is a way to activate only a few of all of my installed plugins depending on the workspace I currently work in.
For example - If I organized my workspaces like this
/workspaces
/java
/jee
/php
...
I don't need the Android-Plugin if I'm working on my Java EE-Projects and so on.
I also came accross this, suggesting to deactivate some capabilities for each workspace. But this not an option, as apparently no plugin is registered as capability.
Thanks, m
Edit: BTW, I am using Eclipse 3.5 Galileo
Maybe you can achieve your goal but it needs lots of "customization work" so I would not do it for myself :)
Create a "minimal" Eclipse install with plugins you use all of your workspaces.
Create one dropins folder for every workspace and put all of your "workspace-specific plugins" into that folder.
Create an Eclipse shortcut for all workspaces and use something like "-data _workspacedir_ -vmargs -Dorg.eclipse.equinox.p2.reconciler.dropins.directory=_dropindir_" in the shortcut.
Start eclipse with one of your new shortcuts.
Note that in this case you cannot switch workspace within Eclipse, you have to close the current one and start the new one using the corresponding shortcut.
UPDATE: I have found some Eclipse feature request for making this kind of setup easier if they will be implemented:
Software Update must allow to install plug-ins into extension location
Support for multiple bundle pools
You can use a different configuration folder for each Eclipse instance using the -configuration option when starting Eclipse.
On Windows, I would use a batch file (e.g. run-eclipse.cmd) which looks a bit like this (a bit different on Unix, more complex on OS X because of the app packaging):
eclipsec.exe -clean -configuration configs/%1/configuration
Execute it with your environment ID (e.g. run-eclipse.cmd java). I use eclipsec because I need the console output, but you can use the plain eclipse.exe executable. The -clean is not mandatory either.
Under my Eclipse installation folder, I will have a configs folder and under this folder I will have multiple configurations. Each config folder can have its' own plugins and folders. AFAIK, if you install plugins they will be installed in your configuration folder and not your main installation folder.
The structure you get is like this:
Eclipse Folder
plugins
features
configs
java
plugins
features
configuration
Eclipse plugins are expected to start only as needed, in a lazy manner. I'm not saying that all behave exactly that way, but if you write your own plugin, you'll see this is how the technology works, your plugin gets called only as needed.
So in Eclipse, if you configure your starting Perspective (Java for me) to have only the Views you need, the plugins that are used for other views should not be started.
To do this, take the view away and save your perspective (Windows - Save perspective as).
In addition, in Ganymede, in Windows - Preferences - General - Startup and Shutdown,
there is a list of plugins that should be started on startup, so you can edit that list.
I didn't try to see if this works per workspace though.
Although my solution won't let you install plugins per workspace but will solve the problem.
The best way i found to do this is using different eclipse copies:
Extract officialeclipse.zip to two different places and install plugins you like per eclipse.
A bit late answer but if you want to manage many workspaces shortcut the following tool is very simple and helpful : http://www.xdreamteam.ch/downloads/eclipselauncher/
I use it for sorting my projects by customers and workspaces, and it launch the right workspace with all the necessary configurations needed for each.