本文整理汇总了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);
}
示例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);
}
示例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);
}