@Override public void loadProject(String fileName) throws Exception { Application application = Application.getInstance(); ProjectDescriptor projectDescriptor = null; // First, check if the user is logged in to teamwork server. /*String loggedUserName = TeamworkUtils.getLoggedUserName(); if(loggedUserName != null){ // Ok, the user is logged in. So try to load the project remotely. // load teamwork project projectDescriptor = TeamworkUtils.getRemoteProjectDescriptorByQualifiedName(fileName); }*/ if (projectDescriptor == null) { File projectFile = new File(fileName); if (!projectFile.exists()) throw new FileNotFoundException(IGUILabels.TITLE + ": Can't find project file " + fileName); String activeProjectFileName = getActiveProjectFileName(); File activeProjectFile = null; if (activeProjectFileName != null) { activeProjectFile = new File(activeProjectFileName); } if (activeProjectFile == null || !(activeProjectFile.equals(projectFile))) { projectDescriptor = ProjectDescriptorsFactory.createProjectDescriptor(projectFile.toURI()); } } if (projectDescriptor != null) { application.getProjectsManager().loadProject(projectDescriptor, true); } }
@Override public void saveProject(String fileName) throws Exception { ProjectsManager projectsManager = Application.getInstance().getProjectsManager(); File projectFile = new File(fileName); ProjectDescriptor projectDescriptor = ProjectDescriptorsFactory.createLocalProjectDescriptor( (Project) getActiveProject(), projectFile); projectsManager.saveProject(projectDescriptor, true); }