Skip to content

Instantly share code, notes, and snippets.

@GarstgerUnhold
Created April 30, 2010 12:45
Show Gist options
  • Save GarstgerUnhold/385137 to your computer and use it in GitHub Desktop.
Save GarstgerUnhold/385137 to your computer and use it in GitHub Desktop.
public DynamicToggleButton() {
super("de.hpi3d.tracing.ui.dynamicToggleButton");
comServ = (ICommandService) PlatformUI.getWorkbench()
.getService(ICommandService.class);
contextServ = (IContextService) PlatformUI
.getWorkbench().getService(IContextService.class);
ContextHelper.addListener(new ITracingContextListener() {
public void handleEvent(TracingContextEvent event) {
Type type = event.getType();
if (type.equals(Type.TOGGLETRACING) || type.equals(Type.DEBUGGINGSESSION)) {
update();
}
}
});
}
public void fill(ToolBar bar, int index) {
item = new ToolItem(bar, SWT.PUSH);
com = comServ.getCommand(TOGGLETRACINGCOMMANDID);
update();
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
new ToggleTracingCommandUtils().toggleToggleTracingCommand();
update();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment