Community
Participate
Working Groups
Would be nice to have a quickfix to change a static method call to a static import: Button ok = new Button (shell, SWT.PUSH); ok.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> System.out.println("OK"))); Quickfix should be able to covert to: import static org.eclipse.swt.events.SelectionListener.*; ok.addSelectionListener(widgetSelectedAdapter(e -> System.out.println("OK")));
We already have the "Add Import" action for this. - Place the caret on a static member in your code: "widgetSelectedAdapter". - Press: Ctrl+Shift+M Or, click Source > Add Import. It will add the static import: import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter; and convert the code to: ok.addSelectionListener(widgetSelectedAdapter(e -> System.out.println("OK")));
Good you offer the same as Ctrl+1 Quickfix? As IDE user, I find the usage of "Add Import" surprising here, as I'm not missing an import. It is great that this works but I think a Quickfix is more fitting here.
*** This bug has been marked as a duplicate of bug 197850 ***