Package org.springframework.ide.eclipse.beans.core.model

Examples of org.springframework.ide.eclipse.beans.core.model.IBean


   
    Set<IBean> beans = BeansModelUtils.getBeansByContainingTypes(resource, typeEngine, null);
    assertEquals(2, beans.size());
   
    Iterator<IBean> iterator = beans.iterator();
    IBean bean1 = iterator.next();
    IBean bean2 = iterator.next();

    assertTrue("acrossConfigsBean1".equals(bean1.getElementName()) || "acrossConfigsBean1".equals(bean2.getElementName()));
    assertTrue("acrossConfigsBean2".equals(bean1.getElementName()) || "acrossConfigsBean2".equals(bean2.getElementName()));
  }
View Full Code Here


      }
      if (showExternal) {
        Set<IBean> beansList = BeansEditorUtils.getBeansFromConfigSets(file);
        Iterator<IBean> iterator = beansList.iterator();
        while (iterator.hasNext()) {
          IBean bean = iterator.next();
          requestor.acceptSearchMatch(bean, file, prefix);
        }
      }
    }
  }
View Full Code Here

      }
      else {
        // assume this is an external reference
        Iterator<?> beans = BeansEditorUtils.getBeansFromConfigSets(file).iterator();
        while (beans.hasNext()) {
          IBean modelBean = (IBean) beans.next();
          if (modelBean.getElementName().equals(target)) {
            return new ExternalBeanHyperlink(modelBean, hyperlinkRegion);
          }
        }
      }
    }
View Full Code Here

    return false;
  }

  @Override
  public void run() {
    IBean bean = ((BeanPart) getFirstSelectedEditPart()).getBean()
        .getBean();
    IType type = BeansModelUtils.getBeanType(bean, null);
    if (type != null) {
      SpringUIUtils.openInEditor(type);
    }
View Full Code Here

   * <li>An ordinary object or null, in which case it's ignored.
   */
  private void addReferencesForValue(Object value, List<Object> references) {
    if (value instanceof BeanDefinitionHolder) {
      String beanName = ((BeanDefinitionHolder) value).getBeanName();
      IBean modelBean = bean.getBean();
      String  propertyName  = getName();
      IBean innerBean = null;
      for (IBean iBean : BeansModelUtils.getInnerBeans(modelBean)) {
        if (iBean.getElementName().equals(beanName)) {
          IModelElement parent = iBean.getElementParent();
          if (parent instanceof IBeanProperty
              && parent.getElementName().equals(propertyName)) {
View Full Code Here

          if (config != null && parentNode instanceof Element) {
            IModelElement element = BeansModelUtils.getModelElement((Element) parentNode, config);
            int argIndex = getArgumentIndex(node);
            if (argIndex >= 0) {
              if (element instanceof IBean) {
                IBean bean = (IBean) element;
                int count = bean.getConstructorArguments().size();
                if (count > 0) {
                  try {
                    Set<IMethod> methods = Introspector.getConstructors(type, count, false);
                    Iterator<IMethod> iter = methods.iterator();
                    while (iter.hasNext()) {
View Full Code Here

   * @throws IllegalArgumentException if unsupported context specified
   */
  public static IBean getBean(String name, IModelElement context) {
    if (context instanceof IBeansConfig) {
      IBeansConfig config = (IBeansConfig) context;
      IBean bean = config.getBean(name);
      if (bean == null) {
        IBeanAlias alias = config.getAlias(name);
        if (alias != null) {
          bean = config.getBean(alias.getBeanName());
        }
      }
      if (bean == null) {
        for (IBeansComponent component : config.getComponents()) {
          bean = getBean(name, component);
          if (bean != null) {
            return bean;
          }
        }
      }
      return bean;
    }
    else if (context instanceof IBeansConfigSet) {
      IBeansConfigSet configSet = (IBeansConfigSet) context;
      IBean bean = configSet.getBean(name);
      if (bean == null) {
        IBeanAlias alias = configSet.getAlias(name);
        if (alias != null) {
          bean = configSet.getBean(alias.getBeanName());
        }
View Full Code Here

      if (componentBean.getElementName().equals(name)) {
        return componentBean;
      }
    }
    for (IBeansComponent nestedComponent : component.getComponents()) {
      IBean bean = getBean(name, nestedComponent);
      if (bean != null) {
        return bean;
      }
    }
    return null;
View Full Code Here

    }
    return null;
  }

  public static IBean getBeanWithConfigSets(String name, IBeansConfig config) {
    IBean bean = getBean(name, config);
    if (bean == null) {
      IBeansProject project = (IBeansProject) config.getElementParent();
      for (IBeansConfigSet configSet : project.getConfigSets()) {
        if (configSet.hasConfig(config.getElementName())) {
          bean = getBean(name, configSet);
View Full Code Here

    }
    else if (BeansTags.isTag(element, Tag.PROPERTY) && BeansTags.isTag(parent, Tag.BEAN)
        && BeansTags.isTag(parent.getParentNode(), Tag.BEANS)) {
      String beanName = getBeanName((Element) parent);
      if (beanName != null) {
        IBean bean = BeansModelUtils.getBean(beanName, context);
        if (bean != null) {
          Node nameAttribute = element.getAttributeNode("name");
          if (nameAttribute != null && nameAttribute.getNodeValue() != null) {
            return bean.getProperty(nameAttribute.getNodeValue());
          }
          return bean;
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.springframework.ide.eclipse.beans.core.model.IBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.