37

What is the difference between Java working set and Resource working set in Eclipse?

The Resource working set is more general and it can include not only the Java applications / projects, but let me put it this way:

Let's assume a daily life of a Java developer. Do you suggest him/her to use Resource working set over Java working set? Is there any specific situation in which you prefer one over the other?

Lii
  • 11,553
  • 8
  • 64
  • 88
sheidaei
  • 9,842
  • 20
  • 63
  • 86
  • Working sets seems to be more focused on the "java developer" you can close working sets which is helpful, and in product configurations you can add working sets. Not sure about resource sets, i looked in my IDE was unable to figure out how to create one! – Duncan Krebs Dec 11 '12 at 17:46
  • 3
    @DuncanKrebs follow these instructions http://www.avajava.com/tutorials/lessons/what-is-a-working-set-and-how-do-i-use-it.html you can find out how to create one! – sheidaei Dec 11 '12 at 19:07

5 Answers5

13

It sounds like this should have answered the question:

A Working Set is a subset of your Eclipse projects. You can create different Working Sets and then select which Working Set to display in the Navigator view.

Specifically:

  1. "Working set" (in this particular context), is an "Eclipse thing"

  2. The purpose of Eclipse working sets is to help organize your projects

  3. A project consists of "stuff": source code, bitmap graphics files, WSDL's, CSS style sheets - just about anything imagineable.

  4. Consequently, Eclipse projects are organized (glancing at my J2EE perspective, for example) into subsections like "src", "WebContent", "Services" and so on. A project itself can be one of many different types: a "Java project", a "Java Swing Design project", and "Dynamic Web Project" and so on.

  5. Similarly, an Eclipse Working set can be one of several different types: a "Java working set", a "Breakpoint working set ... and a "Resource working set".

  6. As with Eclipse "Views" and Perspectives", you can usually access any project resource you need any time you need it. Selecting one or another perspective simply makes the object (e.g. "Problems pane" or "Build list") easier to get to.

  7. Which kind of "Working Set" you choose - or whether or not you use working sets at all - is largely just a matter of personal preference and convenience.

Please let us know if you still have any further questions.

PS: Additional links:

https://www.ibm.com/developerworks/library/os-eclipse-visualstudio/

As mentioned, many developers load all their projects into a single Eclipse workspace. It's convenient, but it can sometimes create too much clutter. In addition to closing unnecessary projects, you can define working sets: groups of elements (projects, folders, classes, etc.). Eclipse can use working sets in different views (such as Package Explorer) and operations (like searching).

...and:

help.eclipse.org: Working Sets

Lii
  • 11,553
  • 8
  • 64
  • 88
paulsm4
  • 114,292
  • 17
  • 138
  • 190
  • 7
    The link talks about making resource sets and when to use them, but I still have no idea why the distinction between Java vs Resource Working set if I can add all my Java Project to the latter (I always end up using Resource set because I want to be able to link non-java project also) – mothmonsterman Dec 14 '12 at 20:46
  • 1
    Don't take the names too literally - they're not "hard and fast" definitions; merely "guidelines". "Resources" are more like "bitmap files" (in my example above); "Java" is clearly like the "src" folder in my example above. – paulsm4 Dec 14 '12 at 22:08
  • 2
    totally agree with @happytimeharry I still don't understand when I have to use Java working set over Resource working set. And if there isn't any benefit why it has been defined as two separate entity? – sheidaei Dec 17 '12 at 21:50
  • 1
    No, not really. Again: I think you might be taking the "name" ("Resources") too literally. It's just a convention; which you choose is largely (not entirely, but largely) just a convenience. – paulsm4 Dec 17 '12 at 22:52
  • You never *have* to use a Java working set. However, you might *decide* to use a java working set when you don't want to be distracted by all of the other different resources. – biggusjimmus Dec 21 '12 at 09:15
  • 2
    I think we are overlooking the distinction here: a Java working set has dedicated purpose in the context of a Java project: it inspects the java classpath for resources, unlike a resource working set which inspects merely the included files in a project. – Neel Dec 21 '12 at 16:06
  • The first link http://www.avajava.com/tutorials/lessons/what-is-a-working-set-and-how-do-i-use-it.html in the answer leads to site with expired domain name. – Zarremgregarrok Mar 05 '14 at 09:47
  • 3
    This answer does not even address the original question. As @Neel pointed out, it doesn't explain the distinction between resource/java working sets. – Jon Coombs Aug 22 '15 at 18:19
  • The first link in the answer was all i needed. Thanks Paul! – jumping_monkey Jul 05 '22 at 02:50
10

A working set in the context of eclipse is a logical grouping of related projects to ease search and organize views within the IDE.

A resource working set can capture all types of resources - maybe java source, html, xml, javascript, images - anything that exists within the scope of the projects included into the working set.

The Java working set is a different working set (it is NOT a subset of a resource working set!) which captures only those java files which belong to a source folder and are being compiled into the classpath, or those java files which belong to a module (library) in the build path. Hence, it lets you lookup java "classes" which are in the classpath. Note that all java file in your project may not necessarily be built into the classpath (for example when you exclude a java source file, it does not get built any more). But a java source file which is not included in your classpath can still be detected by a resource working set (you will notice that the icon for an included java source file is a solid J, while for an excluded java source, it is a hollow J).

Example: Say you have two projects p1 and p2 of which p1 belongs to the working set but p2 does not. So:

MyClass.java (belongs to p1 and included in build path) - Shows up in java type search (Ctrl + T) and also in resource search (Ctrl + R).

