Search in sources :

Example 26 with DocumentAdapter

use of com.intellij.ui.DocumentAdapter in project intellij-plugins by JetBrains.

the class PhoneGapRunConfigurationEditor method setListenerForExecutablePath.

private void setListenerForExecutablePath() {
    final Ref<String> prevExecutablePathRef = Ref.create(StringUtil.notNullize(myExecutablePathField.getText()));
    final JTextField textEditor = myExecutablePathField.getChildComponent().getTextEditor();
    textEditor.getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(DocumentEvent e) {
            String executablePath = StringUtil.notNullize(textEditor.getText());
            if (StringUtil.isEmpty(executablePath))
                return;
            String prevExecutablePath = prevExecutablePathRef.get();
            if (!prevExecutablePath.equals(executablePath)) {
                setCommandList();
                prevExecutablePathRef.set(executablePath);
            }
        }
    });
}
Also used : DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent)

Example 27 with DocumentAdapter

use of com.intellij.ui.DocumentAdapter in project intellij-plugins by JetBrains.

the class DartGeneratorPeer method addSettingsStateListener.

@Override
public void addSettingsStateListener(@NotNull final WebProjectGenerator.SettingsStateListener stateListener) {
    // invalid Dartium path is not a blocking error
    final JTextComponent editorComponent = (JTextComponent) mySdkPathComboWithBrowse.getComboBox().getEditor().getEditorComponent();
    editorComponent.getDocument().addDocumentListener(new DocumentAdapter() {

        protected void textChanged(final DocumentEvent e) {
            stateListener.stateChanged(validate() == null);
        }
    });
    myCreateSampleProjectCheckBox.addActionListener(e -> stateListener.stateChanged(validate() == null));
    myTemplatesList.addListSelectionListener(e -> stateListener.stateChanged(validate() == null));
}
Also used : DocumentAdapter(com.intellij.ui.DocumentAdapter) JTextComponent(javax.swing.text.JTextComponent) DocumentEvent(javax.swing.event.DocumentEvent)

Example 28 with DocumentAdapter

use of com.intellij.ui.DocumentAdapter in project intellij-plugins by JetBrains.

the class RegistrationForm method setupFormActionsAndLF.

private void setupFormActionsAndLF() {
    myUseExisting.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            boolean useExisting = myUseExisting.isSelected();
            JComponent[] hideableFields = new JComponent[] { myNickname, myNicknameLabel, myFirstName, myFirstNameLabel, myLastName, myLastNameLabel, myPasswordAgain, myPasswordAgainLabel };
            for (JComponent hideableField : hideableFields) {
                hideableField.setVisible(!useExisting);
            }
            Window window = SwingUtilities.getWindowAncestor(myPanel);
            if (window != null) {
                window.pack();
            }
        }
    });
    UIUtil.traverse(myPanel, new UIUtil.TraverseAction() {

        public boolean executeAndContinue(Component c) {
            if (c instanceof JTextComponent) {
                JTextComponent textComponent = (JTextComponent) c;
                textComponent.getDocument().addDocumentListener(new DocumentAdapter() {

                    protected void textChanged(DocumentEvent e) {
                        myErrorLabel.setText(null);
                    }
                });
            }
            return true;
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) DocumentAdapter(com.intellij.ui.DocumentAdapter) ItemListener(java.awt.event.ItemListener) JTextComponent(javax.swing.text.JTextComponent) JTextComponent(javax.swing.text.JTextComponent) DocumentEvent(javax.swing.event.DocumentEvent) UIUtil(jetbrains.communicator.util.UIUtil)

Example 29 with DocumentAdapter

use of com.intellij.ui.DocumentAdapter in project android by JetBrains.

the class IconPickerDialog method createUIComponents.

private void createUIComponents() {
    mySearchField = new SearchField(false);
    mySearchField.addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(DocumentEvent e) {
            updateFilter();
        }
    });
}
Also used : SearchField(com.android.tools.idea.ui.SearchField) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent)

Example 30 with DocumentAdapter

use of com.intellij.ui.DocumentAdapter in project liferay-ide by liferay.

the class LiferayModuleNameLocationComponent method bindModuleSettings.

