feat(JavaLangDoc): 2.15 java anno doc | java 注解注释
This commit is contained in:
@@ -24,6 +24,8 @@ public abstract class AbstractSettingsComponent {
|
||||
|
||||
private final JBCheckBox docGetEffect = new JBCheckBox("");
|
||||
private final JBTextField docGet = new JBTextField();
|
||||
private final JBCheckBox annoDocEffect = new JBCheckBox("");
|
||||
private final JBTextArea annoDoc = new JBTextArea();
|
||||
private final JBCheckBox dirDocEffect = new JBCheckBox("");
|
||||
private final JBTextArea dirDoc = new JBTextArea();
|
||||
private final JBCheckBox fileDocEffect = new JBCheckBox("");
|
||||
@@ -50,9 +52,11 @@ public abstract class AbstractSettingsComponent {
|
||||
.addLabeledComponent(new JBLabel(ShowBundle.message("comment.include.regexp")), docInclude, 1, true)
|
||||
.addLabeledComponent(new JBLabel(ShowBundle.message("comment.exclude.regexp")), docExclude, 1, true)
|
||||
.addSeparator();
|
||||
@NotNull JPanel label = JPanelFactory.of(docGetEffect, new JBLabel(ShowBundle.message("get.doc.regexp")));
|
||||
JPanel panel = builder
|
||||
.addLabeledComponent(label, docGet, 1, true).getPanel();
|
||||
@NotNull JPanel getLabel = JPanelFactory.of(docGetEffect, new JBLabel(ShowBundle.message("get.doc.regexp")));
|
||||
builder = builder.addLabeledComponent(getLabel, docGet, 1, true);
|
||||
@NotNull JPanel annoLabel = JPanelFactory.of(annoDocEffect, new JBLabel(ShowBundle.message("anno.doc")));
|
||||
builder = builder.addLabeledComponent(annoLabel, annoDoc, 1, true);
|
||||
JPanel panel = builder.getPanel();
|
||||
panel.setBorder(IdeBorderFactory.createTitledBorder(ShowBundle.message("line.end.comment")));
|
||||
return panel;
|
||||
}
|
||||
@@ -142,6 +146,24 @@ public abstract class AbstractSettingsComponent {
|
||||
}
|
||||
|
||||
|
||||
public boolean getAnnoDocEffect() {
|
||||
return annoDocEffect.isSelected();
|
||||
}
|
||||
|
||||
public void setAnnoDocEffect(boolean newStatus) {
|
||||
annoDocEffect.setSelected(newStatus);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getAnnoDoc() {
|
||||
return annoDoc.getText();
|
||||
}
|
||||
|
||||
public void setAnnoDoc(@NotNull String newText) {
|
||||
annoDoc.setText(newText);
|
||||
}
|
||||
|
||||
|
||||
public boolean getDirEffect() {
|
||||
return dirDocEffect.isSelected();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ public class AbstractSettingsConfigurable {
|
||||
modified |= !component.getDocExclude().equals(settings.getDocExclude());
|
||||
modified |= component.getDocGetEffect() != settings.docGetEffect;
|
||||
modified |= !component.getDocGet().equals(settings.getDocGet());
|
||||
modified |= component.getAnnoDocEffect() != settings.annoDocEffect;
|
||||
modified |= !component.getAnnoDoc().equals(settings.getAnnoDoc());
|
||||
modified |= component.getDirEffect() != settings.dirDocEffect;
|
||||
modified |= !component.getDirDoc().equals(settings.getDirDoc());
|
||||
modified |= component.getFileEffect() != settings.fileDocEffect;
|
||||
@@ -36,6 +38,8 @@ public class AbstractSettingsConfigurable {
|
||||
settings.setDocExclude(component.getDocExclude());
|
||||
settings.docGetEffect = component.getDocGetEffect();
|
||||
settings.setDocGet(component.getDocGet());
|
||||
settings.annoDocEffect = component.getAnnoDocEffect();
|
||||
settings.setAnnoDoc(component.getAnnoDoc());
|
||||
settings.dirDocEffect = component.getDirEffect();
|
||||
settings.setDirDoc(component.getDirDoc());
|
||||
settings.fileDocEffect = component.getFileEffect();
|
||||
@@ -51,6 +55,8 @@ public class AbstractSettingsConfigurable {
|
||||
component.setDocExclude(settings.getDocExclude());
|
||||
component.setDocGetEffect(settings.docGetEffect);
|
||||
component.setDocGet(settings.getDocGet());
|
||||
component.setAnnoDocEffect(settings.annoDocEffect);
|
||||
component.setAnnoDoc(settings.getAnnoDoc());
|
||||
component.setDirEffect(settings.dirDocEffect);
|
||||
component.setDirDoc(settings.getDirDoc());
|
||||
component.setFileEffect(settings.fileDocEffect);
|
||||
|
||||
@@ -2,9 +2,11 @@ package io.github.linwancen.plugin.show.settings;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public abstract class AbstractSettingsState {
|
||||
|
||||
@@ -25,6 +27,13 @@ public abstract class AbstractSettingsState {
|
||||
@NotNull
|
||||
public transient Pattern docGet = Pattern.compile(".+?(?:[。\\r\\n]|\\. )");
|
||||
|
||||
public boolean annoDocEffect = true;
|
||||
@NotNull
|
||||
public transient String[][] annoDoc = {
|
||||
{"field", "io.swagger.annotations.ApiModelProperty", "value"},
|
||||
{"field", "io.swagger.v3.oas.annotations.media.Schema", "title"},
|
||||
};
|
||||
|
||||
public boolean dirDocEffect = true;
|
||||
@NotNull
|
||||
public transient Map<String, Pattern[]> dirDoc = new LinkedHashMap<>() {{
|
||||
@@ -93,6 +102,23 @@ public abstract class AbstractSettingsState {
|
||||
}
|
||||
|
||||
|
||||
public String getAnnoDoc() {
|
||||
return Arrays.stream(annoDoc)
|
||||
.map(a -> String.join("#", a))
|
||||
.collect(Collectors.joining("\n"));
|
||||
}
|
||||
|
||||
public static final Pattern LINE_PATTERN = Pattern.compile("[\\r\\n]++");
|
||||
public static final Pattern METHOD_PATTERN = Pattern.compile("#");
|
||||
|
||||
public void setAnnoDoc(@NotNull String s) {
|
||||
String[] split = LINE_PATTERN.split(s);
|
||||
this.annoDoc = Arrays.stream(split)
|
||||
.map(METHOD_PATTERN::split)
|
||||
.toArray(String[][]::new);
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public String getDirDoc() {
|
||||
return PatternMapUtils.toString(dirDoc);
|
||||
|
||||
@@ -19,6 +19,8 @@ public class ProjectSettingsState extends AbstractSettingsState implements Persi
|
||||
|
||||
public ProjectSettingsState() {
|
||||
this.lineExclude = Pattern.compile("");
|
||||
this.annoDocEffect = false;
|
||||
this.annoDoc = new String[][]{};
|
||||
this.dirDocEffect = false;
|
||||
this.dirDoc = Collections.emptyMap();
|
||||
this.fileDocEffect = false;
|
||||
|
||||
Reference in New Issue
Block a user