当前位置: 首页>>代码示例>>Java>>正文


Java LocalQuickFix.EMPTY_ARRAY属性代码示例

本文整理汇总了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()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DomElementAnnotationHolderImpl.java

示例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);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MavenDomAnnotator.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ImplementOrExtendFix.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GroovyEmptyCatchBlockInspection.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:XsltReferenceContributor.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DomResolveConverter.java

示例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
    )
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:DtdReferencesProvider.java

示例8: getQuickFixes

@Nullable
@Override
public LocalQuickFix[] getQuickFixes() {
  if (getScope() != null) {
    return new LocalQuickFix[] { new CreatePatternFix(this) };
  }
  return LocalQuickFix.EMPTY_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PatternReference.java

示例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)};
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ResourceNameConverter.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:ResourceReferenceConverter.java

示例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;
            }
          }
        }
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:TestNGDataProviderInspection.java

示例12: buildFixes

protected LocalQuickFix[] buildFixes(boolean isOnTheFly, boolean hasEquals) {
  if (!isOnTheFly) {
    return LocalQuickFix.EMPTY_ARRAY;
  }
  return new LocalQuickFix[]{new GenerateEqualsHashcodeFix(hasEquals)};
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:EqualsAndHashcode.java

示例13: getQuickFixes

@Override
public LocalQuickFix[] getQuickFixes() {
  final List<? extends LocalQuickFix> list = registerFixes();
  return list == null ? LocalQuickFix.EMPTY_ARRAY : list.toArray(new LocalQuickFix[list.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:JavaClassReference.java

示例14: DomElementProblemDescriptorImpl

public DomElementProblemDescriptorImpl(@NotNull final DomElement domElement, final String message, final HighlightSeverity type) {
  this(domElement, message, type, LocalQuickFix.EMPTY_ARRAY);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:3,代码来源:DomElementProblemDescriptorImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ResolvingElementQuickFix.java


注:本文中的com.intellij.codeInspection.LocalQuickFix.EMPTY_ARRAY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。