Eclipse Working Sets Explained

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:

Menu to select working set

Menu to select working set

If I have no working set defined, then this will show the following dialog where I can press New… to create a new one:

Creating new working set

Creating new working set

To create a working set of C/C++ projects, I select C/C++ and press Next:

New C C++ working set

New C C++ working set

Next I give a name and select the project(s) which shall be in my working set, and press Finish:

Defining working set

Defining working set

To build my set of projects, I can select the working set and press OK:

Selected working set

Selected working set

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:

Search in a working set

Search in a working set

Managing Working Sets

To manage working sets, I press CTRL+3 (see Quick Access) and choose Manage Working Sets…:

CTRL+3 with Manage Working Sets...

CTRL+3 with 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:

Manage Working Set Configuration

Manage Working Set Configuration

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:

Working Sets for Project View

Working Sets for Project View

With this I can easily filter and focus on a subset of projects:

Project view with applied working set

Project view with applied working set

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:

Filtering project files

Filtering project files

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:

Export Working Set

Export Working Sets with MQX plugins

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:

Export Working Set Dialog

Export Working Set Dialog

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:

Select working set type

Select working set type

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?

Window Working Sets

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:

Two different working sets

Two different working sets

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:

Window Working Set commands

Window Working Set commands

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:

Working Set Toolbars

Working Set Toolbars

In a similar way, it gives me menu access as well:

Working Sets menu

Working Sets menu

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:

Selecting global Window or Workbench Working Set

Selecting global Window or Workbench Working Set

In the individual views I choose to use the Window Working Sets instead a selection of working sets:

Selected global Window or Workbench Working Set

Selected global Window or Workbench Working Set

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’:

Window Working Set applied to multiple views

Window Working Set applied to multiple views

That way my working set is the same across views, and switching between different project settings is done with a simple mouse click.

Summary

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 šŸ™‚

14 thoughts on “Eclipse Working Sets Explained

  1. Pingback: MQX Eclipse Working Sets | MCU on Eclipse

  2. Good article.
    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)?

    Like

  3. Hi Erich,
    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.
    Roberto

    Like

      • 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?
        Thanks again

        Like

        • Hi Roberto,
          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?

          Like

        • Hi Erich,
          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.

          Best Regards

          Like

        • Hi Erich,
          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.
          Thanks again

          Like

  4. Pingback: Grouping Eclipse Projects with Working Sets | MCU on Eclipse

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.