Skip to content

Commit 65f9cbf

Browse files
authored
Merge pull request #140 from hellokent/master
调整若干 UI 细节
2 parents 53623ae + 25f8f4a commit 65f9cbf

File tree

6 files changed

+124
-10
lines changed

6 files changed

+124
-10
lines changed

.gitignore

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,117 @@ hs_err_pid*
2424
/*.iml
2525
.idea/
2626
/build/
27-
/out/
27+
/out/
28+
### JetBrains template
29+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
30+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
31+
32+
# User-specific stuff
33+
.idea/**/workspace.xml
34+
.idea/**/tasks.xml
35+
.idea/**/usage.statistics.xml
36+
.idea/**/dictionaries
37+
.idea/**/shelf
38+
39+
# Generated files
40+
.idea/**/contentModel.xml
41+
42+
# Sensitive or high-churn files
43+
.idea/**/dataSources/
44+
.idea/**/dataSources.ids
45+
.idea/**/dataSources.local.xml
46+
.idea/**/sqlDataSources.xml
47+
.idea/**/dynamic.xml
48+
.idea/**/uiDesigner.xml
49+
.idea/**/dbnavigator.xml
50+
51+
# Gradle
52+
.idea/**/gradle.xml
53+
.idea/**/libraries
54+
55+
# Gradle and Maven with auto-import
56+
# When using Gradle or Maven with auto-import, you should exclude module files,
57+
# since they will be recreated, and may cause churn. Uncomment if using
58+
# auto-import.
59+
# .idea/artifacts
60+
# .idea/compiler.xml
61+
# .idea/modules.xml
62+
# .idea/*.iml
63+
# .idea/modules
64+
# *.iml
65+
# *.ipr
66+
67+
# CMake
68+
cmake-build-*/
69+
70+
# Mongo Explorer plugin
71+
.idea/**/mongoSettings.xml
72+
73+
# File-based project format
74+
*.iws
75+
76+
# IntelliJ
77+
out/
78+
79+
# mpeltonen/sbt-idea plugin
80+
.idea_modules/
81+
82+
# JIRA plugin
83+
atlassian-ide-plugin.xml
84+
85+
# Cursive Clojure plugin
86+
.idea/replstate.xml
87+
88+
# Crashlytics plugin (for Android Studio and IntelliJ)
89+
com_crashlytics_export_strings.xml
90+
crashlytics.properties
91+
crashlytics-build.properties
92+
fabric.properties
93+
94+
# Editor-based Rest Client
95+
.idea/httpRequests
96+
97+
# Android studio 3.1+ serialized cache file
98+
.idea/caches/build_file_checksums.ser
99+
100+
### Gradle template
101+
.gradle
102+
/build/
103+
104+
# Ignore Gradle GUI config
105+
gradle-app.setting
106+
107+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
108+
!gradle-wrapper.jar
109+
110+
# Cache of project
111+
.gradletasknamecache
112+
113+
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
114+
# gradle/wrapper/gradle-wrapper.properties
115+
116+
### Java template
117+
# Compiled class file
118+
*.class
119+
120+
# Log file
121+
*.log
122+
123+
# BlueJ files
124+
*.ctxt
125+
126+
# Mobile Tools for Java (J2ME)
127+
.mtj.tmp/
128+
129+
# Package Files #
130+
*.jar
131+
*.war
132+
*.nar
133+
*.ear
134+
*.zip
135+
*.tar.gz
136+
*.rar
137+
138+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
139+
hs_err_pid*
140+

src/main/java/com/shuzijun/leetcode/plugin/actions/editor/TestcaseAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void actionPerformed(AnActionEvent anActionEvent, Config config, Question
2727
dialog.setTitle(question.getFormTitle() + " Testcase");
2828
dialog.setText(question.getTestCase());
2929
if (dialog.showAndGet()) {
30-
String text = dialog.testcaeText();
30+
String text = dialog.testcaseText();
3131
if (StringUtils.isBlank(text)) {
3232
MessageUtils.getInstance(anActionEvent.getProject()).showWarnMsg("info", PropertiesUtils.getInfo("test.case"));
3333
return;

src/main/java/com/shuzijun/leetcode/plugin/actions/tree/TestcaseAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void actionPerformed(AnActionEvent anActionEvent, Config config, JTree tr
2929
dialog.setTitle(question.getFormTitle() + " Testcase");
3030
dialog.setText(question.getTestCase());
3131
if (dialog.showAndGet()) {
32-
String text = dialog.testcaeText();
32+
String text = dialog.testcaseText();
3333
if (StringUtils.isBlank(text)) {
3434
MessageUtils.getInstance(anActionEvent.getProject()).showWarnMsg("info", PropertiesUtils.getInfo("test.case"));
3535
return;

src/main/java/com/shuzijun/leetcode/plugin/listener/QueryKeyListener.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,15 @@ public void keyPressed(KeyEvent e) {
8080
}
8181
DefaultMutableTreeNode temp = (DefaultMutableTreeNode) all.getChildAt(i);
8282
if (temp.getUserObject().toString().toUpperCase().replace(" ","").contains(selectText.toUpperCase().replace(" ",""))) {
83-
tree.setSelectionPath(new TreePath(temp.getPath()));
84-
Point point = new Point(0, i < 3 ? 0 : (i - 3) * tree.getRowHeight());
83+
TreePath toShowPath = new TreePath(temp.getPath());
84+
tree.setSelectionPath(toShowPath);
85+
Rectangle bounds = tree.getPathBounds(toShowPath);
86+
Point point = new Point(0, (int) bounds.getY());
8587
viewport.setViewPosition(point);
8688
return;
8789
}
8890
}
8991
MessageUtils.showMsg(toolWindow.getContentManager().getComponent(), MessageType.INFO, "info", "not find next");
90-
return;
9192
}
9293
}
9394

src/main/java/com/shuzijun/leetcode/plugin/window/NavigatorPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected void paintComponent(Graphics g) {
8989
}
9090
};
9191
tree.getEmptyText().clear();
92-
tree.setRowHeight(21);
92+
//tree.setRowHeight(21);
9393
tree.setOpaque(false);
9494
tree.setCellRenderer(new CustomTreeCellRenderer());
9595
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

src/main/java/com/shuzijun/leetcode/plugin/window/TestcasePanel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ public class TestcasePanel extends DialogWrapper {
2222
public TestcasePanel(@Nullable Project project) {
2323
super(project, true);
2424
jpanel = new JBPanel();
25+
jpanel.setLayout(new BorderLayout());
2526
caseText = new JTextArea();
2627
caseText.setMinimumSize(new Dimension(400, 200));
2728
caseText.setPreferredSize(new Dimension(400, 200));
28-
jpanel.add(new JBScrollPane(caseText, JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JBScrollPane.HORIZONTAL_SCROLLBAR_NEVER));
29-
29+
jpanel.add(new JBScrollPane(caseText, JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JBScrollPane.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER);
3030
setModal(true);
3131
init();
3232
}
@@ -45,7 +45,7 @@ protected Action getOKAction() {
4545
return action;
4646
}
4747

48-
public String testcaeText() {
48+
public String testcaseText() {
4949
return caseText.getText();
5050
}
5151

0 commit comments

Comments
 (0)