Exemplo n.º 1
0
 /*
  * (non-Javadoc)
  *
  * @see javax.swing.event.HyperlinkListener#hyperlinkUpdate(javax.swing.event.HyperlinkEvent)
  */
 public void hyperlinkUpdate(HyperlinkEvent e) {
   if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
     OpenBrowser openBrowser =
         ServiceController.getInstance()
             .getAdapter()
             .getCyServiceRegistrar()
             .getService(OpenBrowser.class);
     openBrowser.openURL(e.getURL().toString());
   }
 }
Exemplo n.º 2
0
 /**
  * Open an OS web browser to display the passed URL.
  *
  * @param url
  */
 public static void openURL(String url) {
   BundleContext context = PlugInScopeObjectManager.getManager().getBundleContext();
   ServiceReference serviceReference = context.getServiceReference(OpenBrowser.class.getName());
   boolean isOpened = false;
   if (serviceReference != null) {
     OpenBrowser browser = (OpenBrowser) context.getService(serviceReference);
     if (browser != null) {
       browser.openURL(url);
       isOpened = true;
     }
     context.ungetService(serviceReference);
   }
   // In case the passed URL cannot be opened!
   if (!isOpened) {
     showErrorMessage(
         "Error in Opening URL",
         "Error in opening URL: cannot find a configured browser in Cytoscape!");
   }
 }
Exemplo n.º 3
0
  /**
   * User has clicked on a HyperLink.
   *
   * @param evt HyperLink Event Object.
   */
  public void hyperlinkUpdate(HyperlinkEvent evt) {
    URL url = evt.getURL();

    if (url != null) {
      if (evt.getEventType() == HyperlinkEvent.EventType.ENTERED) {
        // CytoscapeWrapper.setStatusBarMsg(url.toString());
      } else if (evt.getEventType() == HyperlinkEvent.EventType.EXITED) {
        // CytoscapeWrapper.clearStatusBar();
      } else if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        browser.openURL(url.toString());
      }
    }
  }