How to highlight a node in GMF based editor? - eclipse-rcp

I am in the process of implementing search functionality in my GMF editor. So what i am planning to do is utilize EMF Search plugin to search within the EMF objects. But when I click on the search result I will be opening the diagram with the node pre-selected.
Is there a way in which I can traverse through all the nodes in a GMF based diagram and highlight a node based on some parameters?

I figured out how to do this. Found the solution in this forum post -
http://www.eclipse.org/forums/index.php/m/734758/
Quote
I did something similar for the YAKINDU Statechart Tools version 2.0.
It is a Statechart Tool where you can execute the statechart model,
the active states are highlighted in the diagram editor then. (see
http://muelder.blogspot.com/2011/09/new-features-in-sct-2-milestone-5.html)
for a screenshot.
Technically, all the highlighting stuff is encapsulated in a single
class called HighlightingSupportAdapter. Maybe you want to have a look
in the code, it is open source. It is a generic HighlightingAdapter,
that can be applied to every GMF based editor. A semantic element is
passed to the adapter as well as the higlighting color and the
highlighting time. Maybe this is a good start for your use case!

Related

How to persists image use for Eclipse Decorator

I'm creating a custom image decorator which will decorate project/file explore according to the several logic. For a example lets take Findbugs plugin it will scan the project and decorate project/files image which are having errors, even Eclipse IDE restarts it will maintain the FindBug image status of the project/file. Like that how can I maintain the persit state of the image decorator even Eclipse IDE restarted?
Is there any good tutorials for that? I found following link for decorators
https://www.eclipse.org/articles/Article-Decorators/decorators.html
Cheers!
There is no standard mechanism for persisting data for decorators.
Things like FindBugs are most likely using Markers defined using the org.eclipse.core.resources.markers extension point and created using the IResource.createMarker API. Markers are persisted.
Views such as Project Explorer have a standard decorator which shows decorations for markers which extend the org.eclipse.core.resources.problemmarker marker.

Eclipse RCP: How to Format a Content Assist Proposal while it's being applied

I've implemented content assist in my RCP app, but I can't figure out how to make the completion proposal work like the JDT content assist capability when it's applied in the document. Specifically, when you select a Java completion proposal and apply it, it has appearance and focus behavior that lets you edit it before accepting it. There are thin borders drawn around each parameter, and you can tab through the method arguments and the text of the next argument is automatically selected when you do so. There is lots of information on implementing content assist on the web, but I can't find anything that addresses how to do this.
Thanks to greg-449 for pointing me to JFace templates. I reviewed the API for the classes in org.eclipse.jface.text.templates per his comment. Seemed like a good approach, though certainly not trivial, as he alluded.
However, I found a simpler solution in the PyDev code (which my app is extending). PyLinkedModeCompletionProposal does something similar to what I want, so I copied that class and modified it as needed. (I just have a different template pattern.)
The implementation in PyLinkedModeCompletionProposal#goToLinkedMode uses the JFace classes LinkedModeModel, EditorLinkedModeUI, and ProposalPosition to place completion proposals in the editor as an editable template.

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:

Activiti Diagramm Editor lacks some elements?

Looks like Activiti's diagramm editor lacks some elements descirbed in their guide. I'm especially looking for the Cancel End Event. If i try to alter the generated XML to have the correct node editor destroys my modifications by further edits.
Am i using an old version of the editor or these elements are really not implemented in the plugin?
It seems that Yaogiang's BPMN editor is more featureful in scope of Activiti elements. So i'm moving on to that. I'm still testing it though.

Customizing UI elements in Eclipse default Java Editor via plugin

I'm trying to develop a plugin for Eclipse that will allow me to modify various elements within the default java text editor. I've found lots of tutorials for creating my own text editor for a different language, but nothing for editing the default java editor. Specifically, I want to be able to run a command and highlight certain areas of the code based on a different program. How do I develop this?
Thanks
You will need to implement your own type of markers and maybe associate annotations with them. Then you can associate the java editor with the annotations to show them. Your application will generate the markers.
Specifically you might want to start to read about org.eclipse.core.resources.marker extension point and IResource.createMarker() to create the markers.
Its doable. You need to find the right extension point that allows you to add functionality to the java editor.
See IBM tutorial. The example with the heading "How do you analyze Java code to apply modifications" seems to be what you want to do.