use of org.eclipse.osgi.service.debug.DebugOptions in project eclipse.platform.runtime by eclipse.
the class Plugin method setDebugging.
/**
* Sets whether this plug-in is in debug mode.
* By default plug-ins are not in debug mode. A plug-in can put itself
* into debug mode or the user can set a debug option to do so.
* <p>
* Note that the plug-in's debug flag is initialized when the
* plug-in is started. The result of calling this method before the plug-in
* has started is unspecified.
* </p>
*
* @param value whether or not this plug-in is in debug mode
* XXX deprecate use the service and cache as needed
*/
public void setDebugging(boolean value) {
Bundle debugBundle = getBundle();
if (debugBundle == null) {
this.debug = value;
return;
}
// $NON-NLS-1$
String key = debugBundle.getSymbolicName() + "/debug";
final DebugOptions options = getDebugOptions();
if (options == null)
this.debug = value;
else {
if (!options.isDebugEnabled())
options.setDebugEnabled(true);
options.setOption(key, value ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
}
}
use of org.eclipse.osgi.service.debug.DebugOptions in project egit by eclipse.
the class GitTraceConfigurationDialog method performOk.
private void performOk() {
DebugOptions options = getOptions();
if (isDirty) {
options.setDebugEnabled(platformSwitch.getSelection());
if (platformSwitch.getSelection()) {
// if this is off, we won't be able to save anything
List<String> checkedKeys = new ArrayList<>();
for (Object checked : Arrays.asList(tv.getCheckedElements())) {
if (checked instanceof PluginNode)
checkedKeys.add(((PluginNode) checked).getPlugin() + MAINSWITCH);
else if (checked instanceof OptionNode)
checkedKeys.add(((OptionNode) checked).getOption());
}
for (PluginNode plugin : optionsMap.keySet()) {
Properties props = optionsMap.get(plugin);
for (Object keyObject : props.keySet()) {
String key = (String) keyObject;
boolean isOn = options.getBooleanOption(key, false);
boolean shouldBeOn = checkedKeys.contains(key);
if (isOn != shouldBeOn) {
options.setOption(key, Boolean.toString(shouldBeOn));
}
}
}
}
fillOptionsMapFromCurrent(options);
tv.refresh();
setDirty(false);
}
}
use of org.eclipse.osgi.service.debug.DebugOptions in project egit by eclipse.
the class GitTraceConfigurationDialog method initValues.
private void initValues() {
DebugOptions options = getOptions();
fillOptionsMapFromCurrent(options);
tv.setCheckStateProvider(new ICheckStateProvider() {
@Override
public boolean isGrayed(Object element) {
return false;
}
@Override
public boolean isChecked(Object element) {
Object data = element;
Properties props;
String key;
if (data instanceof PluginNode) {
PluginNode node = (PluginNode) data;
props = optionsMap.get(node);
key = node.getPlugin() + MAINSWITCH;
} else if (data instanceof OptionNode) {
OptionNode node = (OptionNode) data;
props = optionsMap.get(node.getPlugin());
key = node.getOption();
} else {
return false;
}
boolean active = Boolean.valueOf(props.getProperty(key)).booleanValue();
return active;
}
});
tv.setInput(PLUGIN_LIST);
tv.expandAll();
if (platformSwitch.getSelection() != options.isDebugEnabled()) {
platformSwitch.setSelection(options.isDebugEnabled());
}
traceFileLocation.setText(getOptions().getFile().getPath());
updateEnablement();
}
use of org.eclipse.osgi.service.debug.DebugOptions in project ecf by eclipse.
the class Activator method getDebugOptions.
@SuppressWarnings({ "unchecked", "rawtypes" })
public synchronized DebugOptions getDebugOptions() {
if (context == null)
return null;
if (debugOptionsTracker == null) {
debugOptionsTracker = new ServiceTracker(context, DebugOptions.class.getName(), null);
debugOptionsTracker.open();
}
return (DebugOptions) debugOptionsTracker.getService();
}
Aggregations