Example usage for org.springframework.ide.eclipse.beans.ui.editor.util BeansEditorUtils getBeansFromConfigSets

List of usage examples for org.springframework.ide.eclipse.beans.ui.editor.util BeansEditorUtils getBeansFromConfigSets

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.beans.ui.editor.util BeansEditorUtils getBeansFromConfigSets.

Prototype

public static final Set<IBean> getBeansFromConfigSets(IFile file) 

Source Link

Usage

From source file:org.dozer.eclipse.plugin.sourcepage.util.DozerPluginUtils.java

public static IBean getDozerBeanForMappingFile(IFile mappingIFile) {
    Set<IBean> beans = new HashSet<IBean>();
    IBean returnBean = null;/* w  w w .j av a2  s  . co m*/

    //The mapping file that we are in
    File mappingFile = new File(mappingIFile.getName());
    String mappingFileName = mappingFile.getName();

    //First get direct references
    IBeansProject beansProject = BeansCorePlugin.getModel().getProject(mappingIFile.getProject());

    if (beansProject == null)
        return null;

    Set<IBeansConfig> tempConfigs = beansProject.getConfigs();

    if (tempConfigs == null)
        return null;

    //We need some File to later get allBeans from ConfigSets
    IFile someBeansModelFile = null;

    //check local beans
    for (IBeansConfig config : tempConfigs) {
        if (someBeansModelFile == null)
            someBeansModelFile = (IFile) config.getElementResource();

        beans.addAll(config.getBeans());
    }
    returnBean = getDozerBeanFromBeans(beans, mappingFileName);

    //no local bean for mappingfile found
    if (returnBean == null && someBeansModelFile != null) {
        //check configsets
        Set<IBean> allBeans = BeansEditorUtils.getBeansFromConfigSets(someBeansModelFile);
        returnBean = getDozerBeanFromBeans(allBeans, mappingFileName);
    }

    return returnBean;
}