revert: "[ui][IDEA-334229] quick doc popup redesign"

496c8d97

GitOrigin-RevId: d32086158d641347b96d61e7cec3de70f0a4e94b
This commit is contained in:
Alexander.Glukhov
2024-02-08 15:24:44 +01:00
committed by intellij-monorepo-bot
parent 0b846f9e75
commit 2a752d605e
11 changed files with 28 additions and 63 deletions

View File

@@ -26,4 +26,4 @@
</ul>
</div>
</div>
</div><div class="separator-container"><div class="separator"/></div><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;myLib<div class="bottom"><a href="placeholder">`genericMethod(Class&lt;?&gt;)` on localhost<icon src='AllIcons.Ide.External_link_arrow'></a></div>
</div><div class="bottom"><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;myLib</div><div class="bottom"><a href="placeholder">`genericMethod(Class&lt;?&gt;)` on localhost<icon src='AllIcons.Ide.External_link_arrow'></a></div>

View File

@@ -19,4 +19,4 @@
<div class="block"><a href="psi_element://com.jetbrains.LinkBetweenMethods#m2()"><code>m2()</code></a></div>
</li>
</ul>
</div><div class="separator-container"><div class="separator"/></div><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;myLib<div class="bottom"><a href="placeholder">`m1()` on localhost<icon src='AllIcons.Ide.External_link_arrow'></a></div>
</div><div class="bottom"><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;myLib</div><div class="bottom"><a href="placeholder">`m1()` on localhost<icon src='AllIcons.Ide.External_link_arrow'></a></div>

View File

@@ -24,4 +24,4 @@
</ul>
</div>
</div>
</div><div class="separator-container"><div class="separator"/></div><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;myLib<div class="bottom"><a href="placeholder">`SimpleInterface` on localhost<icon src='AllIcons.Ide.External_link_arrow'></a></div>
</div><div class="bottom"><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;myLib</div><div class="bottom"><a href="placeholder">`SimpleInterface` on localhost<icon src='AllIcons.Ide.External_link_arrow'></a></div>

View File

@@ -32,4 +32,4 @@ extends java.lang.Object</pre>
</li>
</ul>
</div>
</div><div class="separator-container"><div class="separator"/></div><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;myLib<div class="bottom"><a href="placeholder">`ClassWithRefLink` on localhost<icon src='AllIcons.Ide.External_link_arrow'></a></div>
</div><div class="bottom"><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;myLib</div><div class="bottom"><a href="placeholder">`ClassWithRefLink` on localhost<icon src='AllIcons.Ide.External_link_arrow'></a></div>

View File

@@ -26,4 +26,4 @@
</ul>
</div>
</div>
</div><div class="separator-container"><div class="separator"/></div><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;myLib<div class="bottom"><a href="placeholder">`param()` on localhost<icon src='AllIcons.Ide.External_link_arrow'></a></div>
</div><div class="bottom"><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;myLib</div><div class="bottom"><a href="placeholder">`param()` on localhost<icon src='AllIcons.Ide.External_link_arrow'></a></div>

View File

@@ -5,4 +5,4 @@
at least one element <tt>e</tt> such that
<tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>.
</div><table class='sections'><tr><td valign='top' class='section'><p>Overrides:</td><td valign='top'><p><a href="psi_element://java.util.Collection#contains(java.lang.Object)"><code><span style="color:#000000;">contains</span></code></a> in interface <a href="psi_element://java.util.Collection"><code><span style="color:#000000;">Collection</span></code></a></td><tr><td valign='top' class='section'><p>Params:</td><td valign='top'><code><span style="color:#000000;">o</span></code> &ndash; element whose presence in this list is to be tested </td><tr><td valign='top' class='section'><p>Returns:</td><td valign='top'><p><tt>true</tt> if this list contains the specified element </td><tr><td valign='top' class='section'><p>Throws:</td><td valign='top'><p><a href="psi_element://java.lang.ClassCastException"><code><span style="color:#0000ff;">ClassCastException</span></code></a> &ndash; if the type of the specified element is incompatible with this list (<a href="psi_element://java.util.Collection###optional-restrictions">optional</a>) <p><a href="psi_element://java.lang.NullPointerException"><code><span style="color:#0000ff;">NullPointerException</span></code></a> &ndash; if the specified element is null and this list does not permit null elements (<a href="psi_element://java.util.Collection###optional-restrictions">optional</a>)</td></table><div class="separator-container"><div class="separator"/></div><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;&lt; java 1.7 &gt;
</div><table class='sections'><tr><td valign='top' class='section'><p>Overrides:</td><td valign='top'><p><a href="psi_element://java.util.Collection#contains(java.lang.Object)"><code><span style="color:#000000;">contains</span></code></a> in interface <a href="psi_element://java.util.Collection"><code><span style="color:#000000;">Collection</span></code></a></td><tr><td valign='top' class='section'><p>Params:</td><td valign='top'><code><span style="color:#000000;">o</span></code> &ndash; element whose presence in this list is to be tested </td><tr><td valign='top' class='section'><p>Returns:</td><td valign='top'><p><tt>true</tt> if this list contains the specified element </td><tr><td valign='top' class='section'><p>Throws:</td><td valign='top'><p><a href="psi_element://java.lang.ClassCastException"><code><span style="color:#0000ff;">ClassCastException</span></code></a> &ndash; if the type of the specified element is incompatible with this list (<a href="psi_element://java.util.Collection###optional-restrictions">optional</a>) <p><a href="psi_element://java.lang.NullPointerException"><code><span style="color:#0000ff;">NullPointerException</span></code></a> &ndash; if the specified element is null and this list does not permit null elements (<a href="psi_element://java.util.Collection###optional-restrictions">optional</a>)</td></table><div class="bottom"><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;&lt; java 1.7 &gt;</div>

