Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2022-01-21 15:18:24 +0000
committerptessier2022-01-24 10:18:18 +0000
commit6d24445d5e4388731a991ed9d8d94259f13d43d4 (patch)
tree72ed30c876db5e897eeb01afc01115d90c632871 /plugins
parent2107a622198ee3467d0668291fb15c35d8f52685 (diff)
downloadorg.eclipse.papyrus-6d24445d5e4388731a991ed9d8d94259f13d43d4.tar.gz
org.eclipse.papyrus-6d24445d5e4388731a991ed9d8d94259f13d43d4.tar.xz
org.eclipse.papyrus-6d24445d5e4388731a991ed9d8d94259f13d43d4.zip
bug 578311: migrate to batik 1.14.0
Change-Id: I78ea1168ee29731ce6a074165212ca0add9a035c Signed-off-by: ptessier <patrick.tessier@cea.fr>
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF15
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/shape/AbstractShapeProvider.java2
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.export/META-INF/MANIFEST.MF5
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/extension/contribution/CommentAnnotateSVG.java4
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/svgextension/PapyrusDiagramSVGGenerator.java74
5 files changed, 56 insertions, 44 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
index 3a5765238fb..20f8ac3afed 100755
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/META-INF/MANIFEST.MF
@@ -1,9 +1,9 @@
Manifest-Version: 1.0
Require-Bundle: com.ibm.icu,
- org.apache.batik.dom;bundle-version="[1.6.0,1.7.0)",
- org.apache.batik.dom.svg;bundle-version="[1.6.0,1.7.0)",
- org.apache.batik.util;bundle-version="[1.6.0,1.7.0)",
- org.apache.batik.xml;bundle-version="[1.6.0,1.7.0)",
+ org.apache.batik.dom;bundle-version="1.14.0",
+ org.apache.batik.dom.svg;bundle-version="1.14.0",
+ org.apache.batik.util;bundle-version="1.14.0",
+ org.apache.batik.xml;bundle-version="1.14.0",
org.eclipse.core.databinding.property;bundle-version="[1.8.0,2.0.0)",
org.eclipse.core.expressions;bundle-version="[3.6.0,4.0.0)",
org.eclipse.emf.databinding;bundle-version="[1.5.0,2.0.0)",
@@ -49,7 +49,8 @@ Require-Bundle: com.ibm.icu,
org.eclipse.uml2.types;bundle-version="[2.5.0,3.0.0)",
org.w3c.dom.svg;bundle-version="[1.1.0,2.0.0)",
org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.papyrus.infra.guava;bundle-version="[1.0.0,2.0.0)"
+ org.eclipse.papyrus.infra.guava;bundle-version="[1.0.0,2.0.0)",
+ org.apache.batik.anim
Export-Package: org.eclipse.papyrus.infra.gmfdiag.common,
org.eclipse.papyrus.infra.gmfdiag.common.adapter,
org.eclipse.papyrus.infra.gmfdiag.common.advice,
@@ -109,5 +110,5 @@ Import-Package: com.google.common.base;version="[30.1.0, 31.0.0)",
com.google.common.util.concurrent;version="[30.1.0, 31.0.0)",
org.osgi.service.component.annotations;version="1.3.0";resolution:=optional
Automatic-Module-Name: org.eclipse.papyrus.infra.gmfdiag.common
-Service-Component: OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.ViewProviderServiceImpl.xml,
- OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.EditPolicyProviderServiceImpl.xml
+Service-Component: OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.EditPolicyProviderServiceImpl.xml,
+ OSGI-INF/org.eclipse.papyrus.infra.gmfdiag.common.internal.service.ViewProviderServiceImpl.xml
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/shape/AbstractShapeProvider.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/shape/AbstractShapeProvider.java
index c2f15ec90db..29593dc9533 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/shape/AbstractShapeProvider.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/service/shape/AbstractShapeProvider.java
@@ -22,7 +22,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.WeakHashMap;
-import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
+import org.apache.batik.anim.dom.SAXSVGDocumentFactory;
import org.apache.batik.dom.util.DOMUtilities;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.draw2d.PositionConstants;
diff --git a/plugins/uml/org.eclipse.papyrus.uml.export/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.export/META-INF/MANIFEST.MF
index 489707c13ba..0a16e25ec9c 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.export/META-INF/MANIFEST.MF
+++ b/plugins/uml/org.eclipse.papyrus.uml.export/META-INF/MANIFEST.MF
@@ -5,7 +5,7 @@ Bundle-SymbolicName: org.eclipse.papyrus.uml.export;singleton:=true
Bundle-Version: 2.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: com.google.gson;bundle-version="[2.7.0,2.8.0)",
- org.apache.batik.dom.svg;bundle-version="[1.6.0,1.7.0)",
+ org.apache.batik.dom.svg;bundle-version="1.14.0",
org.eclipse.emf.databinding;bundle-version="[1.5.0,2.0.0)",
org.eclipse.emf.edit.ui;bundle-version="[2.18.0,3.0.0)",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="[1.9.0,2.0.0)",
@@ -20,7 +20,8 @@ Require-Bundle: com.google.gson;bundle-version="[2.7.0,2.8.0)",
org.eclipse.papyrus.infra.gmfdiag.export;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.gmfdiag.style;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.ui;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.uml2.uml;bundle-version="[5.5.0,6.0.0)"
+ org.eclipse.uml2.uml;bundle-version="[5.5.0,6.0.0)",
+ org.apache.batik.anim
Bundle-Activator: org.eclipse.papyrus.uml.export.Activator
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
diff --git a/plugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/extension/contribution/CommentAnnotateSVG.java b/plugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/extension/contribution/CommentAnnotateSVG.java
index 245ce8a0488..0ec8035fca4 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/extension/contribution/CommentAnnotateSVG.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/extension/contribution/CommentAnnotateSVG.java
@@ -13,7 +13,7 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.export.extension.contribution;
-import org.apache.batik.dom.svg.SVGDOMImplementation;
+import org.apache.batik.anim.dom.SVGDOMImplementation;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.svg.export.GraphicsSVG;
@@ -48,7 +48,7 @@ public class CommentAnnotateSVG implements AnnotateSVG {
EObject eObject = view.getElement();
if (eObject instanceof NamedElement) {
NamedElement namedElement = (NamedElement) eObject;
- EList<Comment> ownedComments = namedElement.getOwnedComments();
+ EList<Comment> ownedComments = namedElement.getOwnedComments();
if (!ownedComments.isEmpty()) {
rectangle.setAttributeNS(null, ATTRIBUTE_TITLE, ownedComments.get(0).getBody());
Element title = svgG.getDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, ATTRIBUTE_TITLE);
diff --git a/plugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/svgextension/PapyrusDiagramSVGGenerator.java b/plugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/svgextension/PapyrusDiagramSVGGenerator.java
index 3459e842a85..8c34357f9e6 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/svgextension/PapyrusDiagramSVGGenerator.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.export/src/org/eclipse/papyrus/uml/export/svgextension/PapyrusDiagramSVGGenerator.java
@@ -28,7 +28,7 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import org.apache.batik.dom.svg.SVGDOMImplementation;
+import org.apache.batik.anim.dom.SVGDOMImplementation;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Rectangle;
@@ -59,15 +59,17 @@ import org.w3c.dom.Element;
public class PapyrusDiagramSVGGenerator extends OpenAPIDiagramSVGGenerator {
/** The annotations. */
- private List<AnnotateSVG> annotations = new ArrayList<>();
-
+ private List<AnnotateSVG> annotations = new ArrayList<>();
+
/**
* Instantiates a new papyrus diagram SVG generator.
*
- * @param diagramEditPart the diagram edit part
- * @param annotations the annotations
+ * @param diagramEditPart
+ * the diagram edit part
+ * @param annotations
+ * the annotations
*/
- public PapyrusDiagramSVGGenerator(DiagramEditPart diagramEditPart, List<AnnotateSVG> annotations ) {
+ public PapyrusDiagramSVGGenerator(DiagramEditPart diagramEditPart, List<AnnotateSVG> annotations) {
super(diagramEditPart);
this.annotations = annotations;
}
@@ -90,7 +92,7 @@ public class PapyrusDiagramSVGGenerator extends OpenAPIDiagramSVGGenerator {
*/
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.render.clipboard.DiagramGenerator#
* setUpGraphics(int, int)
*/
@@ -108,7 +110,7 @@ public class PapyrusDiagramSVGGenerator extends OpenAPIDiagramSVGGenerator {
*/
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.render.clipboard.DiagramGenerator#
* getImageDescriptor(org.eclipse.draw2d.Graphics)
*/
@@ -118,11 +120,11 @@ public class PapyrusDiagramSVGGenerator extends OpenAPIDiagramSVGGenerator {
Activator.log(IStatus.INFO, "Start transformation from Graphics to image descriptor");
GraphicsSVG svgG = (GraphicsSVG) g;
- svgRoot = svgG.getRoot();
-
+ svgRoot = svgG.getRoot();
+
//////// Papyrus Specific code //////////
List<PartPositionInfo> allPartPositionInfo = this.getDiagramPartInfo();
-
+
Collections.reverse(allPartPositionInfo);// Required to have property after class
for (PartPositionInfo partPositionInfo : allPartPositionInfo) {
Element rectangle = svgG.getDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, "rect");
@@ -130,27 +132,27 @@ public class PapyrusDiagramSVGGenerator extends OpenAPIDiagramSVGGenerator {
NamedElement nameElement = (NamedElement) partPositionInfo.getSemanticElement();
rectangle.setAttributeNS(null, "id", nameElement.getName());// useful for svg debug
}
-
+
rectangle.setAttributeNS(null, "x", String.valueOf(partPositionInfo.getPartX()));
rectangle.setAttributeNS(null, "y", String.valueOf(partPositionInfo.getPartY()));
rectangle.setAttributeNS(null, "width", String.valueOf(partPositionInfo.getPartWidth()));
rectangle.setAttributeNS(null, "height", String.valueOf(partPositionInfo.getPartHeight()));
- rectangle.setAttributeNS(null, "fill-opacity", "0"); //transparent
+ rectangle.setAttributeNS(null, "fill-opacity", "0"); // transparent
rectangle.setAttributeNS(null, "stroke-opacity", "0"); // no border
- View view = partPositionInfo.getView();
+ View view = partPositionInfo.getView();
if (view instanceof Shape) { // filter on shape only to avoid duplication
boolean hasAnnotation = applyAll(view, svgG, rectangle);
if (hasAnnotation) {
- svgRoot.appendChild(rectangle);
- }
+ svgRoot.appendChild(rectangle);
+ }
}
}
-
+
/////////////////////////
-
-
+
+
ByteArrayOutputStream os = new ByteArrayOutputStream(5000); // 5K
// buffer
stream(os);
@@ -159,22 +161,25 @@ public class PapyrusDiagramSVGGenerator extends OpenAPIDiagramSVGGenerator {
setRenderedImage(RenderedImageFactory.getInstance(os.toByteArray()));
return RenderedImageDescriptor
- .createFromRenderedImage(getRenderedImage());
+ .createFromRenderedImage(getRenderedImage());
} catch (IOException ex) {
Log.error(DiagramUIRenderPlugin.getInstance(), IStatus.ERROR, ex
- .getMessage(), ex);
+ .getMessage(), ex);
}
return null;
}
-
+
/**
* Apply all.
*
- * @param view the view
- * @param svgG the svg G
- * @param rectangle the rectangle
+ * @param view
+ * the view
+ * @param svgG
+ * the svg G
+ * @param rectangle
+ * the rectangle
* @return true, if successful
*/
public boolean applyAll(View view, GraphicsSVG svgG, Element rectangle) {
@@ -183,14 +188,15 @@ public class PapyrusDiagramSVGGenerator extends OpenAPIDiagramSVGGenerator {
res = res || annotateSVG.addAnnotation(view, svgG, rectangle);
}
return true;
- }
-
+ }
+
/**
* Writes the SVG Model out to a file.
- *
+ *
* @param outputStream
* output stream to store the SVG Model
*/
+ @Override
public void stream(OutputStream outputStream) {
try {
// Define the view box
@@ -222,17 +228,19 @@ public class PapyrusDiagramSVGGenerator extends OpenAPIDiagramSVGGenerator {
*/
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.internal.clipboard.DiagramGenerator#
* createAWTImageForParts(java.util.List)
*/
+ @Override
public Image createAWTImageForParts(List editparts, org.eclipse.swt.graphics.Rectangle sourceRect) {
createSWTImageDescriptorForParts(editparts, sourceRect);
if (getRenderedImage() != null) {
try {
- BufferedImage bufImg = (BufferedImage) getRenderedImage().getAdapter(BufferedImage.class);
- if (bufImg == null)
+ BufferedImage bufImg = getRenderedImage().getAdapter(BufferedImage.class);
+ if (bufImg == null) {
bufImg = ImageConverter.convert(getRenderedImage().getSWTImage());
+ }
return bufImg;
} catch (Error e) {
// log the Error but allow execution to continue
@@ -259,6 +267,7 @@ public class PapyrusDiagramSVGGenerator extends OpenAPIDiagramSVGGenerator {
* @return Returns the rendered image created by previous call to
* createSWTImageDescriptorForParts
*/
+ @Override
public RenderedImage getRenderedImage() {
return renderedImage;
}
@@ -266,7 +275,8 @@ public class PapyrusDiagramSVGGenerator extends OpenAPIDiagramSVGGenerator {
/**
* Sets the rendered image.
*
- * @param renderedImage the new rendered image
+ * @param renderedImage
+ * the new rendered image
*/
private void setRenderedImage(RenderedImage renderedImage) {
this.renderedImage = renderedImage;

Back to the top