[572885] Register Batik image formats explicitly
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=572885
Change-Id: Ia40b294b68ea3e7f0fd48683145d4b22aaa6d1dc
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
diff --git a/org.eclipse.gmf.runtime.draw2d.ui.render.awt/src/org/eclipse/gmf/runtime/draw2d/ui/render/awt/internal/Draw2dRenderPlugin.java b/org.eclipse.gmf.runtime.draw2d.ui.render.awt/src/org/eclipse/gmf/runtime/draw2d/ui/render/awt/internal/Draw2dRenderPlugin.java
index c17c148..bcb8bc0 100644
--- a/org.eclipse.gmf.runtime.draw2d.ui.render.awt/src/org/eclipse/gmf/runtime/draw2d/ui/render/awt/internal/Draw2dRenderPlugin.java
+++ b/org.eclipse.gmf.runtime.draw2d.ui.render.awt/src/org/eclipse/gmf/runtime/draw2d/ui/render/awt/internal/Draw2dRenderPlugin.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2002, 2003, 2006 IBM Corporation and others.
+ * Copyright (c) 2002, 2003, 2006, 2021 IBM Corporation and others.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
@@ -7,55 +7,69 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * IBM Corporation - initial API and implementation
+ * IBM Corporation - initial API and implementation
****************************************************************************/
package org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal;
import java.awt.Color;
+import org.apache.batik.ext.awt.image.spi.ImageTagRegistry;
+import org.apache.batik.ext.awt.image.spi.ImageWriterRegistry;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
* @author melaasar
*/
-public class Draw2dRenderPlugin
- extends AbstractUIPlugin {
+public class Draw2dRenderPlugin extends AbstractUIPlugin {
- /** the plugin singleton */
- private static Plugin singleton;
+ /** the plugin singleton */
+ private static Plugin singleton;
- /**
- * Method getInstance.
- *
- * @return Plugin
- */
- public static Plugin getInstance() {
- return singleton;
- }
+ /**
+ * Method getInstance.
+ *
+ * @return Plugin
+ */
+ public static Plugin getInstance() {
+ return singleton;
+ }
- /**
- * Retrieves the unique identifier of this plug-in.
- *
- * @return A non-empty string and is unique within the plug-in registry.
- */
- public static String getPluginId() {
- return getInstance().getBundle().getSymbolicName();
- }
+ /**
+ * Retrieves the unique identifier of this plug-in.
+ *
+ * @return A non-empty string and is unique within the plug-in registry.
+ */
+ public static String getPluginId() {
+ return getInstance().getBundle().getSymbolicName();
+ }
- public Draw2dRenderPlugin() {
- super();
- if (singleton == null)
- singleton = this;
-
- // force loading of AWT - bugzilla 119649
- initAWT();
- }
+ public Draw2dRenderPlugin() {
+ super();
+ if (singleton == null) {
+ singleton = this;
+ }
- private void initAWT() {
- Color initColor = new Color(0, 0, 0);
- initColor.getRed();
- }
+ // force loading of AWT - bugzilla 119649
+ initAWT();
+ registerBatikImageFormats();
+ }
-}
\ No newline at end of file
+ private void initAWT() {
+ Color initColor = new Color(0, 0, 0);
+ initColor.getRed();
+ }
+
+ private void registerBatikImageFormats() {
+ ImageWriterRegistry.getInstance().register(new org.apache.batik.ext.awt.image.codec.imageio.ImageIOPNGImageWriter());
+ ImageWriterRegistry.getInstance().register(new org.apache.batik.ext.awt.image.codec.imageio.ImageIOTIFFImageWriter());
+ ImageWriterRegistry.getInstance().register(new org.apache.batik.ext.awt.image.codec.imageio.ImageIOJPEGImageWriter());
+
+ ImageTagRegistry.getRegistry().register(new org.apache.batik.ext.awt.image.codec.png.PNGRegistryEntry());
+ ImageTagRegistry.getRegistry().register(new org.apache.batik.ext.awt.image.codec.imageio.ImageIOJPEGRegistryEntry());
+ ImageTagRegistry.getRegistry().register(new org.apache.batik.ext.awt.image.codec.imageio.ImageIOPNGRegistryEntry());
+ ImageTagRegistry.getRegistry().register(new org.apache.batik.ext.awt.image.codec.imageio.ImageIOTIFFRegistryEntry());
+ }
+
+}