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/02 04:33:41 UTC

[GitHub] [netbeans] lkishalmi commented on a change in pull request #3145: Gradle Support for Payara Micro

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



##########
File path: enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroActionConvertor.java
##########
@@ -0,0 +1,68 @@
+/*
+ * 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.fish.payara.micro.project;
+
+import org.netbeans.api.project.Project;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.COMPILE_EXPLODE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.DEBUG_SINGLE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.EXPLODE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.PROFILE_SINGLE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.RUN_SINGLE_ACTION;
+import static org.netbeans.modules.fish.payara.micro.project.Actions.COMMAND_MICRO_RELOAD;
+import org.netbeans.modules.maven.api.execute.RunUtils;
+import org.netbeans.modules.maven.spi.actions.ActionConvertor;
+import static org.netbeans.spi.project.ActionProvider.COMMAND_DEBUG;
+import static org.netbeans.spi.project.ActionProvider.COMMAND_PROFILE;
+import static org.netbeans.spi.project.ActionProvider.COMMAND_RUN;
+import org.openide.util.Lookup;
+
+/**
+ *
+ * @author lkishalmi
+ */
+public class MicroActionConvertor implements ActionConvertor {
+
+    private final Project project;
+
+    public MicroActionConvertor(Project project) {
+        this.project = project;
+    }
+    
+    @Override
+    public String convert(String action, Lookup lookup) {
+        MicroApplication microApplication = MicroApplication.getInstance(project);
+        String convertedAction = null;
+        if (microApplication != null) {
+            switch (action) {
+                case COMMAND_RUN:
+                case COMMAND_DEBUG:
+                case COMMAND_PROFILE:
+                case RUN_SINGLE_ACTION:
+                case DEBUG_SINGLE_ACTION:
+                case PROFILE_SINGLE_ACTION:
+                    convertedAction = "micro." + action; //NOI18N
+                    break;
+                case COMMAND_MICRO_RELOAD:

Review comment:
       This is a pseudo action string for the reload action, converted according to the CoS flag.

##########
File path: enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/Actions.java
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.fish.payara.micro.project;
+
+import java.awt.event.ActionEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.IOException;
+import javax.swing.Action;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.RELOAD_FILE;
+import static org.netbeans.modules.fish.payara.micro.plugin.Constants.RELOAD_ICON;
+import org.netbeans.spi.project.ui.support.ProjectSensitiveActions;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
+import org.openide.awt.ActionRegistration;
+import org.openide.util.Exceptions;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author lkishalmi
+ */
+public class Actions {
+
+    public static final String COMMAND_MICRO_RELOAD = "micro-reload"; //NOI18N
+
+    private Actions() {}
+    
+    @ActionID(
+            id = "org.netbeans.modules.payara.micro.action.reload",
+            category = "Build"
+    )
+    @ActionRegistration(
+            displayName = "#CTL_ReloadAppAction",
+            lazy = false
+    )
+    @ActionReferences({
+        @ActionReference(path = "Menu/BuildProject", position = 55),
+        @ActionReference(path = "Toolbars/Build", position = 325),
+        @ActionReference(path = "Projects/org-netbeans-modules-maven/Actions", position = 1020),
+        @ActionReference(path = "Shortcuts", name = "DS-A")
+    })
+    @NbBundle.Messages("CTL_ReloadAppAction=Reload")
+    public static Action reloadAction() {

Review comment:
       This makes the Reload action a real context sensitive project action.

##########
File path: enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/resources/action-mapping.xml
##########
@@ -21,7 +21,7 @@
 -->

Review comment:
       Made the action names specific to this plugin. Some actions are dash, some are dot separated, later on it will be standardized on dots, that's how most of the actions defined in the IDE.

##########
File path: enterprise/payara.micro/src/org/netbeans/modules/fish/payara/micro/project/MicroActionsProvider.java
##########
@@ -65,78 +36,40 @@
         service = MavenActionsProvider.class,
         projectType = MAVEN_WAR_PROJECT_TYPE
 )
-public class MicroActionsProvider implements MavenActionsProvider {
+public final class MicroActionsProvider extends AbstractMavenActionsProvider {
 
     @StaticResource
     private static final String ACTION_MAPPINGS = "org/netbeans/modules/fish/payara/micro/project/resources/action-mapping.xml";
-        
-    private final AbstractMavenActionsProvider actionsProvider = new AbstractMavenActionsProvider() {

Review comment:
       Not needed as we provide unique actions in our mapping file. The MicroActionConvertor would convert standard actions to micro actions when they are supported by the project.

##########
File path: java/maven/src/org/netbeans/modules/maven/spi/actions/ActionConvertor.java
##########
@@ -22,11 +22,23 @@
 import org.openide.util.Lookup;
 
 /**
+ * Register an {@code ActionConverter} in a Maven Project Lookup to convert

Review comment:
       Added missing JavaDoc.




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