com.intellij.psi.PsiElementVisitor Java Examples

The following examples show how to use com.intellij.psi.PsiElementVisitor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TwigRouteMissingInspection.java    From idea-php-symfony2-plugin with MIT License 6 votes vote down vote up
@NotNull
public PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) {
    if(!Symfony2ProjectComponent.isEnabled(holder.getProject())) {
        return super.buildVisitor(holder, isOnTheFly);
    }

    return new PsiElementVisitor() {
        @Override
        public void visitElement(PsiElement element) {
            if(TwigPattern.getAutocompletableRoutePattern().accepts(element) && TwigUtil.isValidStringWithoutInterpolatedOrConcat(element)) {
                invoke(element, holder);
            }

            super.visitElement(element);
        }
    };
}
 
Example #2
Source File: ClassNameMatcherInspection.java    From idea-php-typo3-plugin with MIT License 6 votes vote down vote up
@NotNull
@Override
public PsiElementVisitor buildRealVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
    return new PhpElementVisitor() {

        @Override
        public void visitPhpClassReference(ClassReference classReference) {
            Set<String> deprecatedClassNames = getDeprecatedClassNames(classReference.getProject());
            if (deprecatedClassNames.contains(classReference.getFQN())) {
                problemsHolder.registerProblem(classReference, "Class scheduled for removal in upcoming TYPO3 version, consider using an alternative");
            }

            super.visitPhpClassReference(classReference);
        }
    };
}
 
Example #3
Source File: ConstantMatcherInspection.java    From idea-php-typo3-plugin with MIT License 5 votes vote down vote up
@NotNull
@Override
public PsiElementVisitor buildRealVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
    return new PhpElementVisitor() {
        @Override
        public void visitPhpConstantReference(ConstantReference reference) {
            if (DeprecationUtility.isDeprecated(problemsHolder.getProject(), reference)) {
                problemsHolder.registerProblem(reference, "Constant scheduled for removal in upcoming TYPO3 version, consider using an alternative");
            }

            super.visitPhpConstantReference(reference);
        }
    };
}
 
Example #4
Source File: PluginEnabledPhpInspection.java    From idea-php-typo3-plugin with MIT License 5 votes vote down vote up
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
    if (!TYPO3CMSProjectSettings.getInstance(problemsHolder.getProject()).pluginEnabled) {
        return new PhpElementVisitor() {
        };
    }

    return buildRealVisitor(problemsHolder, b);
}
 
Example #5
Source File: UnityEmptyMagicMethodInspection.java    From consulo-unity3d with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public PsiElementVisitor buildVisitor(@Nonnull ProblemsHolder holder, boolean isOnTheFly)
{
	if(Unity3dModuleExtensionUtil.getRootModule(holder.getProject()) == null)
	{
		return PsiElementVisitor.EMPTY_VISITOR;
	}

	return new CSharpElementVisitor()
	{
		@Override
		@RequiredReadAction
		public void visitMethodDeclaration(CSharpMethodDeclaration declaration)
		{
			UnityFunctionManager.FunctionInfo magicMethod = UnityEventCSharpMethodLineMarkerProvider.findMagicMethod(declaration);
			if(magicMethod != null)
			{
				PsiElement codeBlock = declaration.getCodeBlock().getElement();
				if(codeBlock == null || codeBlock instanceof CSharpBlockStatementImpl && ((CSharpBlockStatementImpl) codeBlock).getStatements().length == 0)
				{
					PsiElement nameIdentifier = declaration.getNameIdentifier();
					assert nameIdentifier != null;
					holder.registerProblem(nameIdentifier, Unity3dBundle.message("empty.magic.method.inspection.message"), new RemoveMethodFix(declaration));
				}
			}
		}
	};
}
 
Example #6
Source File: AnnotationDeprecatedInspection.java    From idea-php-annotation-plugin with MIT License 5 votes vote down vote up
@NotNull
@Override
public PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) {
    return new PsiElementVisitor() {
        @Override
        public void visitElement(PsiElement element) {
            if (element instanceof PhpDocTag && AnnotationUtil.isAnnotationPhpDocTag((PhpDocTag) element)) {
                visitAnnotationDocTag((PhpDocTag) element, holder);
            }

            super.visitElement(element);
        }
    };
}
 
Example #7
Source File: UnityOnGUIMethodInspection.java    From consulo-unity3d with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public PsiElementVisitor buildVisitor(@Nonnull ProblemsHolder holder, boolean isOnTheFly)
{
	if(Unity3dModuleExtensionUtil.getRootModule(holder.getProject()) == null)
	{
		return PsiElementVisitor.EMPTY_VISITOR;
	}

	return new CSharpElementVisitor()
	{
		@Override
		@RequiredReadAction
		public void visitMethodDeclaration(CSharpMethodDeclaration declaration)
		{
			String name = declaration.getName();
			if("OnGUI".equals(name))
			{
				UnityFunctionManager.FunctionInfo magicMethod = UnityEventCSharpMethodLineMarkerProvider.findMagicMethod(declaration);
				if(magicMethod != null)
				{
					PsiElement nameIdentifier = declaration.getNameIdentifier();
					assert nameIdentifier != null;
					holder.registerProblem(nameIdentifier, Unity3dBundle.message("ongui.method.inspection.message"), new UnityEmptyMagicMethodInspection.RemoveMethodFix(declaration));
				}
			}
		}
	};
}
 
