Search in sources :

Example 1 with BrowserSpecificSettings

use of com.intellij.ide.browsers.BrowserSpecificSettings in project intellij-plugins by JetBrains.

the class DartConfigurable method reset.

@Override
public void reset() {
    myInReset = true;
    // remember initial state
    mySdkInitial = DartSdk.getDartSdk(myProject);
    myModulesWithDartSdkLibAttachedInitial.clear();
    if (mySdkInitial != null) {
        myModulesWithDartSdkLibAttachedInitial.addAll(DartSdkLibUtil.getModulesWithDartSdkEnabled(myProject));
    }
    myDartSupportEnabledInitial = !myModulesWithDartSdkLibAttachedInitial.isEmpty();
    myDartiumInitial = DartiumUtil.getDartiumBrowser();
    myDartiumSettingsCurrent = new ChromeSettings();
    if (myDartiumInitial != null) {
        final BrowserSpecificSettings browserSpecificSettings = myDartiumInitial.getSpecificSettings();
        if (browserSpecificSettings instanceof ChromeSettings) {
            myDartiumSettingsCurrent = (ChromeSettings) browserSpecificSettings.clone();
        }
    }
    // reset UI
    myEnableDartSupportCheckBox.setSelected(myDartSupportEnabledInitial);
    final String sdkInitialPath = mySdkInitial == null ? "" : FileUtilRt.toSystemDependentName(mySdkInitial.getHomePath());
    mySdkPathComboWithBrowse.getComboBox().getEditor().setItem(sdkInitialPath);
    if (!sdkInitialPath.isEmpty()) {
        ensureComboModelContainsCurrentItem(mySdkPathComboWithBrowse.getComboBox());
    }
    final DartSdkUpdateOption sdkUpdateOption = DartSdkUpdateOption.getDartSdkUpdateOption();
    myCheckSdkUpdateCheckBox.setSelected(sdkUpdateOption != DartSdkUpdateOption.DoNotCheck);
    mySdkUpdateChannelCombo.setSelectedItem(sdkUpdateOption);
    final String dartiumInitialPath = myDartiumInitial == null ? "" : FileUtilRt.toSystemDependentName(StringUtil.notNullize(myDartiumInitial.getPath()));
    myDartiumPathComboWithBrowse.getComboBox().getEditor().setItem(dartiumInitialPath);
    if (!dartiumInitialPath.isEmpty()) {
        ensureComboModelContainsCurrentItem(myDartiumPathComboWithBrowse.getComboBox());
    }
    // we decided to save one line in settings and always use Dartium in checked mode
    myCheckedModeCheckBox.setVisible(false);
    DartiumUtil.setCheckedMode(myDartiumSettingsCurrent.getEnvironmentVariables(), true);
    if (DartSdkLibUtil.isIdeWithMultipleModuleSupport()) {
        final CheckedTreeNode rootNode = (CheckedTreeNode) myModulesCheckboxTreeTable.getTree().getModel().getRoot();
        rootNode.setChecked(false);
        final Enumeration children = rootNode.children();
        while (children.hasMoreElements()) {
            final CheckedTreeNode node = (CheckedTreeNode) children.nextElement();
            node.setChecked(myModulesWithDartSdkLibAttachedInitial.contains((Module) node.getUserObject()));
        }
    }
    updateControlsEnabledState();
    updateErrorLabel();
    myInReset = false;
}
Also used : ChromeSettings(com.intellij.ide.browsers.chrome.ChromeSettings) BrowserSpecificSettings(com.intellij.ide.browsers.BrowserSpecificSettings) Module(com.intellij.openapi.module.Module)

Example 2 with BrowserSpecificSettings

use of com.intellij.ide.browsers.BrowserSpecificSettings in project intellij-plugins by JetBrains.

the class DartiumUtil method resetDartiumFlags.

public static void resetDartiumFlags() {
    final WebBrowser dartium = getDartiumBrowser();
    final BrowserSpecificSettings browserSpecificSettings = dartium == null ? null : dartium.getSpecificSettings();
    if (!(browserSpecificSettings instanceof ChromeSettings))
        return;
    final Map<String, String> envVars = browserSpecificSettings.getEnvironmentVariables();
    setDartFlagState(envVars, ENABLE_ASYNC_OPTION, false);
    setDartFlagState(envVars, CHECKED_MODE_OPTION, true);
}
Also used : ChromeSettings(com.intellij.ide.browsers.chrome.ChromeSettings) WebBrowser(com.intellij.ide.browsers.WebBrowser) BrowserSpecificSettings(com.intellij.ide.browsers.BrowserSpecificSettings)

Aggregations

BrowserSpecificSettings (com.intellij.ide.browsers.BrowserSpecificSettings)2 ChromeSettings (com.intellij.ide.browsers.chrome.ChromeSettings)2 WebBrowser (com.intellij.ide.browsers.WebBrowser)1 Module (com.intellij.openapi.module.Module)1