Search in sources :

Example 16 with FilterText

use of org.netxms.ui.eclipse.widgets.FilterText in project netxms by netxms.

the class DataCollectionEditor method createPartControl.

/* (non-Javadoc)
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
	 */
@Override
public void createPartControl(Composite parent) {
    content = new Composite(parent, SWT.NONE);
    content.setLayout(new FormLayout());
    // Create filter area
    filterText = new FilterText(content, SWT.NONE);
    filterText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            onFilterModify();
        }
    });
    final String[] names = { Messages.get().DataCollectionEditor_ColID, Messages.get().DataCollectionEditor_ColOrigin, Messages.get().DataCollectionEditor_ColDescription, Messages.get().DataCollectionEditor_ColParameter, Messages.get().DataCollectionEditor_ColDataType, Messages.get().DataCollectionEditor_ColPollingInterval, Messages.get().DataCollectionEditor_ColRetentionTime, Messages.get().DataCollectionEditor_ColStatus, Messages.get().DataCollectionEditor_ColThresholds, Messages.get().DataCollectionEditor_ColTemplate };
    final int[] widths = { 60, 100, 250, 200, 90, 90, 90, 100, 200, 150 };
    viewer = new SortableTableViewer(content, names, widths, 0, SWT.UP, SortableTableViewer.DEFAULT_STYLE);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new DciLabelProvider());
    viewer.setComparator(new DciComparator((DciLabelProvider) viewer.getLabelProvider()));
    filter = new DciFilter();
    viewer.addFilter(filter);
    // $NON-NLS-1$
    WidgetHelper.restoreTableViewerSettings(viewer, settings, "DataCollectionEditor");
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            if (selection != null) {
                actionEdit.setEnabled(selection.size() == 1);
                actionDelete.setEnabled(selection.size() > 0);
                actionCopy.setEnabled(selection.size() > 0);
                actionMove.setEnabled(selection.size() > 0);
                actionConvert.setEnabled(selection.size() > 0);
                actionDuplicate.setEnabled(selection.size() > 0);
                Iterator<?> it = selection.iterator();
                boolean canActivate = false;
                boolean canDisable = false;
                while (it.hasNext() && (!canActivate || !canDisable)) {
                    DataCollectionObject dci = (DataCollectionObject) it.next();
                    if (dci.getStatus() != DataCollectionObject.ACTIVE)
                        canActivate = true;
                    if (dci.getStatus() != DataCollectionObject.DISABLED)
                        canDisable = true;
                }
                actionActivate.setEnabled(canActivate);
                actionDisable.setEnabled(canDisable);
            }
        }
    });
    viewer.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            actionEdit.run();
        }
    });
    viewer.getTable().addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            // $NON-NLS-1$
            WidgetHelper.saveTableViewerSettings(viewer, settings, "DataCollectionEditor");
            settings.put("DataCollectionEditor.hideModificationWarnings", hideModificationWarnings);
        }
    });
    // Setup layout
    FormData fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(filterText);
    fd.right = new FormAttachment(100, 0);
    fd.bottom = new FormAttachment(100, 0);
    viewer.getTable().setLayoutData(fd);
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    filterText.setLayoutData(fd);
    createActions();
    contributeToActionBars();
    createPopupMenu();
    filterText.setCloseAction(new Action() {

        @Override
        public void run() {
            enableFilter(false);
            actionShowFilter.setChecked(false);
        }
    });
    // Request server to open data collection configuration
    new ConsoleJob(Messages.get().DataCollectionEditor_OpenJob_Title + object.getObjectName(), this, Activator.PLUGIN_ID, null) {

        @Override
        protected void runInternal(IProgressMonitor monitor) throws Exception {
            dciConfig = session.openDataCollectionConfiguration(object.getObjectId());
            dciConfig.setUserData(viewer);
            runInUIThread(new Runnable() {

                @Override
                public void run() {
                    viewer.setInput(dciConfig.getItems());
                }
            });
        }

        @Override
        protected void jobFailureHandler() {
            runInUIThread(new Runnable() {

                @Override
                public void run() {
                    DataCollectionEditor.this.getViewSite().getPage().hideView(DataCollectionEditor.this);
                }
            });
        }

        @Override
        protected String getErrorMessage() {
            return Messages.get().DataCollectionEditor_OpenJob_Error + object.getObjectName();
        }
    }.start();
    // Set initial focus to filter input line
    if (actionShowFilter.isChecked())
        filterText.setFocus();
    else
        // Will hide filter area correctly
        enableFilter(false);
    hideModificationWarnings = getBooleanFromSettings("DataCollectionEditor.hideModificationWarnings", false);
    activateContext();
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) ExportToCsvAction(org.netxms.ui.eclipse.actions.ExportToCsvAction) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) Action(org.eclipse.jface.action.Action) ModifyListener(org.eclipse.swt.events.ModifyListener) SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) DciLabelProvider(org.netxms.ui.eclipse.datacollection.views.helpers.DciLabelProvider) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) Iterator(java.util.Iterator) FilterText(org.netxms.ui.eclipse.widgets.FilterText) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) FormAttachment(org.eclipse.swt.layout.FormAttachment) DciFilter(org.netxms.ui.eclipse.datacollection.views.helpers.DciFilter) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) DataCollectionObject(org.netxms.client.datacollection.DataCollectionObject) DciComparator(org.netxms.ui.eclipse.datacollection.views.helpers.DciComparator) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) PartInitException(org.eclipse.ui.PartInitException) NXCException(org.netxms.client.NXCException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider)

