Search in sources :

Example 21 with HyperlinkLabel

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

the class DeveloperServicePanel method addToLinkPanel.

private void addToLinkPanel(@NotNull String text, @NotNull final URI uri) {
    HyperlinkLabel hyperlinkLabel = new HyperlinkLabel(text);
    hyperlinkLabel.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        protected void hyperlinkActivated(HyperlinkEvent e) {
            try {
                Desktop.getDesktop().browse(uri);
            } catch (IOException ex) {
            // Don't care
            }
        }
    });
    // apart using invisible rigid areas instead.
    if (myLinksPanel.getComponentCount() > 0) {
        myLinksPanel.add(Box.createRigidArea(new Dimension(JBUI.scale(10), 0)));
    }
    myLinksPanel.add(hyperlinkLabel);
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) IOException(java.io.IOException) HyperlinkLabel(com.intellij.ui.HyperlinkLabel) HyperlinkAdapter(com.intellij.ui.HyperlinkAdapter)

Example 22 with HyperlinkLabel

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

the class IdeSdksConfigurable method createNdkDownloadLink.

private void createNdkDownloadLink() {
    myNdkDownloadHyperlinkLabel = new HyperlinkLabel();
    myNdkDownloadHyperlinkLabel.setHyperlinkText("", "Download", " Android NDK.");
    myNdkDownloadHyperlinkLabel.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        protected void hyperlinkActivated(HyperlinkEvent e) {
            if (validateAndroidSdkPath() != null) {
                Messages.showErrorDialog(getContentPanel(), "Please select a valid SDK before downloading the NDK.");
                return;
            }
            List<String> requested = ImmutableList.of(FD_NDK);
            ModelWizardDialog dialog = createDialogForPaths(myWholePanel, requested, false);
            if (dialog != null && dialog.showAndGet()) {
                File ndk = IdeSdks.getInstance().getAndroidNdkPath();
                if (ndk != null) {
                    myNdkLocationTextField.setText(ndk.getPath());
                }
                validateState();
            }
        }
    });
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) 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) ModelWizardDialog(com.android.tools.idea.wizard.model.ModelWizardDialog) HyperlinkAdapter(com.intellij.ui.HyperlinkAdapter)

Example 23 with HyperlinkLabel

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

the class EditorNotificationPanelFixture method performAction.

public IdeFrameFixture performAction(@NotNull final String label) {
    checkState(target().isShowing(), "cannot click link on hidden notification");
    HyperlinkLabel link = robot().finder().find(target(), new GenericTypeMatcher<HyperlinkLabel>(HyperlinkLabel.class) {

        @Override
        protected boolean isMatching(@NotNull HyperlinkLabel hyperlinkLabel) {
            // IntelliJ's HyperLinkLabel class does not expose the getText method (it is package private)
            return hyperlinkLabel.isShowing() && label.equals(Reflection.method("getText").withReturnType(String.class).in(hyperlinkLabel).invoke());
        }
    });
    driver().click(link);
    Wait.seconds(5).expecting("notification panel to disappear").until(() -> !target().isShowing());
    return myIdeFrameFixture;
}
Also used : HyperlinkLabel(com.intellij.ui.HyperlinkLabel)

Example 24 with HyperlinkLabel

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

the class AddAdapterSupportDialog method createInformationPanel.

@NotNull
private static JComponent createInformationPanel(@NotNull final String adapterHomePageUrl) {
    JLabel label1 = new JLabel("See");
    HyperlinkLabel hyperlink = SwingHelper.createWebHyperlink(adapterHomePageUrl);
    JLabel label2 = new JLabel("for details.");
    JPanel panel = SwingHelper.newHorizontalPanel(Component.BOTTOM_ALIGNMENT, SwingHelper.newLeftAlignedVerticalPanel(label1, Box.createVerticalStrut(2)), hyperlink, Box.createHorizontalStrut(5), SwingHelper.newLeftAlignedVerticalPanel(label2, Box.createVerticalStrut(2)));
    return SwingHelper.wrapWithoutStretch(panel);
}
Also used : HyperlinkLabel(com.intellij.ui.HyperlinkLabel) NotNull(org.jetbrains.annotations.NotNull)

Example 25 with HyperlinkLabel

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

the class AvdManagerDialogFixture method editAvdWithName.

public AvdEditWizardFixture editAvdWithName(@NotNull String name) {
    final TableView tableView = robot().finder().findByType(target(), TableView.class, true);
    JTableFixture tableFixture = new JTableFixture(robot(), tableView);
    JTableCellFixture cell = tableFixture.cell(name);
    final TableCell actionCell = TableCell.row(cell.row()).column(7);
    JTableCellFixture actionCellFixture = tableFixture.cell(actionCell);
    execute(new GuiTask() {

        @Override
        protected void executeInEDT() throws Throwable {
            tableView.editCellAt(actionCell.row, actionCell.column);
        }
    });
    JPanel actionPanel = (JPanel) actionCellFixture.editor();
    HyperlinkLabel editButtonLabel = robot().finder().find(actionPanel, new GenericTypeMatcher<HyperlinkLabel>(HyperlinkLabel.class) {

        @Override
        protected boolean isMatching(@NotNull HyperlinkLabel component) {
            return "Edit this AVD".equals(component.getToolTipText());
        }
    });
    robot().click(editButtonLabel);
    return AvdEditWizardFixture.find(robot());
}
Also used : JTableCellFixture(org.fest.swing.fixture.JTableCellFixture) GuiTask(org.fest.swing.edt.GuiTask) JTableFixture(org.fest.swing.fixture.JTableFixture) TableCell(org.fest.swing.data.TableCell) HyperlinkLabel(com.intellij.ui.HyperlinkLabel) TableView(com.intellij.ui.table.TableView)

Aggregations

HyperlinkLabel (com.intellij.ui.HyperlinkLabel)25 HyperlinkEvent (javax.swing.event.HyperlinkEvent)9 NotNull (org.jetbrains.annotations.NotNull)7 HyperlinkAdapter (com.intellij.ui.HyperlinkAdapter)5 HyperlinkListener (javax.swing.event.HyperlinkListener)4 Project (com.intellij.openapi.project.Project)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 DataContext (com.intellij.openapi.actionSystem.DataContext)2 FileChooser.chooseFile (com.intellij.openapi.fileChooser.FileChooser.chooseFile)2 VfsUtil.findFileByIoFile (com.intellij.openapi.vfs.VfsUtil.findFileByIoFile)2 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)2 File (java.io.File)2 IOException (java.io.IOException)2 ScreenOrientation (com.android.resources.ScreenOrientation)1 SystemImage (com.android.sdklib.repository.targets.SystemImage)1 LabelWithEditLink (com.android.tools.adtui.LabelWithEditLink)1 TabularLayout (com.android.tools.adtui.TabularLayout)1 ModelWizardDialog (com.android.tools.idea.wizard.model.ModelWizardDialog)1 Function (com.google.common.base.Function)1 ImmutableList (com.google.common.collect.ImmutableList)1