Search in sources :

Example 31 with HyperlinkListener

use of javax.swing.event.HyperlinkListener in project android by JetBrains.

the class ServicePanelBuilder method addLink.

public HyperlinkLabel addLink(@NotNull String text, @NotNull final URI uri) {
    HyperlinkLabel linkLabel = new HyperlinkLabel(text);
    linkLabel.addHyperlinkListener(new HyperlinkListener() {

        @Override
        public void hyperlinkUpdate(HyperlinkEvent e) {
            try {
                Desktop.getDesktop().browse(uri);
            } catch (IOException e1) {
            // Don't care
            }
        }
    });
    addComponent(linkLabel);
    return linkLabel;
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) HyperlinkListener(javax.swing.event.HyperlinkListener) IOException(java.io.IOException) HyperlinkLabel(com.intellij.ui.HyperlinkLabel)

Example 32 with HyperlinkListener

use of javax.swing.event.HyperlinkListener in project intellij-plugins by JetBrains.

the class FlexBaseRunner method checkDebuggerFromSdk4.

private static void checkDebuggerFromSdk4(final Project project, final RunProfile runProfile, final FlashRunnerParameters params, final FlexBuildConfiguration bc) {
    final Sdk sdk = bc.getSdk();
    assert sdk != null;
    final Sdk sdkForDebugger = FlexDebugProcess.getDebuggerSdk(params.getDebuggerSdkRaw(), sdk);
    if (!FlexSdkUtils.isAirSdkWithoutFlex(sdk) && StringUtil.compareVersionNumbers(sdkForDebugger.getVersionString(), "4") < 0) {
        final HyperlinkListener listener = new HyperlinkAdapter() {

            @Override
            protected void hyperlinkActivated(final HyperlinkEvent e) {
                if ("RunConfiguration".equals(e.getDescription())) {
                    for (RunnerAndConfigurationSettings configuration : RunManager.getInstance(project).getConfigurationSettingsList(((RunConfiguration) runProfile).getType())) {
                        if (configuration.getConfiguration() == runProfile) {
                            RunDialog.editConfiguration(project, configuration, FlexBundle.message("edit.configuration.title"));
                            break;
                        }
                    }
                }
            }
        };
        final String message = FlexBundle.message("flex.sdk.3.mac.debug.problem", sdkForDebugger.getVersionString());
        ToolWindowManager.getInstance(project).notifyByBalloon(ToolWindowId.DEBUG, MessageType.WARNING, message, null, listener);
    }
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) HyperlinkListener(javax.swing.event.HyperlinkListener) Sdk(com.intellij.openapi.projectRoots.Sdk) HyperlinkAdapter(com.intellij.ui.HyperlinkAdapter)

Example 33 with HyperlinkListener

use of javax.swing.event.HyperlinkListener in project processdash by dtuma.

the class TaskScheduleDialog method displayErrorDialog.

protected void displayErrorDialog(Map errors) {
    if (errors == null || errors.size() == 0)
        return;
    String[] footer = EVMetrics.isWarningOnly(errors) ? null : resources.getStrings("Error_Dialog.Foot");
    ErrorReporter err = new ErrorReporter(resources.getString("Error_Dialog.Title"), resources.getStrings("Error_Dialog.Head"), footer);
    Iterator i = errors.keySet().iterator();
    while (i.hasNext()) {
        err.logError(//
        StringUtils.findAndReplace(//
        (String) i.next(), "\n#", "\n#http://ignored/"));
    }
    err.setHyperlinkListener(new HyperlinkListener() {

        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                String url = e.getURL().getFile();
                int pos = url.lastIndexOf('/');
                String helpSet = url.substring(0, pos);
                String topic = url.substring(pos + 1);
                String helpUri = helpSet + "/frame.html?" + topic;
                Browser.launch(helpUri);
            }
        }
    });
    err.done();
}
Also used : ErrorReporter(net.sourceforge.processdash.ui.lib.ErrorReporter) HyperlinkEvent(javax.swing.event.HyperlinkEvent) HyperlinkListener(javax.swing.event.HyperlinkListener) Iterator(java.util.Iterator)

Aggregations

HyperlinkListener (javax.swing.event.HyperlinkListener)33 HyperlinkEvent (javax.swing.event.HyperlinkEvent)31 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 NotNull (org.jetbrains.annotations.NotNull)6 Project (com.intellij.openapi.project.Project)5 HyperlinkLabel (com.intellij.ui.HyperlinkLabel)4 File (java.io.File)4 IOException (java.io.IOException)4 AnAction (com.intellij.openapi.actionSystem.AnAction)3 Ref (com.intellij.openapi.util.Ref)3 Logger (com.intellij.openapi.diagnostic.Logger)2 MessageType (com.intellij.openapi.ui.MessageType)2 Balloon (com.intellij.openapi.ui.popup.Balloon)2 Computable (com.intellij.openapi.util.Computable)2 StringUtil (com.intellij.openapi.util.text.StringUtil)2 IdeFrame (com.intellij.openapi.wm.IdeFrame)2 HyperlinkAdapter (com.intellij.ui.HyperlinkAdapter)2 JBScrollPane (com.intellij.ui.components.JBScrollPane)2 MouseAdapter (java.awt.event.MouseAdapter)2 MouseEvent (java.awt.event.MouseEvent)2