Search in sources :

Example 46 with AbstractNode

use of org.netxms.client.objects.AbstractNode in project netxms by netxms.

the class MibExplorer method init.

/* (non-Javadoc)
	 * @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
	 */
@Override
public void init(IViewSite site, IMemento memento) throws PartInitException {
    if (memento != null) {
        // $NON-NLS-1$
        long nodeId = safeCast(memento.getInteger("CurrentNode"), 0);
        if (nodeId != 0) {
            AbstractObject object = ((NXCSession) ConsoleSharedData.getSession()).findObjectById(nodeId);
            if ((object != null) && (object instanceof AbstractNode))
                currentNode = (AbstractNode) object;
        }
    }
    session = (NXCSession) ConsoleSharedData.getSession();
    IDialogSettings settings = Activator.getDefault().getDialogSettings();
    initShowFilter = safeCast(settings.get("MibExplorer.showFilter"), settings.getBoolean("MibExplorer.showFilter"), initShowFilter);
    super.init(site, memento);
}
Also used : NXCSession(org.netxms.client.NXCSession) AbstractNode(org.netxms.client.objects.AbstractNode) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) AbstractObject(org.netxms.client.objects.AbstractObject)

Example 47 with AbstractNode

use of org.netxms.client.objects.AbstractNode in project netxms by netxms.

the class MibExplorer method createActions.

/**
 * Create actions
 */
private void createActions() {
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    actionRefresh = new RefreshAction() {

        @Override
        public void run() {
            mibBrowser.refreshTree();
        }
    };
    actionWalk = new Action(Messages.get().MibExplorer_Walk) {

        @Override
        public void run() {
            doWalk();
        }
    };
    actionWalk.setEnabled(currentNode != null);
    actionSetNode = new Action(Messages.get().MibExplorer_SetNodeObject) {

        @Override
        public void run() {
            ObjectSelectionDialog dlg = new ObjectSelectionDialog(MibExplorer.this.getSite().getShell(), null, ObjectSelectionDialog.createNodeSelectionFilter(false));
            dlg.enableMultiSelection(false);
            if (dlg.open() == Window.OK) {
                setNode((AbstractNode) dlg.getSelectedObjects().get(0));
            }
        }
    };
    actionSelect = new Action("Select in MIB tree") {

        @Override
        public void run() {
            selectInTree();
        }
    };
    actionSelect.setEnabled(false);
    actionExportToCsv = new ExportToCsvAction(this, viewer, true);
    actionShowFilter = new Action("Show filter", Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            enableFilter(!initShowFilter);
            actionShowFilter.setChecked(initShowFilter);
        }
    };
    actionShowFilter.setChecked(initShowFilter);
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.snmp.commands.showFilter");
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), new ActionHandler(actionShowFilter));
}
Also used : ObjectSelectionDialog(org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog) ExportToCsvAction(org.netxms.ui.eclipse.actions.ExportToCsvAction) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) Action(org.eclipse.jface.action.Action) IHandlerService(org.eclipse.ui.handlers.IHandlerService) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) AbstractNode(org.netxms.client.objects.AbstractNode) ExportToCsvAction(org.netxms.ui.eclipse.actions.ExportToCsvAction) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Aggregations

AbstractNode (org.netxms.client.objects.AbstractNode)47 AbstractObject (org.netxms.client.objects.AbstractObject)27 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)14 NXCSession (org.netxms.client.NXCSession)13 ArrayList (java.util.ArrayList)12 Cluster (org.netxms.client.objects.Cluster)9 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)6 Composite (org.eclipse.swt.widgets.Composite)6 PartInitException (org.eclipse.ui.PartInitException)6 MobileDevice (org.netxms.client.objects.MobileDevice)6 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)6 NXCException (org.netxms.client.NXCException)5 Interface (org.netxms.client.objects.Interface)5 Sensor (org.netxms.client.objects.Sensor)5 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)4 GridLayout (org.eclipse.swt.layout.GridLayout)4 DataCollectionItem (org.netxms.client.datacollection.DataCollectionItem)4 Subnet (org.netxms.client.objects.Subnet)4 ISelection (org.eclipse.jface.viewers.ISelection)3