amondel2 commented on code in PR #441:
URL: 
https://github.com/apache/grails-intellij-plugin/pull/441#discussion_r4290178884


##########
plugin/src/main/java/org/apache/grails/intellij/plugin/actions/RemoveCustomFolderAction.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
+ *
+ *   https://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.apache.grails.intellij.plugin.actions;
+
+import com.intellij.ide.projectView.ProjectView;
+import com.intellij.ide.projectView.impl.AbstractProjectViewPane;
+import com.intellij.openapi.actionSystem.ActionUpdateThread;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.project.DumbAwareAction;
+import com.intellij.openapi.project.Project;
+import com.intellij.util.ui.tree.TreeUtil;
+import org.apache.grails.intellij.plugin.config.FolderPaths;
+import 
org.apache.grails.intellij.plugin.config.GrailsCustomFoldersProjectService;
+import 
org.apache.grails.intellij.plugin.projectView.nodes.GrailsCustomFolderNode;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.tree.TreePath;
+import java.util.ArrayList;
+import java.util.List;
+
+public class RemoveCustomFolderAction extends DumbAwareAction {
+
+  @Override
+  public void update(@NotNull AnActionEvent e) {
+    Project project = e.getProject();
+    boolean visible = false;
+    if (project != null) {
+      AbstractProjectViewPane pane = 
ProjectView.getInstance(project).getCurrentProjectViewPane();

Review Comment:
   All three actions now take the selection from 
`PlatformCoreDataKeys.SELECTED_ITEMS`, and
   `getSelectedPath()` is gone from `actions/`. `getActionUpdateThread()` stays 
`BGT`.
   
   The duplication you pointed at is gone too: the three actions each carried 
their own copy of the two
   readers and had drifted — one took the read action the background `update()` 
needs and the other did
   not — so they share `CustomFolderSelection`, which is the only place the 
read action and the
   `SELECTED_ITEMS` snapshot are read.
   
   `testRemoveLogicRemovesConfiguredPathFromService` now drives the real 
action: it builds an
   `AnActionEvent` whose data context carries `SELECTED_ITEMS`, calls `update` 
and `actionPerformed`, and
   asserts on the service. It also covers the placeholder, which is removable 
and needs no `PsiDirectory`
   to build.



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

Reply via email to