Summary: | [quick fix] One-step creation of nested Java listeners | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Andy Thomas-Cramer <thomascramera> |
Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
Status: | ASSIGNED --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | CC: | amj87.iitr, deepakazad, markus.kell.r, Olivier_Thomann, remy.suen, thomascramera |
Version: | 3.7 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
Andy Thomas-Cramer
2011-05-26 11:56:13 EDT
You can actually do this in one step using content assist (CTRL-SPACE). If you use CTRL-SPACE after having typed X, the first proposal you get is "X - anonymous inner type". If you use that proposal, not only will content assist add the import for you, but also add the overriden method stub. HTH. Thanks! That's very helpful; I was hoping someone would say "you can already do that." That gets it down to two steps. These enhancements still seem valuable: * Add an option "X() Nested Inner Type", to make it a single step. * Make both actions also available through QuickFix, for discoverability, for those who don't discover the content-assist approach. Moving to JDT/UI See bug 97235 for a quick fix to turn something like "new MouseListener()" into an anonymous class. Keeping this bug for a quick fix to create a nested class instead of an anonymous. I don't think we should add this to content assist, since - it's not a basic operation, - it implies non-local changes (far away from the cursor position), and - it needs 2 inputs: the name of the nested class and the type to extend (e.g. MouseListener or MouseAdapter) |