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

项目:intellij-ce-playground    文件:SwingHelper.java   
@NotNull
public static TextFieldWithHistoryWithBrowseButton createTextFieldWithHistoryWithBrowseButton(@Nullable Project project,
                                                                                              @NotNull String browseDialogTitle,
                                                                                              @NotNull FileChooserDescriptor fileChooserDescriptor,
                                                                                              @Nullable NotNullProducer<List<String>> historyProvider) {
  TextFieldWithHistoryWithBrowseButton textFieldWithHistoryWithBrowseButton = new TextFieldWithHistoryWithBrowseButton();
  TextFieldWithHistory textFieldWithHistory = textFieldWithHistoryWithBrowseButton.getChildComponent();
  textFieldWithHistory.setHistorySize(-1);
  textFieldWithHistory.setMinimumAndPreferredWidth(0);
  if (historyProvider != null) {
    addHistoryOnExpansion(textFieldWithHistory, historyProvider);
  }
  installFileCompletionAndBrowseDialog(
    project,
    textFieldWithHistoryWithBrowseButton,
    browseDialogTitle,
    fileChooserDescriptor
  );
  return textFieldWithHistoryWithBrowseButton;
}
项目:intellij-ce-playground    文件:SwingHelper.java   
public static void resizeDialogToFitTextFor(@NotNull final JComponent... components) {
  if (components.length == 0) return;
  doWithDialogWrapper(components[0], new Consumer<DialogWrapper>() {
    @Override
    public void consume(final DialogWrapper dialogWrapper) {
      if (dialogWrapper instanceof SettingsDialog || dialogWrapper instanceof SingleConfigurableEditor) {
        for (Component component : components) {
          if (component instanceof TextFieldWithHistoryWithBrowseButton) {
            setPreferredWidthToFitText((TextFieldWithHistoryWithBrowseButton)component);
          }
          else if (component instanceof TextFieldWithBrowseButton) {
            setPreferredWidthToFitText((TextFieldWithBrowseButton)component);
          }
          else if (component instanceof JTextField) {
            setPreferredWidthToFitText((JTextField)component);
          }
        }
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          @Override
          public void run() {
            adjustDialogSizeToFitPreferredSize(dialogWrapper);
          }
        }, ModalityState.any());
      }
    }
  });
}
项目:intellij-ce-playground    文件:SwingHelper.java   
public static void installFileCompletionAndBrowseDialog(@Nullable Project project,
                                                        @NotNull TextFieldWithHistoryWithBrowseButton textFieldWithHistoryWithBrowseButton,
                                                        @NotNull @Nls(capitalization = Nls.Capitalization.Title) String browseDialogTitle,
                                                        @NotNull FileChooserDescriptor fileChooserDescriptor) {
  doInstall(project,
            textFieldWithHistoryWithBrowseButton,
            textFieldWithHistoryWithBrowseButton.getChildComponent().getTextEditor(),
            browseDialogTitle,
            fileChooserDescriptor,
            TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
}
项目:tools-idea    文件:MoveFilesOrDirectoriesDialog.java   
@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);

  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).getPanel();
}
项目:sass-lint-plugin    文件:SassLintSettingsPage.java   
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);
    }
}
项目:sass-lint-plugin    文件:SassLintSettingsPage.java   
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) {
    TextFieldWithHistory textFieldWithHistory = field.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    return textFieldWithHistory;
}
项目:sass-lint-plugin    文件:SassLintSettingsPage.java   
private static boolean areEqual(TextFieldWithHistoryWithBrowseButton field, String value) {
    return field.getChildComponent().getText().equals(value);
}
项目:intellij-ce-playground    文件:SwingHelper.java   
public static void setPreferredWidthToFitText(@NotNull TextFieldWithHistoryWithBrowseButton component) {
  int childWidth = calcWidthToFitText(component.getChildComponent().getTextEditor(), JBUI.scale(32));
  setPreferredWidthForComponentWithBrowseButton(component, childWidth);
}
项目:intellij-ce-playground    文件:MoveFilesOrDirectoriesDialog.java   
@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();
}
项目:intellij-ce-playground    文件:CopyFilesOrDirectoriesDialog.java   
@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 JBTextField();
    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();
}
项目:react-templates-plugin    文件:RTSettingsPage.java   
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);
    }
}
项目:react-templates-plugin    文件:RTSettingsPage.java   
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) {
    TextFieldWithHistory textFieldWithHistory = field.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    return textFieldWithHistory;
}
项目:react-templates-plugin    文件:RTSettingsPage.java   
private static boolean areEqual(TextFieldWithHistoryWithBrowseButton field, String value) {
    return field.getChildComponent().getText().equals(value);
}
项目:vue-for-idea    文件:VueSettingsPage.java   
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);
    }
}
项目:vue-for-idea    文件:VueSettingsPage.java   
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) {
    TextFieldWithHistory textFieldWithHistory = field.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    return textFieldWithHistory;
}
项目:vue-for-idea    文件:VueSettingsPage.java   
private static boolean areEqual(TextFieldWithHistoryWithBrowseButton field, String value) {
    return field.getChildComponent().getText().equals(value);
}
项目:coffee-lint-plugin    文件:CoffeeLintSettingsPage.java   
private void validateField(List<ValidationInfo> errors, TextFieldWithHistoryWithBrowseButton field, boolean allowEmpty, String message) {
    if (!validatePath(field.getChildComponent().getText(), allowEmpty)) {
        ValidationInfo error = new ValidationInfo(field.getChildComponent().getTextEditor(), message, FIX_IT);
        errors.add(error);
    }
}
项目:coffee-lint-plugin    文件:CoffeeLintSettingsPage.java   
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) {
    TextFieldWithHistory textFieldWithHistory = field.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    return textFieldWithHistory;
}
项目:coffee-lint-plugin    文件:CoffeeLintSettingsPage.java   
private static boolean areEqual(TextFieldWithHistoryWithBrowseButton field, String value) {
    return field.getChildComponent().getText().equals(value);
}
项目:jscs-plugin    文件:JscsSettingsPage.java   
private void addDocumentListenerToComp(TextFieldWithHistoryWithBrowseButton field, DocumentAdapter docAdp) {
    field.getChildComponent().getTextEditor().getDocument().addDocumentListener(docAdp);
}
项目:jscs-plugin    文件:JscsSettingsPage.java   
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);
    }
}
项目:jscs-plugin    文件:JscsSettingsPage.java   
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) {
    TextFieldWithHistory textFieldWithHistory = field.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    return textFieldWithHistory;
}
项目:jscs-plugin    文件:JscsSettingsPage.java   
private static boolean areEqual(TextFieldWithHistoryWithBrowseButton field, String value) {
    return field.getChildComponent().getText().equals(value);
}
项目:react-templates-plugin    文件:RTSettingsPage.java   
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);
    }
}
项目:react-templates-plugin    文件:RTSettingsPage.java   
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) {
    TextFieldWithHistory textFieldWithHistory = field.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    return textFieldWithHistory;
}
项目:react-templates-plugin    文件:RTSettingsPage.java   
private static boolean areEqual(TextFieldWithHistoryWithBrowseButton field, String value) {
    return field.getChildComponent().getText().equals(value);
}
项目:eslint-plugin    文件:ESLintSettingsPage.java   
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);
        }
    }
项目:eslint-plugin    文件:ESLintSettingsPage.java   
private static TextFieldWithHistory configWithDefaults(TextFieldWithHistoryWithBrowseButton field) {
    TextFieldWithHistory textFieldWithHistory = field.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    return textFieldWithHistory;
}
项目:eslint-plugin    文件:ESLintSettingsPage.java   
private static boolean areEqual(TextFieldWithHistoryWithBrowseButton field, String value) {
    return field.getChildComponent().getText().equals(value);
}
项目:r2m-plugin-android    文件:AddControllerForm.java   
public TextFieldWithHistoryWithBrowseButton getControllerNameBox() {
    return controllerNameBox;
}
项目:tools-idea    文件:CopyFilesOrDirectoriesDialog.java   
@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();
}
项目:consulo    文件:MoveFilesOrDirectoriesDialog.java   
@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();
}
项目:consulo    文件:CopyFilesOrDirectoriesDialog.java   
@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();
}