Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml')
-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
3 files changed, 36 insertions, 47 deletions
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 0a16e25ec9c..489707c13ba 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.14.0",
+ org.apache.batik.dom.svg;bundle-version="[1.6.0,1.7.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,8 +20,7 @@ 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.apache.batik.anim
+ org.eclipse.uml2.uml;bundle-version="[5.5.0,6.0.0)"
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 0ec8035fca4..245ce8a0488 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.anim.dom.SVGDOMImplementation;
+import org.apache.batik.dom.svg.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 8c34357f9e6..3459e842a85 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.anim.dom.SVGDOMImplementation;
+import org.apache.batik.dom.svg.SVGDOMImplementation;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.Rectangle;
@@ -59,17 +59,15 @@ 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;
}
@@ -92,7 +90,7 @@ public class PapyrusDiagramSVGGenerator extends OpenAPIDiagramSVGGenerator {
*/
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.render.clipboard.DiagramGenerator#
* setUpGraphics(int, int)
*/
@@ -110,7 +108,7 @@ public class PapyrusDiagramSVGGenerator extends OpenAPIDiagramSVGGenerator {
*/
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.render.clipboard.DiagramGenerator#
* getImageDescriptor(org.eclipse.draw2d.Graphics)
*/
@@ -120,11 +118,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");
@@ -132,27 +130,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);
@@ -161,25 +159,22 @@ 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) {
@@ -188,15 +183,14 @@ 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
@@ -228,19 +222,17 @@ 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 = getRenderedImage().getAdapter(BufferedImage.class);
- if (bufImg == null) {
+ BufferedImage bufImg = (BufferedImage) 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
@@ -267,7 +259,6 @@ public class PapyrusDiagramSVGGenerator extends OpenAPIDiagramSVGGenerator {
* @return Returns the rendered image created by previous call to
* createSWTImageDescriptorForParts
*/
- @Override
public RenderedImage getRenderedImage() {
return renderedImage;
}
@@ -275,8 +266,7 @@ 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