Copilot commented on code in PR #3312:
URL: 
https://github.com/apache/incubator-kie-tools/pull/3312#discussion_r2446847774


##########
packages/workspaces-git-fs/src/services/WorkspaceService.tsx:
##########
@@ -113,7 +115,13 @@ export class WorkspaceService {
       baseAbsolutePath: this.getAbsolutePath({ workspaceId }),
       shouldExcludeAbsolutePath: (absolutePath) => 
absolutePath.startsWith(gitDirAbsolutePath),
       onVisit: async ({ relativePath }) => {
-        if (matcher && !matcher.match(basename(relativePath))) {
+        if (searchType !== undefined && searchType !== SearchType.ASSET_FOLDER 
&& searchType !== SearchType.TRAVERSAL) {
+          throw Error(
+            `Unhandled SearchType '${searchType}' detected. Such SearchType 
was not taken into account for 'getFilteredWorkspaceFileDescriptors' code`

Review Comment:
   The error message should use 'this code' or 'this implementation' instead of 
'getFilteredWorkspaceFileDescriptors' code' to improve clarity and readability.
   ```suggestion
               `Unhandled SearchType '${searchType}' detected. Such SearchType 
was not taken into account in this implementation.`
   ```



##########
packages/stunner-editors/kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-kogito-runtime/src/main/java/org/kie/workbench/common/stunner/kogito/client/services/WorkItemDefinitionStandaloneClientService.java:
##########
@@ -93,24 +94,34 @@ public WorkItemDefinitionRegistry getRegistry() {
 
     @Override
     public Promise<Collection<WorkItemDefinition>> call(final Metadata input) {
-        return loader;
+        return allWorkItemsLoader(input.getPath());
     }
 
     @PreDestroy
     public void destroy() {
         registry.clear();
-        loader = null;
     }
 
-    private Promise<Collection<WorkItemDefinition>> allWorkItemsLoader() {
+
+    private Promise<Collection<WorkItemDefinition>> allWorkItemsLoader(Path 
openedDiagramPath) {
+
+        final int lastSlashIndex = openedDiagramPath != null ? 
openedDiagramPath.toURI().lastIndexOf('/') : -1;
+        final String directoryPath = (lastSlashIndex != -1) 
+            ? openedDiagramPath.toURI().substring(0, lastSlashIndex + 1) 
+            : ""; 

Review Comment:
   [nitpick] The directoryPath variable should have consistent indentation. The 
continuation lines should align with standard Java indentation (4 spaces) 
rather than being indented to align with the opening parenthesis.
   ```suggestion
                   ? openedDiagramPath.toURI().substring(0, lastSlashIndex + 1) 
                   : ""; 
   ```



##########
packages/stunner-editors/kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-kogito-runtime/src/main/java/org/kie/workbench/common/stunner/kogito/client/services/WorkItemDefinitionStandaloneClientService.java:
##########
@@ -93,24 +94,34 @@ public WorkItemDefinitionRegistry getRegistry() {
 
     @Override
     public Promise<Collection<WorkItemDefinition>> call(final Metadata input) {
-        return loader;
+        return allWorkItemsLoader(input.getPath());
     }
 
     @PreDestroy
     public void destroy() {
         registry.clear();
-        loader = null;
     }
 
-    private Promise<Collection<WorkItemDefinition>> allWorkItemsLoader() {
+
+    private Promise<Collection<WorkItemDefinition>> allWorkItemsLoader(Path 
openedDiagramPath) {
+
+        final int lastSlashIndex = openedDiagramPath != null ? 
openedDiagramPath.toURI().lastIndexOf('/') : -1;
+        final String directoryPath = (lastSlashIndex != -1) 
+            ? openedDiagramPath.toURI().substring(0, lastSlashIndex + 1) 
+            : ""; 
+
+        final String widPattern = (openedDiagramPath == null || 
isEmpty(directoryPath)) ?  RESOURCE_ALL_WID_PATTERN : directoryPath + 
RESOURCE_ALL_WID_PATTERN;

Review Comment:
   [nitpick] This line exceeds typical line length limits and should be split 
across multiple lines for better readability. Consider breaking after the 
ternary operator '?' or assigning the concatenation to a separate variable.
   ```suggestion
           final String widPattern = (openedDiagramPath == null || 
isEmpty(directoryPath))
                   ? RESOURCE_ALL_WID_PATTERN
                   : directoryPath + RESOURCE_ALL_WID_PATTERN;
   ```



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

Reply via email to