You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2021/09/01 09:11:12 UTC

[GitHub] [netbeans] lkishalmi commented on a change in pull request #3135: [NETBEANS-5941] Add generic execute.task action to Gradle projects

lkishalmi commented on a change in pull request #3135:
URL: https://github.com/apache/netbeans/pull/3135#discussion_r699444508



##########
File path: extide/gradle/src/org/netbeans/modules/gradle/actions/GradleTaskTokenProvider.java
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.actions;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.netbeans.modules.gradle.api.GradleTask;
+import org.netbeans.modules.gradle.api.NbGradleProject;
+import org.netbeans.modules.gradle.spi.actions.ReplaceTokenProvider;
+import org.netbeans.spi.project.ProjectServiceProvider;
+import org.openide.util.Lookup;
+
+/**
+ *
+ * @author lkishalmi
+ */
+@ProjectServiceProvider(service = ReplaceTokenProvider.class, projectType = NbGradleProject.GRADLE_PROJECT_TYPE)
+public class GradleTaskTokenProvider implements ReplaceTokenProvider {
+
+    private static Set<String> SUPPORTED = Collections.unmodifiableSet(new HashSet(Arrays.asList(
+       "taskName",
+       "taskPath",
+       "taskNames",
+       "taskPaths"
+    )));

Review comment:
       Well, yes these are never meant to be used widely, though it would be good to find some place for the documentation of Replacement Token Providers. It would interest power users as well.

##########
File path: extide/gradle/src/org/netbeans/modules/gradle/ActionProviderImpl.java
##########
@@ -500,14 +503,12 @@ Action forProject(Project p, FileObject fo) {
     private final class CustomPopupActions extends AbstractAction implements Presenter.Popup {
 
         private final boolean onFile;
-        private final boolean onGradle;
         private final Lookup lookup;
 
         @SuppressWarnings("OverridableMethodCallInConstructor")
         private CustomPopupActions(boolean onFile, boolean onGradleFile, FileObject fo) {

Review comment:
       Well it is not used, but calculated earlier. This one is a copy+paste left over from the maven plugin. Probably have to check why we calculate that on the first place, also check that in the "original" maven plugin code as well.

##########
File path: extide/gradle/src/org/netbeans/modules/gradle/nodes/TaskNode.java
##########
@@ -45,6 +46,8 @@
     @StaticResource
     private static final String TASK_ICON = "org/netbeans/modules/gradle/resources/gradle-task.gif";
 
+    public static final String EXECUTE_TASK_ACTION = "execute.task"; //NOI18N

Review comment:
       Good catch! I've put the constant in different places initially all around the source code. RunUtils might be not the final place.

##########
File path: extide/gradle/src/org/netbeans/modules/gradle/api/execute/RunUtils.java
##########
@@ -90,6 +90,9 @@
     public static final String PROP_INCLUDE_OPEN_PROJECTS = "include.open.projects"; //NOI18N
     public static final String PROP_DEFAULT_CLI = "gradle.cli"; //NOI18N
 
+    /** Action to execute specific Gradle Tasks from the IDE (Eg. from Navigator). */
+    public static final String EXECUTE_TASK_ACTION = "execute.task"; //NOI18N

Review comment:
       Yes, that's true, I'm aware of it.

##########
File path: extide/gradle/src/org/netbeans/modules/gradle/actions/DefaultActionMapping.java
##########
@@ -146,6 +146,12 @@ public boolean equals(Object obj) {
         return Objects.equals(this.withPlugins, other.withPlugins);
     }
 
+    @Override
+    public String toString() {
+        return name + " [" + args + ']';
+    }
+
+    

Review comment:
       Yes. It seems I was debugging the code...




-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists