From 0a749fa1e60591b33697f08021f3d131c0aa5072 Mon Sep 17 00:00:00 2001 From: Alexander Doroshko Date: Tue, 11 Feb 2014 19:48:35 +0400 Subject: [PATCH] no need in special extension for Dartium browser --- .../src/META-INF/XmlPlugin.xml | 1 - .../ide/browsers/CustomWebBrowser.java | 46 ------------------- .../intellij/ide/browsers/WebBrowserBase.java | 12 ----- .../ide/browsers/WebBrowserManager.java | 13 +++++- .../actions/OpenInBrowserActionProducer.java | 12 ----- .../actions/OpenInBrowserBaseGroupAction.java | 11 +---- 6 files changed, 13 insertions(+), 82 deletions(-) delete mode 100644 xml/impl/src/com/intellij/ide/browsers/CustomWebBrowser.java delete mode 100644 xml/impl/src/com/intellij/ide/browsers/actions/OpenInBrowserActionProducer.java diff --git a/platform/platform-resources/src/META-INF/XmlPlugin.xml b/platform/platform-resources/src/META-INF/XmlPlugin.xml index d8889636d101..470c8ada1988 100644 --- a/platform/platform-resources/src/META-INF/XmlPlugin.xml +++ b/platform/platform-resources/src/META-INF/XmlPlugin.xml @@ -71,7 +71,6 @@ - diff --git a/xml/impl/src/com/intellij/ide/browsers/CustomWebBrowser.java b/xml/impl/src/com/intellij/ide/browsers/CustomWebBrowser.java deleted file mode 100644 index d3f296631ae2..000000000000 --- a/xml/impl/src/com/intellij/ide/browsers/CustomWebBrowser.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.intellij.ide.browsers; - -import com.intellij.openapi.util.Computable; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; -import java.util.UUID; - -final class CustomWebBrowser extends WebBrowserBase { - private final Computable pathComputable; - private final Icon icon; - private final String browserNotFoundMessage; - - CustomWebBrowser(@NotNull UUID id, - @NotNull BrowserFamily family, - @NotNull String name, - @NotNull Icon icon, - @NotNull Computable pathComputable, - @Nullable String browserNotFoundMessage) { - super(id, family, name); - - this.pathComputable = pathComputable; - this.icon = icon; - this.browserNotFoundMessage = browserNotFoundMessage; - } - - @Override - @NotNull - public Icon getIcon() { - return icon; - } - - @Override - @Nullable - public String getPath() { - return pathComputable.compute(); - } - - @Override - @NotNull - public String getBrowserNotFoundMessage() { - String message = browserNotFoundMessage; - return message == null ? super.getBrowserNotFoundMessage() : message; - } -} \ No newline at end of file diff --git a/xml/impl/src/com/intellij/ide/browsers/WebBrowserBase.java b/xml/impl/src/com/intellij/ide/browsers/WebBrowserBase.java index fc02f965b6c8..af7ff95ec08e 100644 --- a/xml/impl/src/com/intellij/ide/browsers/WebBrowserBase.java +++ b/xml/impl/src/com/intellij/ide/browsers/WebBrowserBase.java @@ -16,11 +16,9 @@ package com.intellij.ide.browsers; import com.intellij.ide.IdeBundle; -import com.intellij.openapi.util.NullableComputable; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.swing.*; import java.util.UUID; public abstract class WebBrowserBase extends WebBrowser { @@ -64,16 +62,6 @@ public abstract class WebBrowserBase extends WebBrowser { return null; } - @NotNull - public static WebBrowser createCustomBrowser(@NotNull BrowserFamily family, - @NotNull String name, - @NotNull UUID id, - @NotNull Icon icon, - @NotNull NullableComputable pathComputable, - @Nullable String browserNotFoundMessage) { - return new CustomWebBrowser(id, family, name, icon, pathComputable, browserNotFoundMessage); - } - @Override public String toString() { return getName() + " (" + getPath() + ")"; diff --git a/xml/impl/src/com/intellij/ide/browsers/WebBrowserManager.java b/xml/impl/src/com/intellij/ide/browsers/WebBrowserManager.java index 64cfda4e9882..0c7253b95ef1 100644 --- a/xml/impl/src/com/intellij/ide/browsers/WebBrowserManager.java +++ b/xml/impl/src/com/intellij/ide/browsers/WebBrowserManager.java @@ -277,6 +277,15 @@ public class WebBrowserManager implements PersistentStateComponent, Mod ((ConfigurableWebBrowser)browser).setActive(isActive); } + public void addBrowser(final @NotNull UUID id, + final @NotNull BrowserFamily family, + final @NotNull String name, + final @Nullable String path, + final boolean active, + final BrowserSpecificSettings specificSettings) { + browsers.add(new ConfigurableWebBrowser(id, family, name, path, active, specificSettings)); + } + @Nullable private static UUID parseUuid(@NotNull String id) { if (id.indexOf('-') == -1) { @@ -300,7 +309,9 @@ public class WebBrowserManager implements PersistentStateComponent, Mod UUID id = parseUuid(idOrName); if (id == null) { for (ConfigurableWebBrowser browser : browsers) { - if (browser.getFamily().name().equalsIgnoreCase(idOrName) || browser.getFamily().getName().equalsIgnoreCase(idOrName)) { + if (browser.getName().equals(idOrName) || + browser.getFamily().name().equalsIgnoreCase(idOrName) || + browser.getFamily().getName().equalsIgnoreCase(idOrName)) { return browser; } } diff --git a/xml/impl/src/com/intellij/ide/browsers/actions/OpenInBrowserActionProducer.java b/xml/impl/src/com/intellij/ide/browsers/actions/OpenInBrowserActionProducer.java deleted file mode 100644 index 861310e6a6dd..000000000000 --- a/xml/impl/src/com/intellij/ide/browsers/actions/OpenInBrowserActionProducer.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.intellij.ide.browsers.actions; - -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.extensions.ExtensionPointName; - -import java.util.List; - -public abstract class OpenInBrowserActionProducer { - static final ExtensionPointName EP_NAME = ExtensionPointName.create("org.jetbrains.openInBrowserAction"); - - public abstract List getActions(); -} \ No newline at end of file diff --git a/xml/impl/src/com/intellij/ide/browsers/actions/OpenInBrowserBaseGroupAction.java b/xml/impl/src/com/intellij/ide/browsers/actions/OpenInBrowserBaseGroupAction.java index cf5e9553b110..2d5409fd6974 100644 --- a/xml/impl/src/com/intellij/ide/browsers/actions/OpenInBrowserBaseGroupAction.java +++ b/xml/impl/src/com/intellij/ide/browsers/actions/OpenInBrowserBaseGroupAction.java @@ -22,8 +22,6 @@ import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.ComputableActionGroup; import com.intellij.psi.util.CachedValueProvider; -import com.intellij.util.ArrayUtil; -import com.intellij.util.SmartList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -43,15 +41,10 @@ public abstract class OpenInBrowserBaseGroupAction extends ComputableActionGroup @Nullable @Override public Result compute() { - List actionsByEP = new SmartList(); - for (OpenInBrowserActionProducer actionProducer : OpenInBrowserActionProducer.EP_NAME.getExtensions()) { - actionsByEP.addAll(actionProducer.getActions()); - } - List browsers = WebBrowserManager.getInstance().getBrowsers(); boolean addDefaultBrowser = isPopup(); int offset = addDefaultBrowser ? 1 : 0; - AnAction[] actions = new AnAction[browsers.size() + offset + actionsByEP.size()]; + AnAction[] actions = new AnAction[browsers.size() + offset]; if (addDefaultBrowser) { if (myDefaultBrowserAction == null) { @@ -66,8 +59,6 @@ public abstract class OpenInBrowserBaseGroupAction extends ComputableActionGroup actions[i + offset] = new BaseWebBrowserAction(browsers.get(i)); } - ArrayUtil.copy(actionsByEP, actions, offset + browsers.size()); - return Result.create(actions, WebBrowserManager.getInstance()); } };