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


##########
plugin/src/test/java/org/apache/grails/intellij/plugin/actions/CustomFoldersActionTest.java:
##########
@@ -0,0 +1,236 @@
+/*
+ * 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.openapi.actionSystem.ActionManager;
+import com.intellij.openapi.actionSystem.ActionPlaces;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.actionSystem.DataKey;
+import com.intellij.openapi.actionSystem.Presentation;
+import com.intellij.openapi.vfs.VfsUtilCore;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiDirectory;
+import com.intellij.psi.PsiManager;
+import org.apache.grails.intellij.lib.testFramework.GrailsTestCase;
+import 
org.apache.grails.intellij.plugin.config.GrailsCustomFoldersProjectService;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+public class CustomFoldersActionTest extends GrailsTestCase {
+
+  public void testAddPathAppendsToProjectFolders() {

Review Comment:
   Correct, and that is why it could not. Both sides computed `expected` with 
the same broken formula.
   
   `testPathIsRelativeToTheApplicationRootNotTheProjectDir` now asserts the 
exact stored value and then
   that the provider resolves it, in your `app/` shape: `docs` expands, and the 
project-relative spelling
   `app/docs` yields a placeholder with `LeafState.ALWAYS` and no children. 
`SubdirectoryApplication`
   roots the application one level below the project, which is the case that 
used to render an empty
   placeholder.



##########
plugin/src/main/java/org/apache/grails/intellij/plugin/config/GrailsCustomFoldersConfigurable.java:
##########
@@ -0,0 +1,240 @@
+/*
+ * 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.config;
+
+import com.intellij.icons.AllIcons;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.project.Project;
+import com.intellij.ui.DocumentAdapter;
+import com.intellij.ui.components.JBLabel;
+import com.intellij.ui.components.JBScrollPane;
+import com.intellij.ui.components.JBTextArea;
+import com.intellij.util.ui.FormBuilder;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.apache.grails.intellij.plugin.projectView.GrailsProjectViewPanes;
+
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.event.DocumentEvent;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * The single custom-folders settings page. It edits the global defaults 
(application service) and
+ * this project's own folders (project service) together and previews the 
folders the Grails view
+ * will actually show. The global defaults apply to every Grails project; this 
project's folders
+ * are added to them.
+ */
+public class GrailsCustomFoldersConfigurable implements Configurable {
+
+  private final @NotNull GrailsCustomFoldersAppService appService;
+  private final @NotNull GrailsCustomFoldersProjectService projectService;
+  private final @NotNull Project project;
+
+  private @Nullable JPanel component;
+  private @Nullable JBTextArea globalArea;
+  private @Nullable JBTextArea overrideArea;
+  private @Nullable JBTextArea effectiveArea;
+  private @Nullable JBLabel sourceLabel;
+  private @Nullable JBLabel warningLabel;
+
+  public GrailsCustomFoldersConfigurable(@NotNull Project project) {
+    this.project = project;
+    this.appService = 
ApplicationManager.getApplication().getService(GrailsCustomFoldersAppService.class);
+    this.projectService = 
project.getService(GrailsCustomFoldersProjectService.class);
+  }
+
+  @Override
+  public @NotNull String getDisplayName() {
+    return "Custom Folders Configuration";
+  }
+
+  @Override
+  public @NotNull JComponent createComponent() {
+    if (component == null) {
+      globalArea = foldersArea(true);
+      overrideArea = foldersArea(true);
+      effectiveArea = foldersArea(false);
+
+      DocumentAdapter refreshPreview = new DocumentAdapter() {
+        @Override
+        protected void textChanged(@NotNull DocumentEvent e) {
+          updateEffectivePreview();
+        }
+      };
+      globalArea.getDocument().addDocumentListener(refreshPreview);
+      overrideArea.getDocument().addDocumentListener(refreshPreview);
+
+      sourceLabel = new JBLabel();
+      warningLabel = new JBLabel();
+      warningLabel.setIcon(AllIcons.General.Warning);
+
+      JBLabel description = new JBLabel(
+        "<html>Relative paths are resolved against the project root; absolute 
paths are used as-is.<br>"

Review Comment:
   Both halves fixed, and the three now say the same thing.
   
   The description states that a path is resolved against the Grails 
application root and must be
   relative to it and stay inside it. The "absolute paths are used as-is" 
clause is gone, and the page no
   longer claims it anywhere. All the page's text — labels, source indicator, 
over-cap warning,
   validation reasons, the row-numbered error, tooltips, display name — comes 
from `GrailsBundle`.



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