Converters

Identifier:
org.eclipse.e4.xwt.pde.converters

Since:
[Enter the first release in which this extension point appears.]

Description:
This extension point is used to declare a new data converter

Configuration Markup:

<!ELEMENT extension (converter*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT converter EMPTY>

<!ATTLIST converter

name  CDATA #REQUIRED

class CDATA #REQUIRED>

Data converter element



Examples:
Here is an example to define the converter from String to URL:

   <extension
         point="org.eclipse.e4.xwt.pde.converters">
      <converter
            class="org.eclipse.e4.xwt.demo.URLConverter"
            name="URLConverter">
      </converter>
   </extension>

The class implementation should be:


package org.eclipse.e4.xwt.demo;

import java.net.MalformedURLException;
import java.net.URL;

import org.eclipse.core.databinding.conversion.IConverter;

public class URLConverter implements IConverter {
  public Object convert(Object fromObject) {
    try {
      return new URL((String) fromObject);
    } catch (MalformedURLException e) {
      throw new RuntimeException(e);
    }
  }

  public Object getFromType() {
    return String.class;
  }

  public Object getToType() {
    return URL.class;
  }
}

API Information:
[Enter API information here.]

Supplied Implementation:
[Enter information about supplied implementation of this extension point.]