1 11 package org.eclipse.ui.internal; 12 13 import org.eclipse.jface.window.Window; 14 15 21 public final class ExceptionHandler implements Window.IExceptionHandler { 22 23 private static final ExceptionHandler instance = new ExceptionHandler(); 24 25 30 public static ExceptionHandler getInstance() { 31 return instance; 32 } 33 34 private int exceptionCount = 0; 36 private ExceptionHandler() { 37 } 39 40 43 public void handleException(Throwable t) { 44 try { 45 if (t instanceof ThreadDeath ) { 47 throw (ThreadDeath ) t; 48 } 49 50 exceptionCount++; 52 if (exceptionCount > 2) { 53 if (t instanceof RuntimeException ) { 54 throw (RuntimeException ) t; 55 } 56 throw (Error ) t; 57 } 58 59 Workbench wb = Workbench.getInstance(); 61 if (wb != null) { 62 wb.getAdvisor().eventLoopException(t); 63 } 64 } finally { 65 exceptionCount--; 66 } 67 } 68 } 69 | Popular Tags |