1.23 Add setting for show when compact middle packages | 增加折叠中间包时显示中间包注释设置 Fixed #9

This commit is contained in:
林万程
2022-08-24 22:31:32 +08:00
parent 7fa464855a
commit 9adc3775b7
6 changed files with 24 additions and 3 deletions

View File

@@ -58,6 +58,7 @@ Thanks JetBrains Licenses for Open Source.
<h2>English Change Notes:</h2>
<ul>
<li>1.23 Add project-view-tree-comment setting for show when compact middle packages
<li>1.22 Add PopupMenu Copy ClassName.MethodName
<li>1.21 Add line-end-comment default skip only English when system lang is not `en`
<li>1.20 Add get doc first sentence checkbox
@@ -84,6 +85,7 @@ Thanks JetBrains Licenses for Open Source.
<h2>中文更新说明:</h2>
<ul>
<li>1.23 增加 项目导航栏注释 折叠中间包时显示中间包注释设置
<li>1.22 增加 右键菜单 复制 类名.方法名
<li>1.21 增加 行末注释 系统语言非英文时 默认 忽略纯英文
<li>1.20 增加 获取第一句注释选项

View File

@@ -4,7 +4,7 @@ plugins {
}
group 'io.github.linwancen'
version '1.22.0.' + (new Date().format('yyyy.MM.dd_HH.mm'))
version '1.23.0.' + (new Date().format('yyyy.MM.dd_HH.mm'))
apply plugin: 'java'
@@ -39,6 +39,7 @@ patchPluginXml {
changeNotes = """
<h2>English Change Notes:</h2>
<ul>
<li>1.23 Add project-view-tree-comment setting for show when compact middle packages
<li>1.22 Add PopupMenu Copy ClassName.MethodName
<li>1.21 Add line-end-comment default skip only English when system lang is not `en`
<li>1.20 Add get doc first sentence checkbox
@@ -65,6 +66,7 @@ patchPluginXml {
<h2>中文更新说明:</h2>
<ul>
<li>1.23 增加 项目导航栏注释 折叠中间包时显示中间包注释设置
<li>1.22 增加 右键菜单 复制 类名.方法名
<li>1.21 增加 行末注释 系统语言非英文时 默认 忽略纯英文
<li>1.20 增加 获取第一句注释选项

View File

@@ -131,6 +131,10 @@ public class Tree implements ProjectViewNodeDecorator {
if (docComment != null) {
return docComment;
}
AppSettingsState instance = AppSettingsState.getInstance();
if (!instance.compact) {
return null;
}
PsiDirectory parent = child.getParent();
if (parent == null) {
return null;

View File

@@ -15,6 +15,7 @@ public class AppSettingsComponent extends AbstractSettingsComponent {
private final JPanel myMainPanel;
private final JBCheckBox showTreeComment = new JBCheckBox("Show tree comment ");
private final JBCheckBox compact = new JBCheckBox("compact ");
private final JBTextField treeTags = new JBTextField();
private final JBCheckBox showLineEndComment = new JBCheckBox("Show line end comment ");
private final JBTextField lineTags = new JBTextField();
@@ -59,7 +60,7 @@ public class AppSettingsComponent extends AbstractSettingsComponent {
new JBLabel("json text color: "), lineEndJsonColor,
new JBLabel("prefix: "), lineEndPrefix);
FormBuilder formBuilder = FormBuilder.createFormBuilder()
.addComponent(JPanelFactory.of(findElementRightToLeft))
.addComponent(JPanelFactory.of(findElementRightToLeft, compact))
.addSeparator()
.addComponent(JPanelFactory.of(fromCall, fromNew, fromRef, inJson, skipAnnotation, skipAscii, skipBlank), 1)
.addSeparator()
@@ -85,6 +86,14 @@ public class AppSettingsComponent extends AbstractSettingsComponent {
showTreeComment.setSelected(newStatus);
}
public boolean getCompact() {
return compact.isSelected();
}
public void setCompact(boolean newStatus) {
compact.setSelected(newStatus);
}
@NotNull
public String getTreeTags() {
return treeTags.getText();

View File

@@ -33,6 +33,7 @@ public class AppSettingsConfigurable implements Configurable {
public boolean isModified() {
AppSettingsState settings = AppSettingsState.getInstance();
boolean modified = mySettingsComponent.getShowTreeComment() != settings.showTreeComment;
modified |= mySettingsComponent.getCompact() != settings.compact;
modified |= !mySettingsComponent.getTreeTags().equals(String.join("|", settings.treeTags));
modified |= mySettingsComponent.getShowLineEndComment() != settings.showLineEndComment;
modified |= !mySettingsComponent.getLineTags().equals(String.join("|", settings.lineTags));
@@ -61,6 +62,7 @@ public class AppSettingsConfigurable implements Configurable {
public void apply() {
AppSettingsState settings = AppSettingsState.getInstance();
settings.showTreeComment = mySettingsComponent.getShowTreeComment();
settings.compact = mySettingsComponent.getCompact();
settings.treeTags = Splitter.on('|').splitToList(mySettingsComponent.getTreeTags()).toArray(new String[0]);
settings.showLineEndComment = mySettingsComponent.getShowLineEndComment();
settings.lineTags = Splitter.on('|').splitToList(mySettingsComponent.getLineTags()).toArray(new String[0]);
@@ -91,6 +93,7 @@ public class AppSettingsConfigurable implements Configurable {
public void reset() {
AppSettingsState settings = AppSettingsState.getInstance();
mySettingsComponent.setShowTreeComment(settings.showTreeComment);
mySettingsComponent.setCompact(settings.compact);
mySettingsComponent.setTreeTags(String.join("|", settings.treeTags));
mySettingsComponent.setShowLineEndComment(settings.showLineEndComment);
mySettingsComponent.setLineTags(String.join("|", settings.lineTags));

View File

@@ -22,9 +22,10 @@ import java.util.Locale;
public class AppSettingsState extends AbstractSettingsState implements PersistentStateComponent<AppSettingsState> {
public boolean showTreeComment = true;
public boolean compact = true;
public String[] treeTags = {"author"};
public boolean showLineEndComment = true;
public String[] lineTags = {"author"};
public String[] lineTags = {};
public final TextAttributes lineEndTextAttr = new TextAttributes(
new JBColor(new Color(98, 151, 85), new Color(98, 151, 85)),