本文整理汇总了Java中com.intellij.psi.PsiElementVisitor类的典型用法代码示例。如果您正苦于以下问题:Java PsiElementVisitor类的具体用法?Java PsiElementVisitor怎么用?Java PsiElementVisitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PsiElementVisitor类属于com.intellij.psi包,在下文中一共展示了PsiElementVisitor类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildVisitor
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
return new PhpElementVisitor() {
@Override
public void visitPhpClass(PhpClass clazz) {
PhpIndex index = PhpIndex.getInstance(problemsHolder.getProject());
if (DatabaseUtils.HasConnections(problemsHolder.getProject()) &&
ClassUtils.isClassInheritsOrEqual(clazz, ClassUtils.getClass(index, "\\yii\\db\\ActiveRecord"))) {
String table = DatabaseUtils.getTableByActiveRecordClass(clazz);
if (table == null) {
problemsHolder.registerProblem(clazz.getFirstChild(), "Can not detect database table for class " + clazz.getFQN(), ProblemHighlightType.WEAK_WARNING);
} else if (! DatabaseUtils.isTableExists(table, problemsHolder.getProject())) {
problemsHolder.registerProblem(clazz.getFirstChild(), "Table '" + table + "' not found in database connections", ProblemHighlightType.WEAK_WARNING);
}
}
super.visitPhpClass(clazz);
}
};
}
示例2: buildVisitor
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
return new PhpElementVisitor() {
@Override
public void visitPhpElement(PhpPsiElement element) {
if (!PlatformPatterns.psiElement(PhpElementTypes.CLASS_CONSTANT_REFERENCE).accepts(element)) {
return;
}
Set<String> constants = getDeprecatedClassConstants(element);
ClassConstantReference classConstantReference = (ClassConstantReference) element;
if (constants.contains(classConstantReference.getText())) {
problemsHolder.registerProblem(element, "Deprecated class constant");
}
}
};
}
示例3: buildVisitor
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
if (JNomadInspection.jnomad == null) {
setupJNomad();
}
List<EnvFileFullReport> fileFullReports;
VirtualFile virtualFile = holder.getFile().getVirtualFile();
if (virtualFile.getPath().endsWith("java") && virtualFile instanceof VirtualFileImpl) {
CharSequence contents = holder.getFile().getViewProvider().getContents();
fileFullReports = getFileFullReports(contents);
return new JNomadQueryVisitor(holder, holder.getFile().getVirtualFile(), fileFullReports.toArray(new EnvFileFullReport[0]));
}
return new JNomadQueryVisitor(holder, holder.getFile().getVirtualFile(), null);
}
示例4: buildVisitor
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(
@NotNull final ProblemsHolder problemsHolder,
final boolean isOnTheFly
) {
return new PhpElementVisitor() {
@Override
public void visitPhpMethod(final Method method) {
final PhpReturnType returnType = method.getReturnType();
final ClassReference methodReturnTypeClassReference = (returnType != null) ? returnType.getClassReference() : null;
if (FluentUtil.isUsingDirectly(methodReturnTypeClassReference)) {
problemsHolder.registerProblem(methodReturnTypeClassReference, messageDirectInstantiation, ProblemHighlightType.WEAK_WARNING);
}
}
@Override
public void visitPhpFunction(final Function function) {
final PhpReturnType functionReturnType = function.getReturnType();
if ((functionReturnType != null) && FluentUtil.isUsingDirectly(functionReturnType.getClassReference())) {
problemsHolder.registerProblem(functionReturnType, messageDirectInstantiation, ProblemHighlightType.WEAK_WARNING);
}
}
@Override
public void visitPhpParameter(final Parameter parameter) {
if (FluentUtil.isUsingDirectly(parameter)) {
problemsHolder.registerProblem(parameter, messageDirectInstantiation, ProblemHighlightType.WEAK_WARNING);
}
}
@Override
public void visitPhpDocType(final PhpDocType type) {
if (FluentUtil.isUsingDirectly(type)) {
problemsHolder.registerProblem(type, messageDirectInstantiation, ProblemHighlightType.WEAK_WARNING);
}
}
};
}
示例5: buildVisitor
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
return new PhpElementVisitor() {
@Override
public void visitPhpElement(PhpPsiElement element) {
if (element instanceof PhpDocTag) {
PhpDocTag tag = (PhpDocTag) element;
if ("@inject".equals(tag.getName())) {
problemsHolder.registerProblem(element, "Extbase property injection", new CreateInjectorQuickFix(element));
}
}
}
};
}
示例6: accept
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof FlexibleSearchVisitor) accept((FlexibleSearchVisitor)visitor);
else super.accept(visitor);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:5,代码来源:FlexibleSearchStringValueFunctionImpl.java
示例7: accept
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof MasVisitor) accept((MasVisitor)visitor);
else super.accept(visitor);
}
示例8: accept
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof AppleScriptVisitor) accept((AppleScriptVisitor)visitor);
else super.accept(visitor);
}
示例9: accept
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof CptVisitor) accept((CptVisitor)visitor);
else super.accept(visitor);
}
示例10: accept
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof GCMVisitor) accept((GCMVisitor)visitor);
else super.accept(visitor);
}
示例11: accept
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof DotEnvVisitor) accept((DotEnvVisitor)visitor);
else super.accept(visitor);
}
示例12: accept
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof TestVisitor) accept((TestVisitor)visitor);
else super.accept(visitor);
}
示例13: accept
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof ModuleVisitor) accept((ModuleVisitor)visitor);
else super.accept(visitor);
}
示例14: buildVisitor
import com.intellij.psi.PsiElementVisitor; //导入依赖的package包/类
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
return new PhpElementVisitor() {
@Override
public void visitPhpMethodReference(MethodReference reference) {
/* ensure that it's a target call; category is not empty and has no injections; we have messages */
TranslationCallsProcessUtil.ProcessingResult extracted = TranslationCallsProcessUtil.process(reference, true);
if (null == extracted) {
return;
}
/* handle `category` and `category/subcategory` cases */
String categoryForFileName = extracted.getCategory().getContents();
if (-1 != categoryForFileName.indexOf('/')) {
categoryForFileName
= categoryForFileName.substring(1 + categoryForFileName.lastIndexOf('/'), categoryForFileName.length());
}
final String expectedFileName = categoryForFileName + ".php";
/* iterate found translations and validate correctness */
final Map<StringLiteralExpression, PsiElement> messages = extracted.getMessages();
for (StringLiteralExpression literal : messages.keySet()) {
/* only quotes, no content presented */
if (literal.getTextLength() <= 2) {
continue;
}
final String message = literal.getContents();
final PsiElement reportingTarget = messages.get(literal);
/* warn injections are presented and skip further processing */
if (REPORT_INJECTIONS && null != literal.getFirstPsiChild()) {
holder.registerProblem(reportingTarget, messageInjection, ProblemHighlightType.WEAK_WARNING);
continue;
}
/* warn if non-ascii characters has been used */
if (REPORT_NONASCII_CHARACTERS && nonAsciiCharsRegex.matcher(message).matches()) {
holder.registerProblem(reportingTarget, messageNonAscii, ProblemHighlightType.WEAK_WARNING);
}
/* warn if the message is have no translations in the group */
final Set<String> searchEntry
= new HashSet<>(Collections.singletonList(PhpStringUtil.unescapeText(message, literal.isSingleQuote())));
GlobalSearchScope theScope = GlobalSearchScope.allScope(reference.getProject());
theScope = GlobalSearchScope.getScopeRestrictedByFileTypes(theScope, PhpFileType.INSTANCE);
final Set<VirtualFile> providers = new HashSet<>();
FileBasedIndex.getInstance()
.getFilesWithKey(TranslationKeysIndexer.identity, searchEntry, virtualFile -> {
if (virtualFile.getName().equals(expectedFileName)) {
providers.add(virtualFile);
}
return true;
}, theScope);
/* report found cases */
if (REPORT_UNKNOWN_TRANSLATIONS && 0 == providers.size()) {
holder.registerProblem(reportingTarget, messageNoTranslations, ProblemHighlightType.WEAK_WARNING);
}
providers.clear();
}
extracted.dispose();
}
};
}