Search in sources :

Example 1 with HyperlinkAdapter

use of com.intellij.ui.HyperlinkAdapter in project intellij-community by JetBrains.

the class TooltipUtil method createTooltip.

public static HyperlinkLabel createTooltip(final String message) {
    final HyperlinkLabel link = new HyperlinkLabel("");
    link.setIcon(AllIcons.General.Help_small);
    link.setUseIconAsLink(true);
    link.setIconTextGap(0);
    link.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        protected void hyperlinkActivated(HyperlinkEvent e) {
            final JLabel label = new JLabel(message);
            label.setBorder(HintUtil.createHintBorder());
            label.setBackground(HintUtil.getInformationColor());
            label.setOpaque(true);
            HintManager.getInstance().showHint(label, RelativePoint.getSouthEastOf(link), HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE, -1);
        }
    });
    return link;
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) HyperlinkLabel(com.intellij.ui.HyperlinkLabel) HyperlinkAdapter(com.intellij.ui.HyperlinkAdapter)

Example 2 with HyperlinkAdapter

use of com.intellij.ui.HyperlinkAdapter in project android by JetBrains.

the class IdeSdksConfigurable method createNdkResetLink.

private void createNdkResetLink() {
    myNdkResetHyperlinkLabel = new HyperlinkLabel();
    myNdkResetHyperlinkLabel.setHyperlinkText("", "Select", " default NDK");
    myNdkResetHyperlinkLabel.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        protected void hyperlinkActivated(HyperlinkEvent e) {
            // known non-null since otherwise we won't show the link
            File androidNdkPath = IdeSdks.getInstance().getAndroidNdkPath();
            assert androidNdkPath != null;
            myNdkLocationTextField.setText(androidNdkPath.getPath());
        }
    });
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VfsUtil.findFileByIoFile(com.intellij.openapi.vfs.VfsUtil.findFileByIoFile) FileChooser.chooseFile(com.intellij.openapi.fileChooser.FileChooser.chooseFile) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) File(java.io.File) HyperlinkLabel(com.intellij.ui.HyperlinkLabel) HyperlinkAdapter(com.intellij.ui.HyperlinkAdapter)

Example 3 with HyperlinkAdapter

use of com.intellij.ui.HyperlinkAdapter in project intellij-plugins by JetBrains.

the class DartProblemsFilterForm method createUIComponents.

private void createUIComponents() {
    myResetFilterHyperlink = new HoverHyperlinkLabel(DartBundle.message("reset.filter"));
    myResetFilterHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        protected void hyperlinkActivated(final HyperlinkEvent e) {
            myListeners.forEach(FilterListener::filtersResetRequested);
        }
    });
}
Also used : HoverHyperlinkLabel(com.intellij.ui.HoverHyperlinkLabel) HyperlinkEvent(javax.swing.event.HyperlinkEvent) HyperlinkAdapter(com.intellij.ui.HyperlinkAdapter)

Example 4 with HyperlinkAdapter

use of com.intellij.ui.HyperlinkAdapter in project intellij-plugins by JetBrains.

the class FlexRunner method launchFlexConfig.

