use of org.netxms.ui.eclipse.datacollection.objecttabs.LastValues in project netxms by netxms.
the class ToggleDCIFilterHandler method execute.
/* (non-Javadoc)
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Object object = event.getApplicationContext();
if (object instanceof IEvaluationContext) {
// $NON-NLS-1$
Object tab = ((IEvaluationContext) object).getVariable("org.netxms.ui.eclipse.objectview.ActiveTab");
if ((tab != null) && (tab instanceof LastValues)) {
ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
// $NON-NLS-1$
Command command = service.getCommand("org.netxms.ui.eclipse.datacollection.commands.show_dci_filter");
// $NON-NLS-1$
State state = command.getState("org.netxms.ui.eclipse.datacollection.commands.show_dci_filter.state");
boolean isChecked = !(Boolean) state.getValue();
state.setValue(isChecked);
((LastValues) tab).setFilterEnabled(isChecked);
service.refreshElements(event.getCommand().getId(), null);
}
}
return null;
}
Aggregations