Example #8
Source File: EvaluateExpansionInspection.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
    return new BashVisitor() {
        @Override
        public void visitExpansion(BashExpansion expansion) {
            if (isOnTheFly && expansion.isValidExpansion()) {
                boolean bash4 = BashProjectSettings.storedSettings(holder.getProject()).isSupportBash4();
                holder.registerProblem(expansion, "Evaluate expansion", new EvaluateExpansionQuickfix(expansion, bash4));
            }
        }
    };
}
 
Example #9
Source File: HaskellLetexpImpl.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor);
  else super.accept(visitor);
}
 
Example #10
Source File: JenkinsStepImpl.java    From jenkinsfile-idea-plugin with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof JenkinsVisitor) accept((JenkinsVisitor)visitor);
  else super.accept(visitor);
}
 
Example #11
Source File: NixParamSetImpl.java    From nix-idea with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof NixVisitor) accept((NixVisitor)visitor);
  else super.accept(visitor);
}
 
Example #12
Source File: XQueryVarDeclImpl.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof XQueryVisitor) accept((XQueryVisitor)visitor);
  else super.accept(visitor);
}
 
Example #13
Source File: HaskellQqblobImpl.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor);
  else super.accept(visitor);
}
 
Example #14
Source File: WeaveTypeLiteralImpl.java    From mule-intellij-plugins with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof WeaveVisitor) accept((WeaveVisitor)visitor);
  else super.accept(visitor);
}
 
Example #15
Source File: CypherProcedureResultImpl.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof CypherVisitor) accept((CypherVisitor)visitor);
  else super.accept(visitor);
}
 
Example #16
Source File: XQueryFunctionDeclImpl.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof XQueryVisitor) accept((XQueryVisitor)visitor);
  else super.accept(visitor);
}
 
Example #17
Source File: YangRangeStmtImpl.java    From intellij-yang with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof YangVisitor) ((YangVisitor)visitor).visitRangeStmt(this);
  else super.accept(visitor);
}
 
Example #18
Source File: ThriftSenumImpl.java    From intellij-thrift with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof ThriftVisitor) accept((ThriftVisitor)visitor);
  else super.accept(visitor);
}
 
Example #19
Source File: XQueryInsertExprTargetChoiceImpl.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof XQueryVisitor) accept((XQueryVisitor)visitor);
  else super.accept(visitor);
}
 
Example #20
Source File: XQueryTryCatchExprImpl.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof XQueryVisitor) accept((XQueryVisitor)visitor);
  else super.accept(visitor);
}
 
Example #21
Source File: CypherBulkImportQueryImpl.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof CypherVisitor) accept((CypherVisitor)visitor);
  else super.accept(visitor);
}
 
Example #22
Source File: MakefileParserDefinition.java    From CppTools with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor psiElementVisitor) {
  psiElementVisitor.visitFile(this);
}
 
Example #23
Source File: MelDoWhileExpressionImpl.java    From mule-intellij-plugins with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof MelVisitor) accept((MelVisitor)visitor);
  else super.accept(visitor);
}
 
Example #24
Source File: NixExprListImpl.java    From nix-idea with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof NixVisitor) accept((NixVisitor)visitor);
  else super.accept(visitor);
}
 
Example #25
Source File: ElmFieldAccessImpl.java    From elm-plugin with MIT License 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
    if (visitor instanceof ElmVisitor) {
        ((ElmVisitor)visitor).visitPsiElement(this);
    }
    else super.accept(visitor);
}
 
Example #26
Source File: NixStringPartsImpl.java    From nix-idea with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof NixVisitor) accept((NixVisitor)visitor);
  else super.accept(visitor);
}
 
Example #27
Source File: SpecDetailImpl.java    From Intellij-Plugin with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
    if (visitor instanceof SpecVisitor) ((SpecVisitor) visitor).visitSpecDetail(this);
    else super.accept(visitor);
}
 
Example #28
Source File: XQueryLetClauseImpl.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof XQueryVisitor) accept((XQueryVisitor)visitor);
  else super.accept(visitor);
}
 
Example #29
Source File: GraphQLValueImpl.java    From js-graphql-intellij-plugin with MIT License 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof GraphQLVisitor) accept((GraphQLVisitor)visitor);
  else super.accept(visitor);
}
 
Example #30
Source File: NixBindSetImpl.java    From nix-idea with Apache License 2.0 4 votes vote down vote up
public void accept(@NotNull PsiElementVisitor visitor) {
  if (visitor instanceof NixVisitor) accept((NixVisitor)visitor);
  else super.accept(visitor);
}