本文整理汇总了Java中com.intellij.codeInspection.LocalQuickFixProvider类的典型用法代码示例。如果您正苦于以下问题:Java LocalQuickFixProvider类的具体用法?Java LocalQuickFixProvider怎么用?Java LocalQuickFixProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocalQuickFixProvider类属于com.intellij.codeInspection包,在下文中一共展示了LocalQuickFixProvider类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getQuickFixes
import com.intellij.codeInspection.LocalQuickFixProvider; //导入依赖的package包/类
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,代码行数:19,代码来源:DomElementAnnotationHolderImpl.java
示例2: getQuickFixes
import com.intellij.codeInspection.LocalQuickFixProvider; //导入依赖的package包/类
@Override
public LocalQuickFix[] getQuickFixes() {
final ArrayList<LocalQuickFix> list = new ArrayList<LocalQuickFix>();
for (Object ref: myReferences) {
if (ref instanceof LocalQuickFixProvider) {
ContainerUtil.addAll(list, ((LocalQuickFixProvider)ref).getQuickFixes());
}
}
return list.toArray(new LocalQuickFix[list.size()]);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:PsiDynaReference.java
示例3: checkReferences
import com.intellij.codeInspection.LocalQuickFixProvider; //导入依赖的package包/类
private void checkReferences(final PsiElement includeDirective, ProblemKind kind)
{
for(PsiReference ref : includeDirective.getReferences())
{
if(!ref.isSoft() && hasBadResolve(ref))
{
final TextRange elementRange = ref.getElement().getTextRange();
final TextRange textRange = ref.getRangeInElement();
final TextRange range = new TextRange(elementRange.getStartOffset() + textRange.getStartOffset(), elementRange.getStartOffset() + textRange
.getEndOffset());
final String message = MessageFormat.format(((EmptyResolveMessageProvider) ref).getUnresolvedMessagePattern(), ref.getCanonicalText());
Annotation annotation = kind == ProblemKind.ERROR ? myHolder.createErrorAnnotation(range, message) : kind == ProblemKind.WARNING ? myHolder
.createWarningAnnotation(range, message) : myHolder.createInfoAnnotation(range, message);
if(ref instanceof LocalQuickFixProvider)
{
for(LocalQuickFix fix : ((LocalQuickFixProvider) ref).getQuickFixes())
{
if(fix instanceof IntentionAction)
{
annotation.registerFix((IntentionAction) fix, new TextRange(annotation.getStartOffset(), annotation.getEndOffset()));
}
}
}
}
}
}
开发者ID:consulo,项目名称:consulo-javascript,代码行数:29,代码来源:JSAnnotatingVisitor.java
示例4: doCheckRefs
import com.intellij.codeInspection.LocalQuickFixProvider; //导入依赖的package包/类
private void doCheckRefs(final PsiElement value, final PsiReference[] references, int start)
{
for(int i = start; i < references.length; ++i)
{
PsiReference reference = references[i];
ProgressManager.checkCanceled();
if(isUrlReference(reference))
{
continue;
}
if(!hasBadResolve(reference, false))
{
continue;
}
String description = getErrorDescription(reference);
final int startOffset = reference.getElement().getTextRange().getStartOffset();
final TextRange referenceRange = reference.getRangeInElement();
// logging for IDEADEV-29655
if(referenceRange.getStartOffset() > referenceRange.getEndOffset())
{
LOG.error("Reference range start offset > end offset: " + reference + ", start offset: " + referenceRange.getStartOffset() + ", end offset: " + referenceRange.getEndOffset());
}
HighlightInfoType type = getTagProblemInfoType(PsiTreeUtil.getParentOfType(value, XmlTag.class));
if(value instanceof XmlAttributeValue)
{
PsiElement parent = value.getParent();
if(parent instanceof XmlAttribute)
{
String name = ((XmlAttribute) parent).getName().toLowerCase();
if(type.getSeverity(null).compareTo(HighlightInfoType.WARNING.getSeverity(null)) > 0 && name.endsWith("stylename"))
{
type = HighlightInfoType.WARNING;
}
}
}
HighlightInfo info = HighlightInfo.newHighlightInfo(type).range(startOffset + referenceRange.getStartOffset(), startOffset + referenceRange.getEndOffset()).descriptionAndTooltip
(description).create();
addToResults(info);
if(reference instanceof LocalQuickFixProvider)
{
LocalQuickFix[] fixes = ((LocalQuickFixProvider) reference).getQuickFixes();
if(fixes != null)
{
InspectionManager manager = InspectionManager.getInstance(reference.getElement().getProject());
for(LocalQuickFix fix : fixes)
{
ProblemDescriptor descriptor = manager.createProblemDescriptor(value, description, fix, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, true);
QuickFixAction.registerQuickFixAction(info, new LocalQuickFixAsIntentionAdapter(fix, descriptor));
}
}
}
UnresolvedReferenceQuickFixProvider.registerReferenceFixes(reference, new QuickFixActionRegistrarImpl(info));
}
}
开发者ID:consulo,项目名称:consulo-xml,代码行数:58,代码来源:XmlHighlightVisitor.java
注:本文中的com.intellij.codeInspection.LocalQuickFixProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论