| Newsgroups |
gmane.comp.java.netbeans.modules.openide.devel |
| Message-ID |
<[email protected]> |
A project is always a folder that is identified by means of a specific file, e.g., with a specific file extension. I think people generally accept that the notion of a ‘project’ is always more than one file, so possibly you need to reconsider the design of your input.
Gj
> On 17 Aug 2017, at 18:12, Abdiel Carrazana <[email protected]> wrote:
>
> Yes, checking the 431 line <https://urldefense.proofpoint.com/v2/url?u=http-3A__hg.netbeans.org_main_file_tip_projectui_src_org_netbeans_modules_project_ui_ProjectChooserAccessory.java&d=DwMFaQ&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=RsnMTa2TFk6uZ4oegQU-UNFN3nBcDxoWHldd2f5JyQM&m=pwi-CUrFGNdCOajVmiHR2nmBmqCuj8WeR_uZ1IwL5L4&s=XTDZMdQkf0IbNImGY5kv6sQKB2JqiaHVYo26HEq1Mnw&e=> 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] <mailto:[email protected]> <[email protected] <mailto:[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] <mailto:[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 <https://urldefense.proofpoint.com/v2/url?u=https-3A__platform.netbeans.org_tutorials_nbm-2Dprojecttype.html&d=DwMFaQ&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=RsnMTa2TFk6uZ4oegQU-UNFN3nBcDxoWHldd2f5JyQM&m=pwi-CUrFGNdCOajVmiHR2nmBmqCuj8WeR_uZ1IwL5L4&s=rjXYuI3C8mJyplEtMALAZwfRKpplUE9t9zBxxaqlpPw&e=>). 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 <https://urldefense.proofpoint.com/v2/url?u=http-3A__forums.netbeans.org__files_image-5F146.jpg&d=DwMFaQ&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=RsnMTa2TFk6uZ4oegQU-UNFN3nBcDxoWHldd2f5JyQM&m=pwi-CUrFGNdCOajVmiHR2nmBmqCuj8WeR_uZ1IwL5L4&s=aD32ddbQAQl7tf74lwzF1qEJr0in1JGT2mh6SSSWdT0&e=>
> >
>
>