Re: File base Project, not Folder based
Abdiel Carrazana <[email protected]> Thu, 17 Aug 2017 12:12:02 -0400
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <CALPkZ+pZnESTgg2_07ACQxrQZsjJUge4wPd+=nGg-_W_1HFyxA@mail.gmail.com> |
Yes, checking the 431 line <http://hg.netbeans.org/main/file/tip/projectui/src/org/netbeans/modules/project/ui/ProjectChooserAccessory.java> seems that there is no way of reading a project from a single file. *chooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY );* It should't be, a lot of desktop tools work in that way. I will have to use the folder, but I don't like it. Thanks any way 2017-08-17 9:56 GMT-04:00 [email protected] < [email protected]>: > The project will be defined by a folder that contains your single file. > > Gj > > > On 16 Aug 2017, at 16:46, abdielcs <[email protected]> wrote: > > > > I'm trying to implement a new type of project based on this tutorial ( > https://platform.netbeans.org/tutorials/nbm-projecttype.html). The > problem is that I want that my project be saved as a single file, with a > custom extension, so all the content must reside on that file. Like > project_name.cep (cep - custom extension project). I don't want to open a > new type of file inside project, that file is my project, and I want to > write nodes inside it. > > > > This is an example of the ProjectFactory to use: > > > > > > Code: > > > > @ServiceProvider(service=ProjectFactory.class) > > public class CustomProjectFactory implements ProjectFactory{ > > > > public static final String PROJECT_EXT = "cep"; > > > > //Specifies when a project is a project, i.e., > > @Override > > public boolean isProject(FileObject projectDirectory) { > > return PROJECT_EXT.equals(projectDirectory.getExt());//assuming > that getExt() give the file extension > > } > > > > //Specifies when the project will be opened, i.e., if the project > exists: > > @Override > > public Project loadProject(FileObject dir, ProjectState state) throws > IOException { > > return isProject(dir) ? new CustomProject(dir, state) : null; > > } > > > > @Override > > public void saveProject(final Project project) throws IOException, > ClassCastException { > > // leave unimplemented for the moment > > } > > > > } > > > > > > > > > > The problem is that the FileChooser opened when I tried to open the > project seems to be a DIRECTORIES_ONLY chooser, so a single file can't be > opened. It can be done? I really appreciate some example of how to do this > and if is not to much to ask how to write nodes inside this single file and > represent it in the explorer (just some advices). > > > > > > > > > > Attachments: > > http://forums.netbeans.org//files/image_146.jpg > > > >