package-info.java is involved in Ctrl-Q (IDEA-26014); testdata moved

This commit is contained in:
anna
2010-04-21 20:07:35 +04:00
parent 581e899f47
commit 73081ee24d
15 changed files with 83 additions and 11 deletions

View File

@@ -19,6 +19,7 @@ import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.ExternalAnnotationsManager;
import com.intellij.codeInsight.documentation.DocumentationManager;
import com.intellij.lang.ASTNode;
import com.intellij.lang.LangBundle;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
@@ -28,6 +29,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.impl.JavaConstantExpressionEvaluator;
import com.intellij.psi.impl.source.tree.JavaDocElementType;
import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.javadoc.PsiDocTag;
import com.intellij.psi.javadoc.PsiDocTagValue;
@@ -315,10 +317,7 @@ public class JavaDocInfoGenerator {
PsiDocComment comment = getDocComment(aClass);
if (comment != null) {
generateDescription(buffer, comment);
generateDeprecatedSection(buffer, comment);
generateSinceSection(buffer, comment);
generateSeeAlsoSection(buffer, comment);
generateCommonSection(buffer, comment);
generateTypeParametersSection(buffer, aClass);
}
generateEpilogue(buffer);
@@ -418,10 +417,7 @@ public class JavaDocInfoGenerator {
PsiDocComment comment = getDocComment(field);
if (comment != null) {
generateDescription(buffer, comment);
generateDeprecatedSection(buffer, comment);
generateSinceSection(buffer, comment);
generateSeeAlsoSection(buffer, comment);
generateCommonSection(buffer, comment);
}
generateEpilogue(buffer);
@@ -463,6 +459,23 @@ public class JavaDocInfoGenerator {
private void generatePackageJavaDoc(final StringBuilder buffer, final PsiPackage psiPackage) {
for(PsiDirectory directory: psiPackage.getDirectories()) {
final PsiFile packageInfoFile = directory.findFile("package-info.java");
if (packageInfoFile != null) {
final ASTNode node = packageInfoFile.getNode();
if (node != null) {
final ASTNode docCommentNode = node.findChildByType(JavaDocElementType.DOC_COMMENT);
if (docCommentNode != null) {
final PsiDocComment docComment = (PsiDocComment)docCommentNode.getPsi();
generatePrologue(buffer);
generateCommonSection(buffer, docComment);
generateEpilogue(buffer);
break;
}
}
}
PsiFile packageHtmlFile = directory.findFile("package.html");
if (packageHtmlFile != null) {
generatePackageHtmlJavaDoc(buffer, packageHtmlFile);
@@ -471,6 +484,13 @@ public class JavaDocInfoGenerator {
}
}
private void generateCommonSection(StringBuilder buffer, PsiDocComment docComment) {
generateDescription(buffer, docComment);
generateDeprecatedSection(buffer, docComment);
generateSinceSection(buffer, docComment);
generateSeeAlsoSection(buffer, docComment);
}
private void generatePackageHtmlJavaDoc(final StringBuilder buffer, final PsiFile packageHtmlFile) {
String htmlText;
XmlFile packageXmlFile = (XmlFile) packageHtmlFile;
@@ -502,9 +522,7 @@ public class JavaDocInfoGenerator {
generatePrologue(buffer);
generateDescription(buffer, docComment);
generateSinceSection(buffer, docComment);
generateSeeAlsoSection(buffer, docComment);
generateCommonSection(buffer, docComment);
generateEpilogue(buffer);
}

View File

@@ -0,0 +1,3 @@
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body><PRE>class <b>MethodTypeParam</b>&lt;T&gt;
extends <a href="psi_element://java.lang.Object"><code>Object</code></a></PRE>
<DD><DL><DT><b>Type parameters:</b><DD><code>&lt;T&gt;</code> - type param</DD></DL></DD></body></html>

View File

@@ -0,0 +1,6 @@
/**
* @param <T> type param
*/
class MethodTypeParam<T> {
}

View File

@@ -0,0 +1 @@
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static int <b>JAVADOC_ME = 23</b></PRE> The value of the field is 23.</body></html>

View File

@@ -0,0 +1,4 @@
class A {
/** The value of the field is {@value}. */
public static int JAVADOC_ME = 23;
}

View File

@@ -0,0 +1,2 @@
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body><small><b><a href="psi_element://Idea4780"><code>Idea4780</code></a></b></small><PRE>public&nbsp;<a href="psi_element://java.lang.Object"><code>Object</code></a>&nbsp;<b>read</b>()
throws&nbsp;<a href="psi_element://java.io.IOException"><code>IOException</code></a></PRE><DD><DL><DT><b>Throws:</b><DD><a href="psi_element://java.io.EOFException"><code>EOFException</code></a> - if this source is already closed when the <code>read()</code> is called, or is closed during the <code>read()</code>. <DD><font color=red>InterruptedIOException</font> - if the reading thread is interrupted.<DD><a href="psi_element://java.io.IOException"><code>IOException</code></a> - if an I/O error occurs while reading. </DD></DL></DD></body></html>

View File

@@ -0,0 +1,12 @@
import java.io.*;
public interface Idea4780 {
/**
* @throws IOException if an I/O error occurs while reading.
* @throws EOFException if this source is already closed when the <code>read()</code> is called,
* or is closed during the <code>read()</code>.
* @throws InterruptedIOException if the reading thread is interrupted.
*/
public Object read()
throws IOException;
}

View File

@@ -0,0 +1 @@
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body><small><b><a href="psi_element://MethodTypeParam"><code>MethodTypeParam</code></a></b></small><PRE>&lt;T&gt;&nbsp;void&nbsp;<b>foo</b>(T&nbsp;t)</PRE><DD><DL><DT><b>Type parameters:</b><DD><code>&lt;T&gt;</code> - type param</DD></DL></DD></body></html>

View File

@@ -0,0 +1,7 @@
class MethodTypeParam {
/**
* @param <T> type param
*/
<T> void foo(T t) {
}
}

View File

@@ -0,0 +1,4 @@
/**
* This package contains nothing but package-info.java
*/
package packageInfo;

View File

@@ -0,0 +1,2 @@
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body>
This package contains nothing but package-info.java</body></html>

View File

@@ -0,0 +1 @@
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static int <b>JAVADOC_ME</b></PRE> Test</body></html>

View File

@@ -0,0 +1,4 @@
class A {
/** Test */
public static int JAVADOC_ME;
}

View File

@@ -0,0 +1 @@
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static&nbsp;void&nbsp;<b>JAVADOC_ME</b>()</PRE> The value of A is 23.</body></html>

View File

@@ -0,0 +1,6 @@
class A {
public static int A = 23;
/** The value of A is {@value #A}. */
public static void JAVADOC_ME() { }
}