Java Code Examples for org.openide.ErrorManager#Annotation

The following examples show how to use org.openide.ErrorManager#Annotation . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EvenIfReadonlyItNeedsToThrowExceptionTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testSaveThrowsException() throws IOException, BadLocationException, Exception {
    fileObject.canWrite = true;
    
    DES des = support();
    des.open();
    waitEQ();
    
    Document doc = des.openDocument();
    
    doc.insertString(0, "Ahoj", null);
    
    assertTrue("Now it is modified", des.isModified());
    
    fileObject.canWrite = false;
    
    try {
        des.saveDocument();
        fail("This has to throw exception");
    } catch (IOException ex) {
        ErrorManager.Annotation[] ann = ErrorManager.getDefault().findAnnotations(ex);
        assertNotNull("There are annotations", ann);
    }
}
 
Example 2
Source File: ResultModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** This exception stoped search */
synchronized void searchException(RuntimeException ex) {
    ErrorManager.Annotation[] annotations =
            ErrorManager.getDefault().findAnnotations(ex);
    for (ErrorManager.Annotation annotation : annotations) {
        if (annotation.getSeverity() == ErrorManager.USER) {
            finishMessage = annotation.getLocalizedMessage();
            if (finishMessage != null) return;
        }
    }
    finishMessage = ex.getLocalizedMessage();
}
 
Example 3
Source File: FileEntityResolver66438Test.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Throwable attachAnnotations(Throwable t, ErrorManager.Annotation[] arr) {
    return null;
}
 
Example 4
Source File: FileEntityResolver66438Test.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public ErrorManager.Annotation[] findAnnotations(Throwable t) {
    return null;
}
 
Example 5
Source File: DataFolderSetOrderTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Throwable attachAnnotations (Throwable t, ErrorManager.Annotation[] arr) {
    return t;
}
 
Example 6
Source File: DataFolderSetOrderTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public ErrorManager.Annotation[] findAnnotations (Throwable t) {
    return null;
}