Search in sources :

Example 1 with HTMLFrameHyperlinkEvent

use of javax.swing.text.html.HTMLFrameHyperlinkEvent in project android by JetBrains.

the class LintNotificationPanel method hyperlinkUpdate.

// ---- Implements HyperlinkListener ----
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        JEditorPane pane = (JEditorPane) e.getSource();
        if (e instanceof HTMLFrameHyperlinkEvent) {
            HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
            HTMLDocument doc = (HTMLDocument) pane.getDocument();
            doc.processHTMLFrameHyperlinkEvent(evt);
            return;
        }
        String url = e.getDescription();
        NlModel model = myScreenView.getModel();
        Module module = model.getModule();
        PsiFile file = model.getFile();
        DataContext dataContext = DataManager.getInstance().getDataContext(myScreenView.getSurface());
        assert dataContext != null;
        myLinkManager.handleUrl(url, module, file, dataContext, null);
    }
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) HTMLFrameHyperlinkEvent(javax.swing.text.html.HTMLFrameHyperlinkEvent) HTMLDocument(javax.swing.text.html.HTMLDocument) NlModel(com.android.tools.idea.uibuilder.model.NlModel) PsiFile(com.intellij.psi.PsiFile) Module(com.intellij.openapi.module.Module)

Example 2 with HTMLFrameHyperlinkEvent

use of javax.swing.text.html.HTMLFrameHyperlinkEvent in project adempiere by adempiere.

the class Worker method hyperlinkUpdate.

/**************************************************************************
	 *	Hyperlink Listener
	 *  @param e event
	 */
public void hyperlinkUpdate(HyperlinkEvent e) {
    //	System.out.println("OnlineHelp.hyperlinkUpdate - " + e.getDescription() + " " + e.getURL());
    if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED)
        return;
    this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    //
    if (e instanceof HTMLFrameHyperlinkEvent) {
        HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
        HTMLDocument doc = (HTMLDocument) getDocument();
        doc.processHTMLFrameHyperlinkEvent(evt);
    } else if (e.getURL() == null)
        //	remove # of the reference
        scrollToReference(e.getDescription().substring(1));
    else {
        try {
            setPage(e.getURL());
        } catch (Throwable t) {
            System.err.println("Help.hyperlinkUpdate - " + t.toString());
            displayError("Error", e.getURL(), t);
        }
    }
    this.setCursor(Cursor.getDefaultCursor());
}
Also used : HTMLFrameHyperlinkEvent(javax.swing.text.html.HTMLFrameHyperlinkEvent) HTMLDocument(javax.swing.text.html.HTMLDocument)

Aggregations

HTMLDocument (javax.swing.text.html.HTMLDocument)2 HTMLFrameHyperlinkEvent (javax.swing.text.html.HTMLFrameHyperlinkEvent)2 NlModel (com.android.tools.idea.uibuilder.model.NlModel)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 Module (com.intellij.openapi.module.Module)1 PsiFile (com.intellij.psi.PsiFile)1