1 11 12 package org.eclipse.ui.statushandlers; 13 14 import org.eclipse.core.runtime.IStatus; 15 import org.eclipse.core.runtime.Status; 16 import org.eclipse.ui.application.WorkbenchAdvisor; 17 import org.eclipse.ui.internal.WorkbenchPlugin; 18 import org.eclipse.ui.internal.statushandlers.StatusNotificationManager; 19 20 27 public class WorkbenchErrorHandler extends AbstractStatusHandler { 28 29 35 public void handle(final StatusAdapter statusAdapter, int style) { 36 if (((style & StatusManager.SHOW) == StatusManager.SHOW) 37 || ((style & StatusManager.BLOCK) == StatusManager.BLOCK)) { 38 39 if (statusAdapter.getStatus().getSeverity() == IStatus.OK 42 || statusAdapter.getStatus().getSeverity() == IStatus.CANCEL) { 43 IStatus status = statusAdapter.getStatus(); 44 statusAdapter.setStatus(new Status(IStatus.INFO, status 45 .getPlugin(), status.getMessage(), status 46 .getException())); 47 } 48 49 boolean modal = ((style & StatusManager.BLOCK) == StatusManager.BLOCK); 50 StatusNotificationManager.getInstance().addError(statusAdapter, 51 modal); 52 } 53 54 if ((style & StatusManager.LOG) == StatusManager.LOG) { 55 StatusManager.getManager().addLoggedStatus( 56 statusAdapter.getStatus()); 57 WorkbenchPlugin.getDefault().getLog() 58 .log(statusAdapter.getStatus()); 59 } 60 } 61 } 62 | Popular Tags |