Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » How to implement Quick Fix / Quick Assist for custom editor?
icon5.gif  How to implement Quick Fix / Quick Assist for custom editor? [message #781144] Fri, 20 January 2012 17:22 Go to next message
Baris Akar is currently offline Baris AkarFriend
Messages: 2
Registered: January 2012
Junior Member
Hi,

I have extended org.eclipse.ui.editors.text.TextEditor to implement a custom editor.
For this editor, I have defined a marker type (org.eclipse.core.resources.markers extension point) and an annotation type (org.eclipse.ui.editors.annotationTypes extension point) to mark specific parts of code in my editor. I use a reconciler to update my annotation model.


Now I want to add a quick fix / quick assist feature. I simply want eclipse, to show a box with proposals, when I hover over an annotated part of the code and replace that part with a given string, when I click on a proposal. Just like the quick fix feature for the java editor.

So, what is the best way to implement this behavior?

I read about marker resolution generators and quick assist processors, but I'm still confused how it all works together...

I would be glad, if someone could point me to the right direction.
Re: How to implement Quick Fix / Quick Assist for custom editor? [message #783193 is a reply to message #781144] Wed, 25 January 2012 09:09 Go to previous messageGo to next message
Baris Akar is currently offline Baris AkarFriend
Messages: 2
Registered: January 2012
Junior Member
I finally found out how to get Quick Fix to work for my editor.

I use the annotationTypes extension point to register my own annotation type and the markerAnnotationSpecification extension point to specify the look and feel. In my custom SourceViewerConfiguration class I override getAnnotationHover(...) to return a DefaultAnnotationHover object and getTextHover(...) to return a DefaultTextHover object, so the annotations are shown in my source viewer.

Then I override getReconciler(...) to return a MonoReconciler with my own implementation of IReconcilingStrategy to create the annotations in its reconcile(...) method. And finally I override getQuickAssistAssistant(...) to return a QuickAssistAssistant with my own implementation of IQuickAssistProcessor. The computeQuickAssistProposals(...) method in the processor class computes the quick fix proposals which show up, when I press CTRL+1.

I don't create any Marker objects and don't use a MarkerResolutionGenerator, since the marker concept is much more heavyweight than using only annotations and the functionality which annotations provide fits my needs.
Re: How to implement Quick Fix / Quick Assist for custom editor? [message #1734126 is a reply to message #781144] Sat, 04 June 2016 11:58 Go to previous message
Philipp Nolte is currently offline Philipp NolteFriend
Messages: 1
Registered: June 2016
Junior Member
I know this is an old Thread, but can you provide some further details?
Previous Topic:qualifier and jaring with build,xml
Next Topic:Icons of Outline-view
Goto Forum:
  


Current Time: Fri Mar 24 22:10:11 GMT 2017

Powered by FUDForum. Page generated in 0.02187 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software