diff --git a/src/io/flutter/FlutterBundle.properties b/src/io/flutter/FlutterBundle.properties index 23d62c9243..80f2151f40 100644 --- a/src/io/flutter/FlutterBundle.properties +++ b/src/io/flutter/FlutterBundle.properties @@ -112,7 +112,7 @@ flutter.module.create.settings.includedriver.label=Include driver test: flutter.module.create.settings.includedriver.tip=Include generating a driver test. flutter.module.create.settings.help.label=Help: -flutter.module.create.settings.help.getting_started_html=Getting started with your first Flutter app. +flutter.module.create.settings.help.getting_started_link_text=Getting started with your first Flutter app. flutter.module.create.settings.help.project_name.label=Project name: flutter.module.create.settings.help.project_name.description=Enter the project name with all lower case letters. flutter.module.create.settings.help.org.label=Organization: diff --git a/src/io/flutter/module/settings/SettingsHelpForm.form b/src/io/flutter/module/settings/SettingsHelpForm.form index e220ace248..e18112433d 100644 --- a/src/io/flutter/module/settings/SettingsHelpForm.form +++ b/src/io/flutter/module/settings/SettingsHelpForm.form @@ -100,13 +100,11 @@ - + - - diff --git a/src/io/flutter/module/settings/SettingsHelpForm.java b/src/io/flutter/module/settings/SettingsHelpForm.java index 61ffb1b406..ae807a90d2 100644 --- a/src/io/flutter/module/settings/SettingsHelpForm.java +++ b/src/io/flutter/module/settings/SettingsHelpForm.java @@ -5,16 +5,13 @@ */ package io.flutter.module.settings; +import com.intellij.ide.browsers.BrowserLauncher; +import com.intellij.ui.components.labels.LinkLabel; import io.flutter.FlutterBundle; import org.jetbrains.annotations.NotNull; import javax.swing.*; import java.awt.*; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; /** * The settings panel that list helps. @@ -35,7 +32,7 @@ public class SettingsHelpForm { private JLabel orgLabel; private JLabel orgDescription; - private JTextPane gettingStartedUrl; + private LinkLabel gettingStartedUrl; public SettingsHelpForm() { projectNameLabel.setText(FlutterBundle.message("flutter.module.create.settings.help.label")); @@ -50,27 +47,15 @@ public SettingsHelpForm() { orgLabel.setText(FlutterBundle.message("flutter.module.create.settings.help.org.label")); orgDescription.setText(FlutterBundle.message("flutter.module.create.settings.help.org.description")); - gettingStartedUrl.setText(FlutterBundle.message("flutter.module.create.settings.help.getting_started_html")); + gettingStartedUrl.setText(FlutterBundle.message("flutter.module.create.settings.help.getting_started_link_text")); gettingStartedUrl.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - gettingStartedUrl.addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent e) { - if (e.getClickCount() > 0) { - if (Desktop.isDesktopSupported()) { - Desktop desktop = Desktop.getDesktop(); - try { - URI uri = new URI("https://flutter.io/getting-started/"); - desktop.browse(uri); - } catch (IOException | URISyntaxException ex) { - // do nothing - } - } else { - //do nothing - } - } - } - }); + gettingStartedUrl.setIcon(null); + //noinspection unchecked + gettingStartedUrl + .setListener((label, linkUrl) -> BrowserLauncher.getInstance().browse("https://flutter.io/getting-started/", null), null); } + @NotNull public JComponent getComponent() { return mainPanel;