Browser API cleanup (launch method moved to suitable class)

This commit is contained in:
Roman Shevchenko
2013-02-11 20:21:53 +01:00
parent 333724b646
commit e99a8591a2
3 changed files with 20 additions and 5 deletions
@@ -152,9 +152,7 @@ public class BrowsersConfiguration implements PersistentStateComponent<Element>
}
myBrowserToSettingsMap.put(browserFamily, new WebBrowserSettings(path, Boolean.parseBoolean(active), specificSettings));
}
catch (IllegalArgumentException e) {
// skip
}
catch (IllegalArgumentException ignored) { }
}
}
@@ -194,6 +192,8 @@ public class BrowsersConfiguration implements PersistentStateComponent<Element>
return ServiceManager.getService(BrowsersConfiguration.class);
}
/** @deprecated use {@link DefaultUrlOpener} (to remove in IDEA 13) */
@SuppressWarnings("unused")
public static void launchBrowser(final @Nullable BrowserFamily family, @NotNull final String url) {
if (family == null) {
BrowserUtil.launchBrowser(url);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2013 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.
@@ -85,7 +85,7 @@ public class OpenUrlHyperlinkInfo implements HyperlinkWithPopupMenuInfo {
@Override
public void actionPerformed(AnActionEvent e) {
BrowsersConfiguration.launchBrowser(myFamily, myUrl);
UrlOpener.launchBrowser(myFamily, myUrl);
}
}
}
@@ -15,11 +15,26 @@
*/
package com.intellij.ide.browsers;
import com.intellij.ide.BrowserUtil;
import com.intellij.openapi.extensions.ExtensionPointName;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class UrlOpener {
public static final ExtensionPointName<UrlOpener> EP_NAME = ExtensionPointName.create("org.jetbrains.urlOpener");
public static void launchBrowser(@Nullable BrowsersConfiguration.BrowserFamily family, @NotNull String url) {
if (family == null) {
BrowserUtil.launchBrowser(url);
}
else {
for (UrlOpener urlOpener : EP_NAME.getExtensions()) {
if (urlOpener.openUrl(family, url)) {
return;
}
}
}
}
public abstract boolean openUrl(@NotNull BrowsersConfiguration.BrowserFamily family, String url);
}