mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] better way of stopping comment injection lookup in compiled code (IDEA-164741)
This commit is contained in:
+9
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -31,6 +31,7 @@ import com.intellij.openapi.ui.DialogBuilder;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Factory;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.patterns.PsiJavaPatterns;
|
||||
import com.intellij.patterns.compiler.PatternCompiler;
|
||||
@@ -98,6 +99,13 @@ public class JavaLanguageInjectionSupport extends AbstractLanguageInjectionSuppo
|
||||
return host instanceof PsiLiteralExpression;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BaseInjection findCommentInjection(@NotNull PsiElement host, @Nullable Ref<PsiElement> commentRef) {
|
||||
boolean compiled = host.getContainingFile().getOriginalFile() instanceof PsiCompiledFile;
|
||||
return compiled ? null : super.findCommentInjection(host, commentRef);
|
||||
}
|
||||
|
||||
public boolean addInjectionInPlace(final Language language, final PsiLanguageInjectionHost psiElement) {
|
||||
if (!isMine(psiElement)) return false;
|
||||
return doInjectInJava(psiElement.getProject(), psiElement, psiElement, language.getID());
|
||||
|
||||
Reference in New Issue
Block a user