From b34aa8f9d45e7e4017fcdfe694e13d75ed120901 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Fri, 6 Oct 2017 15:44:59 +0200 Subject: [PATCH] SSR: fix too much escaping on complete-match tool tip --- .../ui/SubstitutionShortInfoHandler.java | 20 +++-------------- .../structuralsearch/plugin/ui/UIUtil.java | 22 +++---------------- 2 files changed, 6 insertions(+), 36 deletions(-) diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SubstitutionShortInfoHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SubstitutionShortInfoHandler.java index ae37cb2607e0..aade72c4be99 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SubstitutionShortInfoHandler.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/SubstitutionShortInfoHandler.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.structuralsearch.plugin.ui; import com.intellij.codeInsight.hint.TooltipController; @@ -188,7 +174,7 @@ public class SubstitutionShortInfoHandler implements DocumentListener, EditorMou if (buf.length() == 0) { return SSRBundle.message("no.constraints.specified.tooltip.message"); } - return StringUtil.escapeXml(buf.toString()); + return buf.toString(); } private static void append(final StringBuilder buf, final String str) { @@ -216,7 +202,7 @@ public class SubstitutionShortInfoHandler implements DocumentListener, EditorMou editor.getComponent().getRootPane().getLayeredPane()); final HintHint hint = new HintHint(editor, bestPoint).setAwtTooltip(true).setHighlighterType(true).setShowImmediately(true) .setCalloutShift(editor.getLineHeight() / 2 - 1); - TooltipController.getInstance().showTooltip(editor, p, text, visibleArea.width, false, SS_INFO_TOOLTIP_GROUP, hint); + TooltipController.getInstance().showTooltip(editor, p, StringUtil.escapeXml(text), visibleArea.width, false, SS_INFO_TOOLTIP_GROUP, hint); } static SubstitutionShortInfoHandler retrieve(Editor editor) { diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java index 243c16461c5a..affb638f53d9 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/plugin/ui/UIUtil.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.structuralsearch.plugin.ui; import com.intellij.codeInsight.template.TemplateContextType; @@ -190,15 +176,13 @@ public class UIUtil { return; } final MatchOptions matchOptions = configuration.getMatchOptions(); - final MatchVariableConstraint constraint = - getOrAddVariableConstraint(Configuration.CONTEXT_VAR_NAME, configuration); + final MatchVariableConstraint constraint = getOrAddVariableConstraint(Configuration.CONTEXT_VAR_NAME, configuration); if (isTarget(Configuration.CONTEXT_VAR_NAME, matchOptions)) { constraint.setPartOfSearchResults(true); } label.setText(SSRBundle.message("complete.match.variable.tooltip.message", SubstitutionShortInfoHandler.getShortParamString(constraint))); - final IdeTooltipManager tooltipManager = IdeTooltipManager.getInstance(); - tooltipManager.show(tooltip, true); + IdeTooltipManager.getInstance().show(tooltip, true); } @Override