sdedic commented on a change in pull request #2995:
URL: https://github.com/apache/netbeans/pull/2995#discussion_r651657889



##########
File path: 
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java
##########
@@ -1088,6 +1121,39 @@ public Void visitMethod(MethodTree tree, Void p) {
         return result;
     }
 
+    private List<Pair<String, String>> getProjectConfigurations(JavaSource 
source) {
+        for (FileObject fo : source.getFileObjects()) {
+            Project p = FileOwnerQuery.getOwner(fo);
+            if (p != null) {
+                ProjectConfigurationProvider<ProjectConfiguration> provider = 
p.getLookup().lookup(ProjectConfigurationProvider.class);
+                List<Pair<String, String>> configDispNames = new ArrayList<>();
+                if (provider != null) {
+                    boolean skippedFirst = false;
+                    for (ProjectConfiguration c : 
provider.getConfigurations()) {
+                        if (skippedFirst) {
+                            String runConfig = null;
+                            String debugConfig = null;
+                            if (provider.configurationAffectsAction(c, 
ActionProvider.COMMAND_RUN_SINGLE)) {

Review comment:
       My point was, that the project support(s) DO such fallback, and the API 
is defined so that configuration is just an override (the concept of disabling 
an action in a configuration is not present in the implementation, that's 
right). 
   
   So the point is that this approach works now, in the current de-facto state, 
for these specific actions. But can break in the future - consider (some) 
Configuration that focuses on other technology aspect than `--continuous`, i.e. 
on build or package; if it won't defne `run.single`, Run would be disabled.
   
   IMHO it would be better to somehow implement @JaroslavTulach's suggestion to 
allow plugins (maven, gradle) to indicate the action is to be disabled in a 
configuration - and propagate that from API through `isActionEnabled` query.




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

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