private static void convertOldRetrieveConf()

in org.apache.ivyde.eclipse/src/java/org/apache/ivyde/internal/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java [276:333]


    private static void convertOldRetrieveConf(IvyClasspathContainerConfiguration conf,
            boolean isRetrieveProjectSpecific, boolean doStandaloneRetrieve,
            RetrieveSetup retrieveSetup, SettingsSetup settingsSetup, String ivyXmlPath) {
        if (conf.getJavaProject() == null) {
            // no project means no retrieve possible
            return;
        }

        StandaloneRetrieveSetup setup = new StandaloneRetrieveSetup();
        setup.setName("dependencies");
        setup.setSettingsSetup(settingsSetup);
        setup.setIvyXmlPath(ivyXmlPath);
        setup.setSettingsProjectSpecific(conf.isSettingsProjectSpecific());
        setup.setProject(conf.getJavaProject().getProject());

        IPreferenceStore prefStore = IvyPlugin.getDefault().getPreferenceStore();

        if (isRetrieveProjectSpecific) {
            if (!doStandaloneRetrieve) {
                return;
            }
        } else {
            if (!prefStore.getBoolean(PreferenceConstants.DO_RETRIEVE)) {
                return;
            }
            retrieveSetup = new RetrieveSetup();
            retrieveSetup.setRetrieveConfs(prefStore.getString(PreferenceConstants.RETRIEVE_CONFS));
            retrieveSetup.setRetrievePattern(prefStore
                    .getString(PreferenceConstants.RETRIEVE_PATTERN));
            retrieveSetup.setRetrieveSync(prefStore.getBoolean(PreferenceConstants.RETRIEVE_SYNC));
            retrieveSetup.setRetrieveTypes(prefStore.getString(PreferenceConstants.RETRIEVE_TYPES));
        }

        if (retrieveSetup.getRetrievePattern() == null) {
            retrieveSetup.setRetrievePattern(prefStore
                    .getString(PreferenceConstants.RETRIEVE_PATTERN));
        }

        setup.setRetrieveSetup(retrieveSetup);

        RetrieveSetupManager manager = IvyPlugin.getDefault().getRetrieveSetupManager();
        IProject project = conf.getJavaProject().getProject();
        List<StandaloneRetrieveSetup> retrieveSetups;
        try {
            retrieveSetups = manager.getSetup(project);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            IvyPlugin.logError(e.getMessage(), e);
            return;
        }
        retrieveSetups.add(setup);
        try {
            manager.save(project, retrieveSetups);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            IvyPlugin.logError(e.getMessage(), e);
        }
    }