Skip to content

Commit 60c5463

Browse files
committed
upgrade gradle, fixed IntelliJ warnings, update against API dicelib changes introduced in dicelib related to RPTools/maptool#1898
1 parent e7aa927 commit 60c5463

File tree

5 files changed

+40
-34
lines changed

5 files changed

+40
-34
lines changed

.gitignore

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1-
.idea/
2-
.gradle/
3-
.settings
4-
.classpath
1+
# OS generated files
2+
################################################################################
3+
.DS_Store
4+
.DS_Store?
5+
._*
6+
.Spotlight-V100
7+
.Trashes
8+
Icon?
9+
ehthumbs.db
10+
Thumbs.db
11+
12+
# Others
13+
################################################################################
14+
.gradle
515
build/
6-
src/main/java/net/rptools/dicetool/dicetool/
16+
/bin/
17+
target/
18+
out/
19+
/releases/
20+
*.log
21+
*~
22+
\${sys:appHome}/
23+
/.idea

gradle/wrapper/gradle-wrapper.jar

205 Bytes
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Sat Mar 04 13:37:30 EST 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-bin.zip

gradlew

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
3333
# Use the maximum available, or set MAX_FD != -1 to use that value.
3434
MAX_FD="maximum"
3535

36-
warn ( ) {
36+
warn () {
3737
echo "$*"
3838
}
3939

40-
die ( ) {
40+
die () {
4141
echo
4242
echo "$*"
4343
echo
@@ -155,7 +155,7 @@ if $cygwin ; then
155155
fi
156156

157157
# Escape application args
158-
save ( ) {
158+
save () {
159159
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160160
echo " "
161161
}

src/main/java/net/rptools/dicetool/ui/MainFrame.java

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import java.math.BigDecimal;
3434
import java.util.ArrayList;
3535
import java.util.Collections;
36-
import java.util.Iterator;
3736
import java.util.List;
3837
import java.util.prefs.BackingStoreException;
3938
import java.util.prefs.Preferences;
@@ -57,8 +56,7 @@ public class MainFrame extends JFrame {
5756
private static final long serialVersionUID = -5149326446698624828L;
5857

5958
private static String version;
60-
61-
private final JMenuBar menuBar;
59+
6260
private final JTabbedPane customRollTab;
6361
private final JLabel statusBar;
6462

@@ -68,9 +66,9 @@ public class MainFrame extends JFrame {
6866

6967
private final AboutDialog aboutDialog;
7068

71-
private List<CustomRollPanel> rollPanels = new ArrayList<CustomRollPanel>();
69+
private List<CustomRollPanel> rollPanels = new ArrayList<>();
7270

73-
private List<RollListener> rollListeners = new ArrayList<RollListener>();
71+
private final List<RollListener> rollListeners = new ArrayList<>();
7472

7573
private static final String EXPRESSION_SYNTAX =
7674
"bags (non cumulative rolls):\n"
@@ -105,7 +103,7 @@ public MainFrame() {
105103
}
106104

107105
String credits = "";
108-
String version = "";
106+
String version;
109107
Image logo = null;
110108
try {
111109
credits = new String(FileUtil.loadResource("java/net.rptools.dicetool.dicetool/credits.html"));
@@ -117,9 +115,9 @@ public MainFrame() {
117115
ioe.printStackTrace();
118116
}
119117
aboutDialog = new AboutDialog(this, logo, credits);
120-
121118

122-
menuBar = new JMenuBar();
119+
120+
JMenuBar menuBar = new JMenuBar();
123121
JMenu menu = new JMenu("File");
124122
menu.setMnemonic('F');
125123
menuBar.add(menu);
@@ -168,8 +166,6 @@ public void actionPerformed(ActionEvent e) {
168166
private static final long serialVersionUID = -7511992886537497232L;
169167

170168
public void actionPerformed(ActionEvent e) {
171-
RowListModel tm = resultPanel.getTableModel();
172-
173169
JOptionPane.showMessageDialog(
174170
MainFrame.this,
175171
"Random: "
@@ -213,8 +209,7 @@ public void actionPerformed(ActionEvent e) {
213209
panel.add(dicePanel);
214210

215211
customRollTab = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
216-
for (Iterator i = rollPanels.iterator(); i.hasNext(); ) {
217-
CustomRollPanel rollPanel = (CustomRollPanel) i.next();
212+
for (CustomRollPanel rollPanel : rollPanels) {
218213
customRollTab.add(rollPanel);
219214
}
220215

@@ -282,16 +277,14 @@ public void actionPerformed(ActionEvent e) {
282277
}
283278

284279
public void roll(String definition) {
285-
ExpressionParser parser = new ExpressionParser(resolver);
280+
ExpressionParser parser = new ExpressionParser();
286281

287282

288283
try {
289284
//List xps = ExpressionFactory.getExpressions(definition, variablePanel.getVariables());
290-
291-
for (Iterator i = rollListeners.iterator(); i.hasNext();) {
292-
RollListener l = (RollListener) i.next();
293-
294-
l.rolled(Collections.singletonList(parser.evaluate(definition).format()));
285+
286+
for (RollListener l : rollListeners) {
287+
l.rolled(Collections.singletonList(parser.evaluate(definition, resolver).format()));
295288
}
296289
} catch (ParserException e) {
297290
JOptionPane.showMessageDialog(this, e.getMessage());
@@ -397,8 +390,7 @@ public void saveRollPanelPreferences(Preferences rootPrefs) {
397390
prefs.putBoolean("tabbed", true);
398391

399392
int index = 0;
400-
for (Iterator i = rollPanels.iterator(); i.hasNext(); index++) {
401-
CustomRollPanel rollPanel = (CustomRollPanel) i.next();
393+
for (CustomRollPanel rollPanel : rollPanels) {
402394

403395
String name = rollPanel.getName();
404396
prefs.put("TabName" + index, name);
@@ -435,12 +427,10 @@ public void exportPreferences(File file, int tabIndex) {
435427

436428
try {
437429
tabPrefs.exportSubtree(new FileOutputStream(file));
438-
} catch (IOException e) {
439-
e.printStackTrace(System.err);
440-
} catch (BackingStoreException e) {
430+
} catch (IOException | BackingStoreException e) {
441431
e.printStackTrace(System.err);
442432
}
443-
433+
444434
}
445435

446436
/* public void convertPreferences() {

0 commit comments

Comments
 (0)