本文整理汇总了Java中com.intellij.codeInspection.LocalQuickFix.EMPTY_ARRAY属性的典型用法代码示例。如果您正苦于以下问题:Java LocalQuickFix.EMPTY_ARRAY属性的具体用法?Java LocalQuickFix.EMPTY_ARRAY怎么用?Java LocalQuickFix.EMPTY_ARRAY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.codeInspection.LocalQuickFix
的用法示例。
在下文中一共展示了LocalQuickFix.EMPTY_ARRAY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getQuickFixes
private LocalQuickFix[] getQuickFixes(final GenericDomValue element, PsiReference reference) {
if (!myOnTheFly) return LocalQuickFix.EMPTY_ARRAY;
final List<LocalQuickFix> result = new SmartList<LocalQuickFix>();
final Converter converter = WrappingConverter.getDeepestConverter(element.getConverter(), element);
if (converter instanceof ResolvingConverter) {
final ResolvingConverter resolvingConverter = (ResolvingConverter)converter;
ContainerUtil
.addAll(result, resolvingConverter.getQuickFixes(ConvertContextFactory.createConvertContext(DomManagerImpl.getDomInvocationHandler(element))));
}
if (reference instanceof LocalQuickFixProvider) {
final LocalQuickFix[] localQuickFixes = ((LocalQuickFixProvider)reference).getQuickFixes();
if (localQuickFixes != null) {
ContainerUtil.addAll(result, localQuickFixes);
}
}
return result.isEmpty() ? LocalQuickFix.EMPTY_ARRAY : result.toArray(new LocalQuickFix[result.size()]);
}
示例2: addProblems
private static void addProblems(DomElement element, MavenDomProjectModel model, DomElementAnnotationHolder holder,
MavenProjectProblem.ProblemType... types) {
MavenProject mavenProject = MavenDomUtil.findProject(model);
if (mavenProject != null) {
for (MavenProjectProblem each : mavenProject.getProblems()) {
MavenProjectProblem.ProblemType type = each.getType();
if (!Arrays.asList(types).contains(type)) continue;
VirtualFile problemFile = LocalFileSystem.getInstance().findFileByPath(each.getPath());
LocalQuickFix[] fixes = LocalQuickFix.EMPTY_ARRAY;
if (problemFile != null && !Comparing.equal(mavenProject.getFile(), problemFile)) {
fixes = new LocalQuickFix[]{new OpenProblemFileFix(problemFile)};
}
holder.createProblem(element, HighlightSeverity.ERROR, each.getDescription(), fixes);
}
}
}
示例3: createFix
public static LocalQuickFix[] createFix(PsiClass compClass, PsiClass checkedClass, boolean onTheFly) {
ImplementOrExtendFix fix = null;
if (compClass.isInterface() && compClass.getImplementsList() != null) {
fix = new ImplementOrExtendFix(compClass, checkedClass, onTheFly);
} else if (!compClass.isInterface()) {
final PsiReferenceList extendsList = checkedClass.getExtendsList();
if (extendsList != null) {
if (extendsList.getReferenceElements().length == 0) {
fix = new ImplementOrExtendFix(compClass, checkedClass, onTheFly);
} else if (extendsList.getReferenceElements().length == 1) {
// check for explicit "extends Object" case
final PsiClassType javaLangObject = PsiType.getJavaLangObject(checkedClass.getManager(),
checkedClass.getResolveScope());
if (extendsList.getReferencedTypes()[0].equals(javaLangObject)) {
fix = new ImplementOrExtendFix(compClass, checkedClass, onTheFly);
}
}
}
}
return fix != null ? new LocalQuickFix[]{fix} : LocalQuickFix.EMPTY_ARRAY;
}
示例4: visitCatchClause
@Override
public void visitCatchClause(GrCatchClause catchClause) {
super.visitCatchClause(catchClause);
final GrOpenBlock body = catchClause.getBody();
if (body == null || !isEmpty(body)) {
return;
}
final GrParameter parameter = catchClause.getParameter();
if (parameter == null) return;
if (myIgnore && GrExceptionUtil.ignore(parameter)) return;
LocalQuickFix fix = QuickFixFactory.getInstance().createRenameElementFix(parameter, "ignored");
final LocalQuickFix[] fixes = myIgnore
? new LocalQuickFix[]{fix}
: LocalQuickFix.EMPTY_ARRAY;
registerError(catchClause.getFirstChild(), "Empty '#ref' block #loc", fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
}
示例5: getQuickFixes
@Nullable
@Override
public LocalQuickFix[] getQuickFixes() {
final XmlAttributeValue valueElement = myAttribute.getValueElement();
if (valueElement != null) {
return new LocalQuickFix[] {
new CreateNSDeclarationIntentionFix(valueElement, getCanonicalText()) {
@Override
public boolean showHint(@NotNull Editor editor) {
return false;
}
}
};
}
return LocalQuickFix.EMPTY_ARRAY;
}
示例6: getQuickFixes
@Override
public LocalQuickFix[] getQuickFixes(final ConvertContext context) {
final DomElement element = context.getInvocationElement();
final GenericDomValue value = ((GenericDomValue)element).createStableCopy();
final String newName = value.getStringValue();
if (newName == null) return LocalQuickFix.EMPTY_ARRAY;
final DomElement scope = value.getManager().getResolvingScope(value);
return ResolvingElementQuickFix.createFixes(newName, myClass, scope);
}
示例7: getQuickFixes
@Override
public LocalQuickFix[] getQuickFixes() {
if (!canHaveAdequateFix(getElement())) return LocalQuickFix.EMPTY_ARRAY;
return new LocalQuickFix[] {
new AddDtdDeclarationFix(
"xml.dtd.create.dtd.element.intention.name",
ELEMENT_DECLARATION_NAME,
this
)
};
}
示例8: getQuickFixes
@Nullable
@Override
public LocalQuickFix[] getQuickFixes() {
if (getScope() != null) {
return new LocalQuickFix[] { new CreatePatternFix(this) };
}
return LocalQuickFix.EMPTY_ARRAY;
}
示例9: getQuickFixes
@Override
public LocalQuickFix[] getQuickFixes() {
final String resourceName = getValue();
if (resourceName.length() == 0) {
return LocalQuickFix.EMPTY_ARRAY;
}
final PsiFile psiFile = getElement().getContainingFile();
if (psiFile == null) {
return LocalQuickFix.EMPTY_ARRAY;
}
return new LocalQuickFix[] {new CreateValueResourceQuickFix(myFacet, ResourceType.STYLE, resourceName, psiFile, false)};
}
示例10: getQuickFixes
@Override
public LocalQuickFix[] getQuickFixes(ConvertContext context) {
AndroidFacet facet = AndroidFacet.getInstance(context);
if (facet != null) {
final DomElement domElement = context.getInvocationElement();
if (domElement instanceof GenericDomValue) {
final String value = ((GenericDomValue)domElement).getStringValue();
if (value != null) {
ResourceValue resourceValue = ResourceValue.parse(value, false, myWithPrefix, true);
if (resourceValue != null) {
String aPackage = resourceValue.getPackage();
ResourceType resType = resourceValue.getType();
if (resType == null && myResourceTypes.size() == 1) {
resType = ResourceType.getEnum(myResourceTypes.get(0));
}
final String resourceName = resourceValue.getResourceName();
if (aPackage == null &&
resType != null &&
resourceName != null &&
AndroidResourceUtil.isCorrectAndroidResourceName(resourceName)) {
final List<LocalQuickFix> fixes = new ArrayList<LocalQuickFix>();
if (AndroidResourceUtil.XML_FILE_RESOURCE_TYPES.contains(resType)) {
fixes.add(new CreateFileResourceQuickFix(facet, resType, resourceName, context.getFile(), false));
}
if (AndroidResourceUtil.VALUE_RESOURCE_TYPES.contains(resType) && resType != ResourceType.LAYOUT) { // layouts: aliases only
fixes.add(new CreateValueResourceQuickFix(facet, resType, resourceName, context.getFile(), false));
}
return fixes.toArray(new LocalQuickFix[fixes.size()]);
}
}
}
}
}
return LocalQuickFix.EMPTY_ARRAY;
}
示例11: buildVisitor
@NotNull
@Override
public PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, final boolean isOnTheFly) {
return new JavaElementVisitor() {
@Override
public void visitAnnotation(PsiAnnotation annotation) {
if (TestNGUtil.TEST_ANNOTATION_FQN.equals(annotation.getQualifiedName())) {
final PsiAnnotationMemberValue provider = annotation.findDeclaredAttributeValue("dataProvider");
if (provider != null && !TestNGUtil.isDisabled(annotation)) {
for (PsiReference reference : provider.getReferences()) {
if (reference instanceof DataProviderReference) {
final PsiElement dataProviderMethod = reference.resolve();
final PsiElement element = reference.getElement();
final PsiClass topLevelClass = PsiUtil.getTopLevelClass(element);
final PsiClass providerClass = TestNGUtil.getProviderClass(element, topLevelClass);
if (!(dataProviderMethod instanceof PsiMethod)) {
final LocalQuickFix[] fixes;
if (isOnTheFly) {
fixes = new LocalQuickFix[] {createMethodFix(provider, providerClass, topLevelClass)};
}
else {
fixes = LocalQuickFix.EMPTY_ARRAY;
}
holder.registerProblem(provider, "Data provider does not exist", fixes);
} else {
final PsiMethod providerMethod = (PsiMethod)dataProviderMethod;
if (providerClass != topLevelClass && !providerMethod.hasModifierProperty(PsiModifier.STATIC)) {
holder.registerProblem(provider, "Data provider from foreign class need to be static");
}
}
break;
}
}
}
}
}
};
}
示例12: buildFixes
protected LocalQuickFix[] buildFixes(boolean isOnTheFly, boolean hasEquals) {
if (!isOnTheFly) {
return LocalQuickFix.EMPTY_ARRAY;
}
return new LocalQuickFix[]{new GenerateEqualsHashcodeFix(hasEquals)};
}
示例13: getQuickFixes
@Override
public LocalQuickFix[] getQuickFixes() {
final List<? extends LocalQuickFix> list = registerFixes();
return list == null ? LocalQuickFix.EMPTY_ARRAY : list.toArray(new LocalQuickFix[list.size()]);
}
示例14: DomElementProblemDescriptorImpl
public DomElementProblemDescriptorImpl(@NotNull final DomElement domElement, final String message, final HighlightSeverity type) {
this(domElement, message, type, LocalQuickFix.EMPTY_ARRAY);
}
示例15: createFixes
public static LocalQuickFix[] createFixes(final String newName, Class<? extends DomElement> clazz, final DomElement scope) {
final LocalQuickFix fix = createFix(newName, clazz, scope);
return fix != null ? new LocalQuickFix[] { fix } : LocalQuickFix.EMPTY_ARRAY;
}