mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
Postfix templates: added serr and souf templates
This commit is contained in:
@@ -37,6 +37,8 @@ public class JavaPostfixTemplateProvider implements PostfixTemplateProvider {
|
||||
new ForDescendingPostfixTemplate(this),
|
||||
new WhileStatementPostfixTemplate(this),
|
||||
new SoutPostfixTemplate(this),
|
||||
new SerrPostfixTemplate(this),
|
||||
new SoufPostfixTemplate(this),
|
||||
new SoutvPostfixTemplate(this),
|
||||
new ReturnStatementPostfixTemplate(this),
|
||||
new OptionalPostfixTemplate(this),
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.template.postfix.templates;
|
||||
|
||||
import com.intellij.codeInsight.template.postfix.templates.editable.JavaEditablePostfixTemplate;
|
||||
import com.intellij.codeInsight.template.postfix.templates.editable.JavaPostfixTemplateExpressionCondition;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class SerrPostfixTemplate extends JavaEditablePostfixTemplate {
|
||||
public SerrPostfixTemplate(@NotNull JavaPostfixTemplateProvider provider) {
|
||||
super("serr",
|
||||
"System.err.println($EXPR$);$END$",
|
||||
"System.err.println(expr)",
|
||||
Collections.singleton(new JavaPostfixTemplateExpressionCondition.JavaPostfixTemplateNonVoidExpressionCondition()),
|
||||
LanguageLevel.JDK_1_3, true, provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltin() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.template.postfix.templates;
|
||||
|
||||
import com.intellij.codeInsight.template.postfix.templates.editable.JavaEditablePostfixTemplate;
|
||||
import com.intellij.codeInsight.template.postfix.templates.editable.JavaPostfixTemplateExpressionCondition;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class SoufPostfixTemplate extends JavaEditablePostfixTemplate {
|
||||
public SoufPostfixTemplate(@NotNull JavaPostfixTemplateProvider provider) {
|
||||
super("souf",
|
||||
"System.out.printf(\"$END$\", $EXPR$);",
|
||||
"System.out.printf(\"\", expr)",
|
||||
Collections.singleton(new JavaPostfixTemplateExpressionCondition.JavaPostfixTemplateNonVoidExpressionCondition()),
|
||||
LanguageLevel.JDK_1_3, true, provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltin() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package templates;
|
||||
|
||||
public class Foo {
|
||||
void m(boolean b, int value) {
|
||||
b.serr<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package templates;
|
||||
|
||||
public class Foo {
|
||||
void m(boolean b, int value) {
|
||||
System.err.println(b);<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package templates;
|
||||
|
||||
public class Foo {
|
||||
void m(boolean b, int value) {
|
||||
b.souf<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package templates;
|
||||
|
||||
public class Foo {
|
||||
void m(boolean b, int value) {
|
||||
System.out.printf("<caret>", b);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.java.codeInsight.template.postfix.templates;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -28,6 +14,14 @@ public class SoutPostfixTemplateTest extends PostfixTemplateTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSerr() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSouf() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testVoid() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user