1 19 20 package org.netbeans.modules.search.project; 21 22 import java.io.IOException ; 23 import java.util.logging.Level ; 24 import java.util.logging.Logger ; 25 import org.netbeans.api.project.Project; 26 import org.netbeans.api.project.ProjectManager; 27 import org.netbeans.api.project.ui.OpenProjects; 28 import org.netbeans.modules.openfile.OpenFileImpl; 29 import org.openide.filesystems.FileObject; 30 31 36 public class ProjectOpenFileImpl implements OpenFileImpl { 37 38 public boolean open(FileObject fileObject, int line) { 39 if (fileObject.isFolder()) { 40 try { 41 Project p = ProjectManager.getDefault().findProject(fileObject); 42 if (p != null) { 43 OpenProjects.getDefault().open(new Project[] {p}, false); 44 OpenProjects.getDefault().setMainProject(p); 45 return true; 46 } 47 } catch (IOException ex) { 48 Logger.getLogger(ProjectOpenFileImpl.class.getName()).log(Level.WARNING, null, ex); 49 } 50 } 51 return false; 52 } 53 54 } 55 | Popular Tags |