Community
Participate
Working Groups
CTRL+2 L allows to assign a statement to a new locale variable. I use CTRL+2 L a lot, one of the best shortcuts in Eclipse IHMO. What would be nice if that I change the type on the left side of the equation and this type does not fit to the right hand-side that a cast is automatically added. Currently I have to select the right hand-side and use Ctrl+1 to add the cast. I attached a screenshot. If I would change the type on the left side, then I would get an error and have to use Ctrl+1.
Created attachment 206768 [details] Example
Markus, is it possible to set up linked mode in such a way that a cast is added when the user changes the type on LHS? void bar() { Object foo = foo(); // change type in LHS while still in linked mode } Object foo(){ return null; }
> Markus, is it possible to set up linked mode in such a way that a cast is added > when the user changes the type on LHS? No, AFAIK, this is not supported at the moment. The "linking" of the linked mode is implemented in LinkedPositionGroup#handleEvent(DocumentEvent), and that is currently not open for arbitrary transformations supplied by specific quick fixes. But I remember we had other situations where this would have been handy (e.g. the "for - iterate over collection" template).
See also Bug 511175 for a quickfix in a similar area.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.