Search in sources :

Example 36 with DocumentAdapter

use of com.intellij.ui.DocumentAdapter in project scss-lint-plugin by idok.

the class ScssLintSettingsPage method addListeners.

private void addListeners() {
    useSpecificConfigRadioButton.addItemListener(e -> scssLintConfigFile.setEnabled(e.getStateChange() == ItemEvent.SELECTED));
    pluginEnabledCheckbox.addItemListener(e -> {
        boolean enabled = e.getStateChange() == ItemEvent.SELECTED;
        setEnabledState(enabled);
    });
    DocumentAdapter docAdp = new DocumentAdapter() {

        protected void textChanged(@NotNull DocumentEvent e) {
            updateLaterInEDT();
        }
    };
    scssLintExeField.getChildComponent().getTextEditor().getDocument().addDocumentListener(docAdp);
    scssLintConfigFile.getChildComponent().getTextEditor().getDocument().addDocumentListener(docAdp);
}
Also used : DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent) NotNull(org.jetbrains.annotations.NotNull)

Example 37 with DocumentAdapter

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

the class TraceViewPanel method createSearchField.

private SearchTextField createSearchField() {
    SearchTextField stf = new SearchTextField(true);
    stf.setOpaque(false);
    stf.setEnabled(true);
    Utils.setSmallerFont(stf);
    stf.addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(DocumentEvent e) {
            searchTextChanged(getText(e));
        }

        private String getText(DocumentEvent e) {
            try {
                return e.getDocument().getText(0, e.getDocument().getLength());
            } catch (BadLocationException e1) {
                return "";
            }
        }
    });
    JTextField editorTextField = stf.getTextEditor();
    editorTextField.setMinimumSize(new Dimension(JBUI.scale(200), -1));
    editorTextField.registerKeyboardAction(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            closeSearchComponent();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
    return stf;
}
Also used : SearchTextField(com.intellij.ui.SearchTextField) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent) BadLocationException(javax.swing.text.BadLocationException)

Example 38 with DocumentAdapter

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

the class ImportSourceLocationStep method setupSourceLocationControls.

private void setupSourceLocationControls() {
    FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor();
    descriptor.setTitle("Select Source Location");
    descriptor.setDescription("Select existing ADT or Gradle project to import as a new subproject");
    mySourceLocation.addBrowseFolderListener(new TextBrowseFolderListener(descriptor));
    mySourceLocation.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(DocumentEvent e) {
            invalidate();
        }
    });
    applyBackgroundOperationResult(checkPath(mySourceLocation.getText()));
    myErrorWarning.setIcon(null);
    myErrorWarning.setText(null);
}
Also used : FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) TextBrowseFolderListener(com.intellij.openapi.ui.TextBrowseFolderListener) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent)

Example 39 with DocumentAdapter

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

the class SelectDirWithFlashBuilderProjectsStep method setupInitialPathComponent.

private void setupInitialPathComponent() {
    myInitialPathComponent.getComponent().getTextField().getDocument().addDocumentListener(new DocumentAdapter() {

        protected void textChanged(final DocumentEvent e) {
            onInitialPathChanged();
        }
    });
    final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, true, true, false, false) {

        public boolean isFileVisible(final VirtualFile file, final boolean showHiddenFiles) {
            return (super.isFileVisible(file, showHiddenFiles) && (file.isDirectory() || FlashBuilderProjectFinder.isFlashBuilderProject(file)) || FlashBuilderProjectFinder.hasArchiveExtension(file.getPath()));
        }

        public Icon getIcon(final VirtualFile file) {
            // do not use Flash Builder specific icon for zip
            return !file.isDirectory() && (FlashBuilderProjectFinder.hasFxpExtension(file.getPath()) || FlashBuilderProjectFinder.isFlashBuilderProject(file)) ? dressIcon(file, getBuilder().getIcon()) : super.getIcon(file);
        }
    };
    myInitialPathComponent.getComponent().addBrowseFolderListener(FlexBundle.message("select.flash.builder.workspace.or.project"), null, getWizardContext().getProject(), descriptor);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent)

Example 40 with DocumentAdapter

use of com.intellij.ui.DocumentAdapter 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)

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