Search in sources :

Example 1 with InterfacesTab

use of org.netxms.ui.eclipse.objectview.objecttabs.InterfacesTab in project netxms by netxms.

the class HideSubInterfacesHandler 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 InterfacesTab)) {
            ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
            // $NON-NLS-1$
            Command command = service.getCommand("org.netxms.ui.eclipse.objectview.commands.hideSubInterfaces");
            // $NON-NLS-1$
            State state = command.getState("org.netxms.ui.eclipse.objectview.commands.hideSubInterfaces.state");
            boolean isChecked = !(Boolean) state.getValue();
            state.setValue(isChecked);
            ((InterfacesTab) tab).hideSubInterfaces(isChecked);
            service.refreshElements(event.getCommand().getId(), null);
        }
    }
    return null;
}
Also used : InterfacesTab(org.netxms.ui.eclipse.objectview.objecttabs.InterfacesTab) Command(org.eclipse.core.commands.Command) State(org.eclipse.core.commands.State) IEvaluationContext(org.eclipse.core.expressions.IEvaluationContext) ICommandService(org.eclipse.ui.commands.ICommandService)

Example 2 with InterfacesTab

use of org.netxms.ui.eclipse.objectview.objecttabs.InterfacesTab in project netxms by netxms.

the class ToggleFilterHandler method execute.

@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 InterfacesTab)) {
            ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
            // $NON-NLS-1$
            Command command = service.getCommand("org.netxms.ui.eclipse.objectview.commands.show_filter");
            // $NON-NLS-1$
            State state = command.getState("org.netxms.ui.eclipse.objectview.commands.show_filter.state");
            boolean isChecked = !(Boolean) state.getValue();
            state.setValue(isChecked);
            ((InterfacesTab) tab).enableFilter(isChecked);
            service.refreshElements(event.getCommand().getId(), null);
        }
    }
    return null;
}
Also used : InterfacesTab(org.netxms.ui.eclipse.objectview.objecttabs.InterfacesTab) Command(org.eclipse.core.commands.Command) State(org.eclipse.core.commands.State) IEvaluationContext(org.eclipse.core.expressions.IEvaluationContext) ICommandService(org.eclipse.ui.commands.ICommandService)

Aggregations

Command (org.eclipse.core.commands.Command)2 State (org.eclipse.core.commands.State)2 IEvaluationContext (org.eclipse.core.expressions.IEvaluationContext)2 ICommandService (org.eclipse.ui.commands.ICommandService)2 InterfacesTab (org.netxms.ui.eclipse.objectview.objecttabs.InterfacesTab)2