mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
unmatched arguments to singnature tooltip text -- the red color is back
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package com.intellij.codeInsight.hint;
|
||||
|
||||
import com.intellij.ide.BrowserUtil;
|
||||
import com.intellij.ide.Html;
|
||||
import com.intellij.ide.IdeTooltipManager;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
@@ -75,7 +76,7 @@ public class LineTooltipRenderer extends ComparableObject.Impl implements Toolti
|
||||
final JComponent editorComponent = editor.getComponent();
|
||||
final JLayeredPane layeredPane = editorComponent.getRootPane().getLayeredPane();
|
||||
|
||||
final JEditorPane pane = IdeTooltipManager.initPane(myText, hintHint, layeredPane);
|
||||
final JEditorPane pane = IdeTooltipManager.initPane(new Html(myText).setKeepFont(true), hintHint, layeredPane);
|
||||
hintHint.setContentActive(isActiveHtml(myText));
|
||||
if (!hintHint.isAwtTooltip()) {
|
||||
correctLocation(editor, pane, p, alignToRight, expanded, myCurrentWidth);
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.ide;
|
||||
|
||||
public class Html {
|
||||
|
||||
private String myText;
|
||||
private boolean myKeepFont = false;
|
||||
|
||||
public Html(String text) {
|
||||
myText = text;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return myText;
|
||||
}
|
||||
|
||||
public Html setKeepFont(boolean keepFont) {
|
||||
myKeepFont = keepFont;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKeepFont() {
|
||||
return myKeepFont;
|
||||
}
|
||||
}
|
||||
@@ -445,10 +445,15 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static JEditorPane initPane(@NonNls String text, final HintHint hintHint, @Nullable final JLayeredPane layeredPane) {
|
||||
return initPane(new Html(text), hintHint, layeredPane);
|
||||
}
|
||||
|
||||
public static JEditorPane initPane(@NonNls Html html, final HintHint hintHint, @Nullable final JLayeredPane layeredPane) {
|
||||
final Ref<Dimension> prefSize = new Ref<Dimension>(null);
|
||||
String htmlBody = getHtmlBody(text);
|
||||
text = "<html><head>" +
|
||||
String htmlBody = getHtmlBody(html);
|
||||
String text = "<html><head>" +
|
||||
UIUtil.getCssFontDeclaration(hintHint.getTextFont(), hintHint.getTextForeground(), hintHint.getLinkForeground(), hintHint.getUlImg()) +
|
||||
"</head><body>" +
|
||||
htmlBody +
|
||||
@@ -568,7 +573,12 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.black), BorderFactory.createEmptyBorder(0, 5, 0, 5)));
|
||||
}
|
||||
|
||||
public static String getHtmlBody(@NonNls String text) {
|
||||
public static String getHtmlBody(String text) {
|
||||
return getHtmlBody(new Html(text));
|
||||
}
|
||||
|
||||
public static String getHtmlBody(Html html) {
|
||||
String text = html.getText();
|
||||
String result = text;
|
||||
if (!text.startsWith("<html>")) {
|
||||
result = text.replaceAll("\n", "<br>");
|
||||
@@ -590,7 +600,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
|
||||
|
||||
|
||||
return result.replaceAll("<font(.*?)>", "").replaceAll("</font>", "");
|
||||
return html.isKeepFont() ? result : result.replaceAll("<font(.*?)>", "").replaceAll("</font>", "");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user