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

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


    beansProject.addConfig("basic-bean-config.xml", IBeansConfig.Type.MANUAL);
   
    IFile xmlFile = (IFile) project.findMember("basic-bean-config.xml");
    Set<IBeansConfig> configs = beansProject.getConfigs(xmlFile, false);
    assertEquals(1, configs.size());
    IBeansConfig config = configs.iterator().next();
    assertEquals("basic-bean-config.xml", config.getElementName());
  }
View Full Code Here


  private IHyperlink[] createBeanDefinitionParserHyperlink(IHyperlink[] hyperlinks, IDocument document,
      Node currentNode) {
   
    String namespaceUri = currentNode.getNamespaceURI();
    IFile file = BeansEditorUtils.getFile(document);
    IBeansConfig config = BeansCorePlugin.getModel().getConfig(file, true);
   
    // Only search for non-default namespace handlers
    if (config != null && namespaceUri != null && !namespaceUri.equals(NamespaceUtils.DEFAULT_NAMESPACE_URI)) {
     
      ClassLoader cl = BeansCorePlugin.getClassLoader();
      if (NamespaceUtils.useNamespacesFromClasspath(file.getProject())) {
        cl = JdtUtils.getClassLoader(file.getProject(), cl);
      }
     
      // Construct NamespaceHandlerResolver using the project's classpath if configured
      DelegatingNamespaceHandlerResolver resolver = new DelegatingNamespaceHandlerResolver(cl, config);
      NamespaceHandler handler = resolver.resolve(namespaceUri);
      if (handler instanceof NamespaceHandlerSupport) {
       
        XmlReaderContext readerContext = new XmlReaderContext((Resource) config.getAdapter(Resource.class),
            new NoOpProblemReporter(), null, null, new XmlBeanDefinitionReader(
                new DefaultBeanDefinitionRegistry()), resolver);
       
        Object parser = ReflectionUtils.invokeMethod(FIND_PARSER_FOR_ELEMENT_METHOD, handler,
            (Element) currentNode, new ParserContext(readerContext, new BeanDefinitionParserDelegate(
View Full Code Here

    beansProject.addConfig("advanced-bean-config.xml", IBeansConfig.Type.MANUAL);
   
    IFile xmlFile1 = (IFile) project.findMember("basic-bean-config.xml");
    Set<IBeansConfig> configs = beansProject.getConfigs(xmlFile1, false);
    assertEquals(1, configs.size());
    IBeansConfig config = configs.iterator().next();
    assertEquals("basic-bean-config.xml", config.getElementName());

    IFile xmlFile2 = (IFile) project.findMember("advanced-bean-config.xml");
    configs = beansProject.getConfigs(xmlFile2, false);
    assertEquals(1, configs.size());
    config = configs.iterator().next();
    assertEquals("advanced-bean-config.xml", config.getElementName());
  }
View Full Code Here

    beansProject.addConfig("basic-bean-config.xml", IBeansConfig.Type.MANUAL);

    IFile xmlFile = (IFile) project.findMember("basic-bean-config.xml");
    Set<IBeansConfig> configs = beansProject.getConfigs(xmlFile, false);
    assertEquals(1, configs.size());
    IBeansConfig config = configs.iterator().next();
    assertEquals("basic-bean-config.xml", config.getElementName());

    IFile javaFile = (IFile) project.findMember("src/org/test/spring/SimpleConfigurationClass.java");
    configs = beansProject.getConfigs(javaFile, false);
    assertEquals(1, configs.size());
    config = configs.iterator().next();
    assertEquals("java:org.test.spring.SimpleConfigurationClass", config.getElementName());
  }
View Full Code Here

    IFile javaFile = (IFile) project.findMember("src/org/test/spring/TwoInnerConfigurationClasses.java");
    Set<IBeansConfig> configs = beansProject.getConfigs(javaFile, false);
    assertEquals(2, configs.size());

    Iterator<IBeansConfig> iterator = configs.iterator();
    IBeansConfig config1 = iterator.next();
    IBeansConfig config2 = iterator.next();
   
    assertTrue("java:org.test.spring.TwoInnerConfigurationClasses$InnerConfigClass1".equals(config1.getElementName()) ||
        "java:org.test.spring.TwoInnerConfigurationClasses$InnerConfigClass1".equals(config2.getElementName()));
    assertTrue("java:org.test.spring.TwoInnerConfigurationClasses$InnerConfigClass2".equals(config1.getElementName()) ||
        "java:org.test.spring.TwoInnerConfigurationClasses$InnerConfigClass2".equals(config2.getElementName()));
  }
View Full Code Here

    secondBeansProject.addConfig("second-bean-config.xml", IBeansConfig.Type.MANUAL);
   
    IFile xmlFile = (IFile) secondProject.findMember("second-bean-config.xml");
    Set<IBeansConfig> configs = beansProject.getConfigs(xmlFile, false);
    assertEquals(1, configs.size());
    IBeansConfig config = configs.iterator().next();
    assertEquals("second-bean-config.xml", config.getElementName());
   
    secondProject.delete(true, null);
  }
View Full Code Here

 
  @Test
  public void testGetBeanConfigsWithIncludedConfigs() throws Exception {
    beansProject.addConfig("importing-bean-config.xml", IBeansConfig.Type.MANUAL);
   
    IBeansConfig config = beansProject.getConfig("importing-bean-config.xml");
    Set<IBeansImport> imports = config.getImports();
    assertEquals(1, imports.size());
   
    IFile importedFile = (IFile) project.findMember("advanced-bean-config.xml");
    Set<IBeansConfig> configs = beansProject.getConfigs(importedFile, false);
    assertEquals(0, configs.size());
   
    configs = beansProject.getConfigs(importedFile, true);
    assertEquals(1, configs.size());
    IBeansConfig importedConfig = configs.iterator().next();
    assertEquals("advanced-bean-config.xml", importedConfig.getElementName());
  }
View Full Code Here

  public Object getPropertyValue(Object id) {
    if (P_ID_NAME.equals(id)) {
      return bean.getElementName();
    }
    if (P_ID_CONFIG.equals(id)) {
      IBeansConfig config = BeansModelUtils.getConfig(bean);
      IFile file = (IFile) config.getElementResource();
      if (file != null) {
        return new ConfigFilePropertySource(file);
      }
      return config.getElementName();
    }
    if (P_ID_PARENT.equals(id)) {
      String parentName = bean.getParentName();
      IBean parentBean = BeansModelUtils.getConfig(bean).getBean(
          parentName);
View Full Code Here

    if (region instanceof IDOMNode) {
      IDOMNode node = (IDOMNode) region;
      IFile file = editor.getResourceFile();

      BeansValidationContext context = null;
      IBeansConfig config = BeansCorePlugin.getModel().getConfig(file);
      if (config != null) {
        context = new BeansValidationContext(config,
            new SpringProject(SpringCore.getModel(), file.getProject()));
      }
View Full Code Here

  public static TreePath createTreePath(IModelElement element) {
    TreePathBuilder path = new TreePathBuilder();
    while (element != null && element.getElementParent() != null) {
      path.addParent(element);
      if (element instanceof IBeansConfig) {
        IBeansConfig config = (IBeansConfig) element;
        if (config.isElementArchived()) {
          path.addParent(new ZipEntryStorage(config));
        }
        else {
          path.addParent(config.getElementResource());
        }
      }
      element = element.getElementParent();
    }
    return path.getPath();
View Full Code Here

TOP

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

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.