mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 10:20:15 +07:00
Pattern variable can be used mass cleanup
GitOrigin-RevId: 2cf24395e268af841e621531336548a865f5b339
This commit is contained in:
committed by
intellij-monorepo-bot
parent
eab67bb08c
commit
582c1c03e9
@@ -19,7 +19,7 @@ public class CommentLanguageInjector implements LanguageInjectionContributor {
|
||||
@Override
|
||||
public Injection getInjection(@NotNull PsiElement context) {
|
||||
if (!(context instanceof PsiLanguageInjectionHost host) || context instanceof PsiComment) return null;
|
||||
if (!((PsiLanguageInjectionHost)context).isValidHost()) return null;
|
||||
if (!host.isValidHost()) return null;
|
||||
|
||||
boolean applicableFound = false;
|
||||
for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) {
|
||||
|
||||
@@ -21,7 +21,7 @@ final class DefaultLanguageInjectionPerformer implements FallbackInjectionPerfor
|
||||
public boolean performInjection(@NotNull MultiHostRegistrar registrar,
|
||||
@NotNull Injection injection,
|
||||
@NotNull PsiElement context) {
|
||||
if (!(context instanceof PsiLanguageInjectionHost host) || !((PsiLanguageInjectionHost)context).isValidHost()) {
|
||||
if (!(context instanceof PsiLanguageInjectionHost host) || !host.isValidHost()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public final class DefaultLanguageInjector implements LanguageInjectionContribut
|
||||
|
||||
@Override
|
||||
public Injection getInjection(@NotNull PsiElement context) {
|
||||
if (!(context instanceof PsiLanguageInjectionHost host) || !((PsiLanguageInjectionHost)context).isValidHost()) return null;
|
||||
if (!(context instanceof PsiLanguageInjectionHost host) || !host.isValidHost()) return null;
|
||||
|
||||
for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) {
|
||||
if (!support.isApplicableTo(host)) continue;
|
||||
|
||||
@@ -5,7 +5,9 @@ import com.intellij.lang.Language;
|
||||
import com.intellij.lang.injection.general.Injection;
|
||||
import com.intellij.lang.injection.general.LanguageInjectionContributor;
|
||||
import com.intellij.lang.injection.general.SimpleInjection;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiLanguageInjectionHost;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -16,7 +18,7 @@ public final class TemporaryPlacesInjector implements LanguageInjectionContribut
|
||||
|
||||
@Override
|
||||
public @Nullable Injection getInjection(@NotNull PsiElement context) {
|
||||
if (!(context instanceof PsiLanguageInjectionHost host) || !((PsiLanguageInjectionHost)context).isValidHost()) {
|
||||
if (!(context instanceof PsiLanguageInjectionHost host) || !host.isValidHost()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ public final class IdeaSpecificSettings {
|
||||
|
||||
Element element = new Element("lib");
|
||||
|
||||
String libraryName = ((LibraryOrderEntry)entry).getLibraryName();
|
||||
String libraryName = libraryEntry.getLibraryName();
|
||||
if (libraryName == null) {
|
||||
final String[] urls = libraryEntry.getRootUrls(OrderRootType.CLASSES);
|
||||
if (urls.length > 0) {
|
||||
|
||||
@@ -90,7 +90,7 @@ public final class PropertyFoldingBuilder extends FoldingBuilderEx {
|
||||
final UElement parent = injectionHost.getUastParent();
|
||||
if (!msg.equals(UastLiteralUtils.getValueIfStringLiteral(injectionHost)) &&
|
||||
parent instanceof UCallExpression expressions &&
|
||||
((UCallExpression)parent).getValueArguments().get(0).getSourcePsi() == injectionHost.getSourcePsi()) {
|
||||
expressions.getValueArguments().get(0).getSourcePsi() == injectionHost.getSourcePsi()) {
|
||||
PsiElement callSourcePsi = expressions.getSourcePsi();
|
||||
if (callSourcePsi == null) return;
|
||||
final int count = JavaI18nUtil.getPropertyValueParamsMaxCount(injectionHost);
|
||||
|
||||
@@ -37,7 +37,7 @@ public final class JavaFxColorProvider implements ElementColorProvider {
|
||||
if (!(element instanceof PsiIdentifier)) return null;
|
||||
PsiElement parent = element.getParent();
|
||||
PsiElement gp = parent == null ? null : parent.getParent();
|
||||
if (gp instanceof PsiNewExpression newExpression && ((PsiNewExpression)gp).getClassReference() == parent) {
|
||||
if (gp instanceof PsiNewExpression newExpression && newExpression.getClassReference() == parent) {
|
||||
if (isColorClass(PsiTypesUtil.getPsiClass(newExpression.getType()))) {
|
||||
PsiExpressionList argumentList = newExpression.getArgumentList();
|
||||
if (argumentList != null) {
|
||||
@@ -53,7 +53,7 @@ public final class JavaFxColorProvider implements ElementColorProvider {
|
||||
parent = parent.getParent();
|
||||
gp = parent.getParent();
|
||||
}
|
||||
if (gp instanceof PsiMethodCallExpression methodCall && ((PsiMethodCallExpression)gp).getMethodExpression().getReferenceNameElement() == element) {
|
||||
if (gp instanceof PsiMethodCallExpression methodCall && methodCall.getMethodExpression().getReferenceNameElement() == element) {
|
||||
PsiReferenceExpression methodExpression = methodCall.getMethodExpression();
|
||||
String methodName = methodExpression.getReferenceName();
|
||||
if (FACTORY_METHODS.contains(methodName)) {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class MavenDependencyInsertionHandler implements InsertHandler<LookupElem
|
||||
if (domCoordinates == null) {
|
||||
return;
|
||||
}
|
||||
setDependency(context, completionItem, (XmlFile)contextFile, domCoordinates);
|
||||
setDependency(context, completionItem, xmlFile, domCoordinates);
|
||||
|
||||
logMavenDependencyInsertion(context, item, completionItem);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class PropertiesDocumentationProvider extends AbstractDocumentationProvid
|
||||
info += "</div>";
|
||||
}
|
||||
}
|
||||
info += "\n<b>" + property.getName() + "</b>=\"" + renderPropertyValue((IProperty)element) + "\"";
|
||||
info += "\n<b>" + property.getName() + "</b>=\"" + renderPropertyValue(property) + "\"";
|
||||
info += getLocationString(element);
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ShIncludeCommandReference extends PsiReferenceBase<PsiElement> {
|
||||
if (!(parent instanceof ShIncludeCommandImpl includeCommand)) return null;
|
||||
List<ShSimpleCommandElement> commandList = includeCommand.getSimpleCommandElementList();
|
||||
if (commandList.size() <= 0 || commandList.get(0) != myElement) return null;
|
||||
return ((ShIncludeCommandImpl)parent).getReferencingFile(myElement);
|
||||
return includeCommand.getReferencingFile(myElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class JavaStreamChainBuilder implements StreamChainBuilder {
|
||||
final PsiElement parent = expression.getParent();
|
||||
if (!(parent instanceof PsiReferenceExpression)) return;
|
||||
final PsiElement parentCall = parent.getParent();
|
||||
if (parentCall instanceof PsiMethodCallExpression parentCallExpression && myDetector.isStreamCall((PsiMethodCallExpression)parentCall)) {
|
||||
if (parentCall instanceof PsiMethodCallExpression parentCallExpression && myDetector.isStreamCall(parentCallExpression)) {
|
||||
myPreviousCalls.put(parentCallExpression, expression);
|
||||
updateCallTree(parentCallExpression);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user