Skip to content

Commit 437cc15

Browse files
committed
Add JCEF option
1 parent 852aa41 commit 437cc15

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

flutter-idea/src/io/flutter/FlutterBundle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ settings.allow.tests.tooltip=The directory must be marked as a sources root, suc
213213
settings.font.packages=Font Packages
214214
settings.show.all.configs=Show all possible run configurations for apps or tests, even if a created configuration already exists
215215
settings.show.all.configs.tooltip=If there is a defined run configuration to watch a specific test and one to just run it, show both.
216+
settings.jcef.browser=Use JCEF browser to show embedded DevTools.
217+
settings.jcef.browser.tooltip=JCEF is a browser included in IntelliJ that is an alternative to using JxBrowser for showing embedded DevTools.
216218
settings.enable.androi.gradle.sync.tooltip=Provides advanced editing capabilities for Java and Kotlin code. Uses Gradle to find Android libraries then links them into the Flutter project.
217219
settings.experiments=Experiments
218220
settings.editor=Editor

flutter-idea/src/io/flutter/sdk/FlutterSettingsConfigurable.form

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
</grid>
237237
</children>
238238
</grid>
239-
<grid id="23e52" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
239+
<grid id="23e52" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
240240
<margin top="0" left="0" bottom="0" right="0"/>
241241
<constraints>
242242
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -279,6 +279,15 @@
279279
<toolTipText resource-bundle="io/flutter/FlutterBundle" key="settings.show.all.configs.tooltip"/>
280280
</properties>
281281
</component>
282+
<component id="909bb" class="javax.swing.JCheckBox" binding="myEnableJcefBrowserCheckBox">
283+
<constraints>
284+
<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"/>
285+
</constraints>
286+
<properties>
287+
<text resource-bundle="io/flutter/FlutterBundle" key="settings.jcef.browser"/>
288+
<toolTipText resource-bundle="io/flutter/FlutterBundle" key="settings.jcef.browser.tooltip"/>
289+
</properties>
290+
</component>
282291
</children>
283292
</grid>
284293
<grid id="3bf2f" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">

flutter-idea/src/io/flutter/sdk/FlutterSettingsConfigurable.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
import com.intellij.ui.components.ActionLink;
3232
import com.intellij.ui.components.JBLabel;
3333
import com.intellij.ui.components.labels.LinkLabel;
34-
import com.intellij.uiDesigner.core.GridConstraints;
35-
import com.intellij.uiDesigner.core.GridLayoutManager;
3634
import com.intellij.util.PlatformIcons;
3735
import icons.FlutterIcons;
3836
import io.flutter.*;
@@ -49,7 +47,6 @@
4947
import javax.swing.*;
5048
import javax.swing.event.DocumentEvent;
5149
import javax.swing.text.JTextComponent;
52-
import java.awt.*;
5350
import java.awt.datatransfer.StringSelection;
5451
import java.net.URI;
5552
import java.net.URISyntaxException;
@@ -81,6 +78,8 @@ public class FlutterSettingsConfigurable implements SearchableConfigurable {
8178

8279
private JCheckBox myShowAllRunConfigurationsInContextCheckBox;
8380

81+
private JCheckBox myEnableJcefBrowserCheckBox;
82+
8483
private JCheckBox myShowBuildMethodGuides;
8584
private JCheckBox myShowClosingLabels;
8685
private FixedSizeButton myCopyButton;
@@ -263,6 +262,10 @@ public boolean isModified() {
263262
return true;
264263
}
265264

265+
if (settings.isEnableJcefBrowser() != myEnableJcefBrowserCheckBox.isSelected()) {
266+
return true;
267+
}
268+
266269
return false;
267270
}
268271

@@ -320,6 +323,7 @@ public void apply() throws ConfigurationException {
320323
settings.setAllowTestsInSourcesRoot(myAllowTestsInSourcesRoot.isSelected());
321324
settings.setShowAllRunConfigurationsInContext(myShowAllRunConfigurationsInContextCheckBox.isSelected());
322325
settings.setFontPackages(myFontPackagesTextArea.getText());
326+
settings.setEnableJcefBrowser(myEnableJcefBrowserCheckBox.isSelected());
323327

324328
reset(); // because we rely on remembering initial state
325329
checkFontPackages(settings.getFontPackages(), oldFontPackages);
@@ -390,6 +394,7 @@ public void reset() {
390394
myIncludeAllStackTraces.setEnabled(myShowStructuredErrors.isSelected());
391395

392396
myShowAllRunConfigurationsInContextCheckBox.setSelected(settings.showAllRunConfigurationsInContext());
397+
myEnableJcefBrowserCheckBox.setSelected(settings.isEnableJcefBrowser());
393398
myFontPackagesTextArea.setText(settings.getFontPackages());
394399
}
395400

flutter-idea/src/io/flutter/settings/FlutterSettings.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class FlutterSettings {
3232
private static final String enableEmbeddedBrowsersKey = "io.flutter.editor.enableEmbeddedBrowsers";
3333
private static final String enableBazelHotRestartKey = "io.flutter.editor.enableBazelHotRestart";
3434
private static final String showBazelHotRestartWarningKey = "io.flutter.showBazelHotRestartWarning";
35+
private static final String enableJcefBrowserKey = "io.flutter.enableJcefBrowser";
3536
private static final String fontPackagesKey = "io.flutter.fontPackages";
3637
private static final String allowTestsInSourcesRootKey = "io.flutter.allowTestsInSources";
3738
private static final String showBazelIosRunNotificationKey = "io.flutter.hideBazelIosRunNotification";
@@ -257,6 +258,16 @@ public void setShowAllRunConfigurationsInContext(boolean value) {
257258
fireEvent();
258259
}
259260

261+
public boolean isEnableJcefBrowser() {
262+
return getPropertiesComponent().getBoolean(enableJcefBrowserKey, false);
263+
}
264+
265+
public void setEnableJcefBrowser(boolean value) {
266+
getPropertiesComponent().setValue(enableJcefBrowserKey, value, false);
267+
268+
fireEvent();
269+
}
270+
260271
public boolean isVerboseLogging() {
261272
return getPropertiesComponent().getBoolean(verboseLoggingKey, false);
262273
}

0 commit comments

Comments
 (0)