1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.theplugin.idea.config;
18
19 import com.atlassian.theplugin.idea.Constants;
20 import com.atlassian.theplugin.idea.HelpUrl;
21 import com.atlassian.theplugin.idea.BugReporting;
22 import com.intellij.ide.BrowserUtil;
23 import com.intellij.ui.HyperlinkLabel;
24 import com.intellij.openapi.application.ApplicationInfo;
25
26 import javax.swing.*;
27 import javax.swing.event.HyperlinkEvent;
28 import javax.swing.event.HyperlinkListener;
29 import java.awt.*;
30
31 public class FooterPanel extends JPanel {
32
33
34 public FooterPanel() {
35 initLayout();
36 }
37
38 private void initLayout() {
39
40 GridBagLayout gb = new GridBagLayout();
41 setLayout(gb);
42
43
44 final String helpUrl = HelpUrl.getHelpUrl(Constants.HELP_CONFIG_PANEL);
45
46 JPanel linkPanel = new JPanel();
47
48 final HyperlinkLabel openJiraHyperlinkBugLabel = new HyperlinkLabel("Report Bug");
49 openJiraHyperlinkBugLabel.addHyperlinkListener(new HyperlinkListener() {
50 public void hyperlinkUpdate(HyperlinkEvent e) {
51 BrowserUtil.launchBrowser(BugReporting.getBugUrl(ApplicationInfo.getInstance().getBuildNumber()));
52 }
53 });
54
55 final HyperlinkLabel openJiraHyperlinkStoryLabel = new HyperlinkLabel("Request Feature");
56 openJiraHyperlinkStoryLabel.addHyperlinkListener(new HyperlinkListener() {
57 public void hyperlinkUpdate(HyperlinkEvent e) {
58 BrowserUtil.launchBrowser(BugReporting.getStoryUrl());
59 }
60 });
61
62
63 final HyperlinkLabel openConfigHelpLabel = new HyperlinkLabel("Help");
64
65
66
67 openConfigHelpLabel.addHyperlinkListener(new HyperlinkListener() {
68 public void hyperlinkUpdate(HyperlinkEvent e) {
69 BrowserUtil.launchBrowser(helpUrl);
70 }
71 });
72
73 linkPanel.add(openJiraHyperlinkBugLabel);
74 linkPanel.add(new JLabel("|"));
75 linkPanel.add(openJiraHyperlinkStoryLabel);
76 linkPanel.add(new JLabel(BugReporting.getVersionString()));
77
78 GridBagConstraints c = new GridBagConstraints();
79
80 c.gridx = 0;
81 c.fill = GridBagConstraints.NONE;
82 add(linkPanel, c);
83 c.gridx = 1;
84 c.weightx = 1;
85 c.fill = GridBagConstraints.HORIZONTAL;
86 add(new JPanel(), c);
87 c.gridx = 2;
88 c.weightx = 0;
89 c.anchor = GridBagConstraints.LINE_END;
90 c.insets = new Insets(0, 0, 0, Constants.DIALOG_MARGIN);
91 add(openConfigHelpLabel, c);
92 }
93 }