summaryrefslogtreecommitdiff
path: root/src/net/sourceforge/plantuml/version/PSystemVersion.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/sourceforge/plantuml/version/PSystemVersion.java')
-rw-r--r--src/net/sourceforge/plantuml/version/PSystemVersion.java112
1 files changed, 78 insertions, 34 deletions
diff --git a/src/net/sourceforge/plantuml/version/PSystemVersion.java b/src/net/sourceforge/plantuml/version/PSystemVersion.java
index 967bf93..207d10c 100644
--- a/src/net/sourceforge/plantuml/version/PSystemVersion.java
+++ b/src/net/sourceforge/plantuml/version/PSystemVersion.java
@@ -36,6 +36,7 @@ package net.sourceforge.plantuml.version;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -52,7 +53,6 @@ import javax.imageio.ImageIO;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.FileFormatOption;
-import net.sourceforge.plantuml.FileSystem;
import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.OptionPrint;
@@ -60,10 +60,12 @@ import net.sourceforge.plantuml.Run;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
+import net.sourceforge.plantuml.dedication.Dedication;
import net.sourceforge.plantuml.graphic.GraphicPosition;
import net.sourceforge.plantuml.graphic.GraphicStrings;
-import net.sourceforge.plantuml.preproc.PreprocessorInclude;
+import net.sourceforge.plantuml.preproc.ImportedFiles;
import net.sourceforge.plantuml.preproc.Stdlib;
+import net.sourceforge.plantuml.preproc2.PreprocessorInclude3;
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
@@ -81,32 +83,36 @@ public class PSystemVersion extends AbstractPSystem {
}
public static BufferedImage getPlantumlImage() {
- try {
- final InputStream is = PSystemVersion.class.getResourceAsStream("logo.png");
- final BufferedImage image = ImageIO.read(is);
- is.close();
- return image;
- } catch (IOException e) {
- e.printStackTrace();
- }
- return new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+ return getImage("logo.png");
}
public static BufferedImage getCharlieImage() {
- try {
- final InputStream is = PSystemVersion.class.getResourceAsStream("charlie.png");
- final BufferedImage image = ImageIO.read(is);
- is.close();
- return image;
- } catch (IOException e) {
- e.printStackTrace();
- }
- return new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+ return getImage("charlie.png");
+ }
+
+ public static BufferedImage getTime01() {
+ return getImage("time01.png");
+ }
+
+ public static BufferedImage getTime15() {
+ return getImage("time15.png");
+ }
+
+ public static BufferedImage getPlantumlSmallIcon() {
+ return getImage("favicon.png");
+ }
+
+ public static BufferedImage getArecibo() {
+ return getImage("arecibo.png");
}
- public static BufferedImage getTime() {
+ public static BufferedImage getApple2Image() {
+ return getImageWebp("apple2.png");
+ }
+
+ private static BufferedImage getImage(final String name) {
try {
- final InputStream is = PSystemVersion.class.getResourceAsStream("time00.png");
+ final InputStream is = PSystemVersion.class.getResourceAsStream(name);
final BufferedImage image = ImageIO.read(is);
is.close();
return image;
@@ -116,10 +122,10 @@ public class PSystemVersion extends AbstractPSystem {
return new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
}
- public static BufferedImage getPlantumlSmallIcon() {
+ private static BufferedImage getImageWebp(final String name) {
try {
- final InputStream is = PSystemVersion.class.getResourceAsStream("favicon.png");
- final BufferedImage image = ImageIO.read(is);
+ final InputStream is = PSystemVersion.class.getResourceAsStream(name);
+ final BufferedImage image = Dedication.getBufferedImage(is);
is.close();
return image;
} catch (IOException e) {
@@ -165,17 +171,19 @@ public class PSystemVersion extends AbstractPSystem {
final List<String> strings = new ArrayList<String>();
strings.add("<b>PlantUML version " + Version.versionString() + "</b> (" + Version.compileTimeString() + ")");
strings.add("(" + License.getCurrent() + " source distribution)");
- strings.add("Loaded from " + Version.getJarPath());
- if (OptionFlags.getInstance().isWord()) {
- strings.add("Word Mode");
- strings.add("Command Line: " + Run.getCommandLine());
- strings.add("Current Dir: " + FileSystem.getInstance().getCurrentDir().getAbsolutePath());
- strings.add("plantuml.include.path: " + PreprocessorInclude.getenv("plantuml.include.path"));
+ if (OptionFlags.ALLOW_INCLUDE) {
+ strings.add("Loaded from " + Version.getJarPath());
+ if (OptionFlags.getInstance().isWord()) {
+ strings.add("Word Mode");
+ strings.add("Command Line: " + Run.getCommandLine());
+ strings.add("Current Dir: " + new File(".").getAbsolutePath());
+ strings.add("plantuml.include.path: " + PreprocessorInclude3.getenv("plantuml.include.path"));
+ }
}
strings.add(" ");
- strings.add("<b>Stdlib:");
- Stdlib.addInfoVersion(strings, false);
- strings.add(" ");
+ // strings.add("<b>Stdlib:");
+ // Stdlib.addInfoVersion(strings, false);
+ // strings.add(" ");
strings.addAll(GraphvizUtils.getTestDotStrings(true));
strings.add(" ");
@@ -316,6 +324,42 @@ public class PSystemVersion extends AbstractPSystem {
return new PSystemVersion(false, strings);
}
+ public static PSystemVersion createDumpStackTrace() throws IOException {
+ final List<String> strings = new ArrayList<String>();
+ final Throwable creationPoint = new Throwable();
+ creationPoint.fillInStackTrace();
+ for (StackTraceElement ste : creationPoint.getStackTrace()) {
+ strings.add(ste.toString());
+ }
+ return new PSystemVersion(false, strings);
+ }
+
+ public static PSystemVersion createKeyDistributor() throws IOException {
+ final LicenseInfo license = LicenseInfo.retrieveDistributor();
+
+ final List<String> strings = new ArrayList<String>();
+ if (license == null) {
+ strings.add("No license found");
+ } else {
+ strings.add(license.getOwner());
+ strings.add(license.getContext());
+ strings.add(license.getGenerationDate().toString());
+ strings.add(license.getExpirationDate().toString());
+ }
+ return new PSystemVersion(false, strings);
+ }
+
+ public static PSystemVersion createPath() throws IOException {
+ final List<String> strings = new ArrayList<String>();
+ strings.add("<u>Current Dir</u>: " + new File(".").getAbsolutePath());
+ strings.add(" ");
+ strings.add("<u>Default path</u>:");
+ for (File f : ImportedFiles.createImportedFiles(null).getPath()) {
+ strings.add(f.getAbsolutePath());
+ }
+ return new PSystemVersion(true, strings);
+ }
+
public DiagramDescription getDescription() {
return new DiagramDescription("(Version)");
}