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

项目:weex-language-support    文件:DocumentIntention.java   
private void openSample(Project project, Editor editor) {

        EditorTextField field = new EditorTextField(editor.getDocument(), project, WeexFileType.INSTANCE, true, false) {
            @Override
            protected EditorEx createEditor() {
                EditorEx editor1 = super.createEditor();
                editor1.setVerticalScrollbarVisible(true);
                editor1.setHorizontalScrollbarVisible(true);
                return editor1;

            }
        };

        field.setFont(editor.getContentComponent().getFont());

        JBPopup jbPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(field, null)
                .createPopup();

        jbPopup.setSize(new Dimension(500, 500));
        jbPopup.showInBestPositionFor(editor);
    }
项目:intellij-nette-tester    文件:TesterNewTestCaseDialog.java   
private void createUIComponents() {
    testTargetTextField = new EditorTextField("", getProject(), FileTypes.PLAIN_TEXT);
    namespaceComboBox = new PhpNamespaceComboBox(getProject(), "", getDisposable());
    directoryComboBox = new PhpPsrDirectoryComboBox(getProject()) {
        @Override
        public void init(@NotNull VirtualFile baseDir, @NotNull String namespace) {
            super.init(baseDir, namespace);
            ProjectFileIndex index = ProjectRootManager.getInstance(TesterNewTestCaseDialog.this.getProject()).getFileIndex();
            this.setDirectoriesFilter(index::isInTestSourceContent);

            this.updateDirectories(TesterNewTestCaseDialog.this.getNamespace());
        }
    };

    classToTestLabel = new JBLabel(TesterBundle.message("dialog.newTestCase.label.classToTest"));
    testClassLabel = new JBLabel(TesterBundle.message("dialog.newTestCase.label.testClass"));
    namespaceLabel = new JBLabel(TesterBundle.message("dialog.newTestCase.label.namespace"));
    fileNameLabel = new JBLabel(TesterBundle.message("dialog.newTestCase.label.fileName"));
    directoryLabel = new JBLabel(TesterBundle.message("dialog.newTestCase.label.directory"));

    testTargetCompletionHint = new JBLabel(UIUtil.ComponentStyle.MINI);
    namespaceCompletionHint = new JBLabel(UIUtil.ComponentStyle.MINI);
    directoryCompletionHint = new JBLabel(UIUtil.ComponentStyle.MINI);
}
项目:PackageTemplates    文件:ScriptDialog.java   
private void createViews() {
    etfName = new EditorTextField(Localizer.get("ExampleName"));
    btnTry = new JButton(Localizer.get("TryIt"));
    jlResult = new JBLabel(Localizer.get("ResultWillBeHere"));

    etfName.setAlignmentX(Component.CENTER_ALIGNMENT);
    etfName.setAlignmentY(Component.CENTER_ALIGNMENT);
    btnTry.setAlignmentX(Component.CENTER_ALIGNMENT);
    btnTry.setAlignmentY(Component.CENTER_ALIGNMENT);
    jlResult.setAlignmentX(Component.CENTER_ALIGNMENT);
    jlResult.setAlignmentY(Component.CENTER_ALIGNMENT);

    btnTry.addMouseListener(new ClickListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            jlResult.setText(ScriptExecutor.runScript(etfCode.getText(), etfName.getText()));
        }
    });
}
项目:intellij-ce-playground    文件:MethodBrowser.java   
public void installCompletion(EditorTextField field) {
  new TextFieldCompletionProvider() {
    @Override
    protected void addCompletionVariants(@NotNull String text, int offset, @NotNull String prefix, @NotNull CompletionResultSet result) {
      final String className = getClassName();
      if (className.trim().length() == 0) {
        return;
      }
      final PsiClass testClass = getModuleSelector().findClass(className);
      if (testClass == null) return;
      final Condition<PsiMethod> filter = getFilter(testClass);
      for (PsiMethod psiMethod : testClass.getAllMethods()) {
        if (filter.value(psiMethod)) {
          result.addElement(LookupElementBuilder.create(psiMethod.getName()));
        }
      }
    }
  }.apply(field);
}
项目:intellij-ce-playground    文件:PackageChooserDialog.java   
private void setupPathComponent(final JPanel northPanel) {
  northPanel.add(new TextFieldAction() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      toggleShowPathComponent(northPanel, this);
    }
  }, BorderLayout.EAST);
  myPathEditor = new EditorTextField(JavaReferenceEditorUtil.createDocument("", myProject, false), myProject, StdFileTypes.JAVA);
  myPathEditor.addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      myAlarm.cancelAllRequests();
      myAlarm.addRequest(new Runnable() {
        @Override
        public void run() {
          updateTreeFromPath();
        }
      }, 300);
    }
  });
  myPathEditor.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0));
  northPanel.add(myPathEditor, BorderLayout.SOUTH);
}
项目:intellij-ce-playground    文件:MoveInstanceMethodDialog.java   
@Nullable
private JPanel createParametersPanel () {
  myThisClassesMap = MoveInstanceMembersUtil.getThisClassesToMembers(myMethod);
  myOldClassParameterNameFields = new HashMap<PsiClass, EditorTextField>();
  if (myThisClassesMap.size() == 0) return null;
  JPanel panel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, true));
  for (PsiClass aClass : myThisClassesMap.keySet()) {
    final String text = RefactoringBundle.message("move.method.this.parameter.label", aClass.getName());
    panel.add(new TitledSeparator(text, null));

    String suggestedName = MoveInstanceMethodHandler.suggestParameterNameForThisClass(aClass);
    final EditorTextField field = new EditorTextField(suggestedName, getProject(), StdFileTypes.JAVA);
    field.setMinimumSize(new Dimension(field.getPreferredSize()));
    myOldClassParameterNameFields.put(aClass, field);
    panel.add(field);
  }
  panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
  return panel;
}
项目:intellij-ce-playground    文件:MoveInstanceMethodDialog.java   
protected void doAction() {
  Map<PsiClass, String> parameterNames = new LinkedHashMap<PsiClass, String>();
  for (final PsiClass aClass : myThisClassesMap.keySet()) {
    EditorTextField field = myOldClassParameterNameFields.get(aClass);
    if (field.isEnabled()) {
      String parameterName = field.getText().trim();
      if (!PsiNameHelper.getInstance(myMethod.getProject()).isIdentifier(parameterName)) {
        Messages
          .showErrorDialog(getProject(), RefactoringBundle.message("move.method.enter.a.valid.name.for.parameter"), myRefactoringName);
        return;
      }
      parameterNames.put(aClass, parameterName);
    }
  }

  final PsiVariable targetVariable = (PsiVariable)myList.getSelectedValue();
  if (targetVariable == null) return;
  final MoveInstanceMethodProcessor processor = new MoveInstanceMethodProcessor(myMethod.getProject(),
                                                                                myMethod, targetVariable,
                                                                                myVisibilityPanel.getVisibility(),
                                                                                isOpenInEditor(),
                                                                                parameterNames);
  if (!verifyTargetClass(processor.getTargetClass())) return;
  saveOpenInEditorOption();
  invokeRefactoring(processor);
}
项目:intellij-ce-playground    文件:JavaParameterTableModel.java   
public Component getTableCellEditorComponent(final JTable table,
                                             Object value,
                                             boolean isSelected,
                                             final int row,
                                             int column) {
  final EditorTextField textField = (EditorTextField)super.getTableCellEditorComponent(table, value, isSelected, row, column);
  textField.registerKeyboardAction(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      PsiType type = getRowType(table, row);
      if (type != null) {
        completeVariable(textField, type);
      }
    }
  }, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.CTRL_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
  textField.setBorder(new LineBorder(table.getSelectionBackground()));
  return textField;
}
项目:intellij-ce-playground    文件:IJSwingUtilities.java   
public static void adjustComponentsOnMac(@Nullable JLabel label, @Nullable JComponent component) {
  if (component == null) return;
  if (!UIUtil.isUnderAquaLookAndFeel()) return;

  if (component instanceof JComboBox) {
    UIUtil.addInsets(component, new Insets(0,-2,0,0));
    if (label != null) {
      UIUtil.addInsets(label, new Insets(0,2,0,0));
    }
  }
  if (component instanceof JCheckBox) {
    UIUtil.addInsets(component, new Insets(0,-5,0,0));
  }
  if (component instanceof JTextField || component instanceof EditorTextField) {
    if (label != null) {
      UIUtil.addInsets(label, new Insets(0,3,0,0));
    }
  }
}
项目:intellij-ce-playground    文件:UpDownHandler.java   
@Override
public void update(AnActionEvent e) {
  final LookupEx lookup;
  if (myInput instanceof EditorTextField) {
    lookup = LookupManager.getActiveLookup(((EditorTextField)myInput).getEditor());
  } else if (myInput instanceof EditorComponentImpl) {
    lookup = LookupManager.getActiveLookup(((EditorComponentImpl)myInput).getEditor());
  } else {
    lookup = null;
  }

  JComboBox comboBox = UIUtil.findComponentOfType(myInput, JComboBox.class);
  boolean popupMenuVisible = comboBox != null && comboBox.isPopupVisible();

  e.getPresentation().setEnabled(lookup == null && !popupMenuVisible);
}
项目:intellij-ce-playground    文件:StringTableCellEditor.java   
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
  final EditorTextField editorTextField = new EditorTextField((String) value, myProject, StdFileTypes.JAVA) {
          @Override
          protected boolean shouldHaveBorder() {
            return false;
          }
        };
  myDocument = editorTextField.getDocument();
  if (myDocument != null) {
    for (DocumentListener listener : myListeners) {
      editorTextField.addDocumentListener(listener);
    }
  }
  return editorTextField;
}
项目:intellij-ce-playground    文件:ArrayTableCellEditor.java   
public MyTableEditor(Project project,
                     XDebuggerEditorsProvider debuggerEditorsProvider,
                     @Nullable @NonNls String historyId,
                     @Nullable XSourcePosition sourcePosition, @NotNull XExpression text, @NotNull final KeyAdapter actionAdapter) {
  super(project, debuggerEditorsProvider, EvaluationMode.CODE_FRAGMENT, historyId, sourcePosition);
  myExpression = XExpressionImpl.changeMode(text, getMode());
  myEditorTextField = new EditorTextField(createDocument(myExpression), project, debuggerEditorsProvider.getFileType()) {
    @Override
    protected EditorEx createEditor() {
      final EditorEx editor = super.createEditor();
      editor.setVerticalScrollbarVisible(false);
      editor.setOneLineMode(true);
      editor.getContentComponent().addKeyListener(actionAdapter);
      return editor;
    }

    @Override
    protected boolean isOneLineMode() {
      return true;
    }
  };
  myEditorTextField.setFontInheritedFromLAF(false);
}
项目:intellij-ce-playground    文件:PyConsoleSpecificOptionsPanel.java   
private void configureStartingScriptPanel(final PyConsoleOptions.PyConsoleSettings optionsProvider) {
  myEditorTextField =
    new EditorTextField(createDocument(myProject, optionsProvider.myCustomStartScript), myProject, PythonFileType.INSTANCE) {
      @Override
      protected EditorEx createEditor() {
        final EditorEx editor = super.createEditor();
        editor.setVerticalScrollbarVisible(true);
        return editor;
      }

      @Override
      protected boolean isOneLineMode() {
        return false;
      }
    };
  myStartingScriptPanel.setLayout(new BorderLayout());
  myStartingScriptPanel.add(myEditorTextField, BorderLayout.CENTER);
  myConsoleSettings = optionsProvider;
}
项目:intellij-ce-playground    文件:ApplicationRunParameters.java   
private void createUIComponents() {
  final EditorTextField editorTextField = new LanguageTextField(PlainTextLanguage.INSTANCE, myProject, "") {
    @Override
    protected EditorEx createEditor() {
      final EditorEx editor = super.createEditor();
      final PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument());

      if (file != null) {
        DaemonCodeAnalyzer.getInstance(myProject).setHighlightingEnabled(file, false);
      }
      editor.putUserData(ACTIVITY_CLASS_TEXT_FIELD_KEY, ApplicationRunParameters.this);
      return editor;
    }
  };
  myActivityField = new ComponentWithBrowseButton<EditorTextField>(editorTextField, null);
}
项目:intellij-ce-playground    文件:GradleParentProjectForm.java   
private static void collapseIfPossible(@NotNull EditorTextField editorTextField,
                                       @NotNull ProjectSystemId systemId,
                                       @NotNull Project project) {
  Editor editor = editorTextField.getEditor();
  if (editor != null) {
    String rawText = editor.getDocument().getText();
    if (StringUtil.isEmpty(rawText)) return;
    if (EMPTY_PARENT.equals(rawText)) {
      editorTextField.setEnabled(false);
      return;
    }
    final Collection<ExternalProjectInfo> projectsData =
      ProjectDataManager.getInstance().getExternalProjectsData(project, systemId);
    for (ExternalProjectInfo projectInfo : projectsData) {
      if (projectInfo.getExternalProjectStructure() != null && projectInfo.getExternalProjectPath().equals(rawText)) {
        editorTextField.setEnabled(true);
        ExternalProjectPathField.collapse(
          editorTextField.getEditor(), projectInfo.getExternalProjectStructure().getData().getExternalName());
        return;
      }
    }
  }
}
项目:intellij-ce-playground    文件:SearchSupport.java   
public SearchSupport(EditorTextField textField) {

    myTextField = textField;
    myTextField.getDocument().addDocumentListener(new DocumentAdapter() {
      @Override
      public void documentChanged(DocumentEvent event) {
        onTextChanged();
      }
    });

    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        myTextField.addKeyListener(new KeyAdapter() {
          public void keyPressed(final KeyEvent e) {
              processListSelection(e);
          }
        });
      }
    });

    myList.setVisibleRowCount(10);
    myListModel = new SortedListModel<T>(null);
    myList.setModel(myListModel);
  }
