当前位置: 首页>>代码示例>>Java>>正文


Java TextFieldWithHistoryWithBrowseButton.setTextFieldPreferredWidth方法代码示例

本文整理汇总了Java中com.intellij.ui.TextFieldWithHistoryWithBrowseButton.setTextFieldPreferredWidth方法的典型用法代码示例。如果您正苦于以下问题:Java TextFieldWithHistoryWithBrowseButton.setTextFieldPreferredWidth方法的具体用法?Java TextFieldWithHistoryWithBrowseButton.setTextFieldPreferredWidth怎么用?Java TextFieldWithHistoryWithBrowseButton.setTextFieldPreferredWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ui.TextFieldWithHistoryWithBrowseButton的用法示例。


在下文中一共展示了TextFieldWithHistoryWithBrowseButton.setTextFieldPreferredWidth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createNorthPanel

import com.intellij.ui.TextFieldWithHistoryWithBrowseButton; //导入方法依赖的package包/类
@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();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:37,代码来源:MoveFilesOrDirectoriesDialog.java

示例2: createNorthPanel

import com.intellij.ui.TextFieldWithHistoryWithBrowseButton; //导入方法依赖的package包/类
@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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:MoveFilesOrDirectoriesDialog.java

示例3: createNorthPanel

import com.intellij.ui.TextFieldWithHistoryWithBrowseButton; //导入方法依赖的package包/类
@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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:CopyFilesOrDirectoriesDialog.java

示例4: createNorthPanel

import com.intellij.ui.TextFieldWithHistoryWithBrowseButton; //导入方法依赖的package包/类
@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();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:49,代码来源:CopyFilesOrDirectoriesDialog.java

示例5: createNorthPanel

import com.intellij.ui.TextFieldWithHistoryWithBrowseButton; //导入方法依赖的package包/类
@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();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:42,代码来源:MoveFilesOrDirectoriesDialog.java


注:本文中的com.intellij.ui.TextFieldWithHistoryWithBrowseButton.setTextFieldPreferredWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。