neilcsmith-net commented on PR #9650: URL: https://github.com/apache/netbeans/pull/9650#issuecomment-6265438271
> project factory solution is considered, > ... > the `FallbackFactory` and its usages are all in `ide/projectui` ... Firstly, I don't believe there's a demonstrated need for a fallback project, and I don't think it should be inside `projectui` or used anywhere like folder groups. We do a lot to maintain API compatibility, but we should also always consider the importance of behavioural compatibility. My view on the project factory solution is that we need a Generic Project type (which I think aligns with @mbien comments elsewhere, and possibly @lahodaj - see the MVP thread on dev@). A generic project type would wrap any folder, allowing it to act as a container for the files or projects within it. This handles a use case for project groups as well as much more. Ideally, this project type exists in a separate module - eg. `project.generic`, where it can be disabled / excluded to return to the current behaviour. > ... e.g. no API is needed I'm not sure trying to do this without an API is desirable or possible, it's just that the API should not embed the project type or _require_ a project to be created. > > The project factory solution has cons, > > it certainly does - cleaning up internals of `ProjectManager` when new project factories get enabled is now complicated and limited - some tests may still be failing - pending a fix... If we have a standard project type that is created explicitly by user interaction, I'm not sure why this is a requirement in the first place?! > > and will require some SPI to work, but in my opinion has far fewer cons than this API. > > I believe Neil talks about _some marker on disk_ when mentioning SPI here No, I'm really talking about an SPI. What we lack at the moment is an SPI that captures _explicit user intent to open a folder as a project_. As mentioned in email, it might have some similarity to [ProjectConvertor](https://bits.netbeans.org/32/javadoc/org-netbeans-modules-projectuiapi-base/org/netbeans/spi/project/ui/ProjectConvertor.html). But we don't want a project factory or convertor that starts recognising every folder as a potential project! So, something like - ``` interface FolderToProjectCreator { Optional<Result> createProjectFromFolder(FileObject folder); } ``` There may be one, none or many registered. I have a few thoughts where multiple might be useful. In the IDE, there would be at least one in `project.generic` when enabled. The SPI could also return `null` - just emphasising that a return value is not guaranteed. There may also be an API very similar to your original that can be used by project groups, etc. ``` Optional<Project> findOrCreateProject(FileObject dir); ``` Where it would differ is that it doesn't document a specific project type, but that it queries the registered SPI, and it is still allowed to return `null`. Without any enabled SPI implementations, behaviour remains as before. > but the goal of this PR was never to make permanent changes on disk! Agreed, assuming we're not discounting file attributes and talking about the default behaviour. We already have something similar in CPPLite storing project info in the userdir and using it to recognise folders. I suggested piggybacking on the default AuxiliaryConfiguration file attribute. This is going to be added anyway if anything uses `ProjectUtils::getPreferences` etc. And since #9449 it is imported on upgrade. I'm sure someone on list mentioned the _option_ of having the project/group settings shareable, which would require the option to store in the project. Again, the default `AuxiliaryConfiguration` has this. The project factory could recognise either the attribute or the file as symbolising a generic project. > the whole purpose of `ProjectManager.findProjectOrFallback` was to create the fallback project _only temporarily_ while the IDE is running Why? What's the temporary nature solving, and why the added complexity? The above suggestion would allow for projects to be forgotten by removing the attribute. Again the trigger would be explicit user action. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
