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

项目:intellij    文件:GenerateFromBuildFileSelectProjectViewOption.java   
public GenerateFromBuildFileSelectProjectViewOption(BlazeNewProjectBuilder builder) {
  this.builder = builder;
  this.userSettings = builder.getUserSettings();

  this.buildFilePathField = new TextFieldWithStoredHistory(LAST_WORKSPACE_PATH);
  buildFilePathField.setName("build-file-path-field");
  buildFilePathField.setHistorySize(BlazeNewProjectBuilder.HISTORY_SIZE);
  buildFilePathField.setText(userSettings.get(LAST_WORKSPACE_PATH, ""));

  JButton button = new JButton("...");
  button.addActionListener(action -> chooseWorkspacePath());
  int buttonSize = buildFilePathField.getPreferredSize().height;
  button.setPreferredSize(new Dimension(buttonSize, buttonSize));

  JComponent box =
      UiUtil.createHorizontalBox(
          HORIZONTAL_LAYOUT_GAP, new JLabel("BUILD file:"), buildFilePathField, button);
  UiUtil.setPreferredWidth(box, PREFERRED_COMPONENT_WIDTH);
  this.component = box;
}
项目:intellij    文件:ImportFromWorkspaceProjectViewOption.java   
public ImportFromWorkspaceProjectViewOption(BlazeNewProjectBuilder builder) {
  this.builder = builder;
  this.userSettings = builder.getUserSettings();

  this.projectViewPathField = new TextFieldWithStoredHistory(LAST_WORKSPACE_PATH);
  projectViewPathField.setHistorySize(BlazeNewProjectBuilder.HISTORY_SIZE);
  projectViewPathField.setText(userSettings.get(LAST_WORKSPACE_PATH, ""));

  JButton button = new JButton("...");
  button.addActionListener(action -> chooseWorkspacePath());
  int buttonSize = projectViewPathField.getPreferredSize().height;
  button.setPreferredSize(new Dimension(buttonSize, buttonSize));

  JComponent box =
      UiUtil.createHorizontalBox(
          HORIZONTAL_LAYOUT_GAP, new JLabel("Project view:"), projectViewPathField, button);
  UiUtil.setPreferredWidth(box, PREFERRED_COMPONENT_WIDTH);
  this.component = box;
}
项目:intellij    文件:CopyExternalProjectViewOption.java   
public CopyExternalProjectViewOption(BlazeNewProjectBuilder builder) {
  this.userSettings = builder.getUserSettings();

  this.projectViewPathField = new TextFieldWithStoredHistory(LAST_WORKSPACE_PATH);
  projectViewPathField.setHistorySize(BlazeNewProjectBuilder.HISTORY_SIZE);
  projectViewPathField.setText(userSettings.get(LAST_WORKSPACE_PATH, ""));

  JButton button = new JButton("...");
  button.addActionListener(action -> chooseWorkspacePath());
  int buttonSize = projectViewPathField.getPreferredSize().height;
  button.setPreferredSize(new Dimension(buttonSize, buttonSize));

  JComponent box =
      UiUtil.createHorizontalBox(
          HORIZONTAL_LAYOUT_GAP, new JLabel("Project view:"), projectViewPathField, button);
  UiUtil.setPreferredWidth(box, PREFERRED_COMPONENT_WIDTH);
  this.component = box;
}
项目:idea-jflex    文件:JFlexSettingsForm.java   
private void fixButton(final TextFieldWithStoredHistory historyField, ComponentWithBrowseButton<TextFieldWithStoredHistory> control) {
    FixedSizeButton button = control.getButton();
    control.remove(button);
    BorderLayout borderLayout = new BorderLayout();
    JPanel buttonPanel = new JPanel(borderLayout);
    buttonPanel.setBorder(IdeBorderFactory.createEmptyBorder(4, 0, 4, 0));
    buttonPanel.add(button, BorderLayout.CENTER);
    control.add(buttonPanel, BorderLayout.EAST);
    button.setAttachedComponent(new JComponent() {
        public Dimension getPreferredSize() {
            Dimension size = historyField.getTextEditor().getPreferredSize();
            return new Dimension(-1, size.height + 6);
        }

    });
}
项目:idea-jflex    文件:JFlexSettingsForm.java   
@SuppressWarnings({"unchecked"})
private static TextFieldWithStoredHistory createHistoryTextField(@NotNull String name, @NotNull String... defaultValues) {
    TextFieldWithStoredHistory storedHistory = new TextFieldWithStoredHistoryBugFixed(name);
    storedHistory.reset();
    List<String> list = storedHistory.getHistory();
    list.removeAll(Arrays.asList(defaultValues));
    if (list.isEmpty()) {
        // Default histories
        for (String defaultValue : defaultValues) {
            setTextWithHistory(storedHistory, defaultValue);
        }
    } else {
        storedHistory.setSelectedItem(list.get(list.size() - 1));
    }
    return storedHistory;
}
项目:idea-jflex    文件:JFlexSettingsForm.java   
private static void setTextWithHistory(TextFieldWithStoredHistory component, String text) {
    if (StringUtil.isEmptyOrSpaces(text)) {
        component.setText(null);
    } else {
        component.setText(text);
        component.addCurrentTextToHistory();
    }
}
项目:intellij    文件:FileSelectorWithStoredHistory.java   
private FileSelectorWithStoredHistory(TextFieldWithStoredHistory textField, String title) {
  super(textField, null);

  addBrowseFolderListener(
      title,
      "",
      null,
      BrowseFilesListener.SINGLE_FILE_DESCRIPTOR,
      TextComponentAccessor.TEXT_FIELD_WITH_STORED_HISTORY_WHOLE_TEXT);
}
项目:idea-jflex    文件:JFlexSettingsForm.java   
private void createUIComponents() {
    enabledCompilationCheckBox = new StateRestoringCheckBox(JFLEX_ENABLED_COMPILATION_KEY, true);
    TextFieldWithStoredHistory jflexHomeHistory = createHistoryTextField(JFLEX_HOME_KEY, JFlexSettings.getDefaultJFlexHome());
    jFlexHomeTextField = new ComponentWithBrowseButton<TextFieldWithStoredHistory>(jflexHomeHistory, null);
    fixButton(jflexHomeHistory, jFlexHomeTextField);
    TextFieldWithStoredHistory skeletonPathHistory = createHistoryTextField(JFLEX_SKELETON_KEY, JFlexSettings.getDefaultSkeletonPath(JFlexSettings.getDefaultJFlexHome()));
    skeletonPathTextField = new ComponentWithBrowseButton<TextFieldWithStoredHistory>(skeletonPathHistory, null);
    fixButton(skeletonPathHistory, skeletonPathTextField);
    commandLineOptionsTextField = createHistoryTextField(JFLEX_OPTIONS_KEY, JFlexSettings.DEFAULT_OPTIONS_CHARAT_NOBAK);
    enabledEmbedJavaCheckBox = new StateRestoringCheckBox(JFLEX_ENABLED_EMBED_JAVA_KEY, true);
}
项目:reviewboard-plugin-for-idea    文件:PrePostReviewForm.java   
private void createUIComponents() {
        peopleTextField = new TextFieldWithStoredHistory("rb.people");

//        peopleTextField.addKeyboardListener(new KeyAdapter() {
//            @Override
//            public void keyTyped(KeyEvent e) {
//                System.out.println(e);
//                if (e.getKeyCode() == KeyEvent.VK_DELETE) {
//                    peopleTextField.setSelectedIndex(-1);
////                    peopleTextField
//                }
//            }
//        });
        groupTextField = new TextFieldWithStoredHistory("rb.group");
    }
