Java 类com.intellij.ui.DocumentAdapter 实例源码

项目:educational-plugin    文件:StudyTwitterUtils.java   
/**
 * Listener updates label indicating remaining symbols number like in twitter.
 */
private static DocumentListener createTextFieldLengthDocumentListener(@NotNull TwitterDialogWrapper builder, @NotNull final StudyTwitterUtils.TwitterDialogPanel panel) {
  return new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      int length = e.getDocument().getLength();
      if (length > 140 || length == 0) {
        builder.setOKActionEnabled(false);
        panel.getRemainSymbolsLabel().setText("<html><font color='red'>" + String.valueOf(140 - length) + "</font></html>");
      } else {
        builder.setOKActionEnabled(true);
        panel.getRemainSymbolsLabel().setText(String.valueOf(140 - length));
      }

    }
  };
}
项目:MissingInActions    文件:RegExTestDialog.java   
@Override
public TableCellEditor getEditor(final RegExSampleSet item) {
    JTextField textField = new JTextField();

    textField.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            String sample = item.sample;
            item.sample = textField.getText();
            checkRegEx(myPattern, item);
            item.sample = sample;
            myTextTable.repaint();
        }
    });

    return new DefaultCellEditor(textField) {
        @Override
        public boolean isCellEditable(EventObject anEvent) {
            return true;
        }
    };
}
项目:intellij-ce-playground    文件:MisspelledHeaderInspection.java   
public OptionsPanel(final Set<String> headers) {
  super(new BorderLayout(5, 5));

  add(new JLabel(ManifestBundle.message("inspection.header.ui.label")), BorderLayout.NORTH);

  final JTextArea area = new JTextArea("");
  add(area, BorderLayout.CENTER);
  if (!headers.isEmpty()) {
    area.setText(StringUtil.join(new TreeSet<String>(headers), "\n"));
  }

  area.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      headers.clear();
      for (String line : StringUtil.split(area.getText(), "\n")) {
        String header = line.trim();
        if (!header.isEmpty()) {
          headers.add(header);
        }
      }
    }
  });
}
项目:intellij-ce-playground    文件:JavaDocLocalInspection.java   
public FieldPanel createAdditionalJavadocTagsPanel(){
  FieldPanel additionalTagsPanel = new FieldPanel(InspectionsBundle.message("inspection.javadoc.label.text"), InspectionsBundle.message("inspection.javadoc.dialog.title"), null, null);
  additionalTagsPanel.setPreferredSize(new Dimension(150, additionalTagsPanel.getPreferredSize().height));
  additionalTagsPanel.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      final Document document = e.getDocument();
      try {
        final String text = document.getText(0, document.getLength());
        if (text != null) {
          myAdditionalJavadocTags = text.trim();
        }
      }
      catch (BadLocationException e1) {
         LOG.error(e1);
      }
    }
  });
  additionalTagsPanel.setText(myAdditionalJavadocTags);
  return additionalTagsPanel;
}
项目:intellij-ce-playground    文件:ExtractArtifactDialog.java   
public ExtractArtifactDialog(ArtifactEditorContext context, LayoutTreeComponent treeComponent, String initialName) {
  super(treeComponent.getLayoutTree(), true);
  myContext = context;
  setTitle(ProjectBundle.message("dialog.title.extract.artifact"));
  for (ArtifactType type : ArtifactType.getAllTypes()) {
    myTypeBox.addItem(type);
  }
  myTypeBox.setSelectedItem(PlainArtifactType.getInstance());
  myTypeBox.setRenderer(new ArtifactTypeCellRenderer(myTypeBox.getRenderer()));
  myNameField.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      setOKActionEnabled(!StringUtil.isEmptyOrSpaces(getArtifactName()));
    }
  });
  myNameField.setText(initialName);
  init();
}
项目:intellij-ce-playground    文件:CompilerUIConfigurable.java   
public CompilerUIConfigurable(@NotNull final Project project) {
  myProject = project;

  myPatternLegendLabel.setText(XmlStringUtil.wrapInHtml(
                                 "Use <b>;</b> to separate patterns and <b>!</b> to negate a pattern. " +
                                 "Accepted wildcards: <b>?</b> &mdash; exactly one symbol; <b>*</b> &mdash; zero or more symbols; " +
                                 "<b>/</b> &mdash; path separator; <b>/**/</b> &mdash; any number of directories; " +
                                 "<i>&lt;dir_name&gt;</i>:<i>&lt;pattern&gt;</i> &mdash; restrict to source roots with the specified name"
  ));
  myPatternLegendLabel.setForeground(new JBColor(Gray._50, Gray._130));
  tweakControls(project);
  myVMOptionsField.getDocument().addDocumentListener(new DocumentAdapter() {
    protected void textChanged(DocumentEvent e) {
      mySharedVMOptionsField.setEnabled(e.getDocument().getLength() == 0);
      myHeapSizeField.setEnabled(ContainerUtil.find(ParametersListUtil.parse(myVMOptionsField.getText()), new Condition<String>() {
        @Override
        public boolean value(String s) {
          return StringUtil.startsWithIgnoreCase(s, "-Xmx");
        }
      }) == null);
    }
  });
}
项目:intellij-ce-playground    文件:SingleIntegerFieldOptionsPanel.java   
/**
 * Sets integer number format to JFormattedTextField instance,
 * sets value of JFormattedTextField instance to object's field value,
 * synchronizes object's field value with the value of JFormattedTextField instance.
 *
 * @param textField  JFormattedTextField instance
 * @param owner      an object whose field is synchronized with {@code textField}
 * @param property   object's field name for synchronization
 */