项目:intellij-ce-playground    文件:ClassToBindProperty.java   
public MyEditor(final Project project) {
  myProject = project;
  myEditorTextField = new EditorTextField("", project, StdFileTypes.JAVA) {
    protected boolean shouldHaveBorder() {
      return false;
    }
  };
  myActionListener = new MyActionListener();
  myTfWithButton = new ComponentWithBrowseButton<EditorTextField>(myEditorTextField, myActionListener);
  myEditorTextField.setBorder(null);
  new MyCancelEditingAction().registerCustomShortcutSet(CommonShortcuts.ESCAPE, myTfWithButton);
  /*
  myEditorTextField.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        fireValueCommitted();
      }
    }
  );
  */
}
项目:intellij-ce-playground    文件:ExpressionCellEditor.java   
public Component getTableCellEditorComponent(JTable ttable, Object value, boolean isSelected, int row, int col) {
    myExpression = (Expression)value;

    myDocument = PsiDocumentManager.getInstance(project).getDocument(myExpression.getFile());
    return new EditorTextField(myDocument, project, myExpression.getFileType()) {
        protected boolean shouldHaveBorder() {
            return false;
        }

        public void addNotify() {
            super.addNotify();
            Runnable runnable = new Runnable() {
                public void run() {
                    final Editor editor = getEditor();
                    if (editor != null) {
                        editor.getContentComponent().requestFocus();
                    }
                }
            };
            SwingUtilities.invokeLater(runnable);
        }
    };
}
项目:intellij    文件:BlazeAndroidBinaryRunConfigurationStateEditor.java   
private void createUIComponents(Project project) {
  final EditorTextField editorTextField =
      new LanguageTextField(PlainTextLanguage.INSTANCE, project, "") {
        @Override
        protected EditorEx createEditor() {
          final EditorEx editor = super.createEditor();
          final PsiFile file =
              PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());

          if (file != null) {
            DaemonCodeAnalyzer.getInstance(project).setHighlightingEnabled(file, false);
          }
          editor.putUserData(
              ACTIVITY_CLASS_TEXT_FIELD_KEY, BlazeAndroidBinaryRunConfigurationStateEditor.this);
          return editor;
        }
      };
  activityField = new ComponentWithBrowseButton<EditorTextField>(editorTextField, null);
}
项目:intellij    文件:BlazeAndroidTestRunConfigurationStateEditor.java   
BlazeAndroidTestRunConfigurationStateEditor(
    RunConfigurationStateEditor commonStateEditor, Project project) {
  this.commonStateEditor = commonStateEditor;
  setupUI(project);

  packageComponent.setComponent(new EditorTextField());

  classComponent.setComponent(new EditorTextField());

  runnerComponent.setComponent(new EditorTextField());

  methodComponent.setComponent(new EditorTextField());

  addTestingType(BlazeAndroidTestRunConfigurationState.TEST_ALL_IN_TARGET, allInTargetButton);
  addTestingType(TEST_ALL_IN_PACKAGE, allInPackageButton);
  addTestingType(TEST_CLASS, classButton);
  addTestingType(TEST_METHOD, testMethodButton);
}
项目:tools-idea    文件:MoveInstanceMethodDialog.java   
@Nullable
private JPanel createParametersPanel () {
  myThisClassesMap = MoveInstanceMembersUtil.getThisClassesToMembers(myMethod);
  myOldClassParameterNameFields = new HashMap<PsiClass, EditorTextField>();
  if (myThisClassesMap.size() == 0) return null;
  JPanel panel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, true));
  for (PsiClass aClass : myThisClassesMap.keySet()) {
    final String text = RefactoringBundle.message("move.method.this.parameter.label", aClass.getName());
    panel.add(new TitledSeparator(text, null));

    String suggestedName = MoveInstanceMethodHandler.suggestParameterNameForThisClass(aClass);
    final EditorTextField field = new EditorTextField(suggestedName, getProject(), StdFileTypes.JAVA);
    field.setMinimumSize(new Dimension(field.getPreferredSize()));
    myOldClassParameterNameFields.put(aClass, field);
    panel.add(field);
  }
  panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
  return panel;
}
项目:tools-idea    文件:MoveInstanceMethodDialog.java   
protected void doAction() {
  Map<PsiClass, String> parameterNames = new LinkedHashMap<PsiClass, String>();
  for (final PsiClass aClass : myThisClassesMap.keySet()) {
    EditorTextField field = myOldClassParameterNameFields.get(aClass);
    if (field.isEnabled()) {
      String parameterName = field.getText().trim();
      if (!JavaPsiFacade.getInstance(myMethod.getProject()).getNameHelper().isIdentifier(parameterName)) {
        Messages
          .showErrorDialog(getProject(), RefactoringBundle.message("move.method.enter.a.valid.name.for.parameter"), myRefactoringName);
        return;
      }
      parameterNames.put(aClass, parameterName);
    }
  }

  final PsiVariable targetVariable = (PsiVariable)myList.getSelectedValue();
  if (targetVariable == null) return;
  final MoveInstanceMethodProcessor processor = new MoveInstanceMethodProcessor(myMethod.getProject(),
                                                                                myMethod, targetVariable,
                                                                                myVisibilityPanel.getVisibility(),
                                                                                parameterNames);
  if (!verifyTargetClass(processor.getTargetClass())) return;
  invokeRefactoring(processor);
}
项目:tools-idea    文件:JavaParameterTableModel.java   
public Component getTableCellEditorComponent(final JTable table,
                                             Object value,
                                             boolean isSelected,
                                             final int row,
                                             int column) {
  final EditorTextField textField = (EditorTextField)super.getTableCellEditorComponent(table, value, isSelected, row, column);
  textField.registerKeyboardAction(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      PsiType type = getRowType(table, row);
      if (type != null) {
        completeVariable(textField, type);
      }
    }
  }, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.CTRL_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);
  textField.setBorder(new LineBorder(table.getSelectionBackground()));
  return textField;
}
项目:tools-idea    文件:IJSwingUtilities.java   
public static void adjustComponentsOnMac(@Nullable JLabel label, @Nullable JComponent component) {
  if (component == null) return;
  if (!UIUtil.isUnderAquaLookAndFeel()) return;

  if (component instanceof JComboBox) {
    UIUtil.addInsets(component, new Insets(0,-2,0,0));
    if (label != null) {
      UIUtil.addInsets(label, new Insets(0,2,0,0));
    }
  }
  if (component instanceof JCheckBox) {
    UIUtil.addInsets(component, new Insets(0,-5,0,0));
  }
  if (component instanceof JTextField || component instanceof EditorTextField) {
    if (label != null) {
      UIUtil.addInsets(label, new Insets(0,3,0,0));
    }
  }
}
项目:tools-idea    文件:XDebuggerMultilineEditor.java   
public XDebuggerMultilineEditor(Project project,
                                 XDebuggerEditorsProvider debuggerEditorsProvider,
                                 @Nullable @NonNls String historyId,
                                 @Nullable XSourcePosition sourcePosition, @NotNull String text) {
  super(project, debuggerEditorsProvider, EvaluationMode.CODE_FRAGMENT, historyId, sourcePosition);
  myEditorTextField = new EditorTextField(createDocument(text), project, debuggerEditorsProvider.getFileType()) {
    @Override
    protected EditorEx createEditor() {
      final EditorEx editor = super.createEditor();
      editor.setVerticalScrollbarVisible(true);
      return editor;
    }

    @Override
    protected boolean isOneLineMode() {
      return false;
    }
  };
}
项目:tools-idea    文件:FindDialog.java   
private void updateFileTypeForEditorComponent(@NotNull ComboBox inputComboBox) {
  final Component editorComponent = inputComboBox.getEditor().getEditorComponent();

  if (editorComponent instanceof EditorTextField) {
    boolean selected = myCbRegularExpressions.isSelectedWhenSelectable();
    @NonNls final String s = selected ? "*.regexp" : "*.txt";
    FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(s);

    if (selected && fileType == FileTypes.UNKNOWN) {
      fileType = FileTypeManager.getInstance().getFileTypeByFileName("*.txt"); // RegExp plugin is not installed
    }

    final PsiFile file = PsiFileFactory.getInstance(myProject).createFileFromText(s, fileType, ((EditorTextField)editorComponent).getText(), -1, true);

    ((EditorTextField)editorComponent).setNewDocumentAndFileType(fileType, PsiDocumentManager.getInstance(myProject).getDocument(file));
  }
}
项目:tools-idea    文件:StringTableCellEditor.java   
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
  final EditorTextField editorTextField = new EditorTextField((String) value, myProject, StdFileTypes.JAVA) {
          @Override
          protected boolean shouldHaveBorder() {
            return false;
          }
        };
  myDocument = editorTextField.getDocument();
  if (myDocument != null) {
    for (DocumentListener listener : myListeners) {
      editorTextField.addDocumentListener(listener);
    }
  }
  return editorTextField;
}
项目:tools-idea    文件:GenericRepositoryEditor.java   
private void createUIComponents() {
  //todo completion
  //todo completion without whitespace before cursor
  final ArrayList<String> completionList = ContainerUtil.newArrayList(SERVER_URL_PLACEHOLDER, USERNAME_PLACEHOLDER, PASSWORD_PLACEHOLDER);
  myLoginURLText = TextFieldWithAutoCompletion.create(myProject, completionList, null, false, myRepository.getLoginURL());

  final ArrayList<String> completionList1 = ContainerUtil.newArrayList(SERVER_URL_PLACEHOLDER, QUERY_PLACEHOLDER, MAX_COUNT_PLACEHOLDER);
  myTasksListURLText = TextFieldWithAutoCompletion.create(myProject, completionList1, null, false, myRepository.getTasksListURL());

  final Document document = EditorFactory.getInstance().createDocument(myRepository.getTaskPattern());
  myTaskPatternText = new EditorTextField(document, myProject, myRepository.getResponseType().getFileType(), false, false);
  final ArrayList<String> completionList2 = ContainerUtil.newArrayList("({id}.+?)", "({summary}.+?)");
  TextFieldWithAutoCompletionContributor
    .installCompletion(document, myProject, new TextFieldWithAutoCompletion.StringsCompletionProvider(completionList2, null), true);
  myTaskPatternText.setFontInheritedFromLAF(false);
}
项目:tools-idea    文件:SearchSupport.java   
public SearchSupport(EditorTextField textField) {

    myTextField = textField;
    myTextField.getDocument().addDocumentListener(new DocumentAdapter() {
      @Override
      public void documentChanged(DocumentEvent event) {
        onTextChanged();
      }
    });

    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        myTextField.addKeyListener(new KeyAdapter() {
          public void keyPressed(final KeyEvent e) {
              processListSelection(e);
          }
        });
      }
    });

    myList.setVisibleRowCount(10);
    myListModel = new SortedListModel<T>(null);
    myList.setModel(myListModel);
  }
项目:tools-idea    文件:ClassToBindProperty.java   
public MyEditor(final Project project) {
  myProject = project;
  myEditorTextField = new EditorTextField("", project, StdFileTypes.JAVA) {
    protected boolean shouldHaveBorder() {
      return false;
    }
  };
  myActionListener = new MyActionListener();
  myTfWithButton = new ComponentWithBrowseButton<EditorTextField>(myEditorTextField, myActionListener);
  myEditorTextField.setBorder(null);
  new MyCancelEditingAction().registerCustomShortcutSet(CommonShortcuts.ESCAPE, myTfWithButton);
  /*
  myEditorTextField.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        fireValueCommitted();
      }
    }
  );
  */
}
项目:tools-idea    文件:ExpressionCellEditor.java   
public Component getTableCellEditorComponent(JTable ttable, Object value, boolean isSelected, int row, int col) {
    myExpression = (Expression)value;

    myDocument = PsiDocumentManager.getInstance(project).getDocument(myExpression.getFile());
    return new EditorTextField(myDocument, project, myExpression.getFileType()) {
        protected boolean shouldHaveBorder() {
            return false;
        }

        public void addNotify() {
            super.addNotify();
            Runnable runnable = new Runnable() {
                public void run() {
                    final Editor editor = getEditor();
                    if (editor != null) {
                        editor.getContentComponent().requestFocus();
                    }
                }
            };
            SwingUtilities.invokeLater(runnable);
        }
    };
}
项目:consulo-csharp    文件:CSharpParameterTableModel.java   
@Override
public Component getTableCellEditorComponent(final JTable table, Object value, boolean isSelected, final int row, int column)
{
    final EditorTextField textField = (EditorTextField) super.getTableCellEditorComponent(table, value, isSelected, row, column);
    /*textField.registerKeyboardAction(new ActionListener()
    {
        @Override
        public void actionPerformed(ActionEvent e)
        {
            PsiType type = getRowType(table, row);
            if(type != null)
            {
                completeVariable(textField, type);
            }
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.CTRL_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW);*/
    textField.setBorder(new LineBorder(table.getSelectionBackground()));
    return textField;
}
项目:intellij-xquery    文件:ModuleSelector.java   
private static TextComponentAccessor<EditorTextField> getTextComponentAccessor() {
    return new TextComponentAccessor<EditorTextField>() {
        @Override
        public String getText(EditorTextField component) {
            String text = component.getText();
            final VirtualFile file = VirtualFileManager.getInstance()
                            .findFileByUrl(VfsUtil.pathToUrl(text.replace(File.separatorChar, '/')));
            if (file != null && !file.isDirectory()) {
                final VirtualFile parent = file.getParent();
                assert parent != null;
                return parent.getPresentableUrl();
            }
            return text;
        }

        @Override
        public void setText(EditorTextField component, String text) {
            component.setText(text);
        }
    };
}
项目:idea-php-symfony2-plugin    文件:ClassCompletionPanelWrapper.java   
private void init() {
    this.field = new EditorTextField("", project, com.jetbrains.php.lang.PhpFileType.INSTANCE);

    PhpCompletionUtil.installClassCompletion(this.field, null, getDisposable());

    this.field.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        public void documentChanged(DocumentEvent e) {
            String text = field.getText();
            if (StringUtil.isEmpty(text) || StringUtil.endsWith(text, "\\")) {
                return;
            }

            addUpdateRequest(250, () -> consumer.consume(field.getText()));
        }
    });

    GridBagConstraints gbConstraints = new GridBagConstraints();
    gbConstraints.fill = 1;
    gbConstraints.weightx = 1.0D;
    gbConstraints.gridx = 1;
    gbConstraints.gridy = 1;

    panel.add(field, gbConstraints);
}
项目:consulo-ui-designer    文件:ClassToBindProperty.java   
public MyEditor(final Project project) {
  myProject = project;
  myEditorTextField = new EditorTextField("", project, JavaFileType.INSTANCE) {
    protected boolean shouldHaveBorder() {
      return false;
    }
  };
  myActionListener = new MyActionListener();
  myTfWithButton = new ComponentWithBrowseButton<EditorTextField>(myEditorTextField, myActionListener);
  myEditorTextField.setBorder(null);
  new MyCancelEditingAction().registerCustomShortcutSet(CommonShortcuts.ESCAPE, myTfWithButton);
  /*
  myEditorTextField.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        fireValueCommitted();
      }
    }
  );
  */
}
项目:consulo-tasks    文件:SearchSupport.java   
public SearchSupport(EditorTextField textField) {

    myTextField = textField;
    myTextField.getDocument().addDocumentListener(new DocumentAdapter() {
      @Override
      public void documentChanged(DocumentEvent event) {
        onTextChanged();
      }
    });

    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        myTextField.addKeyListener(new KeyAdapter() {
          public void keyPressed(final KeyEvent e) {
              processListSelection(e);
          }
        });
      }
    });

    myList.setVisibleRowCount(10);
    myListModel = new SortedListModel<T>(null);
    myList.setModel(myListModel);
  }