Example 17 with FilterText

use of org.netxms.ui.eclipse.widgets.FilterText in project netxms by netxms.

the class SummaryTableManager method createPartControl.

/* (non-Javadoc)
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
	 */
@Override
public void createPartControl(Composite parent) {
    // Create interface area
    tableArea = new Composite(parent, SWT.BORDER);
    FormLayout formLayout = new FormLayout();
    tableArea.setLayout(formLayout);
    // Create filter
    filterText = new FilterText(tableArea, SWT.NONE);
    filterText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            onFilterModify();
        }
    });
    filterText.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            settings.put("SummaryTableManager.showFilter", initShowFilter);
        }
    });
    final String[] names = { Messages.get().SummaryTableManager_ID, Messages.get().SummaryTableManager_MenuPath, Messages.get().SummaryTableManager_Title };
    final int[] widths = { 90, 250, 200 };
    viewer = new SortableTableViewer(tableArea, names, widths, COLUMN_MENU_PATH, SWT.UP, SortableTableViewer.DEFAULT_STYLE);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new SummaryTableLabelProvider());
    viewer.setComparator(new SummaryTableComparator());
    filter = new SummaryTableFilter();
    viewer.addFilter(filter);
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            actionEdit.setEnabled(selection.size() == 1);
            actionDelete.setEnabled(selection.size() > 0);
        }
    });
    viewer.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            editSummaryTable();
        }
    });
    // Setup layout
    FormData fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(filterText);
    fd.right = new FormAttachment(100, 0);
    fd.bottom = new FormAttachment(100, 0);
    viewer.getControl().setLayoutData(fd);
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    filterText.setLayoutData(fd);
    createActions();
    contributeToActionBars();
    createPopupMenu();
    filterText.setCloseAction(actionShowFilter);
    enableFilter(initShowFilter);
    refresh();
    listener = new SessionListener() {

        @Override
        public void notificationHandler(SessionNotification n) {
            if (n.getCode() == SessionNotification.DCI_SUMMARY_TABLE_DELETED) {
                final int id = (int) n.getSubCode();
                getSite().getShell().getDisplay().asyncExec(new Runnable() {

                    @Override
                    public void run() {
                        if (descriptors.remove(id) != null)
                            viewer.setInput(descriptors.values().toArray());
                    }
                });
            } else if (n.getCode() == SessionNotification.DCI_SUMMARY_TABLE_UPDATED) {
                getSite().getShell().getDisplay().asyncExec(new Runnable() {

                    @Override
                    public void run() {
                        refresh();
                    }
                });
            }
        }
    };
    session.addListener(listener);
    activateContext();
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) ModifyListener(org.eclipse.swt.events.ModifyListener) SummaryTableLabelProvider(org.netxms.ui.eclipse.datacollection.views.helpers.SummaryTableLabelProvider) SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) FilterText(org.netxms.ui.eclipse.widgets.FilterText) SessionNotification(org.netxms.client.SessionNotification) FormAttachment(org.eclipse.swt.layout.FormAttachment) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) SummaryTableFilter(org.netxms.ui.eclipse.datacollection.views.helpers.SummaryTableFilter) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) SummaryTableComparator(org.netxms.ui.eclipse.datacollection.views.helpers.SummaryTableComparator) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) SessionListener(org.netxms.client.SessionListener)

