Search in sources :

Example 86 with JTextComponent

use of javax.swing.text.JTextComponent in project android by JetBrains.

the class ConfigureAvdOptionsStepFixture method setAvdName.

@NotNull
public ConfigureAvdOptionsStepFixture setAvdName(@NotNull String name) {
    JTextComponent textFieldWithLabel = findTextFieldWithLabel("AVD Name");
    replaceText(textFieldWithLabel, name);
    return this;
}
Also used : JTextComponent(javax.swing.text.JTextComponent) NotNull(org.jetbrains.annotations.NotNull)

Example 87 with JTextComponent

use of javax.swing.text.JTextComponent in project android by JetBrains.

the class ConfigureAndroidProjectStepFixture method enterCompanyDomain.

@NotNull
public ConfigureAndroidProjectStepFixture enterCompanyDomain(@NotNull String text) {
    JTextComponent textField = findTextFieldWithLabel("Company domain:");
    replaceText(textField, text);
    return this;
}
Also used : JTextComponent(javax.swing.text.JTextComponent) NotNull(org.jetbrains.annotations.NotNull)

Example 88 with JTextComponent

use of javax.swing.text.JTextComponent in project android by JetBrains.

the class ConfigureBasicActivityStepFixture method enterTextFieldValue.

@NotNull
public ConfigureBasicActivityStepFixture enterTextFieldValue(@NotNull ActivityTextField activityField, @NotNull String text) {
    JTextComponent textField = findTextFieldWithLabel(activityField.getLabelText());
    replaceText(textField, text);
    return this;
}
Also used : JTextComponent(javax.swing.text.JTextComponent) NotNull(org.jetbrains.annotations.NotNull)

Example 89 with JTextComponent

use of javax.swing.text.JTextComponent in project intellij-plugins by JetBrains.

the class DartGeneratorPeer method enableIntellijLiveValidation.

private void enableIntellijLiveValidation() {
    final JTextComponent editorComponent = (JTextComponent) mySdkPathComboWithBrowse.getComboBox().getEditor().getEditorComponent();
    editorComponent.getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(final DocumentEvent e) {
            validateInIntelliJ();
        }
    });
    myCreateSampleProjectCheckBox.addActionListener(e -> validateInIntelliJ());
    myTemplatesList.addListSelectionListener(e -> validateInIntelliJ());
}
Also used : DocumentAdapter(com.intellij.ui.DocumentAdapter) JTextComponent(javax.swing.text.JTextComponent) DocumentEvent(javax.swing.event.DocumentEvent)

Example 90 with JTextComponent

use of javax.swing.text.JTextComponent in project intellij-plugins by JetBrains.

the class DartConfigurable method initDartSdkAndDartiumControls.

private void initDartSdkAndDartiumControls() {
    final Computable<ChromeSettings> currentDartiumSettingsRetriever = () -> myDartiumSettingsCurrent;
    final Computable<Boolean> isResettingControlsComputable = () -> myInReset;
    DartSdkUtil.initDartSdkAndDartiumControls(myProject, mySdkPathComboWithBrowse, myVersionLabel, myDartiumPathComboWithBrowse, currentDartiumSettingsRetriever, myDartiumSettingsButton, isResettingControlsComputable);
    final JTextComponent sdkEditor = (JTextComponent) mySdkPathComboWithBrowse.getComboBox().getEditor().getEditorComponent();
    sdkEditor.getDocument().addDocumentListener(new DocumentAdapter() {

        protected void textChanged(final DocumentEvent e) {
            final String sdkHomePath = getTextFromCombo(mySdkPathComboWithBrowse);
            if (!sdkHomePath.isEmpty()) {
                final String version = DartSdkUtil.getSdkVersion(sdkHomePath);
                if (version != null && (version.contains("-dev.") || version.contains("-edge."))) {
                    mySdkUpdateChannelCombo.setSelectedItem(DartSdkUpdateOption.StableAndDev);
                }
            }
            updateControlsEnabledState();
            updateErrorLabel();
        }
    });
    final JTextComponent dartiumEditor = (JTextComponent) myDartiumPathComboWithBrowse.getComboBox().getEditor().getEditorComponent();
    dartiumEditor.getDocument().addDocumentListener(new DocumentAdapter() {

        protected void textChanged(final DocumentEvent e) {
            updateErrorLabel();
        }
    });
    myCheckSdkUpdateCheckBox.addActionListener(e -> {
        final boolean enabled = myCheckSdkUpdateCheckBox.isSelected() && myCheckSdkUpdateCheckBox.isEnabled();
        mySdkUpdateChannelCombo.setEnabled(enabled);
        myCheckSdkUpdateButton.setEnabled(enabled);
        if (enabled) {
            IdeFocusManager.getInstance(myProject).requestFocus(mySdkUpdateChannelCombo, true);
        }
    });
    mySdkUpdateChannelCombo.setModel(new DefaultComboBoxModel(DartSdkUpdateOption.OPTIONS_TO_SHOW_IN_COMBO));
    mySdkUpdateChannelCombo.setRenderer(new ListCellRendererWrapper<DartSdkUpdateOption>() {

        @Override
        public void customize(JList list, DartSdkUpdateOption value, int index, boolean selected, boolean hasFocus) {
            setText(value.getPresentableName());
        }
    });
    myCheckSdkUpdateButton.addActionListener(e -> {
        final Runnable runnable = this::checkSdkUpdate;
        ApplicationManagerEx.getApplicationEx().runProcessWithProgressSynchronously(runnable, DartBundle.message("checking.dart.sdk.update"), true, myProject, myMainPanel);
    });
}
Also used : JTextComponent(javax.swing.text.JTextComponent) DocumentEvent(javax.swing.event.DocumentEvent) ChromeSettings(com.intellij.ide.browsers.chrome.ChromeSettings)

Aggregations

JTextComponent (javax.swing.text.JTextComponent)181 Component (java.awt.Component)28 JComponent (javax.swing.JComponent)16 BadLocationException (javax.swing.text.BadLocationException)13 NotNull (org.jetbrains.annotations.NotNull)13 DocumentEvent (javax.swing.event.DocumentEvent)11 DocumentAdapter (com.intellij.ui.DocumentAdapter)8 Caret (javax.swing.text.Caret)8 Document (javax.swing.text.Document)8 Point (java.awt.Point)7 ActionEvent (java.awt.event.ActionEvent)7 ActionListener (java.awt.event.ActionListener)7 ArrayList (java.util.ArrayList)7 ComboBoxEditor (javax.swing.ComboBoxEditor)7 FocusEvent (java.awt.event.FocusEvent)6 Color (java.awt.Color)5 KeyEvent (java.awt.event.KeyEvent)5 MouseEvent (java.awt.event.MouseEvent)5 JButton (javax.swing.JButton)5 JComboBox (javax.swing.JComboBox)5