no need in special extension for Dartium browser

This commit is contained in:
Alexander Doroshko
2014-02-11 19:48:35 +04:00
parent 9a5f9fecf0
commit 0a749fa1e6
6 changed files with 13 additions and 82 deletions
@@ -71,7 +71,6 @@
<extensionPoint name="xml.implicitIdRefProvider" interface="com.intellij.psi.impl.source.resolve.reference.impl.providers.ImplicitIdRefProvider"/>
<extensionPoint qualifiedName="org.jetbrains.javaScriptDebuggerStarter" interface="com.intellij.ide.browsers.JavaScriptDebuggerStarter"/>
<extensionPoint qualifiedName="org.jetbrains.openInBrowserAction" interface="com.intellij.ide.browsers.actions.OpenInBrowserActionProducer"/>
<extensionPoint name="html.scriptContentProvider"
beanClass="com.intellij.lang.LanguageExtensionPoint">
@@ -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<String> pathComputable;
private final Icon icon;
private final String browserNotFoundMessage;
CustomWebBrowser(@NotNull UUID id,
@NotNull BrowserFamily family,
@NotNull String name,
@NotNull Icon icon,
@NotNull Computable<String> 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;
}
}
@@ -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<String> pathComputable,
@Nullable String browserNotFoundMessage) {
return new CustomWebBrowser(id, family, name, icon, pathComputable, browserNotFoundMessage);
}
@Override
public String toString() {
return getName() + " (" + getPath() + ")";
@@ -277,6 +277,15 @@ public class WebBrowserManager implements PersistentStateComponent<Element>, 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<Element>, 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;
}
}
@@ -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<OpenInBrowserActionProducer> EP_NAME = ExtensionPointName.create("org.jetbrains.openInBrowserAction");
public abstract List<AnAction> getActions();
}
@@ -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<AnAction[]> compute() {
List<AnAction> actionsByEP = new SmartList<AnAction>();
for (OpenInBrowserActionProducer actionProducer : OpenInBrowserActionProducer.EP_NAME.getExtensions()) {
actionsByEP.addAll(actionProducer.getActions());
}
List<WebBrowser> 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());
}
};