MyOtherClass.java (belongs to p2 and included in build path) - Does not show up in java type search nor in resource search.

MyExcludedClass.java (belongs to p1 and excluded from build path) - Does not show up in java type search but shows up in resource search.

MyExcludedClass.class (belongs to a dependency jar in the build path of p1) - Shows up in java type search but does not show up in resource search.

MyWebPage.html (belongs to p1) - Does not show up in java working set but in resource working set.

MyOtherWebPage.html (belongs to p2) - Does not show up in java type search nor in resource search.

MyConfig.xml (belongs to p1) - Does not show up in java type search but shows up in resource search.

So, in the context of a Java developer's use: I use Java working sets to look up types / classes defined in Java, whereas the resources working set to lookup all different types.

Neel
  • 2,100
  • 5
  • 24
  • 47
  • 2
    I don't believe what you have said is completely true, If I understood correctly what. Please take a look at http://goo.gl/AZPrc I have created a java working set, a dynamic web project within it, and I created an xml file in it. I was also capable of adding a file to the project and it will show even in the Java Working Set. Please let me know if I misunderstood what you've said. – sheidaei Dec 21 '12 at 20:09
  • You are right - please check the updated answer. In your project, try Navigating to a Java resource (Ctrl + T) by looking up types and select working set from the dropdown. Compare this with the behavior when you look up any resource (Ctrl + R), and select your working set. – Neel Dec 24 '12 at 18:17
  • This is the best answer here, and one of just two (currently) that attempt to answer the OP's question. – Jon Coombs Aug 22 '15 at 18:29
  • @JonCoombs Thanks Jon! – Neel Aug 23 '15 at 03:40
4

One difference between the working sets is that they provide different editing wizards (as stated here: http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fcworkset.htm). If you edit a resource working set and a java working set respectively you will see they use different screens for selecting which resources/projects are included.

Apart from this I haven't found any other difference. It also does not seem to differ which resources you can choose in any way. So to answer your question which one would be recommended I would answer "it doesn't matter" since they behave the same way.

K Erlandsson
  • 13,408
  • 6
  • 51
  • 67
  • "provide different editing wizards" is that why it is important to use Java working set over Resource Working set? My questions is specific to Java Working Set and Resource working set. There should be some difference where they defined different kinds? don't you agree? – sheidaei Dec 17 '12 at 21:46
  • I agree there should be some difference. But I as well cannot find one except the differing wizards. I have messed around quite a bit with it and not found anything I can do with one of them that I cannot do with the other... – K Erlandsson Dec 18 '12 at 06:16
4

A working set is a subset of your workspace and is a way to organise all your projects. With the different types of working sets you have also different types of editing wizards as described here.

Editing wizards

For java projects the Java working set is a more comfortable way to work. Let's assume you have a bunch of java projects in a java working set and you have just opend the editing wizard of the Java Working set:

First of all you can see everything what is in the working set at the moment in the right table. If you now want to include another project you can simply select the project(s) and press CTRL+a. To remove a project you can press CTRL+r

In the Properties of a Resources Working set you don't know what is in the working set until you have scrolled to the bottom of the tree view. This is impossible for people who have 300+ projects in their workspace.

Structure

A benefit from having two types of working sets is structure. There are situations in a daily workflow where it is useful to have different types of working sets, because they have different icons. If you have resources like config files you can create a Resource working set namend 'config files' and put all the files in there.

Afterwards you can open your File Search and search in your config files. This is possible because you can define a working set as a scope for a search.

enter image description here

There are several parts in Eclipse where you can select your working set with the Select working set dialog.

jens-na
  • 2,254
  • 1
  • 17
  • 22
  • "With the different types of working sets you have also different types of editing wizards as described here." Would you be able to differentiate different editing wizards that I am going to get using Resource Working Set VS. Java Working Set? Are they different? And if they are, why and when should I use one against the other one? Thanks for this long answer but other than the first line, it wasn't answering my question. – sheidaei Dec 21 '12 at 19:40
0

I'll try answering from the perspective as a plugin developer. From the API:

A working set is intended to group elements for presentation to the user or for operations on a set of elements.

This can be any kind of element and does not have to be a project. Working sets are provided by plugins, which can decide what kind of elements can be added and which provide wizards for adding elements as well as operations that can be performed.

It doesn't really matter for a project in which working set(s) it is in. A Java project is still a Java project if it in a resource working set. It only affects some views, dialogs and operations that filter for certain types of working sets.

Besides Java and Resource working sets, there are also Breakpoint, Task, Plugin and C/C++ working sets (depending on your Eclipse setup of course). Some views only show certain types of working sets while other views don't seem to filter them. For example the "Open Type" and "Open Resource" dialogs seem to display all types of working sets. The "Open task" dialog only shows task working sets.

So what is the actual difference between Java and Resource working sets? I haven't seen any functional differences yet. All standard views and dialogs either seem to handle both or none of these two working set types. Most plugins don't seem to care about the distinction at all - but that doesn't mean some plugin could handle both types differently.

On the other hand resource working sets seem to be a catch-all for any type of project, so it makes sense that most plugins don't make a distinction here. For example if I were to create a plugin that provides an option to analyze Java projects, I would add that operation to the context menu of Java working sets but certainly not to C/C++ working sets. But some people might use resource working sets because they have both Java and C projects in the same working set. So I have to add the Java-specific operation to the context menu of resource working sets too.

kapex
  • 28,903
  • 6
  • 107
  • 121