本文整理匯總了Java中com.intellij.codeInspection.ProblemsHolder類的典型用法代碼示例。如果您正苦於以下問題:Java ProblemsHolder類的具體用法?Java ProblemsHolder怎麽用?Java ProblemsHolder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ProblemsHolder類屬於com.intellij.codeInspection包,在下文中一共展示了ProblemsHolder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildVisitor
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的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.codeInspection.ProblemsHolder; //導入依賴的package包/類
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean isOnTheFly) {
return new PhpElementVisitor() {
@Override
public void visitPhpClass(PhpClass clazz) {
if (clazz.getSuperClass() != null && clazz.getSuperClass().getFQN().equals("\\yii\\db\\ActiveQuery")) {
PhpIndex index = PhpIndex.getInstance(clazz.getProject());
PhpClass activeRecordClass = ClassUtils.findClassInSeeTags(index, clazz, "\\yii\\db\\BaseActiveRecord");
if (activeRecordClass == null) {
problemsHolder.registerProblem(clazz.getFirstChild(),
"Can not find connected ActiveRecord class.\nYou should add @see tag with linked ActiveRecord",
ProblemHighlightType.WEAK_WARNING);
}
}
super.visitPhpClass(clazz);
}
};
}
示例3: buildVisitor
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的package包/類
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
return new PhpElementVisitor() {
@Override
public void visitPhpClassReference(ClassReference classReference) {
if (classReference.getFQN() != null && LegacyClassesForIDEIndex.isLegacyClass(classReference.getProject(), classReference.getFQN())) {
problemsHolder.registerProblem(classReference, "Legacy class usage", ProblemHighlightType.LIKE_DEPRECATED, new LegacyClassesForIdeQuickFix());
}
super.visitPhpClassReference(classReference);
}
@Override
public void visitPhpClassConstantReference(ClassConstantReference constantReference) {
super.visitPhpClassConstantReference(constantReference);
}
};
}
示例4: buildVisitor
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的package包/類
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
return new PhpElementVisitor() {
@Override
public void visitPhpElement(PhpPsiElement element) {
if (!PlatformPatterns.psiElement(PhpElementTypes.CONSTANT_REF).accepts(element)) {
return;
}
ConstantReference constantReference = (ConstantReference) element;
Set<String> constants = getRemovedConstantsFQNs(constantReference);
if (constants.contains(constantReference.getFQN())) {
problemsHolder.registerProblem(element, "Constant removed with TYPO3 9, consider using an alternative");
}
}
};
}
示例5: buildVisitor
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的package包/類
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
return new PhpElementVisitor() {
@Override
public void visitPhpElement(PhpPsiElement element) {
if (!PlatformPatterns.psiElement(PhpElementTypes.FUNCTION_CALL).accepts(element)) {
return;
}
Set<String> constants = getRemovedGlobalFuntions(element);
FunctionReference constantReference = (FunctionReference) element;
if (constants.contains(constantReference.getFQN())) {
problemsHolder.registerProblem(element, "Global function removed with TYPO3 9, consider using an alternative");
}
}
};
}
示例6: buildVisitor
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的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");
}
}
};
}
示例7: buildVisitor
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的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_REFERENCE).accepts(element)) {
return;
}
Set<String> constants = getDeprecatedClasses(element);
ClassReference classReference = (ClassReference) element;
if (constants.contains(classReference.getFQN())) {
problemsHolder.registerProblem(element, "Class removed with TYPO3 9, consider using an alternative");
}
}
};
}
示例8: buildVisitor
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的package包/類
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
return new PhpElementVisitor() {
@Override
public void visitPhpStringLiteralExpression(StringLiteralExpression expression) {
if (expression == null || expression.getParent() instanceof ConcatenationExpression) {
return;
}
String contents = expression.getContents();
if (TranslationUtil.isTranslationKeyString(contents) && contents.length() > 4 && !TranslationUtil.keyExists(problemsHolder.getProject(), contents)) {
// new CreateMissingTranslationQuickFix(contents)
problemsHolder.registerProblem(expression, MESSAGE);
}
}
};
}
示例9: buildVisitor
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的package包/類
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
return new PhpElementVisitor() {
@Override
public void visitPhpElement(PhpPsiElement element) {
boolean isArrayStringValue = PhpElementsUtil.isStringArrayValue().accepts(element);
if (!isArrayStringValue || !insideTCAColumnDefinition(element)) {
return;
}
String arrayIndex = extractArrayIndexFromValue(element);
if (arrayIndex != null && Arrays.asList(TCAUtil.TCA_NUMERIC_CONFIG_KEYS).contains(arrayIndex)) {
if (element instanceof StringLiteralExpression) {
problemsHolder.registerProblem(element, "Config key only accepts integer values");
}
}
}
};
}
示例10: buildVisitor
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的package包/類
@NotNull
@Override
public PsiElementVisitor buildVisitor(
@NotNull final ProblemsHolder problemsHolder,
final boolean isOnTheFly
) {
return new PhpElementVisitor() {
@Override
public void visitPhpNewExpression(final NewExpression expression) {
if (FluentUtil.isUsingDirectly(expression)) {
final ClassReference classReference = expression.getClassReference();
assert classReference != null;
problemsHolder.registerProblem(classReference, messageDirectInstantiation, ProblemHighlightType.WEAK_WARNING,
new TextRange(0, classReference.getTextLength()));
}
}
};
}
示例11: reportRelationship
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的package包/類
static void reportRelationship(
@NotNull final ProblemsHolder problemsHolder,
@NotNull final Function method,
@NotNull final PhpClass methodClass
) {
final PhpType methodReturnType = PhpFunctionUtil.getReturnType(method);
if (!isRelationship(methodReturnType.getTypes())) {
return;
}
final PsiElement methodIdentifier = method.getNameIdentifier();
assert methodIdentifier != null;
validatePropertyAnnotation(problemsHolder, methodClass, methodIdentifier, CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, method.getName()), "mixed");
}
示例12: buildVisitor
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的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);
}
示例13: analyzeFile
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的package包/類
@NotNull
private ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) {
DotEnvPsiElementsVisitor visitor = new DotEnvPsiElementsVisitor();
file.acceptChildren(visitor);
ProblemsHolder problemsHolder = new ProblemsHolder(manager, file, isOnTheFly);
Map<String, PsiElement> existingKeys = new HashMap<>();
Set<PsiElement> markedElements = new HashSet<>();
for(KeyValuePsiElement keyValue : visitor.getCollectedItems()) {
if(existingKeys.containsKey(keyValue.getKey())) {
problemsHolder.registerProblem(keyValue.getElement(), "Duplicate key");
PsiElement markedElement = existingKeys.get(keyValue.getKey());
if(!markedElements.contains(markedElement)) {
problemsHolder.registerProblem(markedElement, "Duplicate key");
markedElements.add(markedElement);
}
} else {
existingKeys.put(keyValue.getKey(), keyValue.getElement());
}
}
return problemsHolder;
}
示例14: buildVisitor
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的package包/類
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
final List<PsiMethod> patternMethods = new ArrayList<>();
final IntArrayList indices = new IntArrayList();
return new JavaElementVisitor() {
@Override
public void visitReferenceExpression(final PsiReferenceExpression expression) {
visitExpression(expression);
}
@Override
public void visitMethodCallExpression(PsiMethodCallExpression methodCall) {
super.visitMethodCallExpression(methodCall);
final String message = getSuspiciousMethodCallMessage(methodCall,
REPORT_CONVERTIBLE_METHOD_CALLS,
patternMethods,
indices
);
if (message != null) {
holder.registerProblem(methodCall.getArgumentList().getExpressions()[0], message);
}
}
};
}
開發者ID:aewhite,項目名稱:intellij-eclipse-collections-plugin,代碼行數:26,代碼來源:EclipseCollectionsSuspiciousMethodCallsInspection.java
示例15: RunQueryCodeInspection
import com.intellij.codeInspection.ProblemsHolder; //導入依賴的package包/類
private void RunQueryCodeInspection(PsiMethod method, String annotation, @NotNull ProblemsHolder holder) {
//Remove UnWanted String
//so we get only the sql query String
annotation = annotation.substring(annotation.indexOf(ANNOTATION_QUERY) + ANNOTATION_QUERY.length());
PsiParameterList methodParameterList = method.getParameterList();
List<String> methodParameterNameList = new ArrayList<>();
for (PsiParameter methodParameter : methodParameterList.getParameters()) {
methodParameterNameList.add(methodParameter.getName());
}
runQueryBindVariableCodeInspection(method, annotation, holder, methodParameterNameList);
runQueryTableNameCodeInspection(method, annotation, holder);
}
開發者ID:MukeshMM,項目名稱:Android-Room-Support-Plugin-For-Android-Studio,代碼行數:18,代碼來源:RoomQueryCodeInspection.java