Skip to content

Commit c30b4fa

Browse files
committed
Checkstyle
1 parent 1273185 commit c30b4fa

File tree

8 files changed

+15
-25
lines changed

8 files changed

+15
-25
lines changed

src/main/java/net/sourceforge/pmd/util/fxdesigner/DesignerStarter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ private static String getHelpText(JCommander jCommander) {
9494
return sb.toString();
9595
}
9696

97+
@SuppressWarnings("PMD.AvoidCatchingThrowable")
9798
private static void launchGui(String[] args) {
9899
String message = null;
99100
if (!isJavaFxAvailable()) {

src/main/java/net/sourceforge/pmd/util/fxdesigner/model/testing/TestXmlParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333

3434
import net.sourceforge.pmd.lang.LanguageVersion;
3535
import net.sourceforge.pmd.util.fxdesigner.model.ObservableRuleBuilder;
36-
import net.sourceforge.pmd.util.fxdesigner.util.DesignerUtil;
3736
import net.sourceforge.pmd.util.fxdesigner.util.AuxLanguageRegistry;
37+
import net.sourceforge.pmd.util.fxdesigner.util.DesignerUtil;
3838
import net.sourceforge.pmd.util.fxdesigner.util.codearea.PmdCoordinatesSystem.TextRange;
3939

4040
public class TestXmlParser {

src/main/java/net/sourceforge/pmd/util/fxdesigner/popups/ExportXPathWizardController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import static com.github.oowekyala.rxstring.ItemRenderer.indented;
99
import static com.github.oowekyala.rxstring.ItemRenderer.surrounded;
1010
import static com.github.oowekyala.rxstring.ItemRenderer.wrapped;
11-
import static net.sourceforge.pmd.util.fxdesigner.util.DesignerUtil.stringConverter;
1211
import static net.sourceforge.pmd.util.fxdesigner.util.AuxLanguageRegistry.getSupportedLanguageVersions;
12+
import static net.sourceforge.pmd.util.fxdesigner.util.DesignerUtil.stringConverter;
1313
import static net.sourceforge.pmd.util.fxdesigner.util.reactfx.ReactfxUtil.rewireInit;
1414

1515
import java.net.URL;

src/main/java/net/sourceforge/pmd/util/fxdesigner/popups/SimplePopups.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,8 @@
77
import static java.lang.Double.max;
88
import static java.lang.Math.min;
99

10-
import java.io.BufferedWriter;
11-
import java.io.File;
1210
import java.io.IOException;
13-
import java.io.OutputStream;
14-
import java.io.OutputStreamWriter;
15-
import java.io.Writer;
1611
import java.nio.charset.StandardCharsets;
17-
import java.nio.file.Files;
1812
import java.util.Locale;
1913
import java.util.stream.Collectors;
2014

@@ -28,9 +22,7 @@
2822
import net.sourceforge.pmd.PMDVersion;
2923
import net.sourceforge.pmd.lang.Language;
3024
import net.sourceforge.pmd.util.fxdesigner.Designer;
31-
import net.sourceforge.pmd.util.fxdesigner.app.ApplicationComponent;
3225
import net.sourceforge.pmd.util.fxdesigner.app.DesignerRoot;
33-
import net.sourceforge.pmd.util.fxdesigner.app.services.LogEntry.Category;
3426
import net.sourceforge.pmd.util.fxdesigner.util.AuxLanguageRegistry;
3527
import net.sourceforge.pmd.util.fxdesigner.util.DesignerUtil;
3628

@@ -41,14 +33,11 @@
4133
import javafx.scene.Node;
4234
import javafx.scene.control.Alert;
4335
import javafx.scene.control.Alert.AlertType;
44-
import javafx.scene.control.Button;
4536
import javafx.scene.control.Label;
4637
import javafx.scene.control.ScrollPane;
4738
import javafx.scene.control.TextArea;
4839
import javafx.scene.layout.StackPane;
49-
import javafx.stage.FileChooser;
5040
import javafx.stage.Popup;
51-
import javafx.stage.Stage;
5241
import javafx.util.Duration;
5342

5443

src/main/java/net/sourceforge/pmd/util/fxdesigner/popups/TestExportWizardController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@ protected void beforeParentInit() {
9494

9595

9696
ControlUtil.copyToClipboardButton(copyResultButton, exportResultArea::getText);
97-
ControlUtil.saveToFileButton(saveToFileButton, myPopupStage, exportResultArea::getText, this);
97+
ControlUtil.saveToFileButton(saveToFileButton, myPopupStage, exportResultArea::getText, this, () -> originalFile);
9898
}
9999
}

src/main/java/net/sourceforge/pmd/util/fxdesigner/popups/TreeExportWizardController.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import net.sourceforge.pmd.util.fxdesigner.util.controls.DynamicWidthChoicebox;
2626
import net.sourceforge.pmd.util.fxdesigner.util.controls.PopOverWrapper;
2727
import net.sourceforge.pmd.util.fxdesigner.util.controls.PropertyMapView;
28-
import net.sourceforge.pmd.util.fxdesigner.util.controls.RippleButton;
2928
import net.sourceforge.pmd.util.fxdesigner.util.controls.ToolbarTitledPane;
3029
import net.sourceforge.pmd.util.fxdesigner.util.reactfx.ReactfxUtil;
3130

@@ -45,7 +44,7 @@ public final class TreeExportWizardController extends AbstractController {
4544
private final Stage myPopupStage;
4645
private final PopOverWrapper<LiveTreeRenderer> propertiesPopover;
4746
@FXML
48-
private RippleButton propertiesMapButton;
47+
private Button propertiesMapButton;
4948
@FXML
5049
private DynamicWidthChoicebox<LiveTreeRenderer> rendererChoicebox;
5150
@FXML
@@ -116,7 +115,7 @@ protected void beforeParentInit() {
116115
exportResultArea.setSyntaxHighlighter(AvailableSyntaxHighlighters.XML);
117116

118117
ControlUtil.copyToClipboardButton(copyResultButton, exportResultArea::getText);
119-
ControlUtil.saveToFileButton(saveToFileButton, myPopupStage, exportResultArea::getText, this);
118+
ControlUtil.saveToFileButton(saveToFileButton, myPopupStage, exportResultArea::getText, this, () -> null);
120119

121120

122121
TreeRendererRegistry rendererRegistry = getService(DesignerRoot.TREE_RENDERER_REGISTRY);

src/main/java/net/sourceforge/pmd/util/fxdesigner/util/TextTreeRenderer.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ public class TextTreeRenderer implements TreeRenderer {
1919

2020
public static final TreeRendererDescriptor DESCRIPTOR = new TreeRendererDescriptor() {
2121

22-
private final PropertyDescriptor<Boolean> ONLY_ASCII =
22+
private final PropertyDescriptor<Boolean> onlyAscii =
2323
PropertyFactory.booleanProperty("onlyAsciiChars")
2424
.defaultValue(false)
2525
.desc("Use only ASCII characters in the structure")
2626
.build();
2727

28-
private final PropertyDescriptor<Integer> MAX_LEVEL =
28+
private final PropertyDescriptor<Integer> maxLevel =
2929
PropertyFactory.intProperty("maxLevel")
3030
.defaultValue(-1)
3131
.desc("Max level on which to recurse. Negative means unbounded")
@@ -46,8 +46,8 @@ public String getName() {
4646
}
4747
};
4848

49-
bundle.definePropertyDescriptor(ONLY_ASCII);
50-
bundle.definePropertyDescriptor(MAX_LEVEL);
49+
bundle.definePropertyDescriptor(onlyAscii);
50+
bundle.definePropertyDescriptor(maxLevel);
5151

5252
return bundle;
5353
}
@@ -65,9 +65,9 @@ public String description() {
6565
@Override
6666
public TreeRenderer produceRenderer(PropertySource properties) {
6767

68-
Strings str = properties.getProperty(ONLY_ASCII) ? ASCII : UNICODE;
68+
Strings str = properties.getProperty(onlyAscii) ? ASCII : UNICODE;
6969

70-
return new TextTreeRenderer(str, properties.getProperty(MAX_LEVEL));
70+
return new TextTreeRenderer(str, properties.getProperty(maxLevel));
7171
}
7272
};
7373

@@ -103,7 +103,7 @@ private String childPrefix(String prefix, boolean isTail) {
103103

104104

105105
protected void appendIndent(Appendable out, String prefix, boolean isTail) throws IOException {
106-
out.append(prefix).append((isTail) ? str.tailFork : str.fork);
106+
out.append(prefix).append(isTail ? str.tailFork : str.fork);
107107
}
108108

109109

src/main/java/net/sourceforge/pmd/util/fxdesigner/util/controls/ControlUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,11 @@ public static void copyToClipboardButton(Button button, Supplier<String> copiedT
233233
});
234234
}
235235

236-
public static void saveToFileButton(Button button, Stage popupStage, Supplier<String> content, ApplicationComponent owner) {
236+
public static void saveToFileButton(Button button, Stage popupStage, Supplier<String> content, ApplicationComponent owner, Supplier<String> initialFileName) {
237237
button.setOnAction(e -> {
238238

239239
FileChooser chooser = new FileChooser();
240+
chooser.setInitialFileName(initialFileName.get());
240241
chooser.setTitle("Write to a file");
241242
File file = chooser.showSaveDialog(popupStage);
242243

0 commit comments

Comments
 (0)