Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/io/flutter/FlutterBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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=<html><a href="https://flutter.io/getting-started/">Getting started with your first Flutter app.</a></html>
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:
Expand Down
4 changes: 1 addition & 3 deletions src/io/flutter/module/settings/SettingsHelpForm.form
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,11 @@
<properties/>
<border type="none"/>
<children>
<component id="26e7" class="javax.swing.JTextPane" binding="gettingStartedUrl">
<component id="6a451" class="com.intellij.ui.components.labels.LinkLabel" binding="gettingStartedUrl">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<contentType value="text/html"/>
<editable value="false"/>
<opaque value="false"/>
</properties>
</component>
Expand Down
33 changes: 9 additions & 24 deletions src/io/flutter/module/settings/SettingsHelpForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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"));
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short and sweet, nice. :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

When things play nice with IntelliJ APIs, it's amazing how terse things can get!

.setListener((label, linkUrl) -> BrowserLauncher.getInstance().browse("https://flutter.io/getting-started/", null), null);
}


@NotNull
public JComponent getComponent() {
return mainPanel;
Expand Down