Search in sources :

Example 6 with DebugOptions

use of org.eclipse.osgi.service.debug.DebugOptions in project ecf by eclipse.

the class Trace method shouldTrace0.

protected static boolean shouldTrace0(String option) {
    if (option == null)
        return false;
    Activator activator = Activator.getDefault();
    if (activator == null)
        return false;
    DebugOptions debugOptions = activator.getDebugOptions();
    if (debugOptions == null)
        return false;
    String result = debugOptions.getOption(option);
    // $NON-NLS-1$
    return (result == null) ? false : result.equalsIgnoreCase("true");
}
Also used : Activator(org.eclipse.ecf.internal.core.identity.Activator) DebugOptions(org.eclipse.osgi.service.debug.DebugOptions)

Example 7 with DebugOptions

use of org.eclipse.osgi.service.debug.DebugOptions in project rt.equinox.framework by eclipse.

the class ModuleResolver method setDebugOptions.

void setDebugOptions() {
    DebugOptions options = adaptor.getDebugOptions();
    // may be null if debugging is not enabled
    if (options == null)
        return;
    boolean debugAll = options.getBooleanOption(OPTION_RESOLVER, false);
    DEBUG_ROOTS = debugAll || options.getBooleanOption(OPTION_ROOTS, false);
    DEBUG_PROVIDERS = debugAll || options.getBooleanOption(OPTION_PROVIDERS, false);
    DEBUG_HOOKS = debugAll || options.getBooleanOption(OPTION_HOOKS, false);
    DEBUG_USES = debugAll || options.getBooleanOption(OPTION_USES, false);
    DEBUG_WIRING = debugAll || options.getBooleanOption(OPTION_WIRING, false);
    DEBUG_REPORT = debugAll || options.getBooleanOption(OPTION_REPORT, false);
}
Also used : DebugOptions(org.eclipse.osgi.service.debug.DebugOptions)

Example 8 with DebugOptions

use of org.eclipse.osgi.service.debug.DebugOptions in project epp.mpc by eclipse.

the class MarketplaceClientUiPlugin method start.

@Override
public void start(BundleContext context) throws Exception {
    instance = this;
    super.start(context);
    MarketplaceClientUiPlugin.bundleContext = context;
    clientServiceTracker = new ServiceTracker<IMarketplaceClientService, IMarketplaceClientService>(context, IMarketplaceClientService.class, null);
    clientServiceTracker.open();
    resourceProvider = new ResourceProvider();
    Hashtable<String, String> props = new Hashtable<String, String>(2);
    props.put(org.eclipse.osgi.service.debug.DebugOptions.LISTENER_SYMBOLICNAME, MarketplaceClientUi.BUNDLE_ID);
    context.registerService(DebugOptionsListener.class.getName(), new DebugOptionsListener() {

        public void optionsChanged(DebugOptions options) {
            DebugTrace debugTrace = null;
            boolean debug = options.getBooleanOption(MarketplaceClientUi.BUNDLE_ID + DEBUG_OPTION, false);
            if (debug) {
                debugTrace = options.newDebugTrace(MarketplaceClientUi.BUNDLE_ID);
            }
            DEBUG = debug;
            MarketplaceClientUiPlugin.debugTrace = debugTrace;
        }
    }, props);
}
Also used : DebugTrace(org.eclipse.osgi.service.debug.DebugTrace) IMarketplaceClientService(org.eclipse.epp.mpc.ui.IMarketplaceClientService) Hashtable(java.util.Hashtable) ResourceProvider(org.eclipse.epp.internal.mpc.ui.catalog.ResourceProvider) DebugOptionsListener(org.eclipse.osgi.service.debug.DebugOptionsListener) DebugOptions(org.eclipse.osgi.service.debug.DebugOptions)

Example 9 with DebugOptions

use of org.eclipse.osgi.service.debug.DebugOptions in project jbosstools-openshift by jbosstools.

the class Trace method isDebugging.

public boolean isDebugging() {
    Bundle bundle = FrameworkUtil.getBundle(getClass());
    if (bundle == null) {
        return DEFAULT_DEBUG;
    }
    DebugOptions debugOptions = getDebugOptions();
    if (debugOptions == null) {
        return DEFAULT_DEBUG;
    }
    if (!debugOptions.isDebugEnabled()) {
        return false;
    }
    if (!debugOptions.getBooleanOption(pluginId + GLOBAL_DEBUG_KEY, DEFAULT_DEBUG)) {
        return false;
    }
    return debugOptions.getBooleanOption(pluginId + CLIENT_DEBUG_KEY, DEFAULT_DEBUG);
}
Also used : Bundle(org.osgi.framework.Bundle) DebugOptions(org.eclipse.osgi.service.debug.DebugOptions)

Example 10 with DebugOptions

use of org.eclipse.osgi.service.debug.DebugOptions in project eclipse.platform.runtime by eclipse.

the class Activator method getBooleanDebugOption.

/**
 * Return the boolean value in the debug options for the given key, or
 * return the default value if there is none.
 */
public boolean getBooleanDebugOption(String option, boolean defaultValue) {
    if (debugTracker == null) {
        debugTracker = new ServiceTracker<>(bundleContext, DebugOptions.class, null);
        debugTracker.open();
    }
    DebugOptions options = (DebugOptions) debugTracker.getService();
    if (options != null) {
        String value = options.getOption(option);
        if (value != null)
            // $NON-NLS-1$
            return "true".equalsIgnoreCase(value);
    }
    return defaultValue;
}
Also used : DebugOptions(org.eclipse.osgi.service.debug.DebugOptions)

Aggregations

DebugOptions (org.eclipse.osgi.service.debug.DebugOptions)14 ServiceTracker (org.osgi.util.tracker.ServiceTracker)3 Hashtable (java.util.Hashtable)2 Properties (java.util.Properties)2 DebugOptionsListener (org.eclipse.osgi.service.debug.DebugOptionsListener)2 DebugTrace (org.eclipse.osgi.service.debug.DebugTrace)2 ArrayList (java.util.ArrayList)1 IEclipseContext (org.eclipse.e4.core.contexts.IEclipseContext)1 Activator (org.eclipse.ecf.internal.core.identity.Activator)1 ResourceProvider (org.eclipse.epp.internal.mpc.ui.catalog.ResourceProvider)1 IMarketplaceClientService (org.eclipse.epp.mpc.ui.IMarketplaceClientService)1 ICheckStateProvider (org.eclipse.jface.viewers.ICheckStateProvider)1 Test (org.junit.Test)1 Bundle (org.osgi.framework.Bundle)1 BundleActivator (org.osgi.framework.BundleActivator)1 BundleContext (org.osgi.framework.BundleContext)1