WEB-966 Smarter Reload in Browser

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)
This commit is contained in:
Vladimir Krivosheev
2013-07-23 18:22:01 +02:00
parent 0f7cfff77e
commit e55a724735
2 changed files with 7 additions and 8 deletions
@@ -111,6 +111,7 @@ public class BrowsersConfiguration implements PersistentStateComponent<Element>
private final Map<BrowserFamily, WebBrowserSettings> myBrowserToSettingsMap = new HashMap<BrowserFamily, WebBrowserSettings>();
@Override
@SuppressWarnings({"HardCodedStringLiteral"})
public Element getState() {
@NonNls Element element = new Element("WebBrowsersConfiguration");
@@ -132,20 +133,18 @@ public class BrowsersConfiguration implements PersistentStateComponent<Element>
return element;
}
@SuppressWarnings({"unchecked"})
@Override
public void loadState(@NonNls Element element) {
for (@NonNls Element child : (Iterable<? extends Element>)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<Element>
return null;
}
}
}
@@ -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;
}