mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] IDEA-372997 Bring back stss and stsf template and restrict to only JDK 24 preview
GitOrigin-RevId: d89039c7426017c35f70bdcbb11061fcfedf22a3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
abfeff2bff
commit
90549f68a6
@@ -1195,6 +1195,8 @@
|
||||
implementation="com.intellij.codeInsight.template.JavaCodeContextType$JavaLangIOStatement"/>
|
||||
<liveTemplateContext contextId="JAVA_NORMAL_CLASS_DECLARATION_WITH_INSTANCE_MAIN" baseContextId="JAVA_CODE"
|
||||
implementation="com.intellij.codeInsight.template.JavaCodeContextType$NormalClassDeclarationAfterShortMainMethod"/>
|
||||
<liveTemplateContext contextId="JAVA_STATEMENT_WITH_STRUCTURED_CONCURRENCY_AVAILABLE_24" baseContextId="JAVA_CODE"
|
||||
implementation="com.intellij.codeInsight.template.JavaCodeContextType$Java24StructuredConcurrency" />
|
||||
<liveTemplateContext contextId="JAVA_STATEMENT_WITH_STRUCTURED_CONCURRENCY_AVAILABLE_25" baseContextId="JAVA_CODE"
|
||||
implementation="com.intellij.codeInsight.template.JavaCodeContextType$Java25StructuredConcurrency" />
|
||||
<liveTemplateContext contextId="JAVA_COMMENT" baseContextId="JAVA_CODE"
|
||||
|
||||
@@ -311,6 +311,22 @@ public abstract class JavaCodeContextType extends TemplateContextType {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Java24StructuredConcurrency extends JavaCodeContextType {
|
||||
private final JavaCodeContextType statementContext = new Statement();
|
||||
|
||||
Java24StructuredConcurrency() {
|
||||
super(JavaBundle.message("live.template.context.statement.java.structured.concurrency.24"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isInContext(@NotNull PsiElement element) {
|
||||
return statementContext.isInContext(element) &&
|
||||
PsiUtil.isAvailable(JavaFeature.STRUCTURED_CONCURRENCY, element) &&
|
||||
PsiUtil.getLanguageLevel(element).equals(LanguageLevel.JDK_24_PREVIEW);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static final class Java25StructuredConcurrency extends JavaCodeContextType {
|
||||
private final JavaCodeContextType statementContext = new Statement();
|
||||
|
||||
|
||||
@@ -1322,6 +1322,7 @@ live.template.context.else='else' position
|
||||
live.template.context.expression=Expression
|
||||
live.template.context.declaration=Declaration
|
||||
live.template.context.statement.java.lang.io=Statement with available java.lang.IO
|
||||
live.template.context.statement.java.structured.concurrency.24=Statement with available Structured Concurrency (Java 24 / JEP 499)
|
||||
live.template.context.statement.java.structured.concurrency.25=Statement with available Structured Concurrency (Java 25 / JEP 505)
|
||||
live.template.context.normal.class.before.instance.main.declaration=Declaration inside a normal class without instance 'main' method
|
||||
live.template.context.normal.class.after.instance.main.declaration=Declaration inside a normal class with instance 'main' method
|
||||
|
||||
@@ -359,6 +359,22 @@
|
||||
</context>
|
||||
</template>
|
||||
|
||||
<template name="stss" value="try (var scope = new java.util.concurrent.StructuredTaskScope.ShutdownOnSuccess()) { $END$ scope.join(); } catch (InterruptedException e) { // TODO: handle exception } "
|
||||
resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.stss" toReformat="true" toShortenFQNames="true">
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_STATEMENT_WITH_STRUCTURED_CONCURRENCY_AVAILABLE_24" value="true" />
|
||||
</context>
|
||||
</template>
|
||||
|
||||
<template name="stsf" value="try (var scope = new java.util.concurrent.StructuredTaskScope.ShutdownOnFailure()) { $END$ scope.join(); } catch (InterruptedException e) { // TODO: handle exception } "
|
||||
resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.stsf" toReformat="true" toShortenFQNames="true">
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_STATEMENT_WITH_STRUCTURED_CONCURRENCY_AVAILABLE_24" value="true" />
|
||||
</context>
|
||||
</template>
|
||||
|
||||
<template name="sts" value="try (var scope = java.util.concurrent.StructuredTaskScope.open()) { $END$ scope.join(); } catch (InterruptedException e) { // TODO: handle exception } "
|
||||
resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.stss" toReformat="true" toShortenFQNames="true">
|
||||
<context>
|
||||
|
||||
Reference in New Issue
Block a user