From a6fe764c1671a1edf7bb60d985daf49e17680cb8 Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 15 Mar 2012 15:59:52 +0400 Subject: [PATCH] allow to specify command line options for Chrome (IDEA-77398) --- .../ide/browsers/chrome/ChromeSettings.java | 13 +++++++++- .../chrome/ChromeSettingsConfigurable.form | 26 ++++++++++++++----- .../chrome/ChromeSettingsConfigurable.java | 9 ++++++- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/xml/impl/src/com/intellij/ide/browsers/chrome/ChromeSettings.java b/xml/impl/src/com/intellij/ide/browsers/chrome/ChromeSettings.java index 9e470ac2022c..8f7b70d539ca 100644 --- a/xml/impl/src/com/intellij/ide/browsers/chrome/ChromeSettings.java +++ b/xml/impl/src/com/intellij/ide/browsers/chrome/ChromeSettings.java @@ -15,6 +15,7 @@ */ package com.intellij.ide.browsers.chrome; +import com.intellij.execution.configurations.ParametersList; import com.intellij.ide.browsers.BrowserSpecificSettings; import com.intellij.openapi.util.io.FileUtil; import com.intellij.util.ArrayUtil; @@ -30,6 +31,7 @@ public class ChromeSettings extends BrowserSpecificSettings { @NonNls public static final String REMOTE_DEBUGGING_PORT_ARG = "--remote-debugging-port="; @NonNls public static final String USER_DATA_DIR_ARG = "--user-data-dir="; public static final int DEFAULT_REMOTE_SHELL_PORT = 7930; + private String myCommandLineOptions = ""; private String myUserDataDirectoryPath; private boolean myUseCustomProfile; private boolean myEnableRemoteDebug; @@ -59,6 +61,15 @@ public class ChromeSettings extends BrowserSpecificSettings { return myRemoteShellPort; } + @Tag("command-line-options") + public String getCommandLineOptions() { + return myCommandLineOptions; + } + + public void setCommandLineOptions(String commandLineOptions) { + myCommandLineOptions = commandLineOptions; + } + public void setEnableRemoteDebug(boolean enableRemoteDebug) { myEnableRemoteDebug = enableRemoteDebug; } @@ -94,7 +105,7 @@ public class ChromeSettings extends BrowserSpecificSettings { remoteShellArg = ArrayUtil.EMPTY_STRING_ARRAY; } - return ArrayUtil.mergeArrays(customProfileArg, remoteShellArg); + return ArrayUtil.mergeArrays(ParametersList.parse(myCommandLineOptions), ArrayUtil.mergeArrays(customProfileArg, remoteShellArg)); } @Override diff --git a/xml/impl/src/com/intellij/ide/browsers/chrome/ChromeSettingsConfigurable.form b/xml/impl/src/com/intellij/ide/browsers/chrome/ChromeSettingsConfigurable.form index 39b81024be5c..f3013409e001 100644 --- a/xml/impl/src/com/intellij/ide/browsers/chrome/ChromeSettingsConfigurable.form +++ b/xml/impl/src/com/intellij/ide/browsers/chrome/ChromeSettingsConfigurable.form @@ -1,6 +1,6 @@
- + @@ -10,7 +10,7 @@ - + @@ -18,12 +18,12 @@ - + - + @@ -31,7 +31,7 @@ - + @@ -39,12 +39,26 @@ - + + + + + + + + + + + + + + + diff --git a/xml/impl/src/com/intellij/ide/browsers/chrome/ChromeSettingsConfigurable.java b/xml/impl/src/com/intellij/ide/browsers/chrome/ChromeSettingsConfigurable.java index 59ed138ddf1d..42ceaeb47caf 100644 --- a/xml/impl/src/com/intellij/ide/browsers/chrome/ChromeSettingsConfigurable.java +++ b/xml/impl/src/com/intellij/ide/browsers/chrome/ChromeSettingsConfigurable.java @@ -21,6 +21,7 @@ import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.openapi.util.io.FileUtil; +import com.intellij.ui.RawCommandLineEditor; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; @@ -40,6 +41,8 @@ public class ChromeSettingsConfigurable implements Configurable { private TextFieldWithBrowseButton myUserDataDirField; private JCheckBox myEnableRemoteDebugCheckBox; private JTextField myPortField; + private JLabel myCommandLineOptionsLabel; + private RawCommandLineEditor myCommandLineOptionsEditor; private final String myDefaultUserDirPath; public ChromeSettingsConfigurable(@NotNull ChromeSettings settings) { @@ -59,6 +62,7 @@ public class ChromeSettingsConfigurable implements Configurable { myPortField.setEnabled(myEnableRemoteDebugCheckBox.isSelected()); } }); + myCommandLineOptionsLabel.setLabelFor(myCommandLineOptionsEditor.getTextField()); } @Override @@ -70,7 +74,8 @@ public class ChromeSettingsConfigurable implements Configurable { public boolean isModified() { if (myEnableRemoteDebugCheckBox.isSelected() != mySettings.isEnableRemoteDebug() || !myPortField.getText().equals(String.valueOf(mySettings.getRemoteShellPort())) - || myUseCustomProfileCheckBox.isSelected() != mySettings.isUseCustomProfile()) { + || myUseCustomProfileCheckBox.isSelected() != mySettings.isUseCustomProfile() + || !myCommandLineOptionsEditor.getText().equals(mySettings.getCommandLineOptions())) { return true; } @@ -93,6 +98,7 @@ public class ChromeSettingsConfigurable implements Configurable { catch (NumberFormatException ignored) { throw new ConfigurationException("Port is not integer!"); } + mySettings.setCommandLineOptions(myCommandLineOptionsEditor.getText()); mySettings.setUseCustomProfile(myUseCustomProfileCheckBox.isSelected()); mySettings.setUserDataDirectoryPath(getConfiguredUserDataDirPath()); mySettings.setEnableRemoteDebug(myEnableRemoteDebugCheckBox.isSelected()); @@ -104,6 +110,7 @@ public class ChromeSettingsConfigurable implements Configurable { myPortField.setText(String.valueOf(mySettings.getRemoteShellPort())); myPortField.setEnabled(mySettings.isEnableRemoteDebug()); + myCommandLineOptionsEditor.setText(mySettings.getCommandLineOptions()); myUseCustomProfileCheckBox.setSelected(mySettings.isUseCustomProfile()); myUserDataDirField.setEnabled(mySettings.isUseCustomProfile()); String path = mySettings.getUserDataDirectoryPath();