private String checkConf()

in org.apache.ivyde.eclipse/src/java/org/apache/ivyde/internal/eclipse/cpcontainer/IvydeContainerPage.java [131:172]


    private String checkConf() {
        String error = null;

        String ivyFilePath = ivyFilePathText.getIvyFilePath();
        List<String> selectedConfigurations = confTableViewer.getSelectedConfigurations();

        List<IvyClasspathContainer> containers = IvyClasspathContainerHelper
                .getContainers(project);
        if (containers == null) {
            return null;
        }

        for (IvyClasspathContainer container : containers) {
            IvyClasspathContainerConfiguration cpc = container.getConf();

            // first check that this is not the one we are editing
            if (cpc.getIvyXmlPath().equals(oldIvyFile) && oldConfs != null
                    && oldConfs.size() == cpc.getConfs().size()
                    && oldConfs.containsAll(cpc.getConfs())) {
                continue;
            }

            if (cpc.getIvyXmlPath().equals(ivyFilePath)) {
                if (selectedConfigurations.isEmpty() || selectedConfigurations.contains("*")
                        || cpc.getConfs().isEmpty() || cpc.getConfs().contains("*")) {
                    error = "A container already exists for the selected conf of "
                            + "the module descriptor";
                    break;
                } else {
                    List<String> list = new ArrayList<>(cpc.getConfs());
                    list.retainAll(selectedConfigurations);
                    if (!list.isEmpty()) {
                        error = "A container already exists for the selected conf of "
                                + "the module descriptor";
                        break;
                    }
                }
            }
        }

        return error;
    }