fix(ProjectSettingsComponent): add ScrollPane

This commit is contained in:
林万程
2024-01-16 22:02:10 +08:00
parent 0ebf080a56
commit 85a70a7ac5
5 changed files with 11 additions and 10 deletions

View File

@@ -7,7 +7,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
public class EnumDoc {

View File

@@ -8,8 +8,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;

View File

@@ -123,9 +123,9 @@ public class LineEndCacheUtils {
if (list != null) {
list.add(lineExt);
} else {
lineCache.map.put(info.text, new ArrayList<>() {{
add(lineExt);
}});
ArrayList<LineExtensionInfo> lineExtList = new ArrayList<>();
lineExtList.add(lineExt);
lineCache.map.put(info.text, lineExtList);
}
}
lineCache.updated();

View File

@@ -39,7 +39,7 @@ public abstract class AbstractSettingsState {
public transient Map<String, Pattern[]> dirDoc = new LinkedHashMap<>() {{
put("pom.xml", new Pattern[]{
Pattern.compile("<description>([^<]++)</description>"),
Pattern.compile("<name>\\$\\{[^}]*+\\}([^<]++)</name>"),
Pattern.compile("<name>\\$\\{[^}]*+}([^<]++)</name>"),
});
put("build.gradle", new Pattern[]{Pattern.compile("(?m)^description[^'\"]*+['\"]([^'\"]++)['\"]")});
put("build.gradle.kts", new Pattern[]{Pattern.compile("(?m)^description[^'\"]*+['\"]([^'\"]++)['\"]")});

View File

@@ -2,6 +2,7 @@ package io.github.linwancen.plugin.show.settings;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.util.ui.FormBuilder;
import org.jetbrains.annotations.NotNull;
@@ -9,14 +10,14 @@ import javax.swing.*;
public class ProjectSettingsComponent extends AbstractSettingsComponent {
private final JPanel myMainPanel;
private final JBScrollPane myMainPanel;
private final JBCheckBox globalFilterEffective = new JBCheckBox(ShowBundle.message("global.settings.effective"));
private final JBCheckBox projectFilterEffective = new JBCheckBox(ShowBundle.message("project.settings.effective"));
public ProjectSettingsComponent() {
@NotNull JButton resetDefault = new JButton(ShowBundle.message("reset.default"));
resetDefault.addActionListener(e -> ProjectSettingsConfigurable.reset(ProjectSettingsState.DEFAULT_SETTING, this));
myMainPanel = FormBuilder.createFormBuilder()
JPanel panel = FormBuilder.createFormBuilder()
.addComponent(JPanelFactory.of(resetDefault,
new JBLabel(ShowBundle.message("line.count")), lineEndCount,
globalFilterEffective, projectFilterEffective
@@ -24,9 +25,12 @@ public class ProjectSettingsComponent extends AbstractSettingsComponent {
.addComponent(commonPanel(), 1)
.addComponentFillVertically(new JPanel(), 0)
.getPanel();
JBScrollPane scrollPane = new JBScrollPane(panel);
scrollPane.setBorder(null);
myMainPanel = scrollPane;
}
public JPanel getPanel() {
public JBScrollPane getPanel() {
return myMainPanel;
}