mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
68 lines
2.6 KiB
Java
68 lines
2.6 KiB
Java
/*
|
|
* Copyright 2000-2009 JetBrains s.r.o.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
package com.intellij.codeInsight.completion;
|
|
|
|
import com.intellij.codeInsight.TailType;
|
|
import com.intellij.psi.*;
|
|
import com.intellij.psi.filters.*;
|
|
import com.intellij.psi.filters.position.LeftNeighbour;
|
|
import com.intellij.psi.filters.position.SuperParentFilter;
|
|
|
|
/**
|
|
* @author ven
|
|
*/
|
|
public class Java15CompletionData extends JavaCompletionData {
|
|
|
|
protected void initVariantsInFileScope() {
|
|
super.initVariantsInFileScope();
|
|
//static keyword in static import
|
|
{
|
|
final CompletionVariant variant = new CompletionVariant(PsiImportList.class, new LeftNeighbour(new TextFilter (PsiKeyword.IMPORT)));
|
|
variant.addCompletion(PsiKeyword.STATIC, TailType.HUMBLE_SPACE_BEFORE_WORD);
|
|
|
|
registerVariant(variant);
|
|
}
|
|
|
|
{
|
|
final ElementFilter position = new AndFilter(new LeftNeighbour(new TextFilter("@")),
|
|
new NotFilter(new SuperParentFilter(
|
|
new OrFilter(new ClassFilter(PsiNameValuePair.class),
|
|
new ClassFilter(PsiParameterList.class))))
|
|
);
|
|
|
|
final CompletionVariant variant = new CompletionVariant(PsiJavaFile.class, position);
|
|
variant.includeScopeClass(PsiClass.class);
|
|
|
|
variant.addCompletion(PsiKeyword.INTERFACE, TailType.HUMBLE_SPACE_BEFORE_WORD);
|
|
|
|
registerVariant(variant);
|
|
}
|
|
}
|
|
|
|
protected void initVariantsInClassScope() {
|
|
super.initVariantsInClassScope();
|
|
{
|
|
//Completion of "extends" & "super" inside wildcards
|
|
final CompletionVariant variant = new CompletionVariant(JavaMemberNameCompletionContributor.INSIDE_TYPE_PARAMS_PATTERN);
|
|
variant.includeScopeClass(PsiVariable.class, true);
|
|
variant.includeScopeClass(PsiExpressionStatement.class, true);
|
|
variant.addCompletion(PsiKeyword.SUPER, TailType.HUMBLE_SPACE_BEFORE_WORD);
|
|
variant.addCompletion(PsiKeyword.EXTENDS, TailType.HUMBLE_SPACE_BEFORE_WORD);
|
|
registerVariant(variant);
|
|
}
|
|
}
|
|
}
|