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:
Really cool 🙂
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 (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.
Happy Work-Setting 🙂
Pingback: MQX Eclipse Working Sets | MCU on Eclipse
Nice article on Working sets
Good overview article about worksets…
I have a question about version controlling working sets.
I want to use a working set to make it easy to open the projects after checking out a new branch.
What files can I avoid from synchronizing in order to avoid seeing changed files that the user did not change (like the .project file that uses a hard coded path to the project on disk being changed by eclipse)?
Not sure if I understand your question?
The .project file is really something you want to to share with a version control system (see https://mcuoneclipse.com/2012/03/17/dissection-of-mcu10-projects/). If the .cproject uses absolute paths, then something is wrong (you can use relative paths).
useful tutorial, as always.
One question, because I can’t make it with working sets.
If I define a working set with many projects inside, I would like to navigate between symbols through projects by opening the symbol’s declaration (F3 for short).
This does not occur, unless I set up a project reference: but of course I would refer the same projects in the working set.
So my question is: once I define a working set, how is it possible to have automatically referred all its projects one to the other?
Thank you very much indeed.
The F3 is driven by the Eclipse ‘Indexer’ (see https://mcuoneclipse.com/2012/03/20/fixing-the-eclipse-index/). Not sure, but you probably need to enable a few options under the menu Help > Preferences > C/C++ > Indexer. Try to index all sources, that probably helps.
Thanks a lot Erich, even if I was not able to solve it following the tutorial.
My question can be said this more clear way: does the indexer work with working sets?
I cannot say for sure, but I believe the Indexer has no information about the working sets. The working sets are simply a way to filter the available projects. But what you can use is the menu Search > File where you can search in working sets?
I’m afraid you are right.
It’s a pity not to have this nice feature. Consider a working set made of an application projects and some libraries still in development phase.
Of course Search menu helps, but the indexer is quite useful.
I have just reached a good tradeoff: I’m using working sets + project references.
Project references can be set on project properties / Project references and then ticking the projects whose files / libraries are included in the one you are focusing on.
Some initial setting, but they are made only once.
This Article saved my life! THANK YOU!!!!!
Glad to hear that 🙂
Pingback: Grouping Eclipse Projects with Working Sets | MCU on Eclipse