예제 #1
0
  private void initServices() {
    BundleContext context = Activator.getContext();
    if (context == null) {
      RuntimeLog.log(
          new Status(
              IStatus.ERROR,
              RegistryMessages.OWNER_NAME,
              0,
              RegistryMessages.bundle_not_activated,
              null));
      return;
    }

    debugTracker = new ServiceTracker(context, DebugOptions.class.getName(), null);
    debugTracker.open();

    bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
    bundleTracker.open();

    // locations
    final String FILTER_PREFIX =
        "(&(objectClass=org.eclipse.osgi.service.datalocation.Location)(type="; //$NON-NLS-1$
    Filter filter = null;
    try {
      filter = context.createFilter(FILTER_PREFIX + PROP_CONFIG_AREA + "))"); // $NON-NLS-1$
    } catch (InvalidSyntaxException e) {
      // ignore this.  It should never happen as we have tested the above format.
    }
    configurationLocationTracker = new ServiceTracker(context, filter, null);
    configurationLocationTracker.open();
  }
예제 #2
0
 public PackageAdmin getPackageAdmin() {
   if (bundleTracker == null) {
     RuntimeLog.log(
         new Status(
             IStatus.ERROR,
             RegistryMessages.OWNER_NAME,
             0,
             RegistryMessages.bundle_not_activated,
             null));
     return null;
   }
   return (PackageAdmin) bundleTracker.getService();
 }
예제 #3
0
 public boolean getBooleanDebugOption(String option, boolean defaultValue) {
   if (debugTracker == null) {
     RuntimeLog.log(
         new Status(
             IStatus.ERROR,
             RegistryMessages.OWNER_NAME,
             0,
             RegistryMessages.bundle_not_activated,
             null));
     return defaultValue;
   }
   DebugOptions options = (DebugOptions) debugTracker.getService();
   if (options != null) {
     String value = options.getOption(option);
     if (value != null) return value.equalsIgnoreCase("true"); // $NON-NLS-1$
   }
   return defaultValue;
 }
 protected void logError(String message) {
   // we log as an error to ensure it's shown
   RuntimeLog.log(new Status(IStatus.ERROR, "org.eclipse.e4.ui.css.core", message));
 }
예제 #5
0
 public void logError(String msg, Throwable e) {
   RuntimeLog.log(new Status(IStatus.ERROR, PI_AUTH, msg, e));
 }
예제 #6
0
 public void logMessage(String msg) {
   RuntimeLog.log(new Status(IStatus.INFO, PI_AUTH, msg, null));
 }