protected RunContentDescriptor launchFlexConfig(final Module module, final FlexBuildConfiguration bc, final FlashRunnerParameters runnerParameters, final RunProfileState state, final RunContentDescriptor contentToReuse, final ExecutionEnvironment environment) throws ExecutionException {
    switch(bc.getTargetPlatform()) {
        case Web:
            final String urlOrPath = runnerParameters.isLaunchUrl() ? runnerParameters.getUrl() : bc.isUseHtmlWrapper() ? PathUtil.getParentPath(bc.getActualOutputFilePath()) + "/" + BCUtils.getWrapperFileName(bc) : bc.getActualOutputFilePath();
            launchWithSelectedApplication(urlOrPath, runnerParameters.getLauncherParameters());
            break;
        case Desktop:
            return standardLaunch(module.getProject(), state, contentToReuse, environment);
        case Mobile:
            switch(runnerParameters.getMobileRunTarget()) {
                case Emulator:
                    return standardLaunch(module.getProject(), state, contentToReuse, environment);
                case AndroidDevice:
                    final String androidDescriptorPath = getAirDescriptorPath(bc, bc.getAndroidPackagingOptions());
                    final String androidAppId = getApplicationId(androidDescriptorPath);
                    if (androidAppId == null) {
                        Messages.showErrorDialog(module.getProject(), FlexBundle.message("failed.to.read.app.id", FileUtil.toSystemDependentName(androidDescriptorPath)), FlexBundle.message("error.title"));
                        return null;
                    }
                    if (packAndInstallToAndroidDevice(module, bc, runnerParameters, androidAppId, false)) {
                        launchOnAndroidDevice(module.getProject(), bc.getSdk(), runnerParameters.getDeviceInfo(), androidAppId, false);
                    }
                    return null;
                case iOSSimulator:
                    final String adtVersionSimulator = AirPackageUtil.getAdtVersion(module.getProject(), bc.getSdk());
                    final String iosSimulatorDescriptorPath = getAirDescriptorPath(bc, bc.getIosPackagingOptions());
                    final String iosSimulatorAppId = getApplicationId(iosSimulatorDescriptorPath);
                    if (iosSimulatorAppId == null) {
                        Messages.showErrorDialog(module.getProject(), FlexBundle.message("failed.to.read.app.id", FileUtil.toSystemDependentName(iosSimulatorDescriptorPath)), FlexBundle.message("error.title"));
                        return null;
                    }
                    if (packAndInstallToIOSSimulator(module, bc, runnerParameters, adtVersionSimulator, iosSimulatorAppId, false)) {
                        launchOnIosSimulator(module.getProject(), bc.getSdk(), iosSimulatorAppId, runnerParameters.getIOSSimulatorSdkPath(), false);
                    }
                    return null;
                case iOSDevice:
                    final String adtVersion = AirPackageUtil.getAdtVersion(module.getProject(), bc.getSdk());
                    if (StringUtil.compareVersionNumbers(adtVersion, "3.4") >= 0) {
                        if (packAndInstallToIOSDevice(module, bc, runnerParameters, adtVersion, false)) {
                            final String appName = getApplicationName(getAirDescriptorPath(bc, bc.getIosPackagingOptions()));
                            ToolWindowManager.getInstance(module.getProject()).notifyByBalloon(ToolWindowId.RUN, MessageType.INFO, FlexBundle.message("ios.application.installed.to.run", appName));
                        }
                    } else {
                        if (AirPackageUtil.packageIpaForDevice(module, bc, runnerParameters, adtVersion, false)) {
                            final String outputFolder = PathUtil.getParentPath(bc.getActualOutputFilePath());
                            final String ipaName = bc.getIosPackagingOptions().getPackageFileName() + ".ipa";
                            final String message = FlexBundle.message("ios.application.packaged.to.run", ipaName);
                            ToolWindowManager.getInstance(module.getProject()).notifyByBalloon(ToolWindowId.RUN, MessageType.INFO, message, null, new HyperlinkAdapter() {

                                protected void hyperlinkActivated(final HyperlinkEvent e) {
                                    ShowFilePathAction.openFile(new File(outputFolder + "/" + ipaName));
                                }
                            });
                        }
                    }
                    break;
            }
            break;
    }
    return null;
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) File(java.io.File) HyperlinkAdapter(com.intellij.ui.HyperlinkAdapter)

Example 5 with HyperlinkAdapter

use of com.intellij.ui.HyperlinkAdapter in project scss-lint-plugin by idok.

the class ScssLintInspection method createHyperLink.

