Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormistria2011-08-08 16:34:43 +0000
committermistria2011-08-08 16:34:43 +0000
commit5a4fbc207fee60723dea85e08fb2075abc1648bb (patch)
treeba047c516a5819c644f97e17386c51904e98e0b9
parent6af63931f1daa587158775a246ec8afcd095cf4e (diff)
downloadorg.eclipse.gmf-tooling-5a4fbc207fee60723dea85e08fb2075abc1648bb.tar.gz
org.eclipse.gmf-tooling-5a4fbc207fee60723dea85e08fb2075abc1648bb.tar.xz
org.eclipse.gmf-tooling-5a4fbc207fee60723dea85e08fb2075abc1648bb.zip
bug:329465
Integrate patch
-rw-r--r--plugins/org.eclipse.gmf.runtime.lite.svg/src/org/eclipse/gmf/runtime/lite/svg/SVGFigure.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/org.eclipse.gmf.runtime.lite.svg/src/org/eclipse/gmf/runtime/lite/svg/SVGFigure.java b/plugins/org.eclipse.gmf.runtime.lite.svg/src/org/eclipse/gmf/runtime/lite/svg/SVGFigure.java
index a6c22036f..36c10c605 100644
--- a/plugins/org.eclipse.gmf.runtime.lite.svg/src/org/eclipse/gmf/runtime/lite/svg/SVGFigure.java
+++ b/plugins/org.eclipse.gmf.runtime.lite.svg/src/org/eclipse/gmf/runtime/lite/svg/SVGFigure.java
@@ -16,6 +16,7 @@ import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
import java.io.IOException;
+import java.util.WeakHashMap;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
@@ -48,6 +49,8 @@ public class SVGFigure extends Figure {
private boolean failedToLoadDocument, specifyCanvasWidth = true, specifyCanvasHeight = true;
private SimpleImageTranscoder transcoder;
+ private static WeakHashMap<String, Document> documentsMap = new WeakHashMap<String, Document>();
+
public final String getURI() {
return uri;
}
@@ -74,7 +77,13 @@ public class SVGFigure extends Figure {
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser);
try {
- Document document = factory.createDocument(uri);
+ Document document;
+ if (documentsMap.containsKey(uri))
+ document = documentsMap.get(uri);
+ else {
+ document = factory.createDocument(uri);
+ documentsMap.put(uri, document);
+ }
transcoder = new SimpleImageTranscoder(document);
failedToLoadDocument = false;
} catch (IOException e) {
@@ -82,6 +91,7 @@ public class SVGFigure extends Figure {
}
}
+
protected final Document getDocument() {
if (failedToLoadDocument) {
return null;

Back to the top