Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 363030

Summary: [Xtend] quick fix for implementing abstract methods
Product: [Modeling] TMF Reporter: Sven Efftinge <sven.efftinge>
Component: XtextAssignee: Jan Koehnlein <jan>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: jan, sebastian.zarnekow, tmf.xtext-inbox
Version: 2.1.0Flags: sven.efftinge: juno+
Target Milestone: M4   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Bug Depends on:    
Bug Blocks: 342398    

Description Sven Efftinge CLA 2011-11-07 04:35:33 EST
A quick fix for adding implementations for abstract methods from super types.
An integration in content assist would also be good.
Comment 1 Jan Koehnlein CLA 2011-11-14 10:26:11 EST
Quickfix pushed to master.
Comment 2 Jan Koehnlein CLA 2011-11-15 07:59:18 EST
Code completion also pushed to MASTER.

One issue remains: In JDT, the quick fix creates ALL missing abstract methods at once. Xtext allows one fix per issue instance, and each missing method is a separate issue (as in JDT). Not sure whether this is a serious problem.
Comment 3 Jan Koehnlein CLA 2011-11-15 08:32:36 EST
Removed static methods form code assist.
Comment 4 Sven Efftinge CLA 2011-11-17 03:14:50 EST
Just tried. Very Cool!

Just the cursor seems to behave a bit funny.
When I use the proposals it jumps at arbitrary places, depending on which method I override.
It should select the whole
'throw new UnsupportedOperationException("TODO: Auto-generated function stub");"
And it shouldn't generate a semicolon and the TODO doesn't seem to work in string literals so we should remove it as well.
'throw new UnsupportedOperationException("Auto-generated function stub");"
Comment 5 Jan Koehnlein CLA 2011-11-17 04:15:29 EST
Pushed fine-tuned version to MASTER.
Comment 6 Sven Efftinge CLA 2011-11-17 07:31:18 EST
There should be one issue and one quick fix which lists/ adds all abstract methods at once.
Comment 7 Sebastian Zarnekow CLA 2011-11-17 07:38:02 EST
(In reply to comment #6)
> There should be one issue and one quick fix which lists/ adds all abstract
> methods at once.

We should be carefule with the error message, e.g. listing all abstract methods may not be practical. Something like 'Foo has to implement add(int, Object) and 15 more' could work, though.
Comment 8 Jan Koehnlein CLA 2011-11-19 07:12:43 EST
Pushed to MASTER. 

To be able to reuse the IAppendable stuff - like variable name handling, type serializtion using TypeSerializer and import handling - I wrote a ReplaceAppendable adapter class that can be used in ContentAssist and QuickFixes. 

Now writing some tests.
Comment 9 Jan Koehnlein CLA 2011-11-21 05:17:21 EST
Pushed to MASTER.
Comment 10 Karsten Thoms CLA 2017-09-19 17:48:01 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 11 Karsten Thoms CLA 2017-09-19 17:59:09 EDT
Closing all bugs that were set to RESOLVED before Neon.0