@NotNull
private HyperlinkLabel createHyperLink() {
    //        List path = ContainerUtil.newArrayList(JSBundle.message("settings.javascript.root.configurable.name"), JSBundle.message("settings.javascript.linters.configurable.name"), getDisplayName());
    List<String> path = ContainerUtil.newArrayList(ScssLintBundle.message("scss.inspections.group.name"), ScssLintBundle.message("scss.inspection.group.name"), getDisplayName());
    String title = Joiner.on(" / ").join(path);
    final HyperlinkLabel settingsLink = new HyperlinkLabel(title);
    settingsLink.addHyperlinkListener(new HyperlinkAdapter() {

        public void hyperlinkActivated(HyperlinkEvent e) {
            DataContext dataContext = DataManager.getInstance().getDataContext(settingsLink);
            Project project = CommonDataKeys.PROJECT.getData(dataContext);
            if (project != null) {
                showSettings(project);
            //                } else {
            //                    new ScssLintSettingsPage(null).showSettings();
            }
        //                Settings settings = (Settings) Settings.KEY.getData(dataContext);
        //                if (settings == null) {
        //                    configurable.showEditDialog();
        //                } else {
        //                    settings.select(settings.find(getId()));
        //                }
        //
        //                OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext);
        //                if (optionsEditor == null) {
        //                    Project project = CommonDataKeys.PROJECT.getData(dataContext);
        //                    if (project != null) {
        //                        showSettings(project);
        //                    }
        //                    return;
        //                }
        //                Configurable configurable = optionsEditor.findConfigurableById(ScssLintInspection.this.getId());
        //                if (configurable != null) {
        //                    optionsEditor.clearSearchAndSelect(configurable);
        //                }
        //
        //
        //
        //                Project project = CommonDataKeys.PROJECT.getData(dataContext);
        //                if(project == null) {
        //                    LOG.warn("No project found in data context");
        //                } else {
        //                    JSLinterConfigurable configurable = JSLinterInspection.this.getExternalAnnotatorForBatchInspection().createSettingsConfigurable(project);
        //                    Settings settings = (Settings)Settings.KEY.getData(dataContext);
        //                    if(settings == null) {
        //                        configurable.showEditDialog();
        //                    } else {
        //                        settings.select(settings.find(configurable.getId()));
        //                    }
        //                }
        }
    });
    return settingsLink;
}
Also used : Project(com.intellij.openapi.project.Project) DataContext(com.intellij.openapi.actionSystem.DataContext) HyperlinkEvent(javax.swing.event.HyperlinkEvent) HyperlinkLabel(com.intellij.ui.HyperlinkLabel) HyperlinkAdapter(com.intellij.ui.HyperlinkAdapter) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

HyperlinkAdapter (com.intellij.ui.HyperlinkAdapter)14 HyperlinkEvent (javax.swing.event.HyperlinkEvent)14 HyperlinkLabel (com.intellij.ui.HyperlinkLabel)5 File (java.io.File)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 NotNull (org.jetbrains.annotations.NotNull)3 DataContext (com.intellij.openapi.actionSystem.DataContext)2 FileChooser.chooseFile (com.intellij.openapi.fileChooser.FileChooser.chooseFile)2 Project (com.intellij.openapi.project.Project)2 VfsUtil.findFileByIoFile (com.intellij.openapi.vfs.VfsUtil.findFileByIoFile)2 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)2 HyperlinkListener (javax.swing.event.HyperlinkListener)2 Abi (com.android.sdklib.devices.Abi)1 InstallComponentsPath (com.android.tools.idea.welcome.wizard.InstallComponentsPath)1 DialogWrapperHost (com.android.tools.idea.wizard.dynamic.DialogWrapperHost)1 DynamicWizard (com.android.tools.idea.wizard.dynamic.DynamicWizard)1 DynamicWizardHost (com.android.tools.idea.wizard.dynamic.DynamicWizardHost)1 ScopedDataBinder (com.android.tools.idea.wizard.dynamic.ScopedDataBinder)1 ScopedStateStore (com.android.tools.idea.wizard.dynamic.ScopedStateStore)1 SingleStepPath (com.android.tools.idea.wizard.dynamic.SingleStepPath)1