X Tutup
Skip to content

Commit eaca5c5

Browse files
add spotless gradle plugin
1 parent 3f264f4 commit eaca5c5

File tree

278 files changed

+59503
-48021
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

278 files changed

+59503
-48021
lines changed

app/build.gradle

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id "application"
3+
id("com.diffplug.spotless") version "7.0.2"
34
}
45
apply plugin: "java"
56

@@ -58,7 +59,6 @@ startScripts {
5859
classpath = ((Jar)jar).outputs.files + ((Jar)pathingJar).outputs.files
5960
}
6061

61-
6262
dependencies {
6363
implementation fileTree(dir: "libs", include: ["*.jar"])
6464

@@ -91,6 +91,25 @@ dependencies {
9191
testImplementation 'junit:junit:4.12'
9292
}
9393

94+
spotless {
95+
java {
96+
// Use the default importOrder configuration
97+
importOrder()
98+
99+
removeUnusedImports()
100+
101+
// Cleanthat will refactor your code, but it may break your style: apply it before your formatter
102+
cleanthat() // has its own section below
103+
104+
// apply a specific flavor of google-java-format
105+
googleJavaFormat().reflowLongStrings().skipJavadocFormatting()
106+
// fix formatting of type annotations
107+
formatAnnotations()
108+
}
109+
}
110+
111+
build.dependsOn spotlessApply
112+
94113
jar {
95114
dependsOn(pathingJar)
96115
from { ((Jar)pathingJar).outputs.files.collect { it.isDirectory() ? it : zipTree(it) } }
@@ -130,8 +149,4 @@ task debugAll {
130149
rootProject.ext.get("debugServerJarPath")
131150
}
132151
}
133-
}
134-
135-
repositories {
136-
mavenCentral()
137-
}
152+
}
Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,82 @@
11
package com.basic4gl.desktop;
22

33
import com.basic4gl.desktop.util.SwingIconUtil;
4-
5-
import javax.swing.*;
6-
import javax.swing.border.EmptyBorder;
74
import java.awt.*;
85
import java.io.IOException;
96
import java.util.Locale;
107
import java.util.ResourceBundle;
8+
import javax.swing.*;
9+
import javax.swing.border.EmptyBorder;
1110