项目:intellij-ce-playground    文件:TextComponentAccessor.java   
@Override
public String getText(TextFieldWithStoredHistory textField) {
  return textField.getText();
}
项目:intellij-ce-playground    文件:TextComponentAccessor.java   
@Override
public void setText(TextFieldWithStoredHistory textField, @NotNull String text) {
  textField.setText(text);
}
项目:intellij    文件:FileSelectorWithStoredHistory.java   
public static FileSelectorWithStoredHistory create(String historyKey, String title) {
  TextFieldWithStoredHistory textField = new TextFieldWithStoredHistory(historyKey);
  return new FileSelectorWithStoredHistory(textField, title);
}
项目:idea-jflex    文件:JFlexSettingsForm.java   
public String getText(TextFieldWithStoredHistory component) {
    return component.getText().replace('\\', '/');
}
项目:idea-jflex    文件:JFlexSettingsForm.java   
public void setText(TextFieldWithStoredHistory component, String text) {
    setTextWithHistory(component, text);
}
项目:tools-idea    文件:TextComponentAccessor.java   
public String getText(TextFieldWithStoredHistory textField) {
  return textField.getText();
}
项目:tools-idea    文件:TextComponentAccessor.java   
public void setText(TextFieldWithStoredHistory textField, String text) {
  textField.setText(text);
}
项目:consulo    文件:TextComponentAccessor.java   
public String getText(TextFieldWithStoredHistory textField) {
  return textField.getText();
}
项目:consulo    文件:TextComponentAccessor.java   
public void setText(TextFieldWithStoredHistory textField, String text) {
  textField.setText(text);
}