mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
correct {} placement when creating a new abstract class with constructor arguments
This commit is contained in:
+3
-2
@@ -53,8 +53,9 @@ class ConstructorInsertHandler implements InsertHandler<LookupElementDecorator<L
|
||||
FeatureUsageTracker.getInstance().triggerFeatureUsed("editing.completion.smarttype.anonymous");
|
||||
|
||||
final Editor editor = context.getEditor();
|
||||
editor.getDocument().insertString(editor.getCaretModel().getOffset(), " {}");
|
||||
editor.getCaretModel().moveToOffset(editor.getCaretModel().getOffset() + 2);
|
||||
final int offset = context.getTailOffset();
|
||||
editor.getDocument().insertString(offset, " {}");
|
||||
editor.getCaretModel().moveToOffset(offset + 2);
|
||||
context.setLaterRunnable(generateAnonymousBody(editor, context.getFile()));
|
||||
}
|
||||
else {
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Bar b = new Bar() {
|
||||
@Override
|
||||
void update() {
|
||||
<selection>//To change body of implemented methods use File | Settings | File Templates.</selection>
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public abstract class Bar {
|
||||
protected Bar(int a) {
|
||||
}
|
||||
|
||||
abstract void update();
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Bar b = new B<caret>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public abstract class Bar {
|
||||
protected Bar(int a) {
|
||||
}
|
||||
|
||||
abstract void update();
|
||||
}
|
||||
+4
@@ -967,6 +967,10 @@ public class SmartTypeCompletionTest extends LightCompletionTestCase {
|
||||
doItemTest();
|
||||
}
|
||||
|
||||
public void testNewAbstractClassWithConstructorArgs() throws Throwable {
|
||||
doItemTest();
|
||||
}
|
||||
|
||||
public void testInsideGenericClassLiteral() throws Throwable {
|
||||
configureByTestName();
|
||||
testByCount(3, "String.class", "StringBuffer.class", "StringBuilder.class");
|
||||
|
||||
Reference in New Issue
Block a user