jhorvath commented on code in PR #7649:
URL: https://github.com/apache/netbeans/pull/7649#discussion_r1711004465
##########
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerTagNode.java:
##########
@@ -50,6 +53,24 @@ public static NodeProvider<ContainerTagItem> createNode() {
return ContainerTagNode::new;
}
+ @Override
+ public boolean canDestroy() {
+ return true;
+ }
+
+ @Override
+ public void destroy() throws IOException {
+ ArtifactsClient client =
OCIManager.getDefault().getActiveSession().newClient(ArtifactsClient.class);
Review Comment:
Lengthy operation cannot be executed inside destroy(). You have use
RequestProcessor here
##########
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/actions/DeleteNodeAction.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * 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.cloud.oracle.actions;
+
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.util.Collection;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
+import org.openide.awt.ActionRegistration;
+import org.openide.nodes.Node;
+import org.openide.util.ContextAwareAction;
+import org.openide.util.Exceptions;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+
+/**
+ *
+ * @author Dusan Petrovic
+ */
+@ActionID(
+ category = "Tools",
+ id = "org.netbeans.modules.cloud.oracle.actions.DeleteNodeAction"
+)
+@ActionRegistration(
+ displayName = "#DeleteNodeAction",
+ asynchronous = true,
+ lazy = true
+)
+
+@ActionReferences(value = {
+ @ActionReference(path = "Cloud/Oracle/ContainerTag/Actions", position =
250),
+ @ActionReference(path = "Cloud/Oracle/Vault/Secret/Actions", position =
250)
+})
[email protected]({
+ "DeleteNodeAction=Delete item",
+ "MSG_ConfirmDeleteAction=Are you sure that you want to delete {0}",
+ "MSG_DeleteActionFailed=Failed to delete {0}.",
+ "MSG_DeleteActionSuccess=Successfully deleted {0}."
Review Comment:
This message is not accurate for scheduled deletions. You should display a
different message specifically for scheduled deletions and consider making it
more general, as other special cases might arise in the future.
##########
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/developer/ContainerTagNode.java:
##########
@@ -49,6 +69,43 @@ public ContainerTagNode(ContainerTagItem tag) {
public static NodeProvider<ContainerTagItem> createNode() {
return ContainerTagNode::new;
}
+
+ @Override
+ public Action[] getActions(boolean context) {
+ Action[] actions = super.getActions(context);
+ List<Action> actionList = new ArrayList<>(Arrays.asList(actions));
+ actionList.add(SystemAction.get(DeleteAction.class));
+ return actionList.toArray(Action[]::new);
+ }
+
+ @Override
+ public boolean canDestroy() {
+ return true;
+ }
+
+ @Override
+ public void destroy() throws IOException {
+ RequestProcessor.getDefault().post(() -> {
Review Comment:
Please don't use default RP. Create a dedicated one for this class with
throughput 1 like this:
RequestProcessor RP = new RequestProcessor(ContainerTagNode.class);
--
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