Skip to content

Commit cf35bfb

Browse files
committed
add some hyperlink
1 parent 540cd6e commit cf35bfb

File tree

4 files changed

+75
-15
lines changed

4 files changed

+75
-15
lines changed

src/main/java/com/tang/intellij/lua/debugger/app/LuaAppSettingsEditor.form

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.tang.intellij.lua.debugger.app.LuaAppSettingsEditor">
3-
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
3+
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="7" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
44
<margin top="0" left="0" bottom="0" right="0"/>
55
<constraints>
66
<xy x="20" y="20" width="500" height="400"/>
@@ -10,20 +10,20 @@
1010
<children>
1111
<vspacer id="58b03">
1212
<constraints>
13-
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
13+
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
1414
</constraints>
1515
</vspacer>
1616
<component id="62714" class="javax.swing.JLabel">
1717
<constraints>
18-
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
18+
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
1919
</constraints>
2020
<properties>
2121
<text value="Parameters:"/>
2222
</properties>
2323
</component>
2424
<component id="d96a3" class="javax.swing.JLabel">
2525
<constraints>
26-
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
26+
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
2727
</constraints>
2828
<properties>
2929
<text value="Entry File:"/>
@@ -45,43 +45,49 @@
4545
</component>
4646
<component id="afd0d" class="com.intellij.util.textCompletion.TextFieldWithCompletion" binding="myFile" custom-create="true">
4747
<constraints>
48-
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
48+
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
4949
</constraints>
5050
<properties/>
5151
</component>
5252
<component id="b7f34" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myWorkingDir">
5353
<constraints>
54-
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
54+
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
5555
</constraints>
5656
<properties/>
5757
</component>
5858
<component id="ffa20" class="javax.swing.JLabel">
5959
<constraints>
60-
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
60+
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
6161
</constraints>
6262
<properties>
6363
<text value="Working Directory:"/>
6464
</properties>
6565
</component>
6666
<component id="70e93" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myProgram">
6767
<constraints>
68-
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
68+
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
6969
</constraints>
7070
<properties>
7171
<editable value="true"/>
7272
</properties>
7373
</component>
7474
<component id="f9b63" class="javax.swing.JLabel">
7575
<constraints>
76-
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
76+
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
7777
</constraints>
7878
<properties>
7979
<text value="Program:"/>
8080
</properties>
8181
</component>
8282
<component id="30b37" class="com.intellij.ui.RawCommandLineEditor" binding="parameters">
8383
<constraints>
84-
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
84+
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
85+
</constraints>
86+
<properties/>
87+
</component>
88+
<component id="a4bf3" class="com.intellij.ui.HoverHyperlinkLabel" binding="mobdebugLink" custom-create="true">
89+
<constraints>
90+
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
8591
</constraints>
8692
<properties/>
8793
</component>

src/main/java/com/tang/intellij/lua/debugger/app/LuaAppSettingsEditor.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.intellij.codeInsight.completion.CompletionResultSet;
2020
import com.intellij.codeInsight.lookup.LookupElementBuilder;
21+
import com.intellij.ide.BrowserUtil;
2122
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
2223
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
2324
import com.intellij.openapi.options.ConfigurationException;
@@ -26,6 +27,8 @@
2627
import com.intellij.openapi.roots.ProjectRootManager;
2728
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
2829
import com.intellij.openapi.util.SystemInfoRt;
30+
import com.intellij.ui.HoverHyperlinkLabel;
31+
import com.intellij.ui.HyperlinkAdapter;
2932
import com.intellij.ui.RawCommandLineEditor;
3033
import com.intellij.util.TextFieldCompletionProvider;
3134
import com.intellij.util.textCompletion.TextFieldWithCompletion;
@@ -36,6 +39,7 @@
3639
import org.jetbrains.annotations.NotNull;
3740

3841
import javax.swing.*;
42+
import javax.swing.event.HyperlinkEvent;
3943

