/**
  * DOC smallet Comment method "afterImportAs".
  *
  * @param newName
  * @param technicalName
  * @throws InvocationTargetException
  */
 private static Project afterImportAs(String newName, String technicalName)
     throws InvocationTargetException {
   // Rename in ".project" and "talendProject" or "talend.project"
   // TODO SML Optimize
   final IWorkspace workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace();
   IContainer containers = (IProject) workspace.getRoot().findMember(new Path(technicalName));
   IResource file2 = containers.findMember(IProjectDescription.DESCRIPTION_FILE_NAME);
   try {
     FilesUtils.replaceInFile(
         "<name>.*</name>",
         file2.getLocation().toOSString(),
         "<name>" + technicalName + "</name>"); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     // TDI-19269
     final IProject project = workspace.getRoot().getProject(technicalName);
     XmiResourceManager xmiManager = new XmiResourceManager();
     try {
       final Project loadProject = xmiManager.loadProject(project);
       loadProject.setTechnicalLabel(technicalName);
       loadProject.setLabel(newName);
       loadProject.setLocal(true);
       loadProject.setId(0);
       loadProject.setUrl(null);
       loadProject.setCreationDate(null);
       loadProject.setDescription("");
       loadProject.setType(null);
       // ADD xqliu 2012-03-12 TDQ-4771 clear the list of Folders
       if (loadProject.getFolders() != null) {
         loadProject.getFolders().clear();
       }
       // ~ TDQ-4771
       xmiManager.saveResource(loadProject.eResource());
       return loadProject;
     } catch (PersistenceException e) {
       //
     }
   } catch (IOException e) {
     throw new InvocationTargetException(e);
   }
   return null;
 }
コード例 #2
0
 /**
  * Sets the description.
  *
  * @param description the description to set
  */
 public void setDescription(String description) {
   project.setDescription(description);
 }