Eclipse Working Sets Explained
Join the DZone community and get the full member experience.Join For Free
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 perspecti ve. 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 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.
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.