View File

@@ -2,4 +2,4 @@
<span style="color:#808000;">@</span><span style="color:#808000;">NotNull</span><a href="external.annotations"><icon src="AllIcons.Ide.External_link_arrow"></a>&nbsp;
<span style="color:#808000;">@</span><span style="color:#808000;">Contract</span><span style="">(</span><span style="">pure</span><span style=""> = </span><span style="color:#000080;font-weight:bold;">true</span><span style="">)</span><a href="external.annotations"><icon src="AllIcons.Ide.External_link_arrow"></a>&nbsp;
<span style="color:#000080;font-weight:bold;">public</span>&nbsp;<a href="psi_element://java.lang.reflect.Constructor"><code><span style="color:#000000;">java.lang.reflect.Constructor</span></code></a><span style="">&lt;</span><span style="">?</span><span style="">&gt;</span><span style="">[]</span>&nbsp;<span style="color:#000000;">getDeclaredConstructors</span><span style="">(</span><span style="">)</span>
<span style="color:#000080;font-weight:bold;">throws</span>&nbsp;<a href="psi_element://java.lang.SecurityException"><code><span style="color:#000000;">SecurityException</span></code></a></pre></div><table class='sections'><p><tr><td valign='top' class='section'><p>Throws:</td><td valign='top'><p><a href="psi_element://java.lang.SecurityException"><code><span style="color:#0000ff;">SecurityException</span></code></a></td></table><div class="separator-container"><div class="separator"/></div><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;&lt; java 10 &gt;
<span style="color:#000080;font-weight:bold;">throws</span>&nbsp;<a href="psi_element://java.lang.SecurityException"><code><span style="color:#000000;">SecurityException</span></code></a></pre></div><table class='sections'><p><tr><td valign='top' class='section'><p>Throws:</td><td valign='top'><p><a href="psi_element://java.lang.SecurityException"><code><span style="color:#0000ff;">SecurityException</span></code></a></td></table><div class="bottom-no-content"><icon src="AllIcons.Nodes.PpLibFolder"/>&nbsp;&lt; java 10 &gt;</div>

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.java.codeInsight
import com.intellij.codeInsight.documentation.DocumentationManager
@@ -326,7 +326,7 @@ class JavaDocumentationTest : LightJavaCodeInsightFixtureTestCase() {
// Here we check that the covering module (SDK in this case) is rendered in decorated info
assertTrue(
component.decoratedText.contains("<div class=\"separator-container\"><div class=\"separator\"/></div><icon src=\"AllIcons.Nodes.PpLibFolder\"/>&nbsp;&lt; java 1.7 &gt;"))
component.decoratedText.contains("<div class=\"bottom\"><icon src=\"AllIcons.Nodes.PpLibFolder\"/>&nbsp;&lt; java 1.7 &gt;</div>"))
return@getDocumentationText null
}
}

View File

