Example usage for org.springframework.ide.eclipse.beans.core.model IBeansConfig getBeans

List of usage examples for org.springframework.ide.eclipse.beans.core.model IBeansConfig getBeans

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.beans.core.model IBeansConfig getBeans.

Prototype

Set<IBean> getBeans();

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;//from   w w w.  j av  a2s.  c  o  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;
}