Skip to content

Commit 113f334

Browse files
committed
移除过时api
1 parent 8dbc3b3 commit 113f334

File tree

5 files changed

+32
-11
lines changed

5 files changed

+32
-11
lines changed

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ repositories {
1717
}
1818

1919
dependencies {
20+
implementation 'org.apache.commons:commons-text:1.12.0'
2021
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
2122
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
2223
}
2324

2425
group 'com.haojiyou'
25-
version '1.6.0'
26+
version '1.6.1'
2627

2728
apply plugin: 'org.kordamp.gradle.markdown'
2829
apply plugin: 'java'
@@ -39,7 +40,7 @@ intellij {
3940
// version = 'IC-2021.1.3'
4041
version = 'IC-2020.3'
4142
pluginName = 'CharAutoReplace'
42-
updateSinceUntilBuild = false
43+
updateSinceUntilBuild = true
4344

4445
sourceCompatibility = JavaVersion.VERSION_11
4546
targetCompatibility = JavaVersion.VERSION_11

docs/CHANGELOG.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<p>---</p>
2+
<h1>1.6.1</h1>
3+
<ul>
4+
<li>移除过时的api</li>
5+
</ul>
26
<h1>1.6.0</h1>
37
<ul>
48
<li>add auto replace in comment area config (default config will not be replaced in comment).<br/> (settings - Tools - CharAutoReplace).</li>

docs/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
2+
# 1.6.1
3+
* 移除过时的api
4+
25
# 1.6.0
36
* add auto replace in comment area config
47
(default config will not be replaced in comment).

src/main/java/com/haojiyou/cnchar/CnCharSettingComponent.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
import java.awt.event.MouseListener;
1414

1515
public class CnCharSettingComponent implements Configurable {
16-
public static final int LENGTH = 45;
16+
public static final int LENGTH = 30;
17+
public static final int ROW = 10;
1718
public static final String DEFAULT_STRING = ", , 。 . : : ; ; ! ! ? ? “ \"\" ‘ ' ’ ' 【 [ 】 ] ( ( ) ) 「 { 」 } 《 < 》 > 、 /".replace(" ",
1819
"\n");
1920
public static final String KEY = "cnchar_config_string";
@@ -29,6 +30,8 @@ public class CnCharSettingComponent implements Configurable {
2930
private JCheckBox isReplaceMsgHit;
3031
private JCheckBox replaceInCommentCheckBox;
3132

33+
private JTextArea extensionWhitelist;
34+
3235
public static void main(String[] args) {
3336
String[] a = DEFAULT_STRING.split("\n");
3437
for (int i = 0; i < a.length; i += 2) {
@@ -56,6 +59,7 @@ public JComponent createComponent() {
5659
settingPanel.repaint();
5760
return settingPanel;
5861
}
62+
5963
settingPanel = new JPanel();
6064
settingPanel.setLayout(null);
6165
text1 = new JTextField[LENGTH];
@@ -67,10 +71,10 @@ public JComponent createComponent() {
6771
text2[i] = new JTextField();
6872
labels1[i] = new JLabel();
6973
labels2[i] = new JLabel();
70-
text1[i].setBounds(35 + (i / 15) * 200, 32 * (i % 15), 60, 32);
71-
text2[i].setBounds(120 + (i / 15) * 200, 32 * (i % 15), 60, 32);
72-
labels1[i].setBounds(5 + (i / 15) * 200, 32 * (i % 15), 30, 32);
73-
labels2[i].setBounds(95 + (i / 15) * 200, 32 * (i % 15), 25, 32);
74+
text1[i].setBounds(35 + (i / ROW) * 200, 32 * (i % ROW), 60, 32);
75+
text2[i].setBounds(120 + (i / ROW) * 200, 32 * (i % ROW), 60, 32);
76+
labels1[i].setBounds(5 + (i / ROW) * 200, 32 * (i % ROW), 30, 32);
77+
labels2[i].setBounds(95 + (i / ROW) * 200, 32 * (i % ROW), 25, 32);
7478
labels1[i].setText((i + 1) + ".");
7579
labels2[i].setText("->");
7680
labels1[i].setHorizontalAlignment(JLabel.CENTER);
@@ -94,7 +98,16 @@ public JComponent createComponent() {
9498
replaceInCommentCheckBox.setBounds(30, 34 * 15, 250, 32);
9599
replaceInCommentCheckBox.setSelected(ReplaceCharConfig.replaceInComment);
96100
settingPanel.add(replaceInCommentCheckBox);
97-
101+
//JLabel text = new JLabel();
102+
//text.setText("不进行替换的文件扩展名配置。格式:.java");
103+
//text.setForeground(JBColor.BLUE);
104+
//text.setBounds(30, 36 * 15, 60, 32);
105+
////替换白名单
106+
//extensionWhitelist = new JTextArea();
107+
//extensionWhitelist.setEditable(true);
108+
//extensionWhitelist.setText("fsfs");
109+
//extensionWhitelist.setBounds(30, 25*15, 250,32);
110+
//settingPanel.add(extensionWhitelist);
98111

99112
btnDefault = new JLabel();
100113
btnDefault.setText("恢复默认");

src/main/java/com/haojiyou/cnchar/service/HintService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import com.intellij.openapi.editor.impl.EditorImpl;
1111
import com.intellij.ui.LightweightHint;
1212
import com.intellij.util.ui.accessibility.AccessibleContextUtil;
13-
import org.apache.commons.lang.StringEscapeUtils;
13+
import org.apache.commons.text.StringEscapeUtils;
1414

1515
import javax.swing.*;
1616
import javax.swing.event.HyperlinkListener;
@@ -62,8 +62,8 @@ public void showHint(EditorImpl editor, int logicalPositionLine,int logicalPosit
6262

6363

6464
public String createHint(String original, String replacement) {
65-
original = originalHtml(StringEscapeUtils.escapeHtml(original));
66-
replacement = replacement(StringEscapeUtils.escapeHtml(replacement));
65+
original = originalHtml(StringEscapeUtils.escapeHtml4(original));
66+
replacement = replacement(StringEscapeUtils.escapeHtml4(replacement));
6767
String title = "提示: ";
6868
String content = original + "已被改为" + replacement;
6969
String apply = "如果不需要替换,请按[撤回]的快捷键还原.";

0 commit comments

Comments
 (0)