From 30b68a6775218e3b20c2e7b4f1a42836246af0f6 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Mon, 5 Dec 2016 09:54:20 +0100 Subject: [PATCH] [java] excludes @author tag from completion in method Javadoc (IDEA-159020) --- .../impl/source/javadoc/AuthorDocTagInfo.java | 38 +++++++++++++++++++ .../source/javadoc/JavadocManagerImpl.java | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/AuthorDocTagInfo.java diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/AuthorDocTagInfo.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/AuthorDocTagInfo.java new file mode 100644 index 000000000000..b286221af7fa --- /dev/null +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/AuthorDocTagInfo.java @@ -0,0 +1,38 @@ +/* + * 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. + * 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. + */ +package com.intellij.psi.impl.source.javadoc; + +import com.intellij.pom.java.LanguageLevel; +import com.intellij.psi.PsiClass; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiMethod; +import com.intellij.psi.PsiPackage; + +class AuthorDocTagInfo extends SimpleDocTagInfo { + AuthorDocTagInfo() { + super("author", LanguageLevel.JDK_1_3, false, PsiClass.class, PsiPackage.class, PsiMethod.class); + } + + @Override + public boolean isValidInContext(PsiElement element) { + if (element instanceof PsiMethod && !element.isPhysical()) { + return false; + } + else { + return super.isValidInContext(element); + } + } +} \ No newline at end of file diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/JavadocManagerImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/JavadocManagerImpl.java index dc393e754398..6dd8be129c28 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/JavadocManagerImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/JavadocManagerImpl.java @@ -39,7 +39,7 @@ public class JavadocManagerImpl implements JavadocManager { public JavadocManagerImpl(Project project) { myInfos = new ArrayList(); - myInfos.add(new SimpleDocTagInfo("author", LanguageLevel.JDK_1_3, false, PsiClass.class, PsiPackage.class, PsiMethod.class)); + myInfos.add(new AuthorDocTagInfo()); myInfos.add(new SimpleDocTagInfo("deprecated", LanguageLevel.JDK_1_3, false, PsiElement.class)); myInfos.add(new SimpleDocTagInfo("serialData", LanguageLevel.JDK_1_3, false, PsiMethod.class)); myInfos.add(new SimpleDocTagInfo("serialField", LanguageLevel.JDK_1_3, false, PsiField.class));