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

Examples of org.springframework.ide.eclipse.beans.core.internal.model.BeansProject


        return null;
      }

      for (IBeansProject project : BeansCorePlugin.getModel().getProjects()) {
        boolean updated = false;
        BeansProject beansProject = (BeansProject) project;

        // Firstly rename references to config sets
        for (IBeansConfigSet configSet : beansProject.getConfigSets()) {
          if (configSet.hasConfig(config)) {
            if (config.getProject().equals(project.getProject())) {
              IPath newPath = newName.getProjectRelativePath().append(config.getName());
              ((BeansConfigSet) configSet).removeConfig(config.getProjectRelativePath().toString());
              ((BeansConfigSet) configSet).addConfig(newPath.toString());
View Full Code Here


      return null;
    }

    for (IBeansProject project : this.beansModel.getProjects()) {
      boolean updated = false;
      BeansProject beansProject = (BeansProject) project;

      // Firstly rename references to config sets
      for (IBeansConfigSet configSet : beansProject.getConfigSets()) {
        Set<IBeansConfig> configs = configSet.getConfigs();
        for (IBeansConfig config : configs) {
          if (config instanceof BeansJavaConfig) {
            IType configClass = ((BeansJavaConfig) config).getConfigClass();
            if (type.equals(configClass)) {
              ((BeansConfigSet) configSet).removeConfig(config.getElementName());
              ((BeansConfigSet) configSet).addConfig(BeansConfigFactory.JAVA_CONFIG_TYPE + newName);
            }
            else if (configClass != null && type.equals(configClass.getDeclaringType())) {
              beansProject.removeConfig(config.getElementName());
              String newConfigClassName = newName + "$" + configClass.getElementName();
              beansProject.addConfig(BeansConfigFactory.JAVA_CONFIG_TYPE + newConfigClassName, IBeansConfig.Type.MANUAL);
            }
          }
        }
      }

      // Secondly rename configs
      for (IBeansConfig config : beansProject.getConfigs()) {
        if (config instanceof BeansJavaConfig) {
          IType configClass = ((BeansJavaConfig) config).getConfigClass();
          if (configClass != null && getNewConfigName(newName, type, configClass) != null) {
            beansProject.removeConfig(config.getElementName());
            beansProject.addConfig(BeansConfigFactory.JAVA_CONFIG_TYPE + getNewConfigName(newName, type, configClass), IBeansConfig.Type.MANUAL);
//            removeMarkers(config);
            updated = true;
          }
        }
      }
View Full Code Here

    ITextRegion valueRegion = parentAttr.getValueRegion();

    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

      return null;
    }

    for (IBeansProject project : BeansCorePlugin.getModel().getProjects()) {
      boolean updated = false;
      BeansProject beansProject = (BeansProject) project;

      // Firstly rename references to config sets
      for (IBeansConfigSet configSet : beansProject.getConfigSets()) {
        Set<IBeansConfig> configs = configSet.getConfigs();
        for (IBeansConfig config : configs) {
          if (config instanceof BeansJavaConfig) {
            IType configClass = ((BeansJavaConfig) config).getConfigClass();
            if (configClass != null && configClass.getPackageFragment().getElementName().equals(oldPackageName)) {
              ((BeansConfigSet) configSet).removeConfig(config.getElementName());
             
              String newConfigClassName = newPackageName + "." + configClass.getTypeQualifiedName();
              ((BeansConfigSet) configSet).addConfig(BeansConfigFactory.JAVA_CONFIG_TYPE + newConfigClassName);
            }
          }
        }
      }

      // Secondly rename configs
      Set<IBeansConfig> configs = beansProject.getConfigs();
      for (IBeansConfig config : configs) {
        if (config instanceof BeansJavaConfig) {
          IType configClass = ((BeansJavaConfig) config).getConfigClass();
          if (configClass != null && configClass.getPackageFragment().getElementName().equals(oldPackageName)) {
            beansProject.removeConfig(config.getElementName());
           
            String newConfigClassName = newPackageName + "." + configClass.getTypeQualifiedName();
            beansProject.addConfig(BeansConfigFactory.JAVA_CONFIG_TYPE + newConfigClassName, IBeansConfig.Type.MANUAL);
            updated = true;
          }
        }
      }
     
View Full Code Here

      if (monitor.isCanceled()) {
        throw new OperationCanceledException();
      }

      IBeansModel model = BeansCorePlugin.getModel();
      BeansProject project = new BeansProject(model, projectHandle);
      project.setConfigSuffixes(configExtensions);
      project.setImportsEnabled(enableImports);
      project.saveDescription();
      monitor.worked(2);
    }
    finally {
      monitor.done();
    }
View Full Code Here

    }
  }

  public void testValidationErrors() throws Exception {
    createBeanClasses();
    BeansProject beansProject = createBeansProject();
    IFile xmlFile = createXmlFile("sample.xml", beansProject);

    IMarker[] markers = getFailureMarkers();
    assertEquals("Wrong number of validation errors (problem markers)", 5,
        markers.length);
View Full Code Here

    assertEquals("Wrong number of validation errors (problem markers)", 8,
        markers.length);
  }

  public void testParseErrors() throws Exception {
    BeansProject beansProject = createBeansProject();
    IFile xmlFile = createXmlFile("parseError.xml", beansProject);

    IMarker[] markers = getFailureMarkers(xmlFile);

    assertEquals(1, markers.length);
View Full Code Here

        marker.getAttribute(IMarker.MESSAGE, ""));
  }

  public void testValidateConfigSetErrors() throws Exception {
    createBeanClasses();
    BeansProject beansProject = createBeansProject();
    IFolder xmlFolder = project.createXmlFolder();
    // TODO: try to create the xml folder only once per test
    IFile xmlFileA = createXmlFile("a.xml", beansProject);
    IFile xmlFileB = createXmlFile("b.xml", beansProject);

    Set<String> configNames = new HashSet<String>();
    configNames.add("xml/a.xml");
    configNames.add("xml/b.xml");
    BeansConfigSet b = new BeansConfigSet(beansProject, "configSet",
        configNames, IBeansConfigSet.Type.MANUAL);
    b.setAllowBeanDefinitionOverriding(false);
    // TODO: really should run this test twice, with this flag set and unset

    Collection c = beansProject.getConfigSets();
    Set<IBeansConfigSet> l = new HashSet<IBeansConfigSet>();
    l.add(b);
    beansProject.setConfigSets(l);
    beansProject.saveDescription();
    updateTestFile(xmlFolder, "b.xml");
    project.waitForAutoBuild();

    IMarker[] markers = getFailureMarkers(xmlFileB);
View Full Code Here

    SpringCoreUtils.addProjectNature(eclipseProject, SpringCore.NATURE_ID,
        new NullProgressMonitor());
    project.waitForAutoBuild();

    IBeansModel model = BeansCorePlugin.getModel();
    BeansProject beansProject = (BeansProject) model
        .getProject(eclipseProject);
    assertNotNull("No sample project in model", beansProject);
    return beansProject;
  }
View Full Code Here

    assertTrue(hasBeansProjectNature());
    assertNotNull(model.getProject(eclipseProject));
    assertTrue(hasBeansBuilder());
   
    BeansProject proj = (BeansProject) model.getProject(eclipseProject);
    assertNotNull(proj);
   
    assertTrue(hasBeansDecorator());

    SpringCoreUtils.removeProjectNature(eclipseProject, SpringCore.NATURE_ID, new NullProgressMonitor());
View Full Code Here

TOP

Related Classes of org.springframework.ide.eclipse.beans.core.internal.model.BeansProject

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.