public void bindModuleSettings(LiferayNamePathComponent namePathComponent) {
    JTextField nameComponent = namePathComponent.getNameComponent();
    Document nameDocument = nameComponent.getDocument();
    nameDocument.addDocumentListener(new DocumentAdapter() {

        protected void textChanged(DocumentEvent event) {
            if (!_moduleNameChangedByUser) {
                setModuleName(namePathComponent.getNameValue());
            }
        }
    });
    JTextField pathComponent = namePathComponent.getPathComponent();
    Document pathDocument = pathComponent.getDocument();
    pathDocument.addDocumentListener(new DocumentAdapter() {

        protected void textChanged(DocumentEvent event) {
            if (!_contentRootChangedByUser) {
                _setModuleContentRoot(namePathComponent.getPath());
            }
        }
    });
    Document document = _moduleName.getDocument();
    document.addDocumentListener(new DocumentAdapter() {

        protected void textChanged(DocumentEvent event) {
            if (_moduleNameDocListenerEnabled) {
                _moduleNameChangedByUser = true;
            }
            String path = _getDefaultBaseDir(_context, namePathComponent);
            String moduleName = _getModuleName();
            if ((path.length() > 0) && !Comparing.strEqual(moduleName, namePathComponent.getNameValue())) {
                path += "/" + _getTargetFolderName() + "/" + moduleName;
            }
            if (!_contentRootChangedByUser) {
                boolean f = _moduleNameChangedByUser;
                _moduleNameChangedByUser = true;
                _setModuleContentRoot(path);
                _moduleNameChangedByUser = f;
            }
            if (!_imlLocationChangedByUser) {
                _setImlFileLocation(path);
            }
        }
    });
    Document moduleContentRootDocument = _moduleContentRoot.getDocument();
    moduleContentRootDocument.addDocumentListener(new DocumentAdapter() {

        protected void textChanged(DocumentEvent event) {
            if (_contentRootDocListenerEnabled) {
                _contentRootChangedByUser = true;
            }
            if (!_imlLocationChangedByUser) {
                _setImlFileLocation(_getModuleContentRoot());
            }
            if (!_moduleNameChangedByUser) {
                String path = FileUtil.toSystemIndependentName(_getModuleContentRoot());
                int idx = path.lastIndexOf("/");
                boolean f = _contentRootChangedByUser;
                _contentRootChangedByUser = true;
                boolean i = _imlLocationChangedByUser;
                _imlLocationChangedByUser = true;
                setModuleName(idx >= 0 ? path.substring(idx + 1) : "");
                _contentRootChangedByUser = f;
                _imlLocationChangedByUser = i;
            }
        }
    });
    Document moduleFileLocationDocument = _moduleFileLocation.getDocument();
    moduleFileLocationDocument.addDocumentListener(new DocumentAdapter() {

        protected void textChanged(DocumentEvent event) {
            if (_imlLocationDocListenerEnabled) {
                _imlLocationChangedByUser = true;
            }
        }
    });
    JTextField jTextField = namePathComponent.getPathComponent();
    Document namePathDocument = jTextField.getDocument();
    namePathDocument.addDocumentListener(new DocumentAdapter() {

        protected void textChanged(DocumentEvent event) {
            if (!_imlLocationChangedByUser) {
                _setImlFileLocation(namePathComponent.getPath());
            }
        }
    });
}
Also used : DocumentAdapter(com.intellij.ui.DocumentAdapter) JTextField(javax.swing.JTextField) Document(javax.swing.text.Document) DocumentEvent(javax.swing.event.DocumentEvent)

Aggregations

DocumentAdapter (com.intellij.ui.DocumentAdapter)81 DocumentEvent (javax.swing.event.DocumentEvent)81 ActionEvent (java.awt.event.ActionEvent)15 ActionListener (java.awt.event.ActionListener)15 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)11 Document (javax.swing.text.Document)8 JTextComponent (javax.swing.text.JTextComponent)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 ItemEvent (java.awt.event.ItemEvent)6 ItemListener (java.awt.event.ItemListener)6 NotNull (org.jetbrains.annotations.NotNull)6 Nullable (org.jetbrains.annotations.Nullable)6 JBTextField (com.intellij.ui.components.JBTextField)5 ChangeEvent (javax.swing.event.ChangeEvent)5 Project (com.intellij.openapi.project.Project)4 FieldPanel (com.intellij.ui.FieldPanel)4 ChangeListener (javax.swing.event.ChangeListener)4 List (java.util.List)3 DocumentListener (javax.swing.event.DocumentListener)3 ProjectSelector (com.google.cloud.tools.intellij.project.ProjectSelector)2