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


Java TextFieldCompletionProvider类代码示例

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


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

示例1: installCompletion

import com.intellij.util.TextFieldCompletionProvider; //导入依赖的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

示例2: installCompletion

import com.intellij.util.TextFieldCompletionProvider; //导入依赖的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:consulo,项目名称:consulo-java,代码行数:29,代码来源:MethodBrowser.java

示例3: createUIComponents

import com.intellij.util.TextFieldCompletionProvider; //导入依赖的package包/类
private void createUIComponents() {
  myPackage = new LabeledComponent<EditorTextFieldWithBrowseButton>();
  myPackage.setComponent(new EditorTextFieldWithBrowseButton(myProject, false));

  myClass = new LabeledComponent<EditorTextFieldWithBrowseButton>();
  final TestClassBrowser classBrowser = new TestClassBrowser(myProject);
  myClass.setComponent(new EditorTextFieldWithBrowseButton(myProject, true, new JavaCodeFragment.VisibilityChecker() {
    @Override
    public Visibility isDeclarationVisible(PsiElement declaration, PsiElement place) {
      try {
        if (declaration instanceof PsiClass && classBrowser.getFilter().isAccepted(((PsiClass)declaration))) {
          return Visibility.VISIBLE;
        }
      }
      catch (ClassBrowser.NoFilterException e) {
        return Visibility.NOT_VISIBLE;
      }
      return Visibility.NOT_VISIBLE;
    }
  }));

  myMethod = new LabeledComponent<EditorTextFieldWithBrowseButton>();
  final EditorTextFieldWithBrowseButton textFieldWithBrowseButton = new EditorTextFieldWithBrowseButton(myProject, true, 
                                                                                                        JavaCodeFragment.VisibilityChecker.EVERYTHING_VISIBLE, 
                                                                                                        PlainTextLanguage.INSTANCE.getAssociatedFileType());
  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 JUnitUtil.TestMethodFilter filter = new JUnitUtil.TestMethodFilter(testClass);
      for (PsiMethod psiMethod : testClass.getAllMethods()) {
        if (filter.value(psiMethod)) {
          result.addElement(LookupElementBuilder.create(psiMethod.getName()));
        }
      }
    }
  }.apply(textFieldWithBrowseButton.getChildComponent());
  myMethod.setComponent(textFieldWithBrowseButton);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:45,代码来源:JUnitConfigurable.java


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