Example 18 with FilterText

use of org.netxms.ui.eclipse.widgets.FilterText in project netxms by netxms.

the class InterfacesTab method createTabContent.

/* (non-Javadoc)
	 * @see org.netxms.ui.eclipse.objectview.objecttabs.ObjectTab#createTabContent(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected void createTabContent(Composite parent) {
    final IDialogSettings settings = Activator.getDefault().getDialogSettings();
    // $NON-NLS-1$ //$NON-NLS-2$
    showFilter = safeCast(settings.get("InterfacesTab.showFilter"), settings.getBoolean("InterfacesTab.showFilter"), showFilter);
    // $NON-NLS-1$ //$NON-NLS-2$
    hideSubInterfaces = safeCast(settings.get("InterfacesTab.hideSubInterfaces"), settings.getBoolean("InterfacesTab.hideSubInterfaces"), hideSubInterfaces);
    // Create interface area
    interfacesArea = new Composite(parent, SWT.BORDER);
    FormLayout formLayout = new FormLayout();
    interfacesArea.setLayout(formLayout);
    // Create filter
    filterText = new FilterText(interfacesArea, SWT.NONE);
    filterText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            onFilterModify();
        }
    });
    filterText.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            // $NON-NLS-1$
            settings.put("InterfacesTab.showFilter", showFilter);
            // $NON-NLS-1$
            settings.put("InterfacesTab.hideSubInterfaces", hideSubInterfaces);
        }
    });
    Action action = new Action() {

        @Override
        public void run() {
            enableFilter(false);
            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");
            state.setValue(false);
            service.refreshElements(command.getId(), null);
        }
    };
    setFilterCloseAction(action);
    // Check/uncheck menu items
    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");
    state.setValue(showFilter);
    service.refreshElements(command.getId(), null);
    // $NON-NLS-1$
    command = service.getCommand("org.netxms.ui.eclipse.objectview.commands.hideSubInterfaces");
    // $NON-NLS-1$
    state = command.getState("org.netxms.ui.eclipse.objectview.commands.hideSubInterfaces.state");
    state.setValue(hideSubInterfaces);
    service.refreshElements(command.getId(), null);
    // Setup layout
    FormData fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    filterText.setLayoutData(fd);
    final String[] names = { Messages.get().InterfacesTab_ColId, Messages.get().InterfacesTab_ColName, Messages.get().InterfacesTab_Alias, Messages.get().InterfacesTab_ColIfType, Messages.get().InterfacesTab_ColIfIndex, Messages.get().InterfacesTab_ColSlot, Messages.get().InterfacesTab_ColPort, Messages.get().InterfacesTab_MTU, Messages.get().InterfacesTab_Speed, Messages.get().InterfacesTab_ColDescription, Messages.get().InterfacesTab_ColMacAddr, Messages.get().InterfacesTab_ColIpAddr, Messages.get().InterfacesTab_ColPeerNode, Messages.get().InterfacesTab_ColPeerMAC, Messages.get().InterfacesTab_ColPeerIP, Messages.get().InterfacesTab_PeerDiscoveryProtocol, Messages.get().InterfacesTab_ColAdminState, Messages.get().InterfacesTab_ColOperState, Messages.get().InterfacesTab_ColExpState, Messages.get().InterfacesTab_ColStatus, Messages.get().InterfacesTab_Col8021xPAE, Messages.get().InterfacesTab_Col8021xBackend };
    final int[] widths = { 60, 150, 150, 150, 70, 70, 70, 70, 90, 150, 100, 90, 150, 100, 90, 80, 80, 80, 80, 80, 80, 80 };
    viewer = new SortableTableViewer(interfacesArea, names, widths, COLUMN_NAME, SWT.UP, SWT.FULL_SELECTION | SWT.MULTI);
    labelProvider = new InterfaceListLabelProvider();
    viewer.setLabelProvider(labelProvider);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setComparator(new InterfaceListComparator());
    viewer.getTable().setHeaderVisible(true);
    viewer.getTable().setLinesVisible(true);
    filter = new InterfacesTabFilter();
    filter.setHideSubInterfaces(hideSubInterfaces);
    viewer.addFilter(filter);
    // $NON-NLS-1$
    WidgetHelper.restoreTableViewerSettings(viewer, Activator.getDefault().getDialogSettings(), "InterfaceTable.V4");
    viewer.getTable().addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            // $NON-NLS-1$
            WidgetHelper.saveColumnSettings(viewer.getTable(), Activator.getDefault().getDialogSettings(), "InterfaceTable.V4");
        }
    });
    // Setup layout
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.top = new FormAttachment(filterText, 0, SWT.BOTTOM);
    fd.bottom = new FormAttachment(100, 0);
    fd.right = new FormAttachment(100, 0);
    viewer.getControl().setLayoutData(fd);
    createActions();
    createPopupMenu();
    // Set initial focus to filter input line
    if (showFilter)
        filterText.setFocus();
    else
        // Will hide filter area correctly
        enableFilter(false);
    sessionListener = new SessionListener() {

        @Override
        public void notificationHandler(SessionNotification n) {
            if (n.getCode() == SessionNotification.OBJECT_CHANGED) {
                AbstractObject object = (AbstractObject) n.getObject();
                if ((object != null) && (object instanceof Interface) && (getObject() != null) && object.isDirectChildOf(getObject().getObjectId())) {
                    viewer.getControl().getDisplay().asyncExec(new Runnable() {

                        @Override
                        public void run() {
                            refresh();
                        }
                    });
                }
            }
        }
    };
    ConsoleSharedData.getSession().addListener(sessionListener);
}
Also used : InterfaceListLabelProvider(org.netxms.ui.eclipse.objectview.objecttabs.helpers.InterfaceListLabelProvider) DisposeListener(org.eclipse.swt.events.DisposeListener) ExportToCsvAction(org.netxms.ui.eclipse.actions.ExportToCsvAction) Action(org.eclipse.jface.action.Action) ModifyListener(org.eclipse.swt.events.ModifyListener) SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ICommandService(org.eclipse.ui.commands.ICommandService) ModifyEvent(org.eclipse.swt.events.ModifyEvent) InterfacesTabFilter(org.netxms.ui.eclipse.objectview.objecttabs.helpers.InterfacesTabFilter) FilterText(org.netxms.ui.eclipse.widgets.FilterText) InterfaceListComparator(org.netxms.ui.eclipse.objectview.objecttabs.helpers.InterfaceListComparator) SessionNotification(org.netxms.client.SessionNotification) FormAttachment(org.eclipse.swt.layout.FormAttachment) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) Command(org.eclipse.core.commands.Command) State(org.eclipse.core.commands.State) AbstractObject(org.netxms.client.objects.AbstractObject) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) SessionListener(org.netxms.client.SessionListener) Interface(org.netxms.client.objects.Interface)

Example 19 with FilterText

use of org.netxms.ui.eclipse.widgets.FilterText in project netxms by netxms.

the class MibExplorer method createPartControl.

/* (non-Javadoc)
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
	 */
