jtulach commented on code in PR #9650:
URL: https://github.com/apache/netbeans/pull/9650#discussion_r4440526620


##########
ide/projectapi/src/org/netbeans/api/project/ProjectManager.java:
##########
@@ -139,7 +145,53 @@ public Project findProject(@NonNull final FileObject 
projectDirectory) throws IO
         if (!projectDirectory.isFolder()) {
             throw new IllegalArgumentException("Attempted to pass a 
non-directory to findProject: " + projectDirectory); // NOI18N
         }
-        return impl.findProject(projectDirectory);
+        return impl.findProject(projectDirectory, 
ProjectManagerImplementation.FindOptions.DEFAULT);
+    }
+
+    /** Finds a project corresponding to the given directory. This method 
behaves
+     * exactly as {@link #findProject}, just instead of {@code null} it returns
+     * the <em>fallback project</em> - e.g. if the directory isn't recognized 
as a project,
+     * a <em>fallback project</em> is created and registered with the 
directory.
+     *
+     * <h2>Fallback Project</h2>
+     * <p>
+     * The <em>fallback project</em> is dummy representation of a folder on
+     * disk, but it can be extended via {@link LookupMerger} mechanism. The
+     * project uses {@code org-netbeans-modules-project-fallback} ID.
+     * </p>
+     * <p>
+     * For example its {@link Project#getLookup()} can be extended by 
registering
+     * instance of {@link LookupProvider} into
+     * {@code Projects/org-netbeans-modules-project-fallback/Lookup}
+     * configuration directory. Either via {@code layer.xml}, or annotations
+     * that generate the layer like
+     * </p>
+     * <pre>
+     * @ProjectServiceProvider(service = LookupProvider.class, projectTypes = {
+     *   @LookupProvider.Registration.ProjectType(id = 
"org-netbeans-modules-project-fallback", position = 11000)

Review Comment:
   Example how to register services into the project's lookup.



-- 
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

Reply via email to