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

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


    beansProject.addConfigSet(configSet);
   
    IType type = secondJavaProject.findType("org.test.spring.ExternalConfigurationClass");
    beansProject.removeConfig((IFile) type.getResource());
   
    IBeansConfigSet set = beansProject.getConfigSet("test-set");
    Set<IBeansConfig> configs = set.getConfigs();
    assertEquals(1, configs.size());
   
    secondProject.delete(true, null);
  }
View Full Code Here


    if (configSetName != null) {
      Set<String> configNames = new HashSet<String>();
      configNames.add(configName);
      configNames.add(referencedConfigName);

      IBeansConfigSet configSet = new BeansConfigSet(project, configSetName, configNames,
          IBeansConfigSet.Type.MANUAL);
      project.addConfigSet(configSet);
      project.saveDescription();
      BeansModelUpdater.updateProject(project);
    }
View Full Code Here

    IFile configFile = (IFile) project.findMember("src/import-test.xml");
    IBeansConfig config = BeansCorePlugin.getModel().getConfig(configFile);
    IBean importBean = BeansModelUtils.getBean(parentAttr.getValue(), config);

    BeansProject beanProject = (BeansProject) BeansCorePlugin.getModel().getProject(project);
    IBeansConfigSet configSet = beanProject.getConfigSet("AddConfigSetTest");
    assertNull("Expects no config set", configSet);

    AddConfigSetQuickFixProposal proposal = new AddConfigSetQuickFixProposal(offset, length, false, importBean,
        file, "AddConfigSetTest");
    proposal.apply(document);

    configSet = beanProject.getConfigSet("AddConfigSetTest");
    assertNotNull("Expects config set to be created", configSet);
    assertTrue("Expects config-set-proposal-test.xml to be added to config set",
        configSet.getConfigs().contains(beanProject.getConfig(file)));

    IFile importFile = project.getFile("src/import-test.xml");
    assertTrue("Expects import-test.xml to be added to config set",
        configSet.getConfigs().contains(beanProject.getConfig(importFile)));
  }
View Full Code Here

    int offset = getOffset(valueRegion, beanNode);
    int length = getLength(valueRegion, false);

    BeansProject beanProject = (BeansProject) BeansCorePlugin.getModel().getProject(project);
    IBeansConfigSet configSet = beanProject.getConfigSet("AddToConfigSetTest");
    IBeansConfig config = beanProject.getConfig(file);

    assertFalse("Expects config file to not be in config set", configSet.getConfigs().contains(config));

    AddToConfigSetQuickFixProposal proposal = new AddToConfigSetQuickFixProposal(offset, length, false, file,
        configSet, beanProject);
    proposal.apply(document);

    configSet = beanProject.getConfigSet("AddToConfigSetTest");
    config = beanProject.getConfig(file);
    assertTrue("Expects config file to be added into config set", configSet.getConfigs().contains(config));
  }
View Full Code Here

      IBeansValidationContext context) {
    return element instanceof IBeanAlias;
  }

  public void validate(IBeanAlias alias, IBeansValidationContext context, IProgressMonitor monitor) {
    IBeansConfigSet configSet = (context.getContextElement() instanceof IBeansConfigSet ? (IBeansConfigSet) context
        .getContextElement() : null);
    // Validate bean overriding
    if (context.getIncompleteRegistry().containsBeanDefinition(alias.getElementName())) {
      if (configSet == null || BeansModelUtils.getConfig(alias).getBean(alias.getElementName()) != null) {
        context.error(alias, "BEAN_OVERRIDE", "Overrides another bean in the same config file");
      }
      else if (!configSet.isAllowBeanDefinitionOverriding()) {
        context.error(alias, "BEAN_OVERRIDE", "Overrides another bean in config set '"
            + configSet.getElementName() + "'");
      }
    }

    // Validate alias overriding within config
    for (IBeanAlias al : BeansModelUtils.getConfig(alias).getAliases()) {
      if (al == alias) {
        continue;
      }
      else if (al.getElementName().equals(alias.getElementName())) {
        context.error(alias, "ALIAS_OVERRIDE", "Overrides another alias in the same config file");
        break;
      }
    }

    // Validate alias within config set
    if (configSet != null) {

      // Validate alias overriding
      if (!configSet.isAllowAliasOverriding()) {
        for (IBeansConfig config : configSet.getConfigs()) {
          if (config == BeansModelUtils.getConfig(alias)) {
            break;
          }
          if (config.getAlias(alias.getElementName()) != null) {
            context.error(alias, "ALIAS_OVERRIDE", "Overrides another alias in config set '"
                + configSet.getElementName() + "'");
            break;
          }
        }
      }

      // Check if corresponding bean exists
      if (!configSet.isIncomplete() && !context.getCompleteRegistry().containsBeanDefinition(alias.getBeanName())) {
        context.warning(alias, "UNDEFINED_REFERENCED_BEAN", "Referenced bean '" + alias.getBeanName()
            + "' not found in config set '" + configSet.getElementName() + "'");
      }
    }
  }
View Full Code Here

    if (!this.modelPopulated) {
      populateModel();
    }
    try {
      r.lock();
      IBeansConfigSet set = configSets.get(configSetName);
      if (set != null) {
        return set;
      }
      return autoDetectedConfigSets.get(configSetName);
    } finally {
View Full Code Here

          // Create a config set for auto detected configs if desired
          // by the extension
          if (configSetName != null && configSetName.length() > 0) {

            IBeansConfigSet configSet = new BeansConfigSet(BeansProject.this, configSetName, configNamesByLocator,
                IBeansConfigSet.Type.AUTO_DETECTED);

            // configure the created IBeansConfig
            locator.getBeansConfigLocator().configureBeansConfigSet(configSet);
View Full Code Here

      context.getIncompleteRegistry().registerBeanDefinition(bean.getElementName(),
          bean.getBeanDefinition());
    }
    catch (BeanDefinitionStoreException e) {
      if (context.getContextElement() instanceof IBeansConfigSet) {
        IBeansConfigSet configSet = (IBeansConfigSet) context.getContextElement();
        context.error(bean, "BEAN_OVERRIDE", "Overrides another bean named '"
            + bean.getElementName() + "' in config set '" + configSet.getElementName()
            + "'");
      }
      else if (context.getContextElement() instanceof IBeansConfig) {
        for (IBean existingBean : ((IBeansConfig) context.getContextElement()).getBeans()) {
          if (existingBean != bean
View Full Code Here

      ISelectionService service = (ISelectionService) locator.getService(ISelectionService.class);
      ISelection selection = service.getSelection();
      if (selection instanceof StructuredSelection) {
        Object element = ((StructuredSelection) selection).getFirstElement();
        if (element instanceof IBeansConfigSet) {
          IBeansConfigSet configSet = (IBeansConfigSet) element;
          Set<IBeansConfig> configs = configSet.getConfigs();
          for (IBeansConfig config : configs) {
            IContributionItem contribution = new ActionContributionItem(
                new RemoveFromConfigSetDynamicAction(configSet, config));
            items.add(contribution);
          }
View Full Code Here

TOP

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

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.