mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
@Override added
This commit is contained in:
+1
@@ -31,6 +31,7 @@ public class MethodParenthesesHandler extends ParenthesesInsertHandler<LookupEle
|
||||
myOverloadsMatter = overloadsMatter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean placeCaretInsideParentheses(final InsertionContext context, final LookupElement item) {
|
||||
return hasParams(item, context.getElements(), myOverloadsMatter, myMethod);
|
||||
}
|
||||
|
||||
+1
@@ -64,6 +64,7 @@ public class PsiTypeCanonicalLookupElement extends LookupElement {
|
||||
return myType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getLookupString() {
|
||||
return myPresentableText;
|
||||
|
||||
+1
@@ -35,6 +35,7 @@ public class SimpleMethodCallLookupElement extends LookupElement {
|
||||
myMethod = method;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getLookupString() {
|
||||
return myMethod.getName();
|
||||
|
||||
@@ -31,6 +31,7 @@ public class BaseGenerateAction extends CodeInsightAction {
|
||||
myHandler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final CodeInsightActionHandler getHandler() {
|
||||
return myHandler;
|
||||
}
|
||||
@@ -44,6 +45,7 @@ public class BaseGenerateAction extends CodeInsightAction {
|
||||
return target instanceof SyntheticElement ? null : target;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidForFile(Project project, Editor editor, PsiFile file) {
|
||||
if (!(file instanceof PsiJavaFile)) return false;
|
||||
if (file instanceof PsiCompiledElement) return false;
|
||||
|
||||
+2
@@ -33,6 +33,7 @@ public abstract class JavaExpressionSurrounder implements Surrounder {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.generation.surroundWith.SurroundExpressionHandler");
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull PsiElement[] elements) {
|
||||
LOG.assertTrue(elements.length == 1 && elements[0] instanceof PsiExpression);
|
||||
return isApplicable((PsiExpression)elements[0]);
|
||||
@@ -40,6 +41,7 @@ public abstract class JavaExpressionSurrounder implements Surrounder {
|
||||
|
||||
public abstract boolean isApplicable(PsiExpression expr);
|
||||
|
||||
@Override
|
||||
public TextRange surroundElements(@NotNull Project project,
|
||||
@NotNull Editor editor,
|
||||
@NotNull PsiElement[] elements) throws IncorrectOperationException {
|
||||
|
||||
@@ -38,6 +38,7 @@ public class AnnotationOrderRootType extends PersistentOrderRootType {
|
||||
super("ANNOTATIONS", "annotationsPath", "annotation-paths", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean skipWriteIfEmpty() {
|
||||
return true;
|
||||
}
|
||||
@@ -45,16 +46,19 @@ public class AnnotationOrderRootType extends PersistentOrderRootType {
|
||||
public static VirtualFile[] getFiles(OrderEntry entry) {
|
||||
List<VirtualFile> result = new ArrayList<VirtualFile>();
|
||||
RootPolicy<List<VirtualFile>> policy = new RootPolicy<List<VirtualFile>>() {
|
||||
@Override
|
||||
public List<VirtualFile> visitLibraryOrderEntry(final LibraryOrderEntry orderEntry, final List<VirtualFile> value) {
|
||||
Collections.addAll(value, orderEntry.getRootFiles(getInstance()));
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VirtualFile> visitJdkOrderEntry(final JdkOrderEntry orderEntry, final List<VirtualFile> value) {
|
||||
Collections.addAll(value, orderEntry.getRootFiles(getInstance()));
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VirtualFile> visitModuleSourceOrderEntry(final ModuleSourceOrderEntry orderEntry,
|
||||
final List<VirtualFile> value) {
|
||||
Collections.addAll(value, orderEntry.getRootModel().getRootPaths(getInstance()));
|
||||
@@ -68,16 +72,19 @@ public class AnnotationOrderRootType extends PersistentOrderRootType {
|
||||
public static String[] getUrls(OrderEntry entry) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
RootPolicy<List<String>> policy = new RootPolicy<List<String>>() {
|
||||
@Override
|
||||
public List<String> visitLibraryOrderEntry(final LibraryOrderEntry orderEntry, final List<String> value) {
|
||||
Collections.addAll(value, orderEntry.getRootUrls(getInstance()));
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> visitJdkOrderEntry(final JdkOrderEntry orderEntry, final List<String> value) {
|
||||
Collections.addAll(value, orderEntry.getRootUrls(getInstance()));
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> visitModuleSourceOrderEntry(final ModuleSourceOrderEntry orderEntry,
|
||||
final List<String> value) {
|
||||
Collections.addAll(value, orderEntry.getRootModel().getRootUrls(getInstance()));
|
||||
|
||||
@@ -30,6 +30,7 @@ public class JavadocOrderRootType extends PersistentOrderRootType {
|
||||
return getOrderRootType(JavadocOrderRootType.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collectFromDependentModules() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ public class LanguageLevelModuleExtension extends ModuleExtension<LanguageLevelM
|
||||
return myLanguageLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(final Element element) throws InvalidDataException {
|
||||
final String languageLevel = element.getAttributeValue(LANGUAGE_LEVEL_ELEMENT_NAME);
|
||||
if (languageLevel != null) {
|
||||
@@ -87,26 +88,31 @@ public class LanguageLevelModuleExtension extends ModuleExtension<LanguageLevelM
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(final Element element) throws WriteExternalException {
|
||||
if (myLanguageLevel != null) {
|
||||
element.setAttribute(LANGUAGE_LEVEL_ELEMENT_NAME, myLanguageLevel.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModuleExtension getModifiableModel(final boolean writable) {
|
||||
return new LanguageLevelModuleExtension(this, writable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commit() {
|
||||
if (mySource != null && mySource.myLanguageLevel != myLanguageLevel) {
|
||||
mySource.myLanguageLevel = myLanguageLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChanged() {
|
||||
return mySource != null && mySource.myLanguageLevel != myLanguageLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
myModule = null;
|
||||
myLanguageLevel = null;
|
||||
|
||||
@@ -45,6 +45,7 @@ public class AnnotationAttributeChildLink extends PsiChildLink<PsiAnnotation, Ps
|
||||
return psiAnnotation.findDeclaredAttributeValue(myAttributeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiAnnotationMemberValue createChild(@NotNull PsiAnnotation psiAnnotation) throws IncorrectOperationException {
|
||||
psiAnnotation.getText();
|
||||
|
||||
@@ -47,6 +47,7 @@ public class AnnotationChildLink extends PsiChildLink<PsiModifierListOwner, PsiA
|
||||
return modifierList != null ? modifierList.findAnnotation(myAnnoFqn) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiAnnotation createChild(@NotNull PsiModifierListOwner member) throws IncorrectOperationException {
|
||||
final PsiModifierList modifierList = member.getModifierList();
|
||||
|
||||
@@ -33,11 +33,13 @@ public class InstanceofLink<Parent extends PsiElement, Child extends PsiElement,
|
||||
myCastTo = castTo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CastTo findLinkedChild(@Nullable Parent parent) {
|
||||
final Child existing = myDelegate.findLinkedChild(parent);
|
||||
return myCastTo.isInstance(existing) ? (CastTo) existing : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public CastTo createChild(@NotNull Parent parent) throws IncorrectOperationException {
|
||||
return (CastTo) myDelegate.createChild(parent);
|
||||
|
||||
@@ -71,6 +71,7 @@ public class PatternPackageSet extends PatternBasedPackageSet {
|
||||
myPattern = aspectPattern != null ? Pattern.compile(FilePatternPackageSet.convertToRegexp(aspectPattern, '.')) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(VirtualFile file, NamedScopesHolder holder) {
|
||||
Project project = holder.getProject();
|
||||
ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
|
||||
@@ -105,14 +106,17 @@ public class PatternPackageSet extends PatternBasedPackageSet {
|
||||
return StringUtil.getQualifiedName(fileIndex.getPackageNameByDirectory(file.isDirectory() ? file : file.getParent()), file.getNameWithoutExtension());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackageSet createCopy() {
|
||||
return new PatternPackageSet(myAspectJSyntaxPattern, myScope, myModulePatternText);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNodePriority() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
if (myScope != SCOPE_ANY) {
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass, Clas
|
||||
|
||||
static {
|
||||
INSTANCE.registerExecutor(new QueryExecutor<PsiClass, SearchParameters>() {
|
||||
@Override
|
||||
public boolean execute(@NotNull final SearchParameters parameters, @NotNull final Processor<PsiClass> consumer) {
|
||||
final PsiClass baseClass = parameters.getClassToProcess();
|
||||
final SearchScope searchScope = parameters.getScope();
|
||||
@@ -161,15 +162,18 @@ public class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass, Clas
|
||||
if (baseClass instanceof PsiAnonymousClass || isFinal(baseClass)) return true;
|
||||
|
||||
final String qname = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
|
||||
@Override
|
||||
public String compute() {
|
||||
return baseClass.getQualifiedName();
|
||||
}
|
||||
});
|
||||
if (CommonClassNames.JAVA_LANG_OBJECT.equals(qname)) {
|
||||
return AllClassesSearch.search(searchScope, baseClass.getProject(), parameters.getNameCondition()).forEach(new Processor<PsiClass>() {
|
||||
@Override
|
||||
public boolean process(final PsiClass aClass) {
|
||||
ProgressManager.checkCanceled();
|
||||
final String qname1 = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
|
||||
@Override
|
||||
@Nullable
|
||||
public String compute() {
|
||||
return aClass.getQualifiedName();
|
||||
@@ -187,12 +191,14 @@ public class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass, Clas
|
||||
final Set<PsiClass> processed = new THashSet<PsiClass>(); // processed classes without FQN (e.g. anonymous)
|
||||
|
||||
final Processor<PsiClass> processor = new Processor<PsiClass>() {
|
||||
@Override
|
||||
public boolean process(final PsiClass candidate) {
|
||||
ProgressManager.checkCanceled();
|
||||
|
||||
final Ref<Boolean> result = new Ref<Boolean>();
|
||||
final String[] fqn = new String[1];
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fqn[0] = candidate.getQualifiedName();
|
||||
if (parameters.isCheckInheritance() || parameters.isCheckDeep() && !(candidate instanceof PsiAnonymousClass)) {
|
||||
@@ -234,6 +240,7 @@ public class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass, Clas
|
||||
final String fqn = pair.getSecond();
|
||||
if (psiClass == null) {
|
||||
psiClass = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
|
||||
@Override
|
||||
public PsiClass compute() {
|
||||
return facade.findClass(fqn, projectScope);
|
||||
}
|
||||
@@ -264,6 +271,7 @@ public class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass, Clas
|
||||
|
||||
private static boolean isFinal(@NotNull final PsiClass baseClass) {
|
||||
return ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
|
||||
@Override
|
||||
public Boolean compute() {
|
||||
return Boolean.valueOf(baseClass.hasModifierProperty(PsiModifier.FINAL));
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ public class DirectClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass
|
||||
|
||||
if (!includeAnonymous) {
|
||||
return new FilteredQuery<PsiClass>(raw, new Condition<PsiClass>() {
|
||||
@Override
|
||||
public boolean value(final PsiClass psiClass) {
|
||||
return !(psiClass instanceof PsiAnonymousClass);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.psi.*;
|
||||
public class EnclosingLoopMatcherExpression implements PsiMatcherExpression {
|
||||
public static final PsiMatcherExpression INSTANCE = new EnclosingLoopMatcherExpression();
|
||||
|
||||
@Override
|
||||
public Boolean match(PsiElement element) {
|
||||
if (element instanceof PsiForStatement) return Boolean.TRUE;
|
||||
if (element instanceof PsiForeachStatement) return Boolean.TRUE;
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.psi.*;
|
||||
public class EnclosingLoopOrSwitchMatcherExpression implements PsiMatcherExpression {
|
||||
public static final PsiMatcherExpression INSTANCE = new EnclosingLoopOrSwitchMatcherExpression();
|
||||
|
||||
@Override
|
||||
public Boolean match(PsiElement element) {
|
||||
if (element instanceof PsiForStatement) return Boolean.TRUE;
|
||||
if (element instanceof PsiForeachStatement) return Boolean.TRUE;
|
||||
|
||||
@@ -221,6 +221,7 @@ public class PsiExpressionTrimRenderer extends JavaRecursiveElementWalkingVisito
|
||||
}
|
||||
|
||||
public static class RenderFunction implements Function<PsiExpression, String> {
|
||||
@Override
|
||||
public String fun(PsiExpression psiExpression) {
|
||||
return render(psiExpression);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ public class PsiMatchers {
|
||||
|
||||
public static PsiMatcherExpression hasModifier(@Modifier final String modifier, final boolean shouldHave) {
|
||||
return new PsiMatcherExpression() {
|
||||
@Override
|
||||
public Boolean match(PsiElement element) {
|
||||
PsiModifierListOwner owner = element instanceof PsiModifierListOwner ? (PsiModifierListOwner) element : null;
|
||||
|
||||
@@ -42,6 +43,7 @@ public class PsiMatchers {
|
||||
|
||||
public static PsiMatcherExpression hasText(final String text) {
|
||||
return new PsiMatcherExpression() {
|
||||
@Override
|
||||
public Boolean match(PsiElement element) {
|
||||
if (element.getTextLength() != text.length()) return Boolean.FALSE;
|
||||
return text.equals(element.getText());
|
||||
@@ -51,6 +53,7 @@ public class PsiMatchers {
|
||||
|
||||
public static PsiMatcherExpression hasText(@NotNull final String... texts) {
|
||||
return new PsiMatcherExpression() {
|
||||
@Override
|
||||
public Boolean match(PsiElement element) {
|
||||
String text = element.getText();
|
||||
return ArrayUtil.find(texts, text) != -1;
|
||||
@@ -60,6 +63,7 @@ public class PsiMatchers {
|
||||
|
||||
public static PsiMatcherExpression hasClass(final Class aClass) {
|
||||
return new PsiMatcherExpression() {
|
||||
@Override
|
||||
public Boolean match(PsiElement element) {
|
||||
if (aClass.isAssignableFrom(element.getClass())) return Boolean.TRUE;
|
||||
return Boolean.FALSE;
|
||||
@@ -69,6 +73,7 @@ public class PsiMatchers {
|
||||
|
||||
public static PsiMatcherExpression hasClass(final Class[] classes) {
|
||||
return new PsiMatcherExpression() {
|
||||
@Override
|
||||
public Boolean match(PsiElement element) {
|
||||
for (Class aClass : classes) {
|
||||
if (aClass.isAssignableFrom(element.getClass())) return Boolean.TRUE;
|
||||
@@ -80,6 +85,7 @@ public class PsiMatchers {
|
||||
|
||||
public static PsiMatcherExpression hasName(final String name) {
|
||||
return new PsiMatcherExpression() {
|
||||
@Override
|
||||
public Boolean match(PsiElement element) {
|
||||
if (element instanceof PsiNamedElement && name.equals(((PsiNamedElement) element).getName())) return Boolean.TRUE;
|
||||
if (element instanceof XmlTag && name.equals(((XmlTag) element).getName())) return Boolean.TRUE;
|
||||
@@ -90,6 +96,7 @@ public class PsiMatchers {
|
||||
|
||||
public static PsiMatcherExpression hasTagValue(final String value) {
|
||||
return new PsiMatcherExpression() {
|
||||
@Override
|
||||
public Boolean match(PsiElement element) {
|
||||
if (element instanceof XmlTag && value.equals(((XmlTag) element).getValue().getTrimmedText())) return Boolean.TRUE;
|
||||
return Boolean.FALSE;
|
||||
@@ -99,6 +106,7 @@ public class PsiMatchers {
|
||||
|
||||
public static PsiMatcherExpression isConstructor(final boolean shouldBe) {
|
||||
return new PsiMatcherExpression() {
|
||||
@Override
|
||||
public Boolean match(PsiElement element) {
|
||||
return element instanceof PsiMethod && ((PsiMethod)element).isConstructor() == shouldBe;
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ public class RedundantCastUtil {
|
||||
// avoid multiple visit
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addToResults(@NotNull PsiTypeCastExpression typeCast){
|
||||
if (!isTypeCastSemantical(typeCast)) {
|
||||
myFoundCasts.add(typeCast);
|
||||
@@ -455,6 +456,7 @@ public class RedundantCastUtil {
|
||||
final PsiElement resolved = refExpression.resolve();
|
||||
final Ref<Boolean> result = new Ref<Boolean>(Boolean.FALSE);
|
||||
CodeStyleManager.getInstance(refExpression.getProject()).performActionWithFormatterDisabled(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(refExpression.getProject()).getElementFactory();
|
||||
|
||||
Reference in New Issue
Block a user