项目:consulo    文件:MultilinePopupBuilder.java   
@Nonnull
private static EditorTextField createTextField(@Nonnull Project project,
                                               Collection<String> values,
                                               boolean supportsNegativeValues,
                                               @Nonnull String initialValue) {
  TextFieldWithCompletion textField =
          new TextFieldWithCompletion(project, new MyCompletionProvider(values, supportsNegativeValues), initialValue, false, true, false) {
            @Override
            protected EditorEx createEditor() {
              EditorEx editor = super.createEditor();
              SoftWrapsEditorCustomization.ENABLED.customize(editor);
              return editor;
            }
          };
  textField.setBorder(new CompoundBorder(JBUI.Borders.empty(2), textField.getBorder()));
  return textField;
}
项目:consulo    文件:IJSwingUtilities.java   
public static void adjustComponentsOnMac(@Nullable JLabel label, @Nullable JComponent component) {
  if (component == null) return;
  if (!UIUtil.isUnderAquaLookAndFeel()) return;

  if (component instanceof JComboBox) {
    UIUtil.addInsets(component, new Insets(0,-2,0,0));
    if (label != null) {
      UIUtil.addInsets(label, new Insets(0,2,0,0));
    }
  }
  if (component instanceof JCheckBox) {
    UIUtil.addInsets(component, new Insets(0,-5,0,0));
  }
  if (component instanceof JTextField || component instanceof EditorTextField) {
    if (label != null) {
      UIUtil.addInsets(label, new Insets(0,3,0,0));
    }
  }
}
项目:consulo    文件:ParameterNameHintsConfigurable.java   
@Nonnull
private static EditorTextField createEditorField(@Nonnull String text, @Nullable TextRange rangeToSelect) {
  Document document = EditorFactory.getInstance().createDocument(text);
  EditorTextField field = new EditorTextField(document, null, PlainTextFileType.INSTANCE, false, false);
  field.setPreferredSize(new Dimension(200, 350));
  field.addSettingsProvider(editor -> {
    editor.setVerticalScrollbarVisible(true);
    editor.setHorizontalScrollbarVisible(true);
    editor.getSettings().setAdditionalLinesCount(2);
    if (rangeToSelect != null) {
      editor.getCaretModel().moveToOffset(rangeToSelect.getStartOffset());
      editor.getScrollingModel().scrollVertically(document.getTextLength() - 1);
      editor.getSelectionModel().setSelection(rangeToSelect.getStartOffset(), rangeToSelect.getEndOffset());
    }
  });
  return field;
}
项目:consulo    文件:StringTableCellEditor.java   
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
  final EditorTextField editorTextField = new EditorTextField((String) value, myProject, InternalStdFileTypes.JAVA) {
          @Override
          protected boolean shouldHaveBorder() {
            return false;
          }
        };
  myDocument = editorTextField.getDocument();
  if (myDocument != null) {
    for (DocumentListener listener : myListeners) {
      editorTextField.addDocumentListener(listener);
    }
  }
  return editorTextField;
}