Example usage for java.beans PropertyEditorManager setEditorSearchPath

List of usage examples for java.beans PropertyEditorManager setEditorSearchPath

Introduction

In this page you can find the example usage for java.beans PropertyEditorManager setEditorSearchPath.

Prototype

public static void setEditorSearchPath(String[] path) 

Source Link

Document

Change the list of package names that will be used for finding property editors.

Usage

From source file:org.eclipse.wb.internal.swing.model.property.editor.beans.JavaBeanEditorProvider.java

@Override
public PropertyEditor getEditorForType(Class<?> propertyType) throws Exception {
    String propertyTypeName = propertyType.getName();
    if (Object.class.isAssignableFrom(propertyType) && propertyType != char[].class
            && propertyType != byte[].class && propertyType != int[].class && propertyType != int[][].class
            && propertyTypeName.indexOf("java.lang.") == -1 && propertyTypeName.indexOf("java.util.") == -1
            && propertyTypeName.indexOf("java.awt.") == -1 && propertyTypeName.indexOf("javax.swing.") == -1
            && propertyTypeName.indexOf("org.eclipse.") == -1) {
        String[] standard_editorSearchPath = PropertyEditorManager.getEditorSearchPath();
        try {/*from   w  w  w .j av a2s.  c o m*/
            PropertyEditorManager.setEditorSearchPath(
                    (String[]) ArrayUtils.removeElement(standard_editorSearchPath, "sun.beans.editors"));
            java.beans.PropertyEditor propertyEditor = PropertyEditorManager.findEditor(propertyType);
            if (propertyEditor != null) {
                return createEditor(propertyEditor);
            }
        } finally {
            PropertyEditorManager.setEditorSearchPath(standard_editorSearchPath);
        }
    }
    return null;
}