com.intellij.xml.util.XmlStringUtil.wrapInHtml

This commit is contained in:
Alexey Kudravtsev
2014-01-14 14:01:47 +04:00
parent 585052bf8b
commit 052622f73a
19 changed files with 82 additions and 72 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -35,6 +35,7 @@ import com.intellij.ui.RawCommandLineEditor;
import com.intellij.ui.components.JBLabel;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtilRt;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -91,12 +92,12 @@ public class CompilerUIConfigurable implements SearchableConfigurable, Configura
public CompilerUIConfigurable(@NotNull final Project project) {
myProject = project;
myPatternLegendLabel.setText("<html><body>" +
myPatternLegendLabel.setText(XmlStringUtil.wrapInHtml(
"Use <b>;</b> to separate patterns and <b>!</b> to negate a pattern. " +
"Accepted wildcards: <b>?</b> &mdash; exactly one symbol; <b>*</b> &mdash; zero or more symbols; " +
"<b>/</b> &mdash; path separator; <b>/**/</b> &mdash; any number of directories; " +
"<i>&lt;dir_name&gt;</i>:<i>&lt;pattern&gt;</i> &mdash; restrict to source roots with the specified name" +
"</body></html>");
"<i>&lt;dir_name&gt;</i>:<i>&lt;pattern&gt;</i> &mdash; restrict to source roots with the specified name"
));
myPatternLegendLabel.setForeground(new JBColor(Gray._50, Gray._130));
tweakControls(project);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -23,6 +23,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -99,7 +100,7 @@ public class RelatedItemLineMarkerInfo<T extends PsiElement> extends MergeableLi
}
tooltip.append(UIUtil.getHtmlBody(info));
}
return "<html><body>" + tooltip.toString() + "</body></html>";
return XmlStringUtil.wrapInHtml(tooltip);
}
};
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -34,6 +34,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import com.intellij.xml.util.XmlStringUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -153,7 +154,7 @@ public class DaemonTooltipRendererProvider implements ErrorStripTooltipRendererP
}
}
if (!text.isEmpty()) { //otherwise do not change anything
myText = "<html><body>" + StringUtil.trimEnd(text, UIUtil.BORDER_LINE) + "</body></html>";
myText = XmlStringUtil.wrapInHtml(StringUtil.trimEnd(text, UIUtil.BORDER_LINE));
return true;
}
return false;
@@ -176,13 +177,13 @@ public class DaemonTooltipRendererProvider implements ErrorStripTooltipRendererP
@Override
protected void stripDescription() {
final List<String> problems = StringUtil.split(UIUtil.getHtmlBody(myText), UIUtil.BORDER_LINE);
myText = "<html><body>";
for (int i = 0, size = problems.size(); i < size; i++) {
final String problem = StringUtil.split(problems.get(i), END_MARKER).get(0);
myText = "";
for (String problem1 : problems) {
final String problem = StringUtil.split(problem1, END_MARKER).get(0);
myText += UIUtil.getHtmlBody(problem).replace(DaemonBundle.message("inspection.collapse.description"),
DaemonBundle.message("inspection.extended.description")) + UIUtil.BORDER_LINE;
}
myText = StringUtil.trimEnd(myText, UIUtil.BORDER_LINE) + "</body></html>";
myText = XmlStringUtil.wrapInHtml(StringUtil.trimEnd(myText, UIUtil.BORDER_LINE));
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -34,6 +34,7 @@ import com.intellij.ui.components.panels.Wrapper;
import com.intellij.util.containers.HashMap;
import com.intellij.util.containers.hash.LinkedHashMap;
import com.intellij.util.ui.AwtVisitor;
import com.intellij.xml.util.XmlStringUtil;
import org.intellij.lang.annotations.Language;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -223,7 +224,7 @@ public class TrafficProgressPanel extends JPanel {
int currentSeverityErrors = 0;
@Language("HTML")
String text = "<html><body>";
String text = "";
for (int i = status.errorCount.length - 1; i >= 0; i--) {
if (status.errorCount[i] > 0) {
final HighlightSeverity severity = SeverityRegistrar.getSeverityRegistrar(myTrafficLightRenderer.getProject()).getSeverityByIndex(i);
@@ -241,7 +242,7 @@ public class TrafficProgressPanel extends JPanel {
? DaemonBundle.message("no.errors.or.warnings.found")
: DaemonBundle.message("no.errors.or.warnings.found.so.far") + "<br>";
}
statistics.setText(text);
statistics.setText(XmlStringUtil.wrapInHtml(text));
}
finally {
if (isFake) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -35,6 +35,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.ui.HyperlinkLabel;
import com.intellij.ui.TitledSeparator;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
@@ -91,7 +92,7 @@ public class IntentionDescriptionPanel {
PluginId pluginId = actionMetaData == null ? null : actionMetaData.getPluginId();
JComponent owner;
if (pluginId == null) {
@NonNls String label = "<html><body><b>" + ApplicationNamesInfo.getInstance().getFullProductName() + "</b></body></html>";
@NonNls String label = XmlStringUtil.wrapInHtml("<b>" + ApplicationNamesInfo.getInstance().getFullProductName() + "</b>");
owner = new JLabel(label);
}
else {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -25,7 +25,7 @@ import com.intellij.ide.IdeBundle;
import com.intellij.ui.UserActivityListener;
import com.intellij.ui.UserActivityWatcher;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -39,8 +39,6 @@ import java.util.List;
* @author nik
*/
public class FacetErrorPanel {
@NonNls private static final String HTML_PREFIX = "<html><body>";
@NonNls private static final String HTML_SUFFIX = "</body></html>";
private final JPanel myMainPanel;
private JPanel myButtonPanel;
private JButton myQuickFixButton;
@@ -128,7 +126,7 @@ public class FacetErrorPanel {
ValidationResult validationResult = validator.check();
if (!validationResult.isOk()) {
myMainPanel.setVisible(true);
myWarningLabel.setText(HTML_PREFIX + validationResult.getErrorMessage() + HTML_SUFFIX);
myWarningLabel.setText(XmlStringUtil.wrapInHtml(validationResult.getErrorMessage()));
myWarningLabel.setVisible(true);
myCurrentQuickFix = validationResult.getQuickFix();
myQuickFixButton.setVisible(myCurrentQuickFix != null);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -66,6 +66,7 @@ import com.intellij.util.messages.MessageBusConnection;
import com.intellij.util.ui.AsyncProcessIcon;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.ListTableModel;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -736,7 +737,7 @@ public class ShowUsagesAction extends AnAction implements PopupAction {
if (title != null) {
text += "<br><small>Press " + title + "</small>";
}
return "<html><body>" + text + "</body></html>";
return XmlStringUtil.wrapInHtml(text);
}
@Nullable
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -33,6 +33,7 @@ import com.intellij.usages.impl.UsageViewImpl;
import com.intellij.usages.rules.UsageInFile;
import com.intellij.util.ui.EmptyIcon;
import com.intellij.util.ui.UIUtil;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -65,7 +66,7 @@ class ShowUsagesTableCellRenderer implements TableCellRenderer {
if (usage == null || usageNode instanceof ShowUsagesAction.StringNode) {
panel.setLayout(new BorderLayout());
if (column == 0) {
panel.add(new JLabel("<html><body><b>" + value + "</b></body></html>", SwingConstants.CENTER));
panel.add(new JLabel(XmlStringUtil.wrapInHtml("<b>" + value + "</b>"), SwingConstants.CENTER));
}
return panel;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -24,6 +24,7 @@ import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.VerticalFlowLayout;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -62,7 +63,7 @@ public class RemoveInvalidElementsDialog extends DialogWrapper {
panel.add(checkBox, constraints);
constraints.anchor = GridBagConstraints.NORTHWEST;
constraints.insets.top = 5;
panel.add(new JLabel("<html><body>" + StringUtil.replace(error.getDescription(), "\n", "<br>") + "</body></html>"), constraints);
panel.add(new JLabel(XmlStringUtil.wrapInHtml(StringUtil.replace(error.getDescription(), "\n", "<br>"))), constraints);
constraints.weightx = 1;
panel.add(new JPanel(), constraints);
myContentPanel.add(panel);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -29,6 +29,7 @@ import com.intellij.util.PlatformIcons;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.ComboBoxCellEditor;
import com.intellij.util.ui.tree.TreeUtil;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
@@ -118,9 +119,9 @@ public class DetectedRootsChooserDialog extends DialogWrapper {
}
private void init(List<SuggestedChildRootInfo> suggestedRoots) {
myDescription = "<html><body>" + ApplicationNamesInfo.getInstance().getFullProductName() +
myDescription = XmlStringUtil.wrapInHtml(ApplicationNamesInfo.getInstance().getFullProductName() +
" just scanned files and detected the following " + StringUtil.pluralize("root", suggestedRoots.size()) + ".<br>" +
"Select items in the tree below or press Cancel to cancel operation.</body></html>";
"Select items in the tree below or press Cancel to cancel operation.");
myTreeTable = createTreeTable(suggestedRoots);
myPane = ScrollPaneFactory.createScrollPane(myTreeTable);
setTitle("Detected Roots");
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -64,6 +64,7 @@ import com.intellij.util.config.StorageAccessors;
import com.intellij.util.containers.Convertor;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.tree.TreeUtil;
import com.intellij.xml.util.XmlStringUtil;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -756,7 +757,7 @@ public class SingleInspectionProfilePanel extends JPanel {
catch (IOException e2) {
try {
//noinspection HardCodedStringLiteral
myBrowser.read(new StringReader("<html><body><b>" + UNDER_CONSTRUCTION + "</b></body></html>"), null);
myBrowser.read(new StringReader(XmlStringUtil.wrapInHtml("<b>" + UNDER_CONSTRUCTION + "</b>")), null);
}
catch (IOException e1) {
//Can't be
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -18,19 +18,16 @@ package com.intellij.openapi.ui;
import com.intellij.ui.components.panels.NonOpaquePanel;
import com.intellij.ui.components.panels.Wrapper;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.GeneralPath;
import java.util.ArrayList;
@@ -219,7 +216,7 @@ public class DetailsComponent {
}
public DetailsComponent setEmptyContentText(@Nullable final String emptyContentText) {
@NonNls final String s = "<html><body><center>" + (emptyContentText != null ? emptyContentText : "") + "</center></body><html>";
@NonNls final String s = XmlStringUtil.wrapInHtml("<center>" + (emptyContentText != null ? emptyContentText : "") + "</center>");
myEmptyContentLabel.setText(s);
return this;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -30,6 +30,7 @@ import com.intellij.ui.ScrollPaneFactory;
import com.intellij.util.ui.Html;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.update.ComparableObject;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -324,7 +325,7 @@ public class LineTooltipRenderer extends ComparableObject.Impl implements Toolti
String html2 = UIUtil.getHtmlBody(text);
newBody = html1 + UIUtil.BORDER_LINE + html2;
}
myText = "<html><body>" + newBody + "</body></html>";
myText = XmlStringUtil.wrapInHtml(newBody);
}
public String getText() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -34,6 +34,7 @@ import com.intellij.util.text.DateFormatUtil;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.ListTableModel;
import com.intellij.util.ui.UIUtil;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -181,7 +182,7 @@ public class ShowFeatureUsageStatisticsDialog extends DialogWrapper {
" (~" + fstats.invocations / fstats.dayCount + " per working day)";
}
controlsPanel.add(new JLabel("<html><body>" + labelText + "</body></html>"), BorderLayout.NORTH);
controlsPanel.add(new JLabel(XmlStringUtil.wrapInHtml(labelText)), BorderLayout.NORTH);
JPanel topPanel = new JPanel(new BorderLayout());
topPanel.add(controlsPanel, BorderLayout.NORTH);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -27,6 +27,7 @@ import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Function;
import com.intellij.util.net.IOExceptionDialog;
import com.intellij.xml.util.XmlStringUtil;
import javax.swing.*;
import java.io.IOException;
@@ -185,10 +186,11 @@ public class ActionInstallPlugin extends AnAction implements DumbAware {
final Set<IdeaPluginDescriptor> disabledDependants,
final ArrayList<PluginNode> list) {
if (!disabled.isEmpty() || !disabledDependants.isEmpty()) {
String message = "<html><body>";
String message = "";
if (disabled.size() == 1) {
message += "Updated plugin '" + disabled.iterator().next().getName() + "' is disabled.";
} else if (!disabled.isEmpty()) {
}
else if (!disabled.isEmpty()) {
message += "Updated plugins " + StringUtil.join(disabled, new Function<IdeaPluginDescriptor, String>() {
@Override
public String fun(IdeaPluginDescriptor pluginDescriptor) {
@@ -202,7 +204,8 @@ public class ActionInstallPlugin extends AnAction implements DumbAware {
message += "Updated plugin" + (list.size() > 1 ? "s depend " : " depends ") + "on disabled";
if (disabledDependants.size() == 1) {
message += " plugin '" + disabledDependants.iterator().next().getName() + "'.";
} else {
}
else {
message += " plugins " + StringUtil.join(disabledDependants, new Function<IdeaPluginDescriptor, String>() {
@Override
public String fun(IdeaPluginDescriptor pluginDescriptor) {
@@ -216,11 +219,12 @@ public class ActionInstallPlugin extends AnAction implements DumbAware {
int result;
if (!disabled.isEmpty() && !disabledDependants.isEmpty()) {
result =
Messages.showYesNoCancelDialog(message + "</body></html>", CommonBundle.getWarningTitle(), "Enable all",
Messages.showYesNoCancelDialog(XmlStringUtil.wrapInHtml(message), CommonBundle.getWarningTitle(), "Enable all",
"Enable updated plugin" + (disabled.size() > 1 ? "s" : ""), CommonBundle.getCancelButtonText(),
Messages.getQuestionIcon());
if (result == Messages.CANCEL) return false;
} else {
}
else {
message += "<br>Would you like to enable ";
if (!disabled.isEmpty()) {
message += "updated plugin" + (disabled.size() > 1 ? "s" : "");
@@ -237,7 +241,8 @@ public class ActionInstallPlugin extends AnAction implements DumbAware {
if (result == Messages.YES) {
disabled.addAll(disabledDependants);
pluginsModel.enableRows(disabled.toArray(new IdeaPluginDescriptor[disabled.size()]), true);
} else if (result == Messages.NO && !disabled.isEmpty()) {
}
else if (result == Messages.NO && !disabled.isEmpty()) {
pluginsModel.enableRows(disabled.toArray(new IdeaPluginDescriptor[disabled.size()]), true);
}
return true;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -21,6 +21,7 @@ import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -50,11 +51,10 @@ public class IncompatibleEncodingDialog extends DialogWrapper {
@Nullable
@Override
protected JComponent createCenterPanel() {
JLabel label = new JLabel("<html><body>" +
JLabel label = new JLabel(XmlStringUtil.wrapInHtml(
"The encoding you've chosen ('" + charset.displayName() + "') may change the contents of '" + virtualFile.getName() + "'.<br>" +
"Do you want to reload the file from disk or<br>" +
"convert the text and save in the new encoding?" +
"</body></html>");
"convert the text and save in the new encoding?"));
label.setIcon(Messages.getQuestionIcon());
label.setIconTextGap(10);
return label;
@@ -74,23 +74,21 @@ public class IncompatibleEncodingDialog extends DialogWrapper {
byte[] bom = virtualFile.getBOM();
if (bom != null) {
Messages
.showErrorDialog("<html><body>" +
.showErrorDialog(XmlStringUtil.wrapInHtml(
"File '" + virtualFile.getName() + "' can't be reloaded in the '" + charset.displayName() + "' encoding.<br><br>" +
(failReason == null ? "" : "Why: "+ failReason +"<br>") +
(autoDetected == null ? "" : "Detected encoding: '"+ autoDetected.displayName()+"'") +
"</body></html>",
"Incompatible Encoding: " + charset.displayName()
(autoDetected == null ? "" : "Detected encoding: '"+ autoDetected.displayName()+"'")),
"Incompatible Encoding: " + charset.displayName()
);
res = -1;
}
else {
res = Messages
.showDialog("<html><body>" +
.showDialog(XmlStringUtil.wrapInHtml(
"File '" + virtualFile.getName() + "' most likely isn't stored in the '" + charset.displayName() + "' encoding." +
"<br><br>" +
(failReason == null ? "" : "Why: " + failReason + "<br>") +
(autoDetected == null ? "" : "Detected encoding: '" + autoDetected.displayName() + "'") +
"</body></html>",
(autoDetected == null ? "" : "Detected encoding: '" + autoDetected.displayName() + "'")),
"Incompatible Encoding: " + charset.displayName(), new String[]{"Reload anyway", "Cancel"}, 1,
AllIcons.General.WarningDialog);
}
@@ -111,10 +109,9 @@ public class IncompatibleEncodingDialog extends DialogWrapper {
protected void doAction(ActionEvent e) {
if (safeToConvert == EncodingUtil.Magic8.NO_WAY) {
String error = EncodingUtil.checkCanConvert(virtualFile);
int res = Messages.showDialog("<html><body>" +
int res = Messages.showDialog(XmlStringUtil.wrapInHtml(
"Please do not convert to '"+charset.displayName()+"'.<br><br>" +
(error == null ? "Encoding '" + charset.displayName() + "' does not support some characters from the text." : error)+
"</body></html>",
(error == null ? "Encoding '" + charset.displayName() + "' does not support some characters from the text." : error)),
"Incompatible Encoding: " + charset.displayName(), new String[]{"Convert anyway", "Cancel"}, 1,
AllIcons.General.WarningDialog);
if (res != 0) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -17,7 +17,7 @@ package com.intellij.util.ui;
public class Html {
private String myText;
private final String myText;
private boolean myKeepFont = false;
public Html(String text) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -18,6 +18,7 @@ package com.intellij.vcsUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.ui.UIUtil;
import com.intellij.xml.util.XmlStringUtil;
import javax.swing.*;
import java.awt.*;
@@ -32,7 +33,7 @@ public class UIVcsUtil {
}
public static JPanel errorPanel(final String text, boolean isError) {
final JLabel label = new JLabel("<html><body>" + escapeXmlAndAddBr(text) + "</body></html>");
final JLabel label = new JLabel(XmlStringUtil.wrapInHtml(escapeXmlAndAddBr(text)));
label.setForeground(isError ? SimpleTextAttributes.ERROR_ATTRIBUTES.getFgColor() : UIUtil.getInactiveTextColor());
final JPanel wrapper = new JPanel(new GridBagLayout());
wrapper.add(label, new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.CENTER, GridBagConstraints.NONE,
@@ -47,8 +48,8 @@ public class UIVcsUtil {
}
public static JPanel infoPanel(final String header, final String text) {
final JLabel label = new JLabel("<html><body><h4>" + StringUtil.escapeXml(header) +
"</h4>" + escapeXmlAndAddBr(text) + "</body></html>");
final JLabel label = new JLabel(XmlStringUtil.wrapInHtml("<h4>" + StringUtil.escapeXml(header) +
"</h4>" + escapeXmlAndAddBr(text)));
final JPanel wrapper = new JPanel(new GridBagLayout());
wrapper.add(label, new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.CENTER, GridBagConstraints.NONE,
new Insets(1,1,1,1), 0,0));
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -93,7 +93,7 @@ public class DomElementsHighlightingUtil {
private static Annotation createAnnotation(final HighlightSeverity severity,
final TextRange range,
final String text) {
String tooltip = text == null ? null : "<html><body>" + XmlStringUtil.escapeString(text) + "</body></html>";
String tooltip = text == null ? null : XmlStringUtil.wrapInHtml(XmlStringUtil.escapeString(text));
return new Annotation(range.getStartOffset(), range.getEndOffset(), severity, text, tooltip);
}