/** Unloads the MIB file from the currently selected symbol. */ protected void unloadMib() { MibNode node = getSelectedNode(); if (node == null) { return; } while (node.getLevel() > 1) { node = (MibNode) node.getParent(); } browser.unloadMib(node.getName()); refreshTree(); }
/** * Sets the selected node based on the specified OID. The MIB that will be searched is based on * the currently selected MIB node. * * @param oid the OID to select */ public void setSelectedNode(String oid) { // Find tree node MibValueSymbol symbol = browser.findMibSymbol(oid); MibNode node = MibTreeBuilder.getInstance().getNode(symbol); if (node == null) { mibTree.clearSelection(); return; } // Select tree node TreePath path = new TreePath(node.getPath()); mibTree.expandPath(path); mibTree.scrollPathToVisible(path); mibTree.setSelectionPath(path); mibTree.repaint(); }
/** * Loads a MIB file from a specified source. * * @param src the MIB file or URL */ public void loadMib(String src) { String message = null; setStatus("Loading " + src + "..."); try { browser.loadMib(src); } catch (FileNotFoundException e) { message = "Failed to load " + e.getMessage(); } catch (IOException e) { message = "Failed to load " + src + ": " + e.getMessage(); } catch (MibLoaderException e) { message = "Failed to load " + src; ByteArrayOutputStream output = new ByteArrayOutputStream(); e.getLog().printTo(new PrintStream(output)); descriptionArea.append(output.toString()); } if (message != null) { JOptionPane.showMessageDialog(this, message, "MIB Loading Error", JOptionPane.ERROR_MESSAGE); } setStatus(null); }
/** Shows the about dialog. */ protected void showAbout() { AboutDialog dialog = new AboutDialog(this, browser.getBuildInfo()); dialog.setVisible(true); }
/** Unloads all MIB files currently loaded. */ protected void unloadAllMibs() { browser.unloadAllMibs(); refreshTree(); }