mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
allow to specify command line options for Chrome (IDEA-77398)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.ide.browsers.chrome.ChromeSettingsConfigurable">
|
||||
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
@@ -10,7 +10,7 @@
|
||||
<children>
|
||||
<component id="6d1fc" class="javax.swing.JCheckBox" binding="myUseCustomProfileCheckBox">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="&Use custom profile directory:"/>
|
||||
@@ -18,12 +18,12 @@
|
||||
</component>
|
||||
<vspacer id="eb956">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="e97dd" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myUserDataDirField">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="2" use-parent-layout="false">
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="2" use-parent-layout="false">
|
||||
<preferred-size width="350" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -31,7 +31,7 @@
|
||||
</component>
|
||||
<component id="b4c6c" class="javax.swing.JCheckBox" binding="myEnableRemoteDebugCheckBox">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Enable remote &debug on port:"/>
|
||||
@@ -39,12 +39,26 @@
|
||||
</component>
|
||||
<component id="72606" class="javax.swing.JTextField" binding="myPortField">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="2" use-parent-layout="false">
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="2" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="3fc23" class="com.intellij.ui.RawCommandLineEditor" binding="myCommandLineOptionsEditor">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="1" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="4b3a7" class="javax.swing.JLabel" binding="myCommandLineOptionsLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="&Command line options:"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user