@Override
public void createPartControl(Composite parent) {
    // $NON-NLS-1$
    headerFont = new Font(parent.getDisplay(), "Verdana", 11, SWT.BOLD);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = 0;
    parent.setLayout(layout);
    header = new CLabel(parent, SWT.BORDER);
    header.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    header.setFont(headerFont);
    header.setBackground(SharedColors.getColor(SharedColors.MIB_EXPLORER_HEADER_BACKGROUND, parent.getDisplay()));
    header.setForeground(SharedColors.getColor(SharedColors.MIB_EXPLORER_HEADER_TEXT, parent.getDisplay()));
    // $NON-NLS-1$
    header.setText((currentNode != null) ? currentNode.getObjectName() : "");
    SashForm splitter = new SashForm(parent, SWT.VERTICAL);
    splitter.setLayout(new FillLayout());
    splitter.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    SashForm mibViewSplitter = new SashForm(splitter, SWT.HORIZONTAL);
    mibViewSplitter.setLayout(new FillLayout());
    mibBrowser = new MibBrowser(mibViewSplitter, SWT.BORDER);
    mibBrowser.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            MibObject object = mibBrowser.getSelection();
            details.setObject(object);
        }
    });
    details = new MibObjectDetails(mibViewSplitter, SWT.BORDER, true, mibBrowser);
    // Create result area
    resultArea = new Composite(splitter, SWT.BORDER);
    FormLayout formLayout = new FormLayout();
    resultArea.setLayout(formLayout);
    // Create filter area
    filterText = new FilterText(resultArea, SWT.BORDER);
    filterText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            onFilterModify();
        }
    });
    filterText.setCloseAction(new Action() {

        @Override
        public void run() {
            enableFilter(false);
            actionShowFilter.setChecked(initShowFilter);
        }
    });
    // Setup layout
    FormData fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    ;
    fd.top = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    filterText.setLayoutData(fd);
    // walk results
    viewer = new TableViewer(resultArea, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    viewer.getTable().setLinesVisible(true);
    viewer.getTable().setHeaderVisible(true);
    setupViewerColumns();
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new SnmpValueLabelProvider());
    filter = new SnmpWalkFilter();
    viewer.addFilter(filter);
    viewer.getTable().addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            // $NON-NLS-1$
            WidgetHelper.saveColumnSettings(viewer.getTable(), Activator.getDefault().getDialogSettings(), "MibExplorer");
        }
    });
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            actionSelect.setEnabled(selection.size() == 1);
        }
    });
    viewer.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(DoubleClickEvent event) {
            selectInTree();
        }
    });
    // Setup layout
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    ;
    fd.top = new FormAttachment(filterText, 0, SWT.BOTTOM);
    fd.bottom = new FormAttachment(100, 0);
    fd.right = new FormAttachment(100, 0);
    viewer.getControl().setLayoutData(fd);
    splitter.setWeights(new int[] { 70, 30 });
    createActions();
    contributeToActionBars();
    createTreePopupMenu();
    createResultsPopupMenu();
    activateContext();
    // Set initial focus to filter input line
    if (initShowFilter)
        filterText.setFocus();
    else
        // Will hide filter area correctly
        enableFilter(false);
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) DisposeListener(org.eclipse.swt.events.DisposeListener) ExportToCsvAction(org.netxms.ui.eclipse.actions.ExportToCsvAction) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) Action(org.eclipse.jface.action.Action) SnmpValueLabelProvider(org.netxms.ui.eclipse.snmp.views.helpers.SnmpValueLabelProvider) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DisposeEvent(org.eclipse.swt.events.DisposeEvent) Font(org.eclipse.swt.graphics.Font) MibObjectDetails(org.netxms.ui.eclipse.snmp.widgets.MibObjectDetails) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) FilterText(org.netxms.ui.eclipse.widgets.FilterText) FormAttachment(org.eclipse.swt.layout.FormAttachment) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) FillLayout(org.eclipse.swt.layout.FillLayout) SnmpWalkFilter(org.netxms.ui.eclipse.snmp.views.helpers.SnmpWalkFilter) SashForm(org.eclipse.swt.custom.SashForm) MibBrowser(org.netxms.ui.eclipse.snmp.widgets.MibBrowser) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) MibObject(org.netxms.client.snmp.MibObject) TableViewer(org.eclipse.jface.viewers.TableViewer)

Aggregations

ModifyEvent (org.eclipse.swt.events.ModifyEvent)19 ModifyListener (org.eclipse.swt.events.ModifyListener)19 FilterText (org.netxms.ui.eclipse.widgets.FilterText)19 FormAttachment (org.eclipse.swt.layout.FormAttachment)15 FormData (org.eclipse.swt.layout.FormData)15 FormLayout (org.eclipse.swt.layout.FormLayout)15 Composite (org.eclipse.swt.widgets.Composite)15 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)12 Action (org.eclipse.jface.action.Action)11 DisposeEvent (org.eclipse.swt.events.DisposeEvent)11 DisposeListener (org.eclipse.swt.events.DisposeListener)11 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)10 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)10 SortableTableViewer (org.netxms.ui.eclipse.widgets.SortableTableViewer)10 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)9 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)8 RefreshAction (org.netxms.ui.eclipse.actions.RefreshAction)8 GridLayout (org.eclipse.swt.layout.GridLayout)6