From e55a724735d968b698e7e7748d5d8371a70daf82 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 23 Jul 2013 14:32:59 +0200 Subject: [PATCH] WEB-966 Smarter Reload in Browser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix BaseWebBrowserAction — element can report language as XML, but we should check parent (or grandparent — we find XmlTag) in this case get action shortcut from active keymap (prev: hardcoded) --- .../ide/browsers/BrowsersConfiguration.java | 13 ++++++------- .../src/com/intellij/xml/util/HtmlUtil.java | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/xml/impl/src/com/intellij/ide/browsers/BrowsersConfiguration.java b/xml/impl/src/com/intellij/ide/browsers/BrowsersConfiguration.java index 3eafa6e21725..d7c71423b6f3 100644 --- a/xml/impl/src/com/intellij/ide/browsers/BrowsersConfiguration.java +++ b/xml/impl/src/com/intellij/ide/browsers/BrowsersConfiguration.java @@ -111,6 +111,7 @@ public class BrowsersConfiguration implements PersistentStateComponent private final Map myBrowserToSettingsMap = new HashMap(); + @Override @SuppressWarnings({"HardCodedStringLiteral"}) public Element getState() { @NonNls Element element = new Element("WebBrowsersConfiguration"); @@ -132,20 +133,18 @@ public class BrowsersConfiguration implements PersistentStateComponent return element; } - @SuppressWarnings({"unchecked"}) + @Override public void loadState(@NonNls Element element) { - for (@NonNls Element child : (Iterable)element.getChildren("browser")) { + for (@NonNls Element child : element.getChildren("browser")) { String family = child.getAttributeValue("family"); final String path = child.getAttributeValue("path"); final String active = child.getAttributeValue("active"); final BrowserFamily browserFamily; Element settingsElement = child.getChild("settings"); - try { browserFamily = BrowserFamily.valueOf(family); - BrowserSpecificSettings specificSettings = null; - if (settingsElement != null) { - specificSettings = browserFamily.createBrowserSpecificSettings(); + BrowserSpecificSettings specificSettings = settingsElement == null ? null : browserFamily.createBrowserSpecificSettings(); + if (specificSettings != null) { XmlSerializer.deserializeInto(specificSettings, settingsElement); } myBrowserToSettingsMap.put(browserFamily, new WebBrowserSettings(path, Boolean.parseBoolean(active), specificSettings)); @@ -253,4 +252,4 @@ public class BrowsersConfiguration implements PersistentStateComponent return null; } -} +} \ No newline at end of file diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlUtil.java b/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlUtil.java index d72f932d3f92..a25f60550e1f 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlUtil.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlUtil.java @@ -521,7 +521,7 @@ public class HtmlUtil { url.startsWith("ftp://"); } - public static boolean isHtmlFile(PsiElement element) { + public static boolean isHtmlFile(@NotNull PsiElement element) { Language language = element.getLanguage(); return language == HTMLLanguage.INSTANCE || language == XHTMLLanguage.INSTANCE; }