1 11 package org.eclipse.jdt.internal.core.manipulation; 12 13 import org.eclipse.core.runtime.IStatus; 14 import org.eclipse.core.runtime.MultiStatus; 15 import org.eclipse.core.runtime.Plugin; 16 import org.eclipse.core.runtime.Status; 17 18 import org.eclipse.jdt.core.manipulation.JavaManipulation; 19 20 import org.osgi.framework.BundleContext; 21 22 25 public class JavaManipulationPlugin extends Plugin { 26 27 private static JavaManipulationPlugin fgDefault; 29 30 33 public JavaManipulationPlugin() { 34 fgDefault = this; 35 } 36 37 40 public void start(BundleContext context) throws Exception { 41 super.start(context); 42 } 43 44 47 public void stop(BundleContext context) throws Exception { 48 super.stop(context); 49 fgDefault = null; 50 } 51 52 57 public static JavaManipulationPlugin getDefault() { 58 return fgDefault; 59 } 60 61 public static String getPluginId() { 62 return JavaManipulation.ID_PLUGIN; 63 } 64 65 public static void log(IStatus status) { 66 getDefault().getLog().log(status); 67 } 68 69 public static void logErrorMessage(String message) { 70 log(new Status(IStatus.ERROR, getPluginId(), IStatusConstants.INTERNAL_ERROR, message, null)); 71 } 72 73 public static void logErrorStatus(String message, IStatus status) { 74 if (status == null) { 75 logErrorMessage(message); 76 return; 77 } 78 MultiStatus multi= new MultiStatus(getPluginId(), IStatusConstants.INTERNAL_ERROR, message, null); 79 multi.add(status); 80 log(multi); 81 } 82 83 public static void log(Throwable e) { 84 log(new Status(IStatus.ERROR, getPluginId(), IStatusConstants.INTERNAL_ERROR, JavaManipulationMessages.JavaManipulationMessages_internalError, e)); 85 } 86 } 87 | Popular Tags |