mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Introduced ExceptionHandler in CodeFragment
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user