Eclipse comes with a large set of different views: They allow the developer to represent the information in various forms and with different angles. Most of these views are navigation oriented: a perfect example for this is the projects view or the Outline view. But over time I add more projects, more resources to my project, and at a certain time things get overwhelming. I have a lot of projects, and I do not want to switch between workspace too often. Yes, I can open and close projects, but this gets cumbersome too. Thankfully, there is a solution in Eclipse: Working Sets.
Working sets allow me to group elements for display in views. With that, I can do operations on a set of elements in that working set. Especially as I’m using many projects the same time, working sets are a big help to focus on the right set of things at a time. I can define a set of things I want to look at, work with, or whatever: it allows me to get be productive in the universe of my environment.
Building/compiling a Working Set
A nice feature of using working sets is to build a set of projects. Instead of selecting a set of projects and then to compile them together, I use a Working Set.
I use the menu Project > Build Working Set > Select Working Set… to create or change working sets:
If I have no working set defined, then this will show the following dialog where I can press New… to create a new one:
To create a working set of C/C++ projects, I select C/C++ and press Next:
Next I give a name and select the project(s) which shall be in my working set, and press Finish:
To build my set of projects, I can select the working set and press OK:
Search in a Working Set
It is possible to limit the search to a working set. For this I can choose a working set as scope in the search dialogs:
Managing Working Sets
To manage working sets, I press CTRL+3 (see Quick Access) and choose Manage Working Sets…:
Note: I can add extra tool-bars and menus for working sets too (this is explained later).
Then I can manage my working sets:
Project View Filtering with Working Sets
I can filter the projects shown in the project view based on working sets. For this I select the small triangle and select/define a working set or choose one from the most recently used sets:
With this I can easily filter and focus on a subset of projects:
Tip: I’m using Working Sets as well to avoid too many workspaces. Instead of having projects spread over different workspaces, I can keep them in one workspace and use working sets instead. There is an added benefit of using working sets: having too many projects open at the same time in eclipse can slow down the IDE: using working sets allows me just to switch quickly between the set of projects I’m working on.
But it does not stop at filtering by projects: you can filter even things inside the project structure. I simply deselect things I don’t want to see and can focus on what is important for me:
Export and Import of Working Sets
Note: Import and Export of Working Sets is not part of the standard CodeWarrior Eclipse distribution. You get the import/export feature installed with the MQX plugins (www.freescale.com/mqx) or with the AnyEdit plugins (http://andrei.gmxhome.de/anyedit/index.html).
To export a working set, I use the menu File > Export > Other > Export Working Set:
Note: The AnyEdit plugins come as well with an import/expert working set wizard. The file format is different, and the MQX plugin allows drag&drop of the file into Eclipse.
This gives the following dialog where I can specify the file name and the root of projects:
This will store the settings in an XML file.
Importing the working set is done with File > Import > Other > Import Working Set.
Tip: I’m using *.wsd extension for working sets. That way I can simply drag&drop the file into Eclipse to import it.
Other Kinds of Working Sets
Working Sets do not stop at projects and files:
I can create working sets of breakpoints or analysis/trace points. Or I can create working sets of any resource files or tasks. The possibilities are nearly endless and depend as well on the extra plugins installed.
Window Working Sets
And now back to the really cool part. One question remains: what are Window Working Sets?
The thing is that every view and dialog has its own working set setting. In my example below I use a working set ‘ColdFire’ for the projects view, but my Search dialog has a ‘Kinetis’ working set configured:
Sometimes I want this, but not always. What I need is a ‘global’ working set. And here the Window Working Sets comes to rescue me. For this I’m going to add some menus and toolbars to make it really easy…
For this I choose the menu Window > Customize Perspective. In the Command Groups I enable ‘Window Working Set’. Additionally it is a good idea to enable ‘Working Set Manipulation’ as well:
The same way I can enable the Toolbar and Menu Visibility. This gives me added tool-bars to switch between working sets and to add/remove things from a working set quickly:
In a similar way, it gives me menu access as well:
And here is the trick: Using ‘Window Working Set‘ really means ‘Using the global workbench working set‘. To select the global workbench working set, I use the toolbar icon to switch between Window (or Workbench) working sets:
In the individual views I choose to use the Window Working Sets instead a selection of working sets:
Now my working set settings are shared and common for all views: if I switch the working set, it will switch for all views where I have set it to ‘Window Working Set’:
That way my working set is the same across views, and switching between different project settings is done with a simple mouse click.
Working sets are an extremely powerful feature to get focus on a subset of things inside Eclipse, based on my workflow. As with many great Eclipse features, I need to know about it until you really appreciate the power of it. Who knows how many other hidden treasures are buried in Eclipse
I hope this article helps to save you a few mouse clicks.