X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.image.ui%2Fsrc%2Forg%2Fsimantics%2Fimage%2Fui%2FCreateImage.java;h=f602d31d40a86a691bdd5bb899bee12deb08171d;hp=f10ada1e154fe375e224f7421206c6997f92068f;hb=47269fe0acb894f346810417d950a1ab59cdc0ea;hpb=11309f6516278203264b680235cbbe1dc2bde98e diff --git a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImage.java b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImage.java index f10ada1e1..f602d31d4 100644 --- a/bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImage.java +++ b/bundles/org.simantics.image.ui/src/org/simantics/image/ui/CreateImage.java @@ -37,20 +37,20 @@ public class CreateImage extends WriteRequest { public static Resource getType(ReadGraph graph, ImageSource source) throws DatabaseException { ImageResource IMAGE = ImageResource.getInstance(graph); String name = source.name.toLowerCase(); - if(name.endsWith("svg")) return IMAGE.SvgImage; - else if(name.endsWith("png")) return IMAGE.PngImage; - else if(name.endsWith("jpg") || name.endsWith("jpeg")) return IMAGE.JpegImage; - else if(name.endsWith("gif")) return IMAGE.GifImage; - else throw new DatabaseException("Unsupported image format " + source.name); + if(name.endsWith("svg")) return IMAGE.SvgImage; //$NON-NLS-1$ + else if(name.endsWith("png")) return IMAGE.PngImage; //$NON-NLS-1$ + else if(name.endsWith("jpg") || name.endsWith("jpeg")) return IMAGE.JpegImage; //$NON-NLS-1$ //$NON-NLS-2$ + else if(name.endsWith("gif")) return IMAGE.GifImage; //$NON-NLS-1$ + else throw new DatabaseException("Unsupported image format " + source.name); //$NON-NLS-1$ } public static void claimLiteral(WriteGraph graph, Resource image, ImageSource source) throws DatabaseException { String name = source.name.toLowerCase(); - if (name.endsWith("svg")) + if (name.endsWith("svg")) //$NON-NLS-1$ graph.claimValue(image, new String(source.data), Bindings.STRING); - else if (name.endsWith("png") || name.endsWith("jpg") || name.endsWith("jpeg") || name.endsWith("gif")) + else if (name.endsWith("png") || name.endsWith("jpg") || name.endsWith("jpeg") || name.endsWith("gif")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ graph.claimValue(image, source.data, Bindings.BYTE_ARRAY); - else throw new DatabaseException("Unsupported image format " + source.name); + else throw new DatabaseException("Unsupported image format " + source.name); //$NON-NLS-1$ } @Override @@ -66,7 +66,7 @@ public class CreateImage extends WriteRequest { graph.claimLiteral(image, L0.HasName, source.name, Bindings.STRING); claimLiteral(graph, image, source); graph.claim(parent, L0.ConsistsOf, image); - Layer0Utils.addCommentMetadata(graph, "Imported image " + source.name + " " + image.toString()); + Layer0Utils.addCommentMetadata(graph, "Imported image " + source.name + " " + image.toString()); //$NON-NLS-1$ //$NON-NLS-2$ return image; // if(file.getPath().endsWith("svg")) {