Introduced ExceptionHandler in CodeFragment

This commit is contained in:
Mike Aizatsky
2005-03-23 20:28:44 +03:00
parent f380c9e2b6
commit ddf222ee46
3 changed files with 21 additions and 0 deletions
@@ -16,6 +16,9 @@ public interface PsiCodeFragment extends PsiFile {
void setVisibilityChecker(VisibilityChecker checker);
VisibilityChecker getVisibilityChecker();
void setExceptionHandler(ExceptionHandler checker);
ExceptionHandler getExceptionHandler();
interface VisibilityChecker {
Visibility isDeclarationVisible(PsiElement declaration, PsiElement place);
@@ -35,4 +38,8 @@ public interface PsiCodeFragment extends PsiFile {
}
}
}
interface ExceptionHandler {
boolean isHandledException(PsiClassType exceptionType);
}
}
@@ -408,6 +408,11 @@ public class ExceptionUtil {
return isHandled(parent, exceptionType, topElement);
}
}
else if (parent instanceof PsiCodeFragment) {
PsiCodeFragment codeFragment = (PsiCodeFragment)parent;
if (codeFragment.getExceptionHandler() == null) return false;
return codeFragment.getExceptionHandler().isHandledException(exceptionType);
}
else if (parent instanceof JspFile) {
return true;
}
@@ -28,6 +28,7 @@ public class PsiCodeFragmentImpl extends PsiFileImpl implements PsiCodeFragment,
private PsiType myThisType;
private LinkedHashMap<String, String> myPseudoImports = new LinkedHashMap<String, String>();
private VisibilityChecker myVisibilityChecker;
private ExceptionHandler myExceptionHandler;
public PsiCodeFragmentImpl(Project project,
IElementType contentElementType,
@@ -248,4 +249,12 @@ public class PsiCodeFragmentImpl extends PsiFileImpl implements PsiCodeFragment,
return new DocumentReference[]{DocumentReferenceByDocument.createDocumentReference(document)};
}
}
public ExceptionHandler getExceptionHandler() {
return myExceptionHandler;
}
public void setExceptionHandler(final ExceptionHandler exceptionHandler) {
myExceptionHandler = exceptionHandler;
}
}