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


Java EditorTextField类代码示例

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


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

示例1: createUIComponents

import com.intellij.ui.EditorTextField; //导入依赖的package包/类
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);
}
 
开发者ID:jiripudil,项目名称:intellij-nette-tester,代码行数:25,代码来源:TesterNewTestCaseDialog.java

示例2: openSample

import com.intellij.ui.EditorTextField; //导入依赖的package包/类
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);
    }
 
开发者ID:misakuo,项目名称:weex-language-support,代码行数:22,代码来源:DocumentIntention.java

示例3: createViews

import com.intellij.ui.EditorTextField; //导入依赖的package包/类
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()));
        }
    });
}
 
开发者ID:CeH9,项目名称:PackageTemplates,代码行数:20,代码来源:ScriptDialog.java

示例4: installCompletion

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

示例5: setupPathComponent

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

示例6: createParametersPanel

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

示例7: doAction

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

示例8: getTableCellEditorComponent

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

示例9: adjustComponentsOnMac

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

示例10: update

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

示例11: getTableCellEditorComponent

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

示例12: MyTableEditor

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

示例13: configureStartingScriptPanel

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

示例14: createUIComponents

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

示例15: collapseIfPossible

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


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