Пример #1
0
 public void start(BundleContext inContext) throws Exception {
   GCActivator.context = inContext;
   DebugOptions debug = (DebugOptions) getService(DebugOptions.class.getName());
   if (debug != null) {
     CoreGarbageCollector.setDebugMode(debug.getBooleanOption(DEBUG_STRING, DEFAULT_DEBUG));
   }
 }
Пример #2
0
        @Override
        public void optionsChanged(DebugOptions options) {
          debug = options.getBooleanOption(Activator.PLUGIN_ID + "/debug", false); // $NON-NLS-1$

          debugProgressMonitors =
              debug
                  && options.getBooleanOption(
                      Activator.PLUGIN_ID + "/progress_monitors", false); // $NON-NLS-1$
        }
 public static void trace(String option, String msg, Throwable error) {
   final DebugOptions debugOptions = activator.getDebugOptions();
   if (debugOptions.isDebugEnabled()
       && debugOptions.getBooleanOption(PI_RENDERERS + option, false)) {
     System.out.println(msg);
     if (error != null) {
       error.printStackTrace(System.out);
     }
   }
   activator.getTrace().trace(option, msg, error);
 }
 public boolean getBooleanDebugOption(String option, boolean defaultValue) {
   if (debugTracker == null) {
     if (JobManager.DEBUG) JobMessages.message("Debug tracker is not set"); // $NON-NLS-1$
     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;
 }
Пример #5
0
 public boolean getBooleanOption(String option, boolean defaultValue) {
   if (debugTracker == null) {
     if (bundleContext == null) return defaultValue;
     debugTracker = new ServiceTracker(bundleContext, DebugOptions.class.getName(), null);
     debugTracker.open();
   }
   DebugOptions options = (DebugOptions) debugTracker.getService();
   if (options == null) return defaultValue;
   String value = options.getOption(option);
   if (value == null) return defaultValue;
   return value.equalsIgnoreCase("true"); // $NON-NLS-1$
 }
Пример #6
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
  * )
  */
 @SuppressWarnings({"rawtypes", "unchecked"})
 public void start(BundleContext context) throws Exception {
   super.start(context);
   plugin = this;
   DebugOptions service = null;
   final ServiceReference reference = context.getServiceReference(DebugOptions.class.getName());
   if (reference != null) service = (DebugOptions) context.getService(reference);
   if (service == null) return;
   try {
     LOGGING = service.getBooleanOption("org.eclipse.rcptt.tesla.core.am/logging", false);
   } finally {
     // we have what we want - release the service
     context.ungetService(reference);
   }
 }
Пример #7
0
 private void setDebugEnabled(final BundleContext bundleContext) {
   final ServiceReference<?> debugOptionsReference =
       bundleContext.getServiceReference(DebugOptions.class.getName());
   if (debugOptionsReference != null) {
     final DebugOptions debugOptions =
         (DebugOptions) bundleContext.getService(debugOptionsReference);
     if (debugOptions != null) {
       Log.debugEnabled =
           debugOptions.getBooleanOption(
               "org.eclipse.equinox.weaving.caching/debug", false); // $NON-NLS-1$
     }
   }
   if (debugOptionsReference != null) {
     bundleContext.ungetService(debugOptionsReference);
   }
 }
Пример #8
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;
 }
Пример #9
0
  @Override
  protected void doExecute() throws Exception {
    final DebugOptions debugOptions = DebugConsoleCommands.getDebugOptions();
    if (debugOptions.isDebugEnabled()) {
      printf("Traceing is currently enabled.");
    } else {
      printf("Traceing is not enabled.");
    }

    final Map<String, String> options = debugOptions.getOptions();
    final TreeSet<String> keys = new TreeSet<String>(options.keySet());
    if (!keys.isEmpty()) {
      printf("The following debug options are set:");
      for (final String key : keys) {
        printf("  %s = %s", key, options.get(key));
      }
    } else {
      printf("No debug options set.");
    }
  }
Пример #10
0
 public static boolean isDebugging(String option) {
   DebugOptions debugOptions = getDefault().getDebugOptions();
   return debugOptions != null
       && debugOptions.getBooleanOption(option == null ? ID : ID + option, false);
 }
Пример #11
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.osgi.service.debug.DebugOptionsListener#optionsChanged(org
  * .eclipse.osgi.service.debug.DebugOptions)
  */
 public void optionsChanged(DebugOptions options) {
   Trace.CONFIG = options.getBooleanOption(Activator.PLUGIN_ID + Trace.STRING_CONFIG, false);
   Trace.INFO = options.getBooleanOption(Activator.PLUGIN_ID + Trace.STRING_INFO, false);
   Trace.WARNING = options.getBooleanOption(Activator.PLUGIN_ID + Trace.STRING_WARNING, false);
   Trace.SEVERE = options.getBooleanOption(Activator.PLUGIN_ID + Trace.STRING_SEVERE, false);
   Trace.FINER = options.getBooleanOption(Activator.PLUGIN_ID + Trace.STRING_FINER, false);
   Trace.FINEST = options.getBooleanOption(Activator.PLUGIN_ID + Trace.STRING_FINEST, false);
   Trace.RESOURCES = options.getBooleanOption(Activator.PLUGIN_ID + Trace.STRING_RESOURCES, false);
   Trace.EXTENSION_POINT =
       options.getBooleanOption(Activator.PLUGIN_ID + Trace.STRING_EXTENSION_POINT, false);
   Trace.LISTENERS = options.getBooleanOption(Activator.PLUGIN_ID + Trace.STRING_LISTENERS, false);
   Trace.RUNTIME_TARGET =
       options.getBooleanOption(Activator.PLUGIN_ID + Trace.STRING_RUNTIME_TARGET, false);
   Trace.PERFORMANCE =
       options.getBooleanOption(Activator.PLUGIN_ID + Trace.STRING_PERFORMANCE, false);
   Trace.PUBLISHING =
       options.getBooleanOption(Activator.PLUGIN_ID + Trace.STRING_PUBLISHING, false);
 }