Annotating/applying labels to classes in Eclipse package explorer - eclipse

Personally, I am a very visual-oriented sort of person. A long list of classes, especially with similar names, in one package in Eclipse can be a pain to stare at. Is there an Eclipse plugin or a way to annotate classes in the Package Explorer with colors?
I am aware of and currently use Eclipse working sets, but I would like to furtherly color-label the classes themselves in the package explorer list.
Seems like a pretty far-fetched request, but is it possible?

Yes there is an plugin call Resource Decorator Check this blog for more details.
Check the motivation section:
While working with mylyn and working sets helps to organize the workspace, I was always missing some visual distinction between different project types. Like having different colors for plug-ins and features or highlight important files.
You can use regular expression to decorate a set similar resources.

Related

Multiple Xtext DSLs in single Eclipse project

I would like to know if there is a way to organize multiple DSLs inside a single Eclipse project. More specifically, I would like to organize all five Xtext projects of a DSL in some top-level "project folder".
The background is that we manage complexity and enable reuse by making smaller reusable DSLs, e.g. one reusable for expressions and other one for more domain-specific or application-specific aspects. However, each Xtext DSL results in 5 projects, causing a lot of clutter in the Package Explorer when multiple DSLs are involved. A strongly related question has been asked before:
Xtext: define 2 DSL's in one project
The answer there is that multiple DSLs are not needed inside the project for that specific use-case. My use-case is different because I want to be able to easily view the different DSLs and potentially co-develop them.
We are using Xtext in an environment managed by Gradle. We are using the Gradle Eclipse plugin, which creates a lot of Eclipse project files everywhere. As a result, when choosing to "Open Project from File System" in Eclipse, I not only get the option to import the five projects related to the DSL, but also the option of opening the parent folder as a project. This means I can have each DSL (all its five projects) organized neatly in a "project folder". This is exactly what I want! ...
BUT ...
it does not actually work. The figure below shows my package explorer with the five projects of my ExperimentDSL included in the bottom. This DSL works. On top, it shows the folder structure I get when including the project file generated by Gradle, resulting in a "project folder" that can potentially contain multiple DSLs.
As you can see, GenerateExperimentDSL is flagged red and refuses to run. It seems Eclipse somehow treats it as a Java project, but I do not know how to change this or and if this would help solve my problem. Secondly, I would not know how to set up such a project by hand, since the project file in this failing case was generated by Gradle.
Long story short, does anyone know how to get this kind of folder structure to work so that I can keep all my DSLs in the workspace without clutter?
What you try to do is currently not possible. Have a look at the concept of WorkingSets in Eclipse that let you achieve something similar

How to insert visual elements inside the Java text editor of Eclipse?

I'd like to add extra visual elements inside the Java text editor of Eclipse, more specifically on top of classes and methods declarations. Things like indicators and links.
The best example is what Microsoft has done in Visual Studio with what they call CodeLens:
The closest solution I can think of is using Annotations (displayed in the rulers) but it's far from the user experience I want to have.
Are there any Eclipse plugins that have done this before?
Any pointers to give me somewhere to start?
Annotations are typically shown in the vertical and overview rulers (left and right), but they're not limited to them. Take a closer look at the documentation you linked to, particularly the mentions of AnnotationPainter, and then how it uses drawing strategies. I expect you'd need a rather complicated one, and I haven't even thought through how you'd generate the information in the first place, never mind adding it directly to the Annotation Model if you're not just going to stash it in a Marker on disk.
Of course, some of this looks like information you can already find through Team->Show Annotations (although that does use the ruler to let you find them by line).
Disclaimer, I'm the author of CodeLens Eclipse.
Eclipse doesn't provide Codelens feature, but it exists CodeLens Eclipse.
This project provides a CodeLens extension point to implement your own CodeLens. Today TypeScript, Java JDT CodeLens and lsp4e CodeLens are available. Here a little demo with Java JDT Editor:

How do I combine projects in eclipse?

I have a lot of projects in Eclipse and I'm trying to tidy it up with something simple like a folder. Is there any way to do this so i can have, for example all projects for a particular client in one collapsable folder?
You can achieve this organization within eclipse without actually changing the filesystem structure of your projects. The feature, to cut to the chase, is called Eclipse Working Sets.
The gist is working sets are groups of projects or resources, and most of the eclipse views (package view, enterprise explorer, navigator, etc) can honor and switch between working sets.
Create a working set of type Resource, select the projects you want, then in the package explorer carat drop down (I'm looking at eclipse Kepler) you can either have the top-level elements be the working sets (e.g. a folder-like view per client) or you can filter out stuff one working set at a time.
Some other uses for working sets might be projects of certain types, Java vs. C++ projects, etc. as outlined in this older tutorial.

Need brief understanding on how eclipse autocomplete works

Hi I am interested in understanding how eclipse autocomplete works. I want to understand how eclipse distinguishes between local and global variables in a piece of Java code. I would also like to understand how eclipse stores method signatures for an infinite number of classes and how it associates a method to a given class. And is it possible for one person to develop an autocomplete feature for a language like JavaScript.
There is already an AutoComplete feature for Javascript. You just need to let Eclipse install the appropriate extensions.
Eclipse maintains a model of your program, including the project and all the dependencies. It's big, but it's not infinite. When you hit the dot, it figures out based on the variable type what the target type can be, and then displays the relevant methods based on its internal model.
This is easy for Java because you can usually know the static type. Much harder in other languages.
The Eclipse plug-in developer's guide discusses how different things, including the internal model and auto completion works. There are extension points to implement yiur own.

Eclipse plugin to colorize/visually flag entries in the Package Explorer?

I am looking for a way to colorize entries in Eclipse' Package Explorer:
In bigger projects you have dozens of files in a package all listed underneath each other. This makes it hard to find the file you look for (e.g. for right-click operations). So it would be nice if I could manually colorize some entries.
Does a plugin for this exist?
This is one that I was using before. It lets you set rules and tints icons accordingly:
Label Decorator
One way to have Eclipse filter the classes you see is to use Eclipse Mylyn. You create tasks that you work on and Mylyn will remember the packages and classes associated with a certain task. It will then filter out all other classes/packages. This gives you an editor that only shows the information relevant to a specific task.
I suggested Mylyn for a different problem aswell and in that answer I gave a bit more information.