public static void setupIntegerFieldTrackingValue(final JFormattedTextField textField,
                                                  final InspectionProfileEntry owner,
                                                  final String property) {
    NumberFormat formatter = NumberFormat.getIntegerInstance();
    formatter.setParseIntegerOnly(true);
    textField.setFormatterFactory(new DefaultFormatterFactory(new NumberFormatter(formatter)));
    textField.setValue(getPropertyValue(owner, property));
    final Document document = textField.getDocument();
    document.addDocumentListener(new DocumentAdapter() {
        @Override
        public void textChanged(DocumentEvent e) {
            try {
                textField.commitEdit();
                setPropertyValue(owner, property,
                        ((Number) textField.getValue()).intValue());
            } catch (ParseException e1) {
                // No luck this time
            }
        }
    });
}
项目:intellij-ce-playground    文件:NamedConfigurable.java   
protected NamedConfigurable(boolean isNameEditable, @Nullable final Runnable updateTree) {
  myNameEditable = isNameEditable;
  myNamePanel.setVisible(myNameEditable);
  if (myNameEditable) {
    myNameField.getDocument().addDocumentListener(new DocumentAdapter() {
      protected void textChanged(DocumentEvent e) {
        setDisplayName(myNameField.getText());
        if (updateTree != null){
          updateTree.run();
        }
      }
    });
  }
  if (Registry.is("ide.new.project.settings")) {
    myNamePanel.setBorder(new EmptyBorder(10, 10, 6, 10));
  } else {
    myNamePanel.setBorder(new EmptyBorder(0,0,0,0));
  }
}
项目:intellij-ce-playground    文件:FileSaverDialogImpl.java   
protected JComponent createFileNamePanel() {
  final JPanel panel = new JPanel(new BorderLayout());
  panel.add(new JLabel(UIBundle.message("file.chooser.save.dialog.file.name")), BorderLayout.WEST);
  myFileName.setText("");
  myFileName.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      updateOkButton();
    }
  });

  panel.add(myFileName, BorderLayout.CENTER);
  if (myExtensions.getModel().getSize() > 0) {
    myExtensions.setSelectedIndex(0);
    panel.add(myExtensions, BorderLayout.EAST);
  }
  return panel;
}
项目:intellij-ce-playground    文件:ComboBoxModelEditor.java   
public NameEditor() {
  getField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      if (item != null && itemEditor.isEditable(item)) {
        String newName = getField().getText();
        if (newName.equals(itemEditor.getName(item))) {
          return;
        }

        if (!mutated) {
          mutated = true;
          item = getMutable(item);
        }
        ((KeymapImpl)item).setName(newName);
      }
    }
  });
}
项目:intellij-ce-playground    文件:CloneDvcsDialog.java   
private void createUIComponents() {
  myRepositoryURL = new EditorComboBox("");
  final DvcsRememberedInputs rememberedInputs = getRememberedInputs();
  List<String> urls = new ArrayList<String>(rememberedInputs.getVisitedUrls());
  if (myDefaultRepoUrl != null) {
    urls.add(0, myDefaultRepoUrl);
  }
  myRepositoryURL.setHistory(ArrayUtil.toObjectArray(urls, String.class));
  myRepositoryURL.addDocumentListener(new com.intellij.openapi.editor.event.DocumentAdapter() {
    @Override
    public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
      // enable test button only if something is entered in repository URL
      final String url = getCurrentUrlText();
      myTestButton.setEnabled(url.length() != 0);
      if (myDefaultDirectoryName.equals(myDirectoryName.getText()) || myDirectoryName.getText().length() == 0) {
        // modify field if it was unmodified or blank
        myDefaultDirectoryName = defaultDirectoryName(url, myVcsDirectoryName);
        myDirectoryName.setText(myDefaultDirectoryName);
      }
      updateButtons();
    }
  });
}
项目:intellij-ce-playground    文件:MultipleFacetEditorHelperImpl.java   
private TextFieldBinding(final JTextField common, final List<JTextField> textFields) {
  LOG.assertTrue(!textFields.isEmpty());
  myCommon = common;
  myTextFields = textFields;
  String initialValue = myTextFields.get(0).getText();
  myInitialValues = new ArrayList<String>();
  for (JTextField field : myTextFields) {
    String value = field.getText();
    myInitialValues.add(value);
    if (initialValue != null && !initialValue.equals(value)) {
      initialValue = null;
    }
  }
  common.setText(initialValue != null ? initialValue : "");

  myListener = new DocumentAdapter() {
    @Override
    protected void textChanged(final DocumentEvent e) {
      TextFieldBinding.this.textChanged();
    }
  };
  myCommon.getDocument().addDocumentListener(myListener);
}
项目:intellij-ce-playground    文件:AbstractExtractMethodDialog.java   
@Override
protected void init() {
  super.init();
  // Set default name and select it
  myMethodNameTextField.setText(myDefaultName);
  myMethodNameTextField.setSelectionStart(0);
  myMethodNameTextField.setSelectionStart(myDefaultName.length());
  myMethodNameTextField.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      updateOutputVariables();
      updateSignature();
      updateOkStatus();
    }
  });


  myVariableData = createVariableData(myArguments);
  myVariablesMap = createVariableMap(myVariableData);
  myParametersPanel.setVariableData(myVariableData);
  myParametersPanel.init();

  updateOutputVariables();
  updateSignature();
  updateOkStatus();
}
项目:intellij-ce-playground    文件:CreateMultiRootResourceFileAction.java   
protected MyDialog(@NotNull AndroidFacet facet, @Nullable InputValidator validator) {
  super(facet.getModule().getProject());
  myValidator = validator;
  setTitle(AndroidBundle.message("new.typed.resource.dialog.title", myResourcePresentableName));
  final List<String> tagNames = getSortedAllowedTagNames(facet);
  myRootElementField = new TextFieldWithAutoCompletion<String>(
    facet.getModule().getProject(), new TextFieldWithAutoCompletion.StringsCompletionProvider(tagNames, null), true, null);
  myRootElementField.setText(myDefaultRootTag);
  myRootElementFieldWrapper.add(myRootElementField, BorderLayout.CENTER);
  myRootElementLabel.setLabelFor(myRootElementField);
  init();

  myFileNameField.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    public void textChanged(DocumentEvent event) {
      final String text = myFileNameField.getText().trim();
      if (myValidator instanceof InputValidatorEx) {
        setErrorText(((InputValidatorEx) myValidator).getErrorText(text));
      }
    }
  });
}
项目:intellij-ce-playground    文件:ImportSourceLocationStep.java   
private void setupSourceLocationControls(@Nullable VirtualFile importSource) {
  if (importSource == null) {
    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();
      }
    });
  }
  else {
    mySourceLocation.setVisible(false);
    myLocationLabel.setVisible(false);
    mySourceLocation.setText(importSource.getPath());
  }
  applyBackgroundOperationResult(checkPath(mySourceLocation.getText()));
  myErrorWarning.setIcon(null);
  myErrorWarning.setText(null);
}
项目:intellij-ce-playground    文件:DependsOnGroupsInspection.java   
@Nullable
public JComponent createOptionsPanel() {
  final LabeledComponent<JTextField> definedGroups = new LabeledComponent<JTextField>();
  definedGroups.setText("&Defined Groups");
  final JTextField textField = new JTextField(StringUtil.join(ArrayUtil.toStringArray(groups), ","));
  textField.getDocument().addDocumentListener(new DocumentAdapter() {
    protected void textChanged(final DocumentEvent e) {
      groups.clear();
      final String[] groupsFromString = textField.getText().split("[, ]");
      ContainerUtil.addAll(groups, groupsFromString);
    }
  });
  definedGroups.setComponent(textField);
  final JPanel optionsPanel = new JPanel(new BorderLayout());
  optionsPanel.add(definedGroups, BorderLayout.NORTH);
  return optionsPanel;
}
项目:intellij-ce-playground    文件:AppEngineCloudConfigurable.java   
public AppEngineCloudConfigurable(@NotNull AppEngineServerConfiguration configuration,
                                  @Nullable Project project, boolean alwaysRememberPassword) {
  myConfiguration = configuration;
  myProject = project;
  ActionListener actionListener = new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent event) {
      updateControls();
    }
  };
  myPasswordLoginButton.addActionListener(actionListener);
  myOAuthLoginButton.addActionListener(actionListener);
  DocumentListener documentListener = new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      updateControls();
    }
  };
  myEmailField.getDocument().addDocumentListener(documentListener);
  myPasswordField.getDocument().addDocumentListener(documentListener);
  myAlwaysRememberPassword = alwaysRememberPassword;
  updateControls();
}
项目:intellij-ce-playground    文件:GithubRepositoryEditor.java   
public GithubRepositoryEditor(final Project project, final GithubRepository repository, Consumer<GithubRepository> changeListener) {
  super(project, repository, changeListener);
  myUrlLabel.setVisible(false);
  myUsernameLabel.setVisible(false);
  myUserNameText.setVisible(false);
  myPasswordLabel.setVisible(false);
  myPasswordText.setVisible(false);
  myUseHttpAuthenticationCheckBox.setVisible(false);

  myRepoAuthor.setText(repository.getRepoAuthor());
  myRepoName.setText(repository.getRepoName());
  myToken.setText(repository.getToken());
  myToken.setText(repository.getToken());
  myShowNotAssignedIssues.setSelected(!repository.isAssignedIssuesOnly());

  DocumentListener buttonUpdater = new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      updateTokenButton();
    }
  };

  myURLText.getDocument().addDocumentListener(buttonUpdater);
  myRepoAuthor.getDocument().addDocumentListener(buttonUpdater);
  myRepoName.getDocument().addDocumentListener(buttonUpdater);
}
项目:intellij-ce-playground    文件:MavenEnvironmentForm.java   
public JComponent createComponent() {
  // all listeners will be removed when dialog is closed
  mavenHomeComponent.getComponent().addBrowseFolderListener(ProjectBundle.message("maven.select.maven.home.directory"),
                                                            "",
                                                            null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
                                                            TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
  mavenHomeField.addDocumentListener(new DocumentAdapter() {
    protected void textChanged(DocumentEvent e) {
      updateMavenVersionLabel();
    }
  });

  settingsFileComponent.getComponent().addBrowseFolderListener(ProjectBundle.message("maven.select.maven.settings.file"), "", null,
                                                               FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
  localRepositoryComponent.getComponent().addBrowseFolderListener(ProjectBundle.message("maven.select.local.repository"), "", null,
                                                                  FileChooserDescriptorFactory.createSingleFolderDescriptor());
  return panel;
}
项目:intellij-ce-playground    文件:MavenAddArchetypeDialog.java   
public MavenAddArchetypeDialog(Component parent) {
  super(parent, false);
  setTitle("Add Archetype");

  init();

  DocumentAdapter l = new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      doValidateInput();
    }
  };

  myGroupIdField.getDocument().addDocumentListener(l);
  myArtifactIdField.getDocument().addDocumentListener(l);
  myVersionField.getDocument().addDocumentListener(l);
  myRepositoryField.getDocument().addDocumentListener(l);

  doValidateInput();
}
项目:intellij-ce-playground    文件:HgTagDialog.java   
public HgTagDialog(@NotNull Project project, @NotNull Collection<HgRepository> repositories, @Nullable HgRepository selectedRepo) {
  super(project, false);
  hgRepositorySelectorComponent.setTitle("Select repository to tag");
  DocumentListener documentListener = new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      validateFields();
    }
  };

  tagTxt.getDocument().addDocumentListener(documentListener);

  setTitle("Tag");
  init();

  setRoots(repositories, selectedRepo);
}
项目:intellij-ce-playground    文件:CvsFieldValidator.java   
public static void installOn(final TagNameFieldOwner dialog,
                             final JTextField field,
                             final JLabel label,
                             AbstractButton[] buttons) {
  field.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    public void textChanged(DocumentEvent event) {
      checkTagNameField(dialog, field, label);
    }
  });

  for (AbstractButton button : buttons) {
    button.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        checkTagNameField(dialog, field, label);
      }
    });
  }

  checkTagNameField(dialog, field, label);
}
项目:intellij-ce-playground    文件:CvsRootAsStringConfigurationPanel.java   
public CvsRootAsStringConfigurationPanel(boolean readOnly, Ref<Boolean> isUpdating) {
  myIsUpdating = isUpdating;
  myCvsRoot.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    public void textChanged(DocumentEvent event) {
      notifyListeners();
    }
  });

  myEditFieldByFieldButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final CvsRootConfiguration cvsRootConfiguration =
        CvsApplicationLevelConfiguration.createNewConfiguration(CvsApplicationLevelConfiguration.getInstance());
      cvsRootConfiguration.CVS_ROOT = FormUtils.getFieldValue(myCvsRoot, false);
      final EditCvsConfigurationFieldByFieldDialog dialog = new EditCvsConfigurationFieldByFieldDialog(myCvsRoot.getText());
      if (dialog.showAndGet()) {
        myCvsRoot.setText(dialog.getConfiguration());
      }
    }
  });
  if (readOnly) {
    myCvsRoot.setEditable(false);
    myEditFieldByFieldButton.setEnabled(false);
  }
}
项目:intellij-ce-playground    文件:BaseIntroduceDialog.java   
protected void init(XPathExpression expression, int numberOfExpressions, String title) {
    setModal(true);
    setTitle(title);

    final JLabel jLabel = getTypeLabel();
    jLabel.setText(expression.getType().getName());

    final JCheckBox jCheckBox = getReplaceAll();
    if (numberOfExpressions > 1) {
        jCheckBox.setText(MessageFormat.format(jCheckBox.getText(), String.valueOf(numberOfExpressions)));
    } else {
        jCheckBox.setVisible(false);
    }

    getNameField().addDocumentListener(new DocumentAdapter() {
        protected void textChanged(DocumentEvent e) {
            getOKAction().setEnabled(myInputValidator.checkInput(getName()));
        }
    });

    getOKAction().setEnabled(false);

    init();
}
项目:react-templates-plugin    文件:CreateRTAction.java   
public MyDialog(final Project project, final MyInputValidator validator) {
            super(project, true);
            myProject = project;
            myValidator = validator;
            myBaseLayoutManagerCombo.registerUpDownHint(myFormNameTextField);
            myUpDownHintForm.setIcon(PlatformIcons.UP_DOWN_ARROWS);
            myBaseLayoutManagerCombo.addItem("None", RTIcons.RT, "none");
            myBaseLayoutManagerCombo.addItem("AMD", RTIcons.RT, "amd");
            myBaseLayoutManagerCombo.addItem("CommonJS", RTIcons.RT, "commonjs");
            myBaseLayoutManagerCombo.addItem("ES6", RTIcons.RT, "es6");
            myBaseLayoutManagerCombo.addItem("Typescript", RTIcons.RT, "typescript");
            init();
            setTitle(RTBundle.message("title.new.gui.form"));
            setOKActionEnabled(false);

            myFormNameTextField.getDocument().addDocumentListener(new DocumentAdapter() {
                protected void textChanged(DocumentEvent e) {
                    setOKActionEnabled(!myFormNameTextField.getText().isEmpty());
                }
            });

            myBaseLayoutManagerCombo.setSelectedName(Settings.getInstance(project).modules);
            myBaseLayoutManagerCombo.setEnabled(false);
//            myBaseLayoutManagerCombo.setSelectedName(GuiDesignerConfiguration.getInstance(project).DEFAULT_LAYOUT_MANAGER);
        }
项目:vue-for-idea    文件:VueSettingsPage.java   
public VueSettingsPage(@NotNull final Project project) {
    this.project = project;
    configRTBinField();
    configNodeField();


    this.packagesNotificationPanel = new PackagesNotificationPanel(project);
    errorPanel.add(this.packagesNotificationPanel.getComponent(), BorderLayout.CENTER);

    DocumentAdapter docAdp = new DocumentAdapter() {
        protected void textChanged(DocumentEvent e) {
            updateLaterInEDT();
        }
    };
    rtBinField.getChildComponent().getTextEditor().getDocument().addDocumentListener(docAdp);
    nodeInterpreterField.getChildComponent().getTextEditor().getDocument().addDocumentListener(docAdp);
}
项目:create-intent-inspection    文件:CreateIntentInspection.java   
@Nullable
@Override
public JComponent createOptionsPanel() {
    InspectionOptionPanel panel = new InspectionOptionPanel();
    panel.methodNameTextField.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            final Document document = e.getDocument();
            try {
                final String text = document.getText(0, document.getLength());
                if (text != null) {
                    methodName = text.trim();
                }
            } catch (BadLocationException e1) {
            }
        }
    });
    panel.methodNameTextField.setText(methodName);
    return panel.panel;

}
项目:google-cloud-intellij    文件:SelectUserDialog.java   
/** Initializes the dialog. */
public SelectUserDialog(@Nullable Project project, @NotNull String title) {
  super(project, true);
  init();
  setTitle(title);

  login
      .getDocument()
      .addDocumentListener(
          new DocumentAdapter() {
            @Override
            protected void textChanged(DocumentEvent event) {
              setOKActionEnabled(login.getSelectedUser() != null);
            }
          });
  setOKButtonText(GctBundle.message("select.user.continue"));
  setCancelButtonText(GctBundle.message("select.user.manuallogin"));
  setOKActionEnabled(false);
  Window window = getWindow();
  if (window != null) {
    window.setPreferredSize(new Dimension(400, 125));
  }
}
项目:google-cloud-intellij    文件:CloneCloudRepositoryDialog.java   
private void createUIComponents() {
  projectSelector = new ProjectSelector(project);
  projectSelector.setMinimumSize(new Dimension(400, 0));
  projectSelector.addProjectSelectionListener(this::updateRepositorySelector);
  repositorySelector =
      new RepositorySelector(projectSelector.getSelectedProject(), false /*canCreateRepository*/);

  repositorySelector
      .getDocument()
      .addDocumentListener(
          new DocumentAdapter() {
            @Override
            protected void textChanged(DocumentEvent event) {
              updateButtons();
            }
          });
}
项目:new-instance-inspection    文件:NewInstanceInspection.java   
@Nullable
@Override
public JComponent createOptionsPanel() {
    InspectionOptionPanel panel = new InspectionOptionPanel();
    panel.methodNameTextField.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            final Document document = e.getDocument();
            try {
                final String text = document.getText(0, document.getLength());
                if (text != null) {
                    methodName = text.trim();
                }
            } catch (BadLocationException e1) {
            }
        }
    });
    panel.methodNameTextField.setText(methodName);
    return panel.panel;
}
项目:react-templates-plugin    文件:CreateRTAction.java   
public MyDialog(final Project project, final MyInputValidator validator) {
            super(project, true);
            myProject = project;
            myValidator = validator;
            myBaseLayoutManagerCombo.registerUpDownHint(myFormNameTextField);
            myUpDownHintForm.setIcon(PlatformIcons.UP_DOWN_ARROWS);
            myBaseLayoutManagerCombo.addItem("None", RTIcons.RT, "none");
            myBaseLayoutManagerCombo.addItem("AMD", RTIcons.RT, "amd");
            myBaseLayoutManagerCombo.addItem("CommonJS", RTIcons.RT, "commonjs");
            myBaseLayoutManagerCombo.addItem("ES6", RTIcons.RT, "es6");
            myBaseLayoutManagerCombo.addItem("Typescript", RTIcons.RT, "typescript");
            init();
            setTitle(RTBundle.message("title.new.gui.form"));
            setOKActionEnabled(false);

            myFormNameTextField.getDocument().addDocumentListener(new DocumentAdapter() {
                protected void textChanged(DocumentEvent e) {
                    setOKActionEnabled(!myFormNameTextField.getText().isEmpty());
                }
            });

            myBaseLayoutManagerCombo.setSelectedName(Settings.getInstance(project).modules);
            myBaseLayoutManagerCombo.setEnabled(false);
//            myBaseLayoutManagerCombo.setSelectedName(GuiDesignerConfiguration.getInstance(project).DEFAULT_LAYOUT_MANAGER);
        }
项目:intelij-hippo-groovy    文件:PluginConfiguration.java   
public PluginConfiguration() {

        final DocumentListener listener = new DocumentAdapter() {
            @Override
            protected void textChanged(DocumentEvent documentEvent) {
                groovyDirectory.getText();
            }
        };
        groovyDirectory.getChildComponent().getDocument().addDocumentListener(listener);
        groovyDirectory.setTextFieldPreferredWidth(50);
        groovyDirectory.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                chooseFolder(groovyDirectory, false);
            }
        });


    }
项目:watchdog    文件:WelcomeStepBase.java   
/**
 * Creates and returns an input field, in which user can enter their
 * existing WatchDog ID.
 */
private JPanel createLoginJPanel(final JPanel parent) {
    JPanel panel = UIUtils.createFlowJPanelLeft(parent);
    userInput = UIUtils.createLinkedFieldInput(panel, labelText, ID_LENGTH, inputToolTip);
    userInput.setDocument(new UIUtils.JTextFieldLimit(ID_LENGTH));
    userInput.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            if (userInput.getText().length() == ID_LENGTH) {
                setErrorMessageAndStepComplete(null);
            } else {
                setErrorMessageAndStepComplete("Not a valid id.");
            }
            parent.updateUI();
            getWizard().updateButtons();
        }
    });

    return panel;
}
项目:tools-idea    文件:JavaDocLocalInspection.java   
public FieldPanel createAdditionalJavadocTagsPanel(){
  FieldPanel additionalTagsPanel = new FieldPanel(InspectionsBundle.message("inspection.javadoc.label.text"), InspectionsBundle.message("inspection.javadoc.dialog.title"), null, null);
  additionalTagsPanel.setPreferredSize(new Dimension(150, additionalTagsPanel.getPreferredSize().height));
  additionalTagsPanel.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      final Document document = e.getDocument();
      try {
        final String text = document.getText(0, document.getLength());
        if (text != null) {
          myAdditionalJavadocTags = text.trim();
        }
      }
      catch (BadLocationException e1) {
         LOG.error(e1);
      }
    }
  });
  additionalTagsPanel.setText(myAdditionalJavadocTags);
  return additionalTagsPanel;
}
项目:tools-idea    文件:ExtractArtifactDialog.java   
public ExtractArtifactDialog(ArtifactEditorContext context, LayoutTreeComponent treeComponent, String initialName) {
  super(treeComponent.getLayoutTree(), true);
  myContext = context;
  setTitle(ProjectBundle.message("dialog.title.extract.artifact"));
  for (ArtifactType type : ArtifactType.getAllTypes()) {
    myTypeBox.addItem(type);
  }
  myTypeBox.setSelectedItem(PlainArtifactType.getInstance());
  myTypeBox.setRenderer(new ArtifactTypeCellRenderer(myTypeBox.getRenderer()));
  myNameField.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      setOKActionEnabled(!StringUtil.isEmptyOrSpaces(getArtifactName()));
    }
  });
  myNameField.setText(initialName);
  init();
}
项目:tools-idea    文件:SingleIntegerFieldOptionsPanel.java   
/**
 * Sets integer number format to JFormattedTextField instance,
 * sets value of JFormattedTextField instance to object's field value,
 * synchronizes object's field value with the value of JFormattedTextField instance.
 *
 * @param textField  JFormattedTextField instance
 * @param owner      an object whose field is synchronized with {@code textField}
 * @param property   object's field name for synchronization
 */
public static void setupIntegerFieldTrackingValue(final JFormattedTextField textField,
                                                  final InspectionProfileEntry owner,
                                                  final String property) {
    NumberFormat formatter = NumberFormat.getIntegerInstance();
    formatter.setParseIntegerOnly(true);
    textField.setFormatterFactory(new DefaultFormatterFactory(new NumberFormatter(formatter)));
    textField.setValue(getPropertyValue(owner, property));
    final Document document = textField.getDocument();
    document.addDocumentListener(new DocumentAdapter() {
        @Override
        public void textChanged(DocumentEvent e) {
            try {
                textField.commitEdit();
                setPropertyValue(owner, property,
                        ((Number) textField.getValue()).intValue());
            } catch (ParseException e1) {
                // No luck this time
            }
        }
    });
}
项目:tools-idea    文件:FileSaverDialogImpl.java   
protected JComponent createFileNamePanel() {
  final JPanel panel = new JPanel(new BorderLayout());
  panel.add(new JLabel(UIBundle.message("file.chooser.save.dialog.file.name")), BorderLayout.WEST);
  myFileName.setText("");
  myFileName.getDocument().addDocumentListener(new DocumentAdapter() {
    protected void textChanged(DocumentEvent e) {
      updateOkButton();
    }
  });

  panel.add(myFileName, BorderLayout.CENTER);
  if (myExtensions.getModel().getSize() > 0) {
    myExtensions.setSelectedIndex(0);
    panel.add(myExtensions, BorderLayout.EAST);
  }
  return panel;
}
项目:tools-idea    文件:MasterKeyUtils.java   
/**
 * Match passwords
 *
 * @param passwordField1 the first password field
 * @param passwordField2 the second password field
 * @param setError       the callback used to set or to clear an error
 */
static void matchPasswords(final JPasswordField passwordField1, final JPasswordField passwordField2, final Processor<String> setError) {
  DocumentAdapter l = new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      if (Arrays.equals(passwordField1.getPassword(), passwordField2.getPassword())) {
        setError.process(null);
      }
      else {
        setError.process("The new password and confirm passwords do not match.");
      }
    }
  };
  passwordField1.getDocument().addDocumentListener(l);
  passwordField2.getDocument().addDocumentListener(l);
}
项目:tools-idea    文件:MultipleFacetEditorHelperImpl.java   
private TextFieldBinding(final JTextField common, final List<JTextField> textFields) {
  LOG.assertTrue(!textFields.isEmpty());
  myCommon = common;
  myTextFields = textFields;
  String initialValue = myTextFields.get(0).getText();
  myInitialValues = new ArrayList<String>();
  for (JTextField field : myTextFields) {
    String value = field.getText();
    myInitialValues.add(value);
    if (initialValue != null && !initialValue.equals(value)) {
      initialValue = null;
    }
  }
  common.setText(initialValue != null ? initialValue : "");

  myListener = new DocumentAdapter() {
    @Override
    protected void textChanged(final DocumentEvent e) {
      TextFieldBinding.this.textChanged();
    }
  };
  myCommon.getDocument().addDocumentListener(myListener);
}
项目:tools-idea    文件:AbstractExtractMethodDialog.java   
@Override
protected void init() {
  super.init();
  // Set default name and select it
  myMethodNameTextField.setText(myDefaultName);
  myMethodNameTextField.setSelectionStart(0);
  myMethodNameTextField.setSelectionStart(myDefaultName.length());
  myMethodNameTextField.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      updateOutputVariables();
      updateSignature();
      updateOkStatus();
    }
  });


  myVariableData = createVariableData(myArguments);
  myVariablesMap = createVariableMap(myVariableData);
  myParametersPanel.setVariableData(myVariableData);
  myParametersPanel.init();

  updateOutputVariables();
  updateSignature();
  updateOkStatus();
}