Extract license popup
This commit is contained in:
parent
bb2999378f
commit
f9aa6679c5
@ -4,6 +4,8 @@
|
||||
|
||||
package net.sourceforge.pmd.util.fxdesigner;
|
||||
|
||||
import static net.sourceforge.pmd.util.fxdesigner.popups.SimplePopups.showLicensePopup;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -220,23 +222,6 @@ public class MainDesignerController extends AbstractController<AbstractControlle
|
||||
}
|
||||
|
||||
|
||||
private void showLicensePopup() {
|
||||
Alert licenseAlert = new Alert(AlertType.INFORMATION);
|
||||
licenseAlert.setWidth(500);
|
||||
licenseAlert.setHeaderText("License");
|
||||
|
||||
ScrollPane scroll = new ScrollPane();
|
||||
try {
|
||||
scroll.setContent(new TextArea(IOUtils.toString(getClass().getResourceAsStream("LICENSE"),
|
||||
StandardCharsets.UTF_8)));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
licenseAlert.getDialogPane().setContent(scroll);
|
||||
licenseAlert.showAndWait();
|
||||
}
|
||||
|
||||
|
||||
private void onFileMenuShowing() {
|
||||
openRecentMenu.setDisable(recentFiles.isEmpty());
|
||||
|
@ -181,8 +181,7 @@ public class SourceEditorController extends AbstractController<MainDesignerContr
|
||||
|
||||
|
||||
public void showAuxclasspathSetupPopup() {
|
||||
new AuxclasspathSetupController(getDesignerRoot())
|
||||
.show(getMainStage(), auxclasspathFiles.getValue(), auxclasspathFiles::setValue);
|
||||
new AuxclasspathSetupController(getDesignerRoot()).show(getMainStage(), auxclasspathFiles.getValue(), auxclasspathFiles::setValue);
|
||||
}
|
||||
|
||||
|
||||
|
@ -238,7 +238,7 @@ public final class EventLogController extends AbstractController<MainDesignerCon
|
||||
}
|
||||
|
||||
private Val<String> titleProperty() {
|
||||
return parent.getLogger().numNewLogEntriesProperty().map(i -> "Event log (" + (i > 0 ? i : "no") + " new)");
|
||||
return getLogger().numNewLogEntriesProperty().map(i -> "Event log (" + (i > 0 ? i : "no") + " new)");
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.util.fxdesigner.popups;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Alert.AlertType;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.control.TextArea;
|
||||
|
||||
|
||||
/**
|
||||
* @author Clément Fournier
|
||||
*/
|
||||
public final class SimplePopups {
|
||||
|
||||
private SimplePopups() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void showLicensePopup() {
|
||||
Alert licenseAlert = new Alert(AlertType.INFORMATION);
|
||||
licenseAlert.setWidth(500);
|
||||
licenseAlert.setHeaderText("License");
|
||||
|
||||
ScrollPane scroll = new ScrollPane();
|
||||
try {
|
||||
scroll.setContent(new TextArea(IOUtils.toString(SimplePopups.class.getResourceAsStream("LICENSE"), StandardCharsets.UTF_8)));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
licenseAlert.getDialogPane().setContent(scroll);
|
||||
licenseAlert.showAndWait();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user