本文整理汇总了Java中com.intellij.codeInspection.reference.RefJavaElement类的典型用法代码示例。如果您正苦于以下问题:Java RefJavaElement类的具体用法?Java RefJavaElement怎么用?Java RefJavaElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RefJavaElement类属于com.intellij.codeInspection.reference包,在下文中一共展示了RefJavaElement类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getElementProblemCount
import com.intellij.codeInspection.reference.RefJavaElement; //导入依赖的package包/类
public int getElementProblemCount(@NotNull RefJavaElement refElement) {
if (refElement instanceof RefParameter) return 0;
RefEntity refOwner = refElement.getOwner();
if (refOwner == null || !(refOwner instanceof RefJavaElement)) return 1;
return 1 - getElementProblemCount((RefJavaElement)refOwner);
}
示例2: getElementProblemCount
import com.intellij.codeInspection.reference.RefJavaElement; //导入依赖的package包/类
public int getElementProblemCount(RefJavaElement refElement) {
if (refElement instanceof RefParameter) return 0;
RefEntity refOwner = refElement.getOwner();
if (refOwner == null || !(refOwner instanceof RefJavaElement)) return 1;
return 1 - getElementProblemCount((RefJavaElement)refOwner);
}
示例3: getElementProblemCount
import com.intellij.codeInspection.reference.RefJavaElement; //导入依赖的package包/类
@Override
public int getElementProblemCount(@NotNull final RefJavaElement refElement)
{
final int problemCount = super.getElementProblemCount(refElement);
if(problemCount > -1)
{
return problemCount;
}
if(!((RefElementImpl) refElement).hasSuspiciousCallers() || ((RefJavaElementImpl) refElement).isSuspiciousRecursive())
{
return 1;
}
return 0;
}
示例4: updateContent
import com.intellij.codeInspection.reference.RefJavaElement; //导入依赖的package包/类
@Override
public void updateContent()
{
getTool().checkForReachables(getContext());
myPackageContents.clear();
getContext().getRefManager().iterate(new RefJavaVisitor()
{
@Override
public void visitElement(@NotNull RefEntity refEntity)
{
if(!(refEntity instanceof RefJavaElement))
{
return;//dead code doesn't work with refModule | refPackage
}
RefJavaElement refElement = (RefJavaElement) refEntity;
if(!(getContext().getUIOptions().FILTER_RESOLVED_ITEMS && getIgnoredRefElements().contains(refElement)
) && refElement.isValid() && getFilter().accepts(refElement))
{
String packageName = RefJavaUtil.getInstance().getPackageName(refEntity);
Set<RefEntity> content = myPackageContents.get(packageName);
if(content == null)
{
content = new HashSet<RefEntity>();
myPackageContents.put(packageName, content);
}
content.add(refEntity);
}
}
});
}
示例5: getElementProblemCount
import com.intellij.codeInspection.reference.RefJavaElement; //导入依赖的package包/类
@Override
public int getElementProblemCount(@NotNull RefJavaElement refElement) {
if (refElement instanceof RefParameter) return 0;
return refElement.isEntry() && !refElement.isSyntheticJSP() ? 1 : 0;
}
示例6: accepts
import com.intellij.codeInspection.reference.RefJavaElement; //导入依赖的package包/类
public final boolean accepts(@NotNull RefJavaElement refElement) {
return getElementProblemCount(refElement) > 0;
}
示例7: accepts
import com.intellij.codeInspection.reference.RefJavaElement; //导入依赖的package包/类
public final boolean accepts(RefJavaElement refElement) {
return getElementProblemCount(refElement) > 0;
}
示例8: exportResults
import com.intellij.codeInspection.reference.RefJavaElement; //导入依赖的package包/类
@Override
public void exportResults(@NotNull final Element parentNode, @NotNull RefEntity refEntity)
{
if(!(refEntity instanceof RefJavaElement))
{
return;
}
final RefFilter filter = getFilter();
if(!getIgnoredRefElements().contains(refEntity) && filter.accepts((RefJavaElement) refEntity))
{
refEntity = getRefManager().getRefinedElement(refEntity);
Element element = refEntity.getRefManager().export(refEntity, parentNode, -1);
if(element == null)
{
return;
}
@NonNls Element problemClassElement = new Element(InspectionsBundle.message("inspection.export.results" +
".problem.element.tag"));
final RefElement refElement = (RefElement) refEntity;
final HighlightSeverity severity = getSeverity(refElement);
final String attributeKey = getTextAttributeKey(refElement.getRefManager().getProject(), severity,
ProblemHighlightType.LIKE_UNUSED_SYMBOL);
problemClassElement.setAttribute("severity", severity.myName);
problemClassElement.setAttribute("attribute_key", attributeKey);
problemClassElement.addContent(InspectionsBundle.message("inspection.export.results.dead.code"));
element.addContent(problemClassElement);
@NonNls Element hintsElement = new Element("hints");
for(String hint : HINTS)
{
@NonNls Element hintElement = new Element("hint");
hintElement.setAttribute("value", hint);
hintsElement.addContent(hintElement);
}
element.addContent(hintsElement);
Element descriptionElement = new Element(InspectionsBundle.message("inspection.export.results.description" +
".tag"));
StringBuffer buf = new StringBuffer();
DeadHTMLComposer.appendProblemSynopsis((RefElement) refEntity, buf);
descriptionElement.addContent(buf.toString());
element.addContent(descriptionElement);
}
}
示例9: applyFix
import com.intellij.codeInspection.reference.RefJavaElement; //导入依赖的package包/类
@Override
protected boolean applyFix(@NotNull final RefEntity[] refElements)
{
if(!super.applyFix(refElements))
{
return false;
}
final ArrayList<PsiElement> psiElements = new ArrayList<PsiElement>();
for(RefEntity refElement : refElements)
{
PsiElement psiElement = refElement instanceof RefElement ? ((RefElement) refElement).getElement() :
null;
if(psiElement == null)
{
continue;
}
if(getFilter().getElementProblemCount((RefJavaElement) refElement) == 0)
{
continue;
}
psiElements.add(psiElement);
}
ApplicationManager.getApplication().invokeLater(new Runnable()
{
@Override
public void run()
{
final Project project = getContext().getProject();
if(isDisposed() || project.isDisposed())
{
return;
}
SafeDeleteHandler.invoke(project, PsiUtilCore.toPsiElementArray(psiElements), false, new Runnable()
{
@Override
public void run()
{
removeElements(refElements, project, myToolWrapper);
}
});
}
});
return false; //refresh after safe delete dialog is closed
}
示例10: getElementProblemCount
import com.intellij.codeInspection.reference.RefJavaElement; //导入依赖的package包/类
@Override
public int getElementProblemCount(RefJavaElement refElement) {
if (refElement instanceof RefParameter) return 0;
return refElement.isEntry() && !refElement.isSyntheticJSP() ? 1 : 0;
}