Changeset 3518 for devel-tools/trunk


Ignore:
Timestamp:
Mar 14, 2008, 9:51:11 AM (13 years ago)
Author:
yura
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.rfpdt.core/src/org/refal/rfpdt/core/RfpCore.java

    r3516 r3518  
    77import org.eclipse.core.runtime.CoreException;
    88import org.eclipse.core.runtime.IStatus;
    9 import org.eclipse.core.runtime.Platform;
    109import org.eclipse.core.runtime.Plugin;
    1110import org.eclipse.core.runtime.Status;
    1211import org.eclipse.jdt.core.IJavaProject;
    1312import org.eclipse.jdt.core.JavaCore;
    14 import org.osgi.framework.BundleContext;
    1513
    1614/**
     
    1816 */
    1917public class RfpCore extends Plugin {
    20 
    2118    private static RfpCore plugin;
    2219
    23     public static final String PLUGIN_ID = "org.refal.rfpdt";
     20    public static final String PLUGIN_ID = "org.refal.rfpdt.core";
    2421    public static final String NATURE_ID = "org.refal.rfpdt.core.rfpnature";
    2522    public static final String BUILDER_ID = "org.refal.rfpdt.core.rfpbuilder";
     
    3027        plugin = this;
    3128    }
    32 
    33     /*
    34      * (non-Javadoc)
    35      *
    36      * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
    37      */
    38     public void start (BundleContext context) throws Exception {
    39         super.start(context);
    40     }
    41 
    42     /*
    43      * (non-Javadoc)
    44      *
    45      * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
    46      */
    47     public void stop (BundleContext context) throws Exception {
    48         plugin = null;
    49         super.stop(context);
    50     }
    51 
    52     /**
    53      * Returns the shared instance
    54      *
    55      * @return the shared instance
    56      */
    57     public static RfpCore getDefault () {
    58         return plugin;
    59     }
    60 
    61     public static String getPluginId () {
    62         return getDefault().getBundle().getSymbolicName();
    63     }
    64 
    65     // logging and tracing
    66     // ////////////////////
    6729
    6830    /**
     
    7537     */
    7638    public static void log (final String message, final int severity) {
    77         String id = getPluginId();
    78         Status status = new Status(severity, id, IStatus.OK, message, null);
    79         getDefault().getLog().log(status);
     39        log(new Status(severity, PLUGIN_ID, IStatus.OK, message, null));
    8040    }
    8141
    8242    public static void log (final String message, final Throwable thr) {
    83         String id = getPluginId();
    84         Status status = new Status(IStatus.ERROR, id, IStatus.OK, message, thr);
    85         getDefault().getLog().log(status);
     43        log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, thr));
    8644    }
    8745
    88     public static boolean isTracing (final String optionId) {
    89         String option = getPluginId() + "/trace/" + optionId;
    90         String value = Platform.getDebugOption(option);
    91         return value != null && value.equals("true");
     46    public static void log (Throwable e) {
     47        log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, "Internal error", e));
    9248    }
    9349
    9450    public static void log (final IStatus status) {
    95         getDefault().getLog().log(status);
    96     }
    97 
    98     public static void log (Throwable e) {
    99         log(new Status(IStatus.ERROR, getPluginId(), IStatus.OK, "Internal error", e));
     51        if (plugin != null)
     52            plugin.getLog().log(status);
    10053    }
    10154
Note: See TracChangeset for help on using the changeset viewer.