Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Code responsible for QuickFix
Code responsible for QuickFix [message #1785794] Fri, 20 April 2018 03:32 Go to next message
Srujan Barai is currently offline Srujan BaraiFriend
Messages: 1
Registered: April 2018
Junior Member
I am totally new to Eclipse development and Eclipse forum. Apologies if I miss any conventions.

I am trying to learn eclipse plugin development and have succeeded a bit. I am playing around with the "Quick fix" feature and trying to figure out which code is responsible for the showing the "Preview" of available fixes when there is an error in the code.

As the first step what I am trying to achieve is to get a list of all available fixes (for the error) and on later bases, implement a plugin that would automatically select the appropriate fix.

[What I expect]

I need someone to point me to the correct code that is responsible for doing these (mentioned below) stuffs when Cmd+1 (Quick fix shortcut) is pressed:
· Detect whether there is an error at the position of the cursor.
· Get a list of all possible solutions
· Show the list of all possible solutions and implement one, the one user clicks on.

Any help would be appreciated.

Thank you.
Re: Code responsible for QuickFix [message #1785798 is a reply to message #1785794] Fri, 20 April 2018 05:47 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 29551
Registered: July 2009
Senior Member
I don't know the answer. But there are some techniques that will help. First, to make it easier to find source for any class available in the target platform, type "add all" in the quick search field in the upper right, just to the left of the perspective control toolbar, to invoke All Plug-ins to Java Search. This will ensure that Ctrl-Shift-T will be able to find any class in any plugin even if no plugin in your workspace depends on it.

Then Alt-Shift-F1 and Alt-Shift-F2 are useful for invoking the plugin spy and the menu spy so you can find out which things are active and which classes implement those things.

The debugger is your best friend too. Launch a runtime instance of Eclipse (via Run -> Debug Configurations... to create a new Eclipse Application to launch). In the debugger you can always pause the main thread to see what it's doing.

Ctrl-1 brings up a shell, so using Ctrl-Shift-T to open the Shell class and set a breakpoint on org.eclipse.swt.widgets.Shell.Shell(Display, Shell, int, long, boolean) or which ever constructor all the other constructors delegate to on the Mac.

Doing that and then using Ctrl-1 in the Java editor in the runtime Eclipse instance you're debugging, you'll see stuff like this on the stack:
Shell.<init>(Display, Shell, int, long, boolean) line: 280	
Shell.<init>(Shell, int) line: 378	
CompletionProposalPopup.createProposalSelector() line: 591	
CompletionProposalPopup$2.run() line: 500	
BusyIndicator.showWhile(Display, Runnable) line: 71	
CompletionProposalPopup.showProposals(boolean) line: 483	
QuickAssistAssistant$QuickAssistAssistantImpl(ContentAssistant).showPossibleCompletions() line: 1829	
JavaCorrectionAssistant(QuickAssistAssistant).showPossibleQuickAssists() line: 109	
JavaCorrectionAssistant.showPossibleQuickAssists() line: 198	
CompilationUnitEditor$AdaptedSourceViewer.doOperation(int) line: 197	
TextOperationAction$1.run() line: 130	
BusyIndicator.showWhile(Display, Runnable) line: 71	
TextOperationAction.run() line: 127	
TextOperationAction(Action).runWithEvent(Event) line: 473	
ActionHandler.execute(ExecutionEvent) line: 118	
E4HandlerProxy.execute(IEclipseContext, Map, Event, IEvaluationContext) line: 93	
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 62	
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
Method.invoke(Object, Object...) line: 498	
MethodRequestor.execute() line: 55	
InjectorImpl.invokeUsingClass(Object, Class<?>, Class<Annotation>, Object, PrimaryObjectSupplier, PrimaryObjectSupplier, boolean, boolean, boolean) line: 318	
InjectorImpl.invoke(Object, Class<Annotation>, Object, PrimaryObjectSupplier, PrimaryObjectSupplier) line: 252	
ContextInjectionFactory.invoke(Object, Class<Annotation>, IEclipseContext, IEclipseContext, Object) line: 161	
WorkbenchHandlerServiceHandler(HandlerServiceHandler).execute(ExecutionEvent) line: 152	
Command.executeWithChecks(ExecutionEvent) line: 494	
ParameterizedCommand.executeWithChecks(Object, Object) line: 487	
HandlerServiceImpl.executeHandler(ParameterizedCommand, IEclipseContext) line: 210	
KeyBindingDispatcher.executeCommand(ParameterizedCommand, Event) line: 287	
KeyBindingDispatcher.press(List<KeyStroke>, Event) line: 523	
KeyBindingDispatcher.processKeyEvent(List<KeyStroke>, Event) line: 573	
KeyBindingDispatcher.filterKeySequenceBindings(Event) line: 385	
KeyBindingDispatcher.access$0(KeyBindingDispatcher, Event) line: 331	
KeyBindingDispatcher$KeyDownFilter.handleEvent(Event) line: 88	

Now you know which code is involved in the process of populating the quick fix and can further investigate in the debugger how the various parts are working together.

Googling for reference information, e.g., "eclipse implement a quick fix" should help you find links such as this:

https://wiki.eclipse.org/FAQ_How_do_I_implement_Quick_Fixes_for_my_own_language%3F
Previous Topic:Eclipse 4.7 - Malformed class name error upon Run As
Next Topic:fatal error: 'iostream.h' file not found
Goto Forum:
  


Current Time: Tue Sep 25 09:54:05 GMT 2018

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

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

Back to the top