4044
/**
4145
*
@@ -48,6 +52,7 @@ public class LuaAppSettingsEditor extends SettingsEditor<LuaAppRunConfiguration>
4852
private TextFieldWithCompletion myFile;
4953
private TextFieldWithBrowseButton myWorkingDir;
5054
private RawCommandLineEditor parameters;
55+
private HoverHyperlinkLabel mobdebugLink;
5156
private Project project;
5257

5358
LuaAppSettingsEditor(Project project) {
@@ -65,7 +70,11 @@ public class LuaAppSettingsEditor extends SettingsEditor<LuaAppRunConfiguration>
6570

6671
DefaultComboBoxModel<DebuggerType> debuggerDataModel = new DefaultComboBoxModel<>(debuggerTypes);
6772
myDebugger.setModel(debuggerDataModel);
68-
myDebugger.addItemListener(e -> fireEditorStateChanged());
73+
myDebugger.addItemListener(e -> {
74+
DebuggerType debuggerType = (DebuggerType) myDebugger.getSelectedItem();
75+
mobdebugLink.setVisible(debuggerType == DebuggerType.Mob);
76+
fireEditorStateChanged();
77+
});
6978
}
7079

7180
@Override
@@ -75,6 +84,8 @@ protected void resetEditorFrom(@NotNull LuaAppRunConfiguration luaAppRunConfigur
7584
myFile.setText(luaAppRunConfiguration.getFile());
7685
myDebugger.setSelectedItem(luaAppRunConfiguration.getDebuggerType());
7786
parameters.setText(luaAppRunConfiguration.getParameters());
87+
88+
mobdebugLink.setVisible(luaAppRunConfiguration.getDebuggerType() == DebuggerType.Mob);
7889
}
7990

8091
@Override
@@ -117,5 +128,13 @@ private void createUIComponents() {
117128
true,
118129
true,
119130
true);
131+
132+
mobdebugLink = new HoverHyperlinkLabel("Get mobdebug.lua");
133+
mobdebugLink.addHyperlinkListener(new HyperlinkAdapter() {
134+
@Override
135+
protected void hyperlinkActivated(HyperlinkEvent hyperlinkEvent) {
136+
BrowserUtil.browse("https://github.com/pkulchenko/MobDebug");
137+
}
138+
});
120139
}
121140
}

src/main/java/com/tang/intellij/lua/luacheck/LuaCheckSettingsPanel.form

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.tang.intellij.lua.luacheck.LuaCheckSettingsPanel">
3-
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
3+
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
44
<margin top="0" left="0" bottom="0" right="0"/>
55
<constraints>
66
<xy x="20" y="20" width="500" height="400"/>
@@ -18,7 +18,7 @@
1818
</component>
1919
<vspacer id="54015">
2020
<constraints>
21-
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
21+
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
2222
</constraints>
2323
</vspacer>
2424
<component id="f780a" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myLuaCheck">
@@ -29,15 +29,27 @@
2929
</component>
3030
<component id="715cb" class="javax.swing.JLabel">
3131
<constraints>
32-
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
32+
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
3333
</constraints>
3434
<properties>
3535
<text value="Command Line"/>
3636
</properties>
3737
</component>
3838
<component id="f7926" class="com.intellij.ui.RawCommandLineEditor" binding="myCmdLine">
3939
<constraints>
40-
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
40+
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
41+
</constraints>
42+
<properties/>
43+
</component>
44+
<component id="e80c0" class="com.intellij.ui.HoverHyperlinkLabel" binding="luaCheckReleasePageLink" custom-create="true">
45+
<constraints>
46+
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
47+
</constraints>
48+
<properties/>
49+
</component>
50+
<component id="8fa3a" class="com.intellij.ui.HoverHyperlinkLabel" binding="commandLineOptionsLink" custom-create="true">
51+
<constraints>
52+
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
4153
</constraints>
4254
<properties/>
4355
</component>

src/main/java/com/tang/intellij/lua/luacheck/LuaCheckSettingsPanel.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,21 @@
1616

1717
package com.tang.intellij.lua.luacheck;
1818

19+
import com.intellij.ide.BrowserUtil;
1920
import com.intellij.openapi.options.Configurable;
2021
import com.intellij.openapi.options.ConfigurationException;
2122
import com.intellij.openapi.options.SearchableConfigurable;
2223
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
2324
import com.intellij.openapi.util.text.StringUtil;
25+
import com.intellij.ui.HoverHyperlinkLabel;
26+
import com.intellij.ui.HyperlinkAdapter;
2427
import com.intellij.ui.RawCommandLineEditor;
2528
import org.jetbrains.annotations.Nls;
2629
import org.jetbrains.annotations.NotNull;
2730
import org.jetbrains.annotations.Nullable;
2831

2932
import javax.swing.*;
33+
import javax.swing.event.HyperlinkEvent;
3034

3135
/**
3236
* lua check settings panel
@@ -36,6 +40,8 @@ public class LuaCheckSettingsPanel implements SearchableConfigurable, Configurab
3640
private JPanel myPanel;
3741
private RawCommandLineEditor myCmdLine;
3842
private TextFieldWithBrowseButton myLuaCheck;
43+
private HoverHyperlinkLabel luaCheckReleasePageLink;
44+
private HoverHyperlinkLabel commandLineOptionsLink;
3945
private LuaCheckSettings settings = LuaCheckSettings.getInstance();
4046

4147
public LuaCheckSettingsPanel() {
@@ -73,4 +79,21 @@ public void apply() throws ConfigurationException {
7379
//String[] params = ParametersListUtil.parseToArray(myCmdLine.getText());
7480
settings.setLuaCheckArgs(myCmdLine.getText());
7581
}
82+
83+
private void createUIComponents() {
84+
luaCheckReleasePageLink = new HoverHyperlinkLabel("Download LuaCheck");
85+
luaCheckReleasePageLink.addHyperlinkListener(new HyperlinkAdapter() {
86+
@Override
87+
protected void hyperlinkActivated(HyperlinkEvent hyperlinkEvent) {
88+
BrowserUtil.browse("https://github.com/mpeterv/luacheck/releases");
89+
}
90+
});
91+
commandLineOptionsLink = new HoverHyperlinkLabel("Command line options");
92+
commandLineOptionsLink.addHyperlinkListener(new HyperlinkAdapter() {
93+
@Override
94+
protected void hyperlinkActivated(HyperlinkEvent hyperlinkEvent) {
95+
BrowserUtil.browse("http://luacheck.readthedocs.io/en/stable/cli.html#command-line-options");
96+
}
97+
});
98+
}
7699
}

0 commit comments

Comments
 (0)