Beispiel #1
0
  public void deleteServer(Object server) {
    String id = ((Server) server).getName();
    Server serverIns = (Server) server;
    DOMConfigurator config = null;
    try {
      Bundle bundle = Platform.getBundle(Application.PLUGIN_ID);
      URL fileURL = FileLocator.toFileURL(BundleUtility.find(bundle, "configuration/nabee.xml"));

      config = new DOMConfigurator(fileURL.getPath());

      config.deleteConf("monitor/server", id);

      if (serverIns.getConnect().isConnect()) serverIns.getConnect().getProtocol()._close();

    } catch (ParserConfigurationException e) {
      IMessageBox.Error(shell, NBLabel.get(0x008F));
      return;
    } catch (TransformerException e) {
      IMessageBox.Error(shell, NBLabel.get(0x008F));
      return;
    } catch (IOException e) {
      IMessageBox.Error(shell, NBLabel.get(0x008F));
      return;
    } catch (SAXException e) {
      IMessageBox.Error(shell, NBLabel.get(0x008F));
      return;
    } catch (Exception e) {
      IMessageBox.Error(shell, NBLabel.get(0x008F));
      return;
    }

    serverIns.getParent().removeChild(id);
    treeViewer.refresh();
  }
 /**
  * Returns an image descriptor for the image file at the given plug-in relative path.
  *
  * @param imagePath path of the image to load (plug-in relative path)
  * @return the image descriptor of the image corresponding to the given path
  */
 @SuppressWarnings("restriction")
 private ImageDescriptor getImageDescriptor(final String imagePath) {
   URL fullPathString = BundleUtility.find(getBundle(), imagePath);
   if (fullPathString == null) {
     try {
       fullPathString = new URL(imagePath);
     } catch (MalformedURLException e) {
       return null;
     }
   }
   return ImageDescriptor.createFromURL(fullPathString);
 }