private void setProjectName()

in org.apache.easyant4e/src/org/apache/easyant4e/wizards/ProjectRecord.java [75:109]


    private void setProjectName() {
        try {
            // If we don't have the project name try again
            IPath path = new Path(projectSystemFile.getPath());
            if (projectName == null && !path.toOSString().endsWith("ivy")) {
                // if the file is in the default location, use the directory
                // name as the project name
                if (isDefaultLocation(path)) {
                    projectName = path.segment(path.segmentCount() - 2);
                    description = Activator.getEasyAntPlugin().getPluginWorkspace().newProjectDescription(projectName);
                } else {
                    description = Activator.getEasyAntPlugin().getPluginWorkspace().loadProjectDescription(path);
                    projectName = description.getName();
                }

            } else if (path.toOSString().endsWith("ivy")) {
                fromIvyDescription = true;
                // Load EasyantFile
                File f = new File(path.toPortableString());
                EasyAntModuleDescriptor moduleDescriptor = easyantProjectService.getEasyAntModuleDescriptor(f);
                projectName = moduleDescriptor.getName();
                description = Activator.getEasyAntPlugin().getPluginWorkspace().newProjectDescription(projectName);                 
                if(lastPath.endsWith(projectName)){
                    description.setLocation(new Path(lastPath));
                }else{
                    description.setLocation(new Path(lastPath+"/"+ projectName));
                }
                description.setComment(moduleDescriptor.getDescription());
                String[] newNatures= {};
                description.setNatureIds(newNatures);                   
            }
        } catch (Exception e) {
            Activator.getEasyAntPlugin().log(IStatus.ERROR, e.getMessage(), e);
        }
    }