Search in sources :

Example 1 with KarmaScopeView

use of com.intellij.javascript.karma.scope.KarmaScopeView in project intellij-plugins by JetBrains.

the class KarmaRunConfigurationEditor method getScopeKindView.

@NotNull
private KarmaScopeView getScopeKindView(@NotNull KarmaScopeKind scopeKind) {
    KarmaScopeView view = myScopeKindViewMap.get(scopeKind);
    if (view == null) {
        view = scopeKind.createView(myProject);
        myScopeKindViewMap.put(scopeKind, view);
        JComponent component = view.getComponent();
        if (component.getLayout() instanceof GridBagLayout) {
            component.add(Box.createHorizontalStrut(myLongestLabelWidth), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, JBUI.insetsRight(UIUtil.DEFAULT_HGAP), 0, 0));
        }
    }
    return view;
}
Also used : KarmaScopeView(com.intellij.javascript.karma.scope.KarmaScopeView) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with KarmaScopeView

use of com.intellij.javascript.karma.scope.KarmaScopeView in project intellij-plugins by JetBrains.

the class KarmaRunConfigurationEditor method resetEditorFrom.

@Override
protected void resetEditorFrom(@NotNull KarmaRunConfiguration runConfiguration) {
    KarmaRunSettings runSettings = runConfiguration.getRunSettings();
    myNodeInterpreterField.setInterpreterRef(runSettings.getInterpreterRef());
    myKarmaPackageField.setSelected(runConfiguration.getKarmaPackage());
    myConfigPathField.setTextAndAddToHistory(FileUtil.toSystemDependentName(runSettings.getConfigPath()));
    myBrowsers.setText(runSettings.getBrowsers());
    myEnvVarsComponent.setData(runSettings.getEnvData());
    setScopeKind(runSettings.getScopeKind());
    KarmaScopeView view = getScopeKindView(runSettings.getScopeKind());
    view.resetFrom(runSettings);
    updatePreferredWidth();
}
Also used : KarmaScopeView(com.intellij.javascript.karma.scope.KarmaScopeView)

Example 3 with KarmaScopeView

use of com.intellij.javascript.karma.scope.KarmaScopeView in project intellij-plugins by JetBrains.

the class KarmaRunConfigurationEditor method applyEditorTo.

@Override
protected void applyEditorTo(@NotNull KarmaRunConfiguration runConfiguration) throws ConfigurationException {
    KarmaRunSettings.Builder builder = new KarmaRunSettings.Builder();
    builder.setConfigPath(myConfigPathField.getChildComponent().getText());
    builder.setBrowsers(StringUtil.notNullize(myBrowsers.getText()));
    builder.setInterpreterRef(myNodeInterpreterField.getInterpreterRef());
    builder.setEnvData(myEnvVarsComponent.getData());
    builder.setKarmaPackage(myKarmaPackageField.getSelected());
    KarmaScopeKind scopeKind = getScopeKind();
    if (scopeKind != null) {
        builder.setScopeKind(scopeKind);
        KarmaScopeView view = getScopeKindView(scopeKind);
        view.applyTo(builder);
    }
    runConfiguration.setRunSettings(builder.build());
}
Also used : KarmaScopeKind(com.intellij.javascript.karma.scope.KarmaScopeKind) KarmaScopeView(com.intellij.javascript.karma.scope.KarmaScopeView)

Example 4 with KarmaScopeView

use of com.intellij.javascript.karma.scope.KarmaScopeView in project intellij-plugins by JetBrains.

the class KarmaRunConfigurationEditor method setScopeKind.

private void setScopeKind(@NotNull KarmaScopeKind scopeKind) {
    KarmaScopeKind selectedScopeKind = getScopeKind();
    if (selectedScopeKind != scopeKind) {
        JRadioButton radioButton = myRadioButtonMap.get(scopeKind);
        radioButton.setSelected(true);
    }
    KarmaScopeView view = getScopeKindView(scopeKind);
    setCenterBorderLayoutComponent(mySelectedScopeKindPanel, view.getComponent());
}
Also used : KarmaScopeKind(com.intellij.javascript.karma.scope.KarmaScopeKind) KarmaScopeView(com.intellij.javascript.karma.scope.KarmaScopeView)

Aggregations

KarmaScopeView (com.intellij.javascript.karma.scope.KarmaScopeView)4 KarmaScopeKind (com.intellij.javascript.karma.scope.KarmaScopeKind)2 NotNull (org.jetbrains.annotations.NotNull)1