mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
continue — debug: select browser instead of debug engine
This commit is contained in:
@@ -16,15 +16,17 @@
|
||||
package com.intellij.ide.browsers;
|
||||
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BrowserSpecificSettings {
|
||||
@NotNull
|
||||
public abstract Configurable createConfigurable();
|
||||
|
||||
@NotNull
|
||||
public String[] getAdditionalParameters() {
|
||||
return ArrayUtil.EMPTY_STRING_ARRAY;
|
||||
public List<String> getAdditionalParameters() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,4 @@ final class CustomWebBrowser extends WebBrowser {
|
||||
String message = browserNotFoundMessage;
|
||||
return message == null ? super.getBrowserNotFoundMessage() : message;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -15,20 +15,22 @@
|
||||
*/
|
||||
package com.intellij.ide.browsers.chrome;
|
||||
|
||||
import com.intellij.execution.configurations.ParametersList;
|
||||
import com.intellij.ide.browsers.BrowserSpecificSettings;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.execution.ParametersListUtil;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class ChromeSettings extends BrowserSpecificSettings {
|
||||
public static final String USER_DATA_DIR_ARG = "--user-data-dir=";
|
||||
private String myCommandLineOptions;
|
||||
private String myUserDataDirectoryPath;
|
||||
private @Nullable String myCommandLineOptions;
|
||||
private @Nullable String myUserDataDirectoryPath;
|
||||
private boolean myUseCustomProfile;
|
||||
|
||||
public ChromeSettings() {
|
||||
@@ -64,14 +66,21 @@ public final class ChromeSettings extends BrowserSpecificSettings {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String[] getAdditionalParameters() {
|
||||
String[] cliOptions = ParametersList.parse(myCommandLineOptions);
|
||||
public List<String> getAdditionalParameters() {
|
||||
if (myCommandLineOptions == null) {
|
||||
if (myUseCustomProfile && myUserDataDirectoryPath != null) {
|
||||
return Collections.singletonList(USER_DATA_DIR_ARG + FileUtilRt.toSystemDependentName(myUserDataDirectoryPath));
|
||||
}
|
||||
else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
List<String> cliOptions = ParametersListUtil.parse(myCommandLineOptions);
|
||||
if (myUseCustomProfile && myUserDataDirectoryPath != null) {
|
||||
return ArrayUtil.mergeArrays(cliOptions, USER_DATA_DIR_ARG + FileUtil.toSystemDependentName(myUserDataDirectoryPath));
|
||||
}
|
||||
else {
|
||||
return cliOptions;
|
||||
cliOptions.add(USER_DATA_DIR_ARG + FileUtilRt.toSystemDependentName(myUserDataDirectoryPath));
|
||||
}
|
||||
return cliOptions;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -20,12 +20,13 @@ import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class FirefoxSettings extends BrowserSpecificSettings {
|
||||
@@ -76,15 +77,15 @@ public final class FirefoxSettings extends BrowserSpecificSettings {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String[] getAdditionalParameters() {
|
||||
final List<FirefoxProfile> profiles = FirefoxUtil.computeProfiles(getProfilesIniFile());
|
||||
public List<String> getAdditionalParameters() {
|
||||
List<FirefoxProfile> profiles = FirefoxUtil.computeProfiles(getProfilesIniFile());
|
||||
if (profiles.size() >= 2) {
|
||||
final FirefoxProfile profile = FirefoxUtil.findProfileByNameOrDefault(myProfile, profiles);
|
||||
FirefoxProfile profile = FirefoxUtil.findProfileByNameOrDefault(myProfile, profiles);
|
||||
if (profile != null && !profile.isDefault()) {
|
||||
return new String[] {"-P", profile.getName()};
|
||||
return Arrays.asList("-P", profile.getName());
|
||||
}
|
||||
}
|
||||
return ArrayUtil.EMPTY_STRING_ARRAY;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.xml.XmlBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -79,20 +78,19 @@ public class DefaultUrlOpener extends UrlOpener {
|
||||
}
|
||||
|
||||
private static void addArgs(List<String> command, @Nullable BrowserSpecificSettings settings, String[] additional) {
|
||||
String[] specific = settings != null ? settings.getAdditionalParameters() : ArrayUtil.EMPTY_STRING_ARRAY;
|
||||
|
||||
if (specific.length + additional.length > 0) {
|
||||
List<String> specific = settings == null ? Collections.<String>emptyList() : settings.getAdditionalParameters();
|
||||
if (specific.size() + additional.length > 0) {
|
||||
if (SystemInfo.isMac && ExecUtil.getOpenCommandPath().equals(command.get(0))) {
|
||||
if (!BrowserUtil.isOpenCommandSupportArgs()) {
|
||||
LOG.warn("'open' command doesn't allow to pass command line arguments so they will be ignored: " +
|
||||
Arrays.toString(specific) + " " + Arrays.toString(additional));
|
||||
if (BrowserUtil.isOpenCommandSupportArgs()) {
|
||||
command.add("--args");
|
||||
}
|
||||
else {
|
||||
command.add("--args");
|
||||
LOG.warn("'open' command doesn't allow to pass command line arguments so they will be ignored: " +
|
||||
StringUtil.join(specific, ", ") + " " + Arrays.toString(additional));
|
||||
}
|
||||
}
|
||||
|
||||
Collections.addAll(command, specific);
|
||||
command.addAll(specific);
|
||||
Collections.addAll(command, additional);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user