@Override protected void tearDown() throws Exception { ExtensionPoint<EntryPoint> point = Extensions.getRootArea().getExtensionPoint(ExtensionPoints.DEAD_CODE_TOOL); point.unregisterExtension(myUnusedCodeExtension); myUnusedCodeExtension = null; ext_src = null; super.tearDown(); }
@Override protected void setUp() throws Exception { super.setUp(); ExtensionPoint<EntryPoint> point = Extensions.getRootArea().getExtensionPoint(ExtensionPoints.DEAD_CODE_TOOL); myUnusedCodeExtension = new EntryPoint() { @NotNull @Override public String getDisplayName() { return "duh"; } @Override public boolean isEntryPoint(RefElement refElement, PsiElement psiElement) { return isEntryPoint(psiElement); } @Override public boolean isEntryPoint(PsiElement psiElement) { return ext_src != null && VfsUtilCore.isAncestor(ext_src, PsiUtilCore.getVirtualFile(psiElement), false); } @Override public boolean isSelected() { return false; } @Override public void setSelected(boolean selected) {} @Override public void readExternal(Element element) {} @Override public void writeExternal(Element element) {} }; point.registerExtension(myUnusedCodeExtension); }