@@ -68,11 +68,8 @@ public final class DocumentationHtmlUtil {
" border-bottom: thin solid " + borderColor + "; }",
".bottom { padding: 3px 16px 0 " + leftPadding + "px; }",
".download-documentation { padding: 0px 0px 18px; }",
".separator-container { padding: 18px " + leftPadding + "px 0px; }",
".separator-container .separator { border-top: thin solid " + borderColor + "; }",
".bottom-no-content { padding: 5px 16px 0 " + leftPadding + "px; }",
".grayed { color: #909090; display: inline;}",
".location .spacer { padding-top: 8px }",
// sections table
".sections { padding: 0 16px 0 " + leftPadding + "px; border-spacing: 0; }",

View File

@@ -1904,7 +1904,8 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
text = StringUtil.replaceIgnoreCase(text, "</body>", "");
text = replaceIgnoreQuotesType(text, SECTIONS_START + SECTIONS_END, "");
text = replaceIgnoreQuotesType(text, SECTIONS_START + "<p>" + SECTIONS_END, ""); //NON-NLS
if (!containsIgnoreQuotesType(text, CONTENT_START)) {
boolean hasContent = containsIgnoreQuotesType(text, CONTENT_START);
if (!hasContent) {
if (!containsIgnoreQuotesType(text, DEFINITION_START)) {
int bodyStart = findContentStart(text);
if (bodyStart > 0) {
@@ -1916,6 +1917,7 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
else {
text = CONTENT_START + text + CONTENT_END;
}
hasContent = true;
}
else if (!containsIgnoreQuotesType(text, SECTIONS_START)) {
text = replaceIgnoreQuotesType(text, DEFINITION_START, "<div class='definition-only'><pre>");
@@ -1924,21 +1926,17 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
if (!containsIgnoreQuotesType(text, DEFINITION_START)) {
text = replaceIgnoreQuotesType(text, "class='content'", "class='content-only'");
}
if (downloadDocumentationActionLink != null || location != null) {
text += HtmlChunk.div().setClass("separator-container")
.child(HtmlChunk.div().setClass("separator"));
if (downloadDocumentationActionLink != null) {
text += HtmlChunk.div()
.children(
HtmlChunk.icon("AllIcons.Plugins.Downloads", AllIcons.Plugins.Downloads),
HtmlChunk.nbsp(),
HtmlChunk.link(downloadDocumentationActionLink, CodeInsightBundle.message("documentation.download.button.label"))
)
.setClass("download-documentation");
}
if (location != null) {
text += location;
}
if (downloadDocumentationActionLink != null) {
text += HtmlChunk.div()
.children(
HtmlChunk.icon("AllIcons.Plugins.Downloads", AllIcons.Plugins.Downloads),
HtmlChunk.nbsp(),
HtmlChunk.link(downloadDocumentationActionLink, CodeInsightBundle.message("documentation.download.button.label"))
)
.setClass("download-documentation");
}
if (location != null) {
text += getBottom(hasContent).child(location);
}
if (links != null) {
text += getBottom(location != null).child(links);

View File

@@ -24,7 +24,6 @@ import com.intellij.openapi.actionSystem.DataProvider
import com.intellij.openapi.application.EDT
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.NlsSafe
import com.intellij.openapi.util.text.HtmlChunk
import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.platform.backend.documentation.impl.DocumentationRequest
@@ -214,44 +213,15 @@ internal class DocumentationUI(
return presentation.locationText?.let { locationText ->
presentation.locationIcon?.let { locationIcon ->
val iconKey = registerIcon(locationIcon)
getLocationChunk(locationText, iconKey)
HtmlChunk.fragment(
HtmlChunk.tag("icon").attr("src", iconKey),
HtmlChunk.nbsp(),
HtmlChunk.text(locationText)
)
} ?: HtmlChunk.text(locationText)
}
}
private fun getLocationChunk(text: String, icon: String): HtmlChunk {
val separatorIndex = text.indexOfFirst { it == ':' } + 1
return if (separatorIndex > 0) {
return getLocationChunkWithProviderInfo(
text.substring(0, separatorIndex),
text.substring(separatorIndex),
icon
)
}
else {
getLocationChunkWithoutProviderInfo(text, icon)
}
}
private fun getLocationChunkWithProviderInfo(provider: @NlsSafe String, @NlsSafe location: String, icon: String) = HtmlChunk.div()
.setClass("location")
.children(
HtmlChunk.tag("icon").attr("src", icon),
HtmlChunk.nbsp(),
HtmlChunk.text(provider),
HtmlChunk.div().setClass("spacer"),
HtmlChunk.text(location)
)
private fun getLocationChunkWithoutProviderInfo(text: @NlsSafe String, icon: String) = HtmlChunk
.div()
.setClass("location")
.children(
HtmlChunk.tag("icon").attr("src", icon),
HtmlChunk.nbsp(),
HtmlChunk.text(text)
)
private fun registerIcon(icon: Icon): String {
val key = icons.size.toString()
icons[key] = icon