1 /*******************************************************************************
2 * Copyright (c) 2020 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Semantum Oy - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.diagram.participant;
14 import java.nio.charset.StandardCharsets;
16 import org.eclipse.swt.dnd.ByteArrayTransfer;
18 public class SVGTransfer extends ByteArrayTransfer {
19 private static SVGTransfer instance = new SVGTransfer();
20 private static final String TYPE_NAME = "image/svg+xml";
21 private static final int TYPE_ID = registerType(TYPE_NAME);
23 public static byte[] formatContent(String svg) {
24 return svg.getBytes(StandardCharsets.UTF_8);
27 public static SVGTransfer getInstance () {
32 protected int[] getTypeIds(){
33 return new int[] {TYPE_ID};
37 protected String[] getTypeNames(){
38 return new String[] {TYPE_NAME};