com.intellij.ui.TextFieldWithHistoryWithBrowseButton Java Examples

The following examples show how to use com.intellij.ui.TextFieldWithHistoryWithBrowseButton. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JscsSettingsPage.java    From jscs-plugin with MIT License 4 votes vote down vote up
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) {
    TextFieldWithHistory textFieldWithHistory = field.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    return textFieldWithHistory;
}
 
Example #2
Source File: CopyFilesOrDirectoriesDialog.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
protected JComponent createNorthPanel() {
  myInformationLabel = JBLabelDecorator.createJBLabelDecorator().setBold(true);
  final FormBuilder formBuilder = FormBuilder.createFormBuilder().addComponent(myInformationLabel).addVerticalGap(
    UIUtil.LARGE_VGAP - UIUtil.DEFAULT_VGAP);
  DocumentListener documentListener = new DocumentAdapter() {
    @Override
    public void textChanged(DocumentEvent event) {
      validateOKButton();
    }
  };

  if (myShowNewNameField) {
    myNewNameField = new JTextField();
    myNewNameField.getDocument().addDocumentListener(documentListener);
    formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.new.name.label"), myNewNameField);
  }

  if (myShowDirectoryField) {
    myTargetDirectoryField = new TextFieldWithHistoryWithBrowseButton();
    myTargetDirectoryField.setTextFieldPreferredWidth(MAX_PATH_LENGTH);
    final List<String> recentEntries = RecentsManager.getInstance(myProject).getRecentEntries(RECENT_KEYS);
    if (recentEntries != null) {
      myTargetDirectoryField.getChildComponent().setHistory(recentEntries);
    }
    final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"),
                                                   RefactoringBundle.message("the.file.will.be.copied.to.this.directory"),
                                                   myProject, descriptor,
                                                   TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
    myTargetDirectoryField.getChildComponent().addDocumentListener(new DocumentAdapter() {
      @Override
      protected void textChanged(DocumentEvent e) {
        validateOKButton();
      }
    });
    formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.to.directory.label"), myTargetDirectoryField);

    String shortcutText =
      KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION));
    formBuilder.addTooltip(RefactoringBundle.message("path.completion.shortcut", shortcutText));
  }

  final JPanel wrapper = new JPanel(new BorderLayout());
  wrapper.add(myOpenFilesInEditor, BorderLayout.EAST);
  formBuilder.addComponent(wrapper);
  return formBuilder.getPanel();
}
 
Example #3
Source File: MoveFilesOrDirectoriesDialog.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
protected JComponent createNorthPanel() {
  myNameLabel = JBLabelDecorator.createJBLabelDecorator().setBold(true);

  myTargetDirectoryField = new TextFieldWithHistoryWithBrowseButton();
  final List<String> recentEntries = RecentsManager.getInstance(myProject).getRecentEntries(RECENT_KEYS);
  if (recentEntries != null) {
    myTargetDirectoryField.getChildComponent().setHistory(recentEntries);
  }
  final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"),
                                                 RefactoringBundle.message("the.file.will.be.moved.to.this.directory"),
                                                 myProject,
                                                 descriptor,
                                                 TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
  final JTextField textField = myTargetDirectoryField.getChildComponent().getTextEditor();
  FileChooserFactory.getInstance().installFileCompletion(textField, descriptor, true, getDisposable());
  textField.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      validateOKButton();
    }
  });
  myTargetDirectoryField.setTextFieldPreferredWidth(CopyFilesOrDirectoriesDialog.MAX_PATH_LENGTH);
  Disposer.register(getDisposable(), myTargetDirectoryField);

  String shortcutText = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION));

  myCbSearchForReferences = new NonFocusableCheckBox(RefactoringBundle.message("search.for.references"));
  myCbSearchForReferences.setSelected(RefactoringSettings.getInstance().MOVE_SEARCH_FOR_REFERENCES_FOR_FILE);

  myOpenInEditorCb = new NonFocusableCheckBox("Open moved files in editor");
  myOpenInEditorCb.setSelected(isOpenInEditor());

  return FormBuilder.createFormBuilder().addComponent(myNameLabel)
          .addLabeledComponent(RefactoringBundle.message("move.files.to.directory.label"), myTargetDirectoryField, UIUtil.LARGE_VGAP)
          .addTooltip(RefactoringBundle.message("path.completion.shortcut", shortcutText))
          .addComponentToRightColumn(myCbSearchForReferences, UIUtil.LARGE_VGAP)
          .addComponentToRightColumn(myOpenInEditorCb, UIUtil.LARGE_VGAP)
          .getPanel();
}
 
Example #4
Source File: AddControllerForm.java    From r2m-plugin-android with Apache License 2.0 4 votes vote down vote up
public TextFieldWithHistoryWithBrowseButton getControllerNameBox() {
    return controllerNameBox;
}
 
Example #5
Source File: ESLintSettingsPage.java    From eslint-plugin with MIT License 4 votes vote down vote up
private static boolean areEqual(TextFieldWithHistoryWithBrowseButton field, String value) {
    return field.getChildComponent().getText().equals(value);
}
 
Example #6
Source File: ESLintSettingsPage.java    From eslint-plugin with MIT License 4 votes vote down vote up
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) {
    TextFieldWithHistory textFieldWithHistory = field.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    return textFieldWithHistory;
}
 
Example #7
Source File: ESLintSettingsPage.java    From eslint-plugin with MIT License 4 votes vote down vote up
private void validateField(Validator validator, TextFieldWithHistoryWithBrowseButton field, boolean allowEmpty, String message) {
        if (!validatePath(field.getChildComponent().getText(), allowEmpty)) {
            validator.add(field.getChildComponent().getTextEditor(), message, FIX_IT);
//            addError(validator, field.getChildComponent().getTextEditor(), message, FIX_IT);
        }
    }
 
Example #8
Source File: RTSettingsPage.java    From react-templates-plugin with MIT License 4 votes vote down vote up
private static boolean areEqual(TextFieldWithHistoryWithBrowseButton field, String value) {
    return field.getChildComponent().getText().equals(value);
}
 
Example #9
Source File: RTSettingsPage.java    From react-templates-plugin with MIT License 4 votes vote down vote up
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) {
    TextFieldWithHistory textFieldWithHistory = field.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    return textFieldWithHistory;
}
 
Example #10
Source File: RTSettingsPage.java    From react-templates-plugin with MIT License 4 votes vote down vote up
private void validateField(Validator validator, TextFieldWithHistoryWithBrowseButton field, boolean allowEmpty, String message) {
    if (!ValidationUtils.validatePath(project, field.getChildComponent().getText(), allowEmpty)) {
        ValidationInfo error = new ValidationInfo(field.getChildComponent().getTextEditor(), message, FIX_IT);
        validator.errors.add(error);
    }
}
 
Example #11
Source File: JscsSettingsPage.java    From jscs-plugin with MIT License 4 votes vote down vote up
private static boolean areEqual(TextFieldWithHistoryWithBrowseButton field, String value) {
    return field.getChildComponent().getText().equals(value);
}
 
Example #12
Source File: SassLintSettingsPage.java    From sass-lint-plugin with MIT License 4 votes vote down vote up
private void validateField(Validator validator, TextFieldWithHistoryWithBrowseButton field, boolean allowEmpty, String message) {
    if (!ValidationUtils.validatePath(project, field.getChildComponent().getText(), allowEmpty)) {
        validator.add(field.getChildComponent().getTextEditor(), message, FIX_IT);
    }
}
 
Example #13
Source File: JscsSettingsPage.java    From jscs-plugin with MIT License 4 votes vote down vote up
private void validateField(List<ValidationInfo> errors, TextFieldWithHistoryWithBrowseButton field, boolean allowEmpty, String message) {
    if (!ValidationUtils.validatePath(project, field.getChildComponent().getText(), allowEmpty)) {
        ValidationInfo error = new ValidationInfo(field.getChildComponent().getTextEditor(), message, FIX_IT);
        errors.add(error);
    }
}
 
Example #14
Source File: JscsSettingsPage.java    From jscs-plugin with MIT License 4 votes vote down vote up
private void addDocumentListenerToComp(TextFieldWithHistoryWithBrowseButton field, DocumentAdapter docAdp) {
    field.getChildComponent().getTextEditor().getDocument().addDocumentListener(docAdp);
}
 
Example #15
Source File: VueSettingsPage.java    From vue-for-idea with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private static boolean areEqual(TextFieldWithHistoryWithBrowseButton field, String value) {
    return field.getChildComponent().getText().equals(value);
}
 
Example #16
Source File: VueSettingsPage.java    From vue-for-idea with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) {
    TextFieldWithHistory textFieldWithHistory = field.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    return textFieldWithHistory;
}
 
Example #17
Source File: VueSettingsPage.java    From vue-for-idea with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void validateField(List<ValidationInfo> errors, TextFieldWithHistoryWithBrowseButton field, boolean allowEmpty, String message) {
    if (!ValidationUtils.validatePath(project, field.getChildComponent().getText(), allowEmpty)) {
        ValidationInfo error = new ValidationInfo(field.getChildComponent().getTextEditor(), message, FIX_IT);
        errors.add(error);
    }
}
 
Example #18
Source File: RTSettingsPage.java    From react-templates-plugin with MIT License 4 votes vote down vote up
private static boolean areEqual(TextFieldWithHistoryWithBrowseButton field, String value) {
    return field.getChildComponent().getText().equals(value);
}
 
Example #19
Source File: RTSettingsPage.java    From react-templates-plugin with MIT License 4 votes vote down vote up
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) {
    TextFieldWithHistory textFieldWithHistory = field.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    return textFieldWithHistory;
}
 
Example #20
Source File: RTSettingsPage.java    From react-templates-plugin with MIT License 4 votes vote down vote up
private void validateField(Validator validator, TextFieldWithHistoryWithBrowseButton field, boolean allowEmpty, String message) {
    if (!ValidationUtils.validatePath(project, field.getChildComponent().getText(), allowEmpty)) {
        ValidationInfo error = new ValidationInfo(field.getChildComponent().getTextEditor(), message, FIX_IT);
        validator.errors.add(error);
    }
}
 
Example #21
Source File: SassLintSettingsPage.java    From sass-lint-plugin with MIT License 4 votes vote down vote up
private static boolean areEqual(TextFieldWithHistoryWithBrowseButton field, String value) {
    return field.getChildComponent().getText().equals(value);
}
 
Example #22
Source File: SassLintSettingsPage.java    From sass-lint-plugin with MIT License 4 votes vote down vote up
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) {
    TextFieldWithHistory textFieldWithHistory = field.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    return textFieldWithHistory;
}