mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Browser API cleanup (launch method moved to suitable class)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user