1 11 12 package org.eclipse.ui.internal.cheatsheets.data; 13 14 import org.eclipse.core.runtime.IStatus; 15 import org.eclipse.core.runtime.MultiStatus; 16 import org.eclipse.core.runtime.Status; 17 import org.eclipse.ui.internal.cheatsheets.ICheatSheetResource; 18 import org.eclipse.ui.internal.cheatsheets.Messages; 19 20 public class ParserStatusUtility { 21 22 public final static int PARSER_ERROR = 1001; 24 29 public static IStatus addStatus(IStatus status, int severity, String message, Throwable exception) { 30 Status newStatus = new Status(severity, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, PARSER_ERROR, message, exception); 31 if (status.isOK()) { 32 return newStatus; 33 } else if (status instanceof MultiStatus) { 34 ((MultiStatus)status).add(newStatus); 35 return status; 36 } else { 37 MultiStatus multiStatus = new MultiStatus(ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, 38 Messages.ERROR_MULTIPLE_ERRORS, exception); 39 multiStatus.add(status); 40 multiStatus.add(newStatus); 41 return multiStatus; 42 } 43 } 44 45 } 46 | Popular Tags |