diff --git a/java/compiler/impl/src/com/intellij/compiler/options/CompilerUIConfigurable.java b/java/compiler/impl/src/com/intellij/compiler/options/CompilerUIConfigurable.java index f66e2a32cc58..b772853559a0 100644 --- a/java/compiler/impl/src/com/intellij/compiler/options/CompilerUIConfigurable.java +++ b/java/compiler/impl/src/com/intellij/compiler/options/CompilerUIConfigurable.java @@ -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("" + + myPatternLegendLabel.setText(XmlStringUtil.wrapInHtml( "Use ; to separate patterns and ! to negate a pattern. " + "Accepted wildcards: ? — exactly one symbol; * — zero or more symbols; " + "/ — path separator; /**/ — any number of directories; " + - "<dir_name>:<pattern> — restrict to source roots with the specified name" + - ""); + "<dir_name>:<pattern> — restrict to source roots with the specified name" + )); myPatternLegendLabel.setForeground(new JBColor(Gray._50, Gray._130)); tweakControls(project); } diff --git a/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerInfo.java b/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerInfo.java index ad0f66c73c9c..0c8236c42ba8 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerInfo.java +++ b/platform/lang-api/src/com/intellij/codeInsight/daemon/RelatedItemLineMarkerInfo.java @@ -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 extends MergeableLi } tooltip.append(UIUtil.getHtmlBody(info)); } - return "" + tooltip.toString() + ""; + return XmlStringUtil.wrapInHtml(tooltip); } }; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonTooltipRendererProvider.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonTooltipRendererProvider.java index 5b705e8c43ba..7b3a3ce4cbc7 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonTooltipRendererProvider.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonTooltipRendererProvider.java @@ -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 = "" + StringUtil.trimEnd(text, UIUtil.BORDER_LINE) + ""; + 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 problems = StringUtil.split(UIUtil.getHtmlBody(myText), UIUtil.BORDER_LINE); - myText = ""; - 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) + ""; + myText = XmlStringUtil.wrapInHtml(StringUtil.trimEnd(myText, UIUtil.BORDER_LINE)); } @Override diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/TrafficProgressPanel.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/TrafficProgressPanel.java index 4ed274f408d2..0b221e059da9 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/TrafficProgressPanel.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/TrafficProgressPanel.java @@ -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 = ""; + 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") + "
"; } - statistics.setText(text); + statistics.setText(XmlStringUtil.wrapInHtml(text)); } finally { if (isFake) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java index 07408d1284f5..ff829c87fe61 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionDescriptionPanel.java @@ -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 = "" + ApplicationNamesInfo.getInstance().getFullProductName() + ""; + @NonNls String label = XmlStringUtil.wrapInHtml("" + ApplicationNamesInfo.getInstance().getFullProductName() + ""); owner = new JLabel(label); } else { diff --git a/platform/lang-impl/src/com/intellij/facet/impl/ui/FacetErrorPanel.java b/platform/lang-impl/src/com/intellij/facet/impl/ui/FacetErrorPanel.java index 5c6616290f93..2de03c48df91 100644 --- a/platform/lang-impl/src/com/intellij/facet/impl/ui/FacetErrorPanel.java +++ b/platform/lang-impl/src/com/intellij/facet/impl/ui/FacetErrorPanel.java @@ -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 = ""; - @NonNls private static final String HTML_SUFFIX = ""; 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); diff --git a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java index cb93e1d328f7..2c15e36fcb5b 100644 --- a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java +++ b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java @@ -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 += "
Press " + title + ""; } - return "" + text + ""; + return XmlStringUtil.wrapInHtml(text); } @Nullable diff --git a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesTableCellRenderer.java b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesTableCellRenderer.java index 9aa4999b1652..7603bab35b7b 100644 --- a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesTableCellRenderer.java +++ b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesTableCellRenderer.java @@ -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("" + value + "", SwingConstants.CENTER)); + panel.add(new JLabel(XmlStringUtil.wrapInHtml("" + value + ""), SwingConstants.CENTER)); } return panel; } diff --git a/platform/lang-impl/src/com/intellij/openapi/module/impl/RemoveInvalidElementsDialog.java b/platform/lang-impl/src/com/intellij/openapi/module/impl/RemoveInvalidElementsDialog.java index f422d1b33293..e9e5704482a0 100644 --- a/platform/lang-impl/src/com/intellij/openapi/module/impl/RemoveInvalidElementsDialog.java +++ b/platform/lang-impl/src/com/intellij/openapi/module/impl/RemoveInvalidElementsDialog.java @@ -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("" + StringUtil.replace(error.getDescription(), "\n", "
") + ""), constraints); + panel.add(new JLabel(XmlStringUtil.wrapInHtml(StringUtil.replace(error.getDescription(), "\n", "
"))), constraints); constraints.weightx = 1; panel.add(new JPanel(), constraints); myContentPanel.add(panel); diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/DetectedRootsChooserDialog.java b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/DetectedRootsChooserDialog.java index a14b7a5312d4..ee44bdf2f08b 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/DetectedRootsChooserDialog.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/DetectedRootsChooserDialog.java @@ -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 suggestedRoots) { - myDescription = "" + ApplicationNamesInfo.getInstance().getFullProductName() + + myDescription = XmlStringUtil.wrapInHtml(ApplicationNamesInfo.getInstance().getFullProductName() + " just scanned files and detected the following " + StringUtil.pluralize("root", suggestedRoots.size()) + ".
" + - "Select items in the tree below or press Cancel to cancel operation."; + "Select items in the tree below or press Cancel to cancel operation."); myTreeTable = createTreeTable(suggestedRoots); myPane = ScrollPaneFactory.createScrollPane(myTreeTable); setTitle("Detected Roots"); diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java index 1b63653e8b74..b512f43b247a 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java @@ -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("" + UNDER_CONSTRUCTION + ""), null); + myBrowser.read(new StringReader(XmlStringUtil.wrapInHtml("" + UNDER_CONSTRUCTION + "")), null); } catch (IOException e1) { //Can't be diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java b/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java index 841a807248f3..673e939d4991 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/DetailsComponent.java @@ -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 = "
" + (emptyContentText != null ? emptyContentText : "") + "
"; + @NonNls final String s = XmlStringUtil.wrapInHtml("
" + (emptyContentText != null ? emptyContentText : "") + "
"); myEmptyContentLabel.setText(s); return this; } diff --git a/platform/platform-impl/src/com/intellij/codeInsight/hint/LineTooltipRenderer.java b/platform/platform-impl/src/com/intellij/codeInsight/hint/LineTooltipRenderer.java index 9bcfb8741e73..bcace21c4801 100644 --- a/platform/platform-impl/src/com/intellij/codeInsight/hint/LineTooltipRenderer.java +++ b/platform/platform-impl/src/com/intellij/codeInsight/hint/LineTooltipRenderer.java @@ -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 = "" + newBody + ""; + myText = XmlStringUtil.wrapInHtml(newBody); } public String getText() { diff --git a/platform/platform-impl/src/com/intellij/featureStatistics/actions/ShowFeatureUsageStatisticsDialog.java b/platform/platform-impl/src/com/intellij/featureStatistics/actions/ShowFeatureUsageStatisticsDialog.java index 7922b18e1b1e..2c328ff510ae 100644 --- a/platform/platform-impl/src/com/intellij/featureStatistics/actions/ShowFeatureUsageStatisticsDialog.java +++ b/platform/platform-impl/src/com/intellij/featureStatistics/actions/ShowFeatureUsageStatisticsDialog.java @@ -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("" + labelText + ""), BorderLayout.NORTH); + controlsPanel.add(new JLabel(XmlStringUtil.wrapInHtml(labelText)), BorderLayout.NORTH); JPanel topPanel = new JPanel(new BorderLayout()); topPanel.add(controlsPanel, BorderLayout.NORTH); diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/ActionInstallPlugin.java b/platform/platform-impl/src/com/intellij/ide/plugins/ActionInstallPlugin.java index d7b0b6bbf0d8..721de87c5fc2 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/ActionInstallPlugin.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/ActionInstallPlugin.java @@ -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 disabledDependants, final ArrayList list) { if (!disabled.isEmpty() || !disabledDependants.isEmpty()) { - String message = ""; + 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() { @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() { @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 + "", 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 += "
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; diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/IncompatibleEncodingDialog.java b/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/IncompatibleEncodingDialog.java index 4e4adfa8977d..7470f9222f95 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/IncompatibleEncodingDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/IncompatibleEncodingDialog.java @@ -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("" + + JLabel label = new JLabel(XmlStringUtil.wrapInHtml( "The encoding you've chosen ('" + charset.displayName() + "') may change the contents of '" + virtualFile.getName() + "'.
" + "Do you want to reload the file from disk or
" + - "convert the text and save in the new encoding?" + - ""); + "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("" + + .showErrorDialog(XmlStringUtil.wrapInHtml( "File '" + virtualFile.getName() + "' can't be reloaded in the '" + charset.displayName() + "' encoding.

" + (failReason == null ? "" : "Why: "+ failReason +"
") + - (autoDetected == null ? "" : "Detected encoding: '"+ autoDetected.displayName()+"'") + - "", - "Incompatible Encoding: " + charset.displayName() + (autoDetected == null ? "" : "Detected encoding: '"+ autoDetected.displayName()+"'")), + "Incompatible Encoding: " + charset.displayName() ); res = -1; } else { res = Messages - .showDialog("" + + .showDialog(XmlStringUtil.wrapInHtml( "File '" + virtualFile.getName() + "' most likely isn't stored in the '" + charset.displayName() + "' encoding." + "

" + (failReason == null ? "" : "Why: " + failReason + "
") + - (autoDetected == null ? "" : "Detected encoding: '" + autoDetected.displayName() + "'") + - "", + (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("" + + int res = Messages.showDialog(XmlStringUtil.wrapInHtml( "Please do not convert to '"+charset.displayName()+"'.

" + - (error == null ? "Encoding '" + charset.displayName() + "' does not support some characters from the text." : error)+ - "", + (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) { diff --git a/platform/util/src/com/intellij/util/ui/Html.java b/platform/util/src/com/intellij/util/ui/Html.java index 6189ebc62186..d322030e89b6 100644 --- a/platform/util/src/com/intellij/util/ui/Html.java +++ b/platform/util/src/com/intellij/util/ui/Html.java @@ -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) { diff --git a/platform/vcs-api/src/com/intellij/vcsUtil/UIVcsUtil.java b/platform/vcs-api/src/com/intellij/vcsUtil/UIVcsUtil.java index 9bf0a4450c14..36aede3aea52 100644 --- a/platform/vcs-api/src/com/intellij/vcsUtil/UIVcsUtil.java +++ b/platform/vcs-api/src/com/intellij/vcsUtil/UIVcsUtil.java @@ -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("" + escapeXmlAndAddBr(text) + ""); + 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("

" + StringUtil.escapeXml(header) + - "

" + escapeXmlAndAddBr(text) + ""); + final JLabel label = new JLabel(XmlStringUtil.wrapInHtml("

" + StringUtil.escapeXml(header) + + "

" + 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)); diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java index 8c2e60b7d67c..06cfcd327156 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java @@ -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 : "" + XmlStringUtil.escapeString(text) + ""; + String tooltip = text == null ? null : XmlStringUtil.wrapInHtml(XmlStringUtil.escapeString(text)); return new Annotation(range.getStartOffset(), range.getEndOffset(), severity, text, tooltip); }