1211
/**
1312
* Created by Nate on 1/12/2015.
1413
*/
1514
public class AboutDialog {
16-
JDialog mDialog;
17-
18-
public AboutDialog(Frame parent) {
19-
Locale locale = new Locale("en", "US");
20-
ResourceBundle resources = ResourceBundle.getBundle("build", locale);
15+
JDialog mDialog;
2116

22-
mDialog = new JDialog(parent);
17+
public AboutDialog(Frame parent) {
18+
Locale locale = new Locale("en", "US");
19+
ResourceBundle resources = ResourceBundle.getBundle("build", locale);
2320

24-
mDialog.setTitle("About");
21+
mDialog = new JDialog(parent);
2522

26-
mDialog.setResizable(false);
27-
mDialog.setModal(true);
23+
mDialog.setTitle("About");
2824

29-
JPanel mainPanel = new JPanel();
30-
mDialog.add(mainPanel);
31-
GridLayout mainLayout = new GridLayout(2, 1);
32-
mainPanel.setLayout(mainLayout);
25+
mDialog.setResizable(false);
26+
mDialog.setModal(true);
3327

34-
JPanel infoPanel = new JPanel();
35-
mainPanel.add(infoPanel);
36-
GridLayout infoLayout1 = new GridLayout(1, 2);
37-
infoPanel.setLayout(infoLayout1);
38-
JLabel labelLogo = new JLabel(SwingIconUtil.createImageIcon(BuildInfo.ICON_LOGO_LARGE));
39-
infoPanel.add(labelLogo);
28+
JPanel mainPanel = new JPanel();
29+
mDialog.add(mainPanel);
30+
GridLayout mainLayout = new GridLayout(2, 1);
31+
mainPanel.setLayout(mainLayout);
4032

41-
JPanel descriptionPanel = new JPanel();
42-
infoPanel.add(descriptionPanel);
43-
BoxLayout descriptionLayout = new BoxLayout(descriptionPanel, BoxLayout.Y_AXIS);
33+
JPanel infoPanel = new JPanel();
34+
mainPanel.add(infoPanel);
35+
GridLayout infoLayout1 = new GridLayout(1, 2);
36+
infoPanel.setLayout(infoLayout1);
37+
JLabel labelLogo = new JLabel(SwingIconUtil.createImageIcon(BuildInfo.ICON_LOGO_LARGE));
38+
infoPanel.add(labelLogo);
4439

45-
descriptionPanel.setLayout(descriptionLayout);
46-
descriptionPanel.setBorder(new EmptyBorder(10, 5, 10, 5));
47-
descriptionPanel.add(new JLabel(BuildInfo.APPLICATION_NAME));
48-
JLabel labelDescription = new JLabel(BuildInfo.APPLICATION_DESCRIPTION);
49-
labelDescription.setFont(new Font(Font.MONOSPACED, Font.ITALIC, 12));
50-
labelDescription.setBorder(new EmptyBorder(5, 5, 5, 5));
51-
descriptionPanel.add(labelDescription);
52-
descriptionPanel.add(new JLabel("Version: " + resources.getString(BuildInfo.APPLICATION_VERSION_RESOURCE)));
53-
descriptionPanel.add(new JLabel("Build Date: " + resources.getString(BuildInfo.APPLICATION_BUILD_DATE_RESOURCE)));
54-
descriptionPanel.add(Box.createVerticalGlue());
55-
descriptionPanel.add(new JLabel(BuildInfo.APPLICATION_COPYRIGHT));
56-
descriptionPanel.add(new JLabel(BuildInfo.APPLICATION_WEBSITE));
40+
JPanel descriptionPanel = new JPanel();
41+
infoPanel.add(descriptionPanel);
42+
BoxLayout descriptionLayout = new BoxLayout(descriptionPanel, BoxLayout.Y_AXIS);
5743

44+
descriptionPanel.setLayout(descriptionLayout);
45+
descriptionPanel.setBorder(new EmptyBorder(10, 5, 10, 5));
46+
descriptionPanel.add(new JLabel(BuildInfo.APPLICATION_NAME));
47+
JLabel labelDescription = new JLabel(BuildInfo.APPLICATION_DESCRIPTION);
48+
labelDescription.setFont(new Font(Font.MONOSPACED, Font.ITALIC, 12));
49+
labelDescription.setBorder(new EmptyBorder(5, 5, 5, 5));
50+
descriptionPanel.add(labelDescription);
51+
descriptionPanel.add(
52+
new JLabel("Version: " + resources.getString(BuildInfo.APPLICATION_VERSION_RESOURCE)));
53+
descriptionPanel.add(
54+
new JLabel(
55+
"Build Date: " + resources.getString(BuildInfo.APPLICATION_BUILD_DATE_RESOURCE)));
56+
descriptionPanel.add(Box.createVerticalGlue());
57+
descriptionPanel.add(new JLabel(BuildInfo.APPLICATION_COPYRIGHT));
58+
descriptionPanel.add(new JLabel(BuildInfo.APPLICATION_WEBSITE));
5859

59-
JTextPane textLicenses = new JTextPane();
60-
JScrollPane scrollLicenses = new JScrollPane(textLicenses);
61-
scrollLicenses.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
62-
textLicenses.setEditable(false);
60+
JTextPane textLicenses = new JTextPane();
61+
JScrollPane scrollLicenses = new JScrollPane(textLicenses);
62+
scrollLicenses.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
63+
textLicenses.setEditable(false);
6364

64-
java.net.URL helpURL = ClassLoader.getSystemClassLoader().getResource("about.html");
65-
if (helpURL != null) {
66-
try {
67-
textLicenses.setPage(helpURL);
68-
} catch (IOException e) {
69-
System.err.println("Attempted to read a bad URL: " + helpURL);
70-
}
71-
} else {
72-
System.err.println("Couldn't find file: about.html");
73-
}
74-
mainPanel.add(scrollLicenses);
75-
//JScrollPane scrollPane = new ScrollPane(textLicenses);
76-
mDialog.pack();
77-
mDialog.setSize(new Dimension(360, 320));
78-
mDialog.setLocationRelativeTo(parent);
79-
mDialog.setVisible(true);
65+
java.net.URL helpURL = ClassLoader.getSystemClassLoader().getResource("about.html");
66+
if (helpURL != null) {
67+
try {
68+
textLicenses.setPage(helpURL);
69+
} catch (IOException e) {
70+
System.err.println("Attempted to read a bad URL: " + helpURL);
71+
}
72+
} else {
73+
System.err.println("Couldn't find file: about.html");
8074
}
81-
75+
mainPanel.add(scrollLicenses);
76+
// JScrollPane scrollPane = new ScrollPane(textLicenses);
77+
mDialog.pack();
78+
mDialog.setSize(new Dimension(360, 320));
79+
mDialog.setLocationRelativeTo(parent);
80+
mDialog.setVisible(true);
81+
}
8282
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.basic4gl.desktop;
22

33
enum ApMode {
4-
AP_CLOSED, AP_STOPPED, AP_PAUSED, AP_RUNNING
4+
AP_CLOSED,
5+
AP_STOPPED,
6+
AP_PAUSED,
7+
AP_RUNNING
58
}

0 commit comments

Comments
 (0)
X Tutup