This is an automated email from the ASF dual-hosted git repository.

mattcasters pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new 4d6fdc5e1c Fix for displaying plain text file types in dark mode under 
Windows #7670 (#7875)
4d6fdc5e1c is described below

commit 4d6fdc5e1c188bb381a0a792ea4039d03466fa15
Author: Nicolas Adment <[email protected]>
AuthorDate: Mon Aug 10 23:06:17 2026 +0200

    Fix for displaying plain text file types in dark mode under Windows #7670 
(#7875)
    
    - Add text.json grammar definition for plain text files
    - Register RawExplorerFileType in file type handlers to display editor icon
    - Override getLanguageId() in TextExplorerFileTypeHandler to return 
"plaintext"
    - Replace list.get(0) with list.getFirst() for better readability
    - Simplify instanceof pattern matching in ExplorerPerspective
---
 .../transforms/types/TextExplorerFileTypeHandler.java         |  5 +++++
 .../org/apache/hop/ui/hopgui/ContentEditorTm4eSupport.java    |  3 +++
 .../resources/org/apache/hop/ui/hopgui/grammars/text.json     |  5 +++++
 .../ui/hopgui/perspective/explorer/ExplorerPerspective.java   | 11 ++++++-----
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git 
a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/TextExplorerFileTypeHandler.java
 
b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/TextExplorerFileTypeHandler.java
index fad906fe3d..b2461d1031 100644
--- 
a/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/TextExplorerFileTypeHandler.java
+++ 
b/plugins/transforms/textfile/src/main/java/org/apache/hop/pipeline/transforms/types/TextExplorerFileTypeHandler.java
@@ -29,4 +29,9 @@ public class TextExplorerFileTypeHandler extends 
BaseTextExplorerFileTypeHandler
       HopGui hopGui, ExplorerPerspective perspective, ExplorerFile 
explorerFile) {
     super(hopGui, perspective, explorerFile);
   }
+
+  @Override
+  protected String getLanguageId() {
+    return "plaintext";
+  }
 }
diff --git 
a/rcp/src/main/java/org/apache/hop/ui/hopgui/ContentEditorTm4eSupport.java 
b/rcp/src/main/java/org/apache/hop/ui/hopgui/ContentEditorTm4eSupport.java
index fc2ec902f5..e00948b071 100644
--- a/rcp/src/main/java/org/apache/hop/ui/hopgui/ContentEditorTm4eSupport.java
+++ b/rcp/src/main/java/org/apache/hop/ui/hopgui/ContentEditorTm4eSupport.java
@@ -51,6 +51,7 @@ final class ContentEditorTm4eSupport {
   private static final boolean TRACE_SCOPES = 
Boolean.getBoolean("hop.contenteditor.trace.scopes");
 
   private static final String SCOPE_JSON = "source.json";
+  private static final String SCOPE_TEXT = "text.plain";
   private static final String SCOPE_XML = "text.xml";
   private static final String SCOPE_SQL = "source.sql";
   private static final String SCOPE_PYTHON = "source.python";
@@ -64,6 +65,7 @@ final class ContentEditorTm4eSupport {
           SCOPE_JSON, "json.json",
           SCOPE_XML, "xml.json",
           SCOPE_SQL, "sql.json",
+          SCOPE_TEXT, "text.json",
           SCOPE_PYTHON, "python.json",
           SCOPE_YAML, "yaml.json",
           SCOPE_SHELL, "shell.json",
@@ -120,6 +122,7 @@ final class ContentEditorTm4eSupport {
       case "yaml", "yml" -> SCOPE_YAML;
       case "shell", "bash", "sh" -> SCOPE_SHELL;
       case "bat", "cmd", "batch" -> SCOPE_BATCH;
+      case "plaintext" -> SCOPE_TEXT;
       default -> null;
     };
   }
diff --git a/rcp/src/main/resources/org/apache/hop/ui/hopgui/grammars/text.json 
b/rcp/src/main/resources/org/apache/hop/ui/hopgui/grammars/text.json
new file mode 100644
index 0000000000..03cc8403ac
--- /dev/null
+++ b/rcp/src/main/resources/org/apache/hop/ui/hopgui/grammars/text.json
@@ -0,0 +1,5 @@
+{
+       "name": "Plain Text Custom",
+       "scopeName": "text.plain",
+       "fileTypes": ["txt", "text"]
+}
\ No newline at end of file
diff --git 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java
 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java
index 5fbabddccd..5c99e2bcc1 100644
--- 
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java
+++ 
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/explorer/ExplorerPerspective.java
@@ -121,6 +121,7 @@ import 
org.apache.hop.ui.hopgui.perspective.explorer.file.ExplorerFileType;
 import 
org.apache.hop.ui.hopgui.perspective.explorer.file.IExplorerFileTypeHandler;
 import org.apache.hop.ui.hopgui.perspective.explorer.file.types.FolderFileType;
 import 
org.apache.hop.ui.hopgui.perspective.explorer.file.types.GenericFileType;
+import 
org.apache.hop.ui.hopgui.perspective.explorer.file.types.raw.RawExplorerFileType;
 import org.apache.hop.ui.hopgui.perspective.metadata.MetadataPerspective;
 import org.apache.hop.ui.hopgui.search.HopGuiPipelineSearchable;
 import org.apache.hop.ui.hopgui.search.HopGuiWorkflowSearchable;
@@ -471,8 +472,7 @@ public class ExplorerPerspective implements 
IHopPerspective, TabClosable, IFileD
               Control c = focusControl;
               while (c != null) {
                 Object data = c.getData(KEY_TAB_FOLDER);
-                if (data instanceof CTabFolder && isEditorTabFolder((Control) 
data)) {
-                  CTabFolder folder = (CTabFolder) data;
+                if (data instanceof CTabFolder folder && 
isEditorTabFolder((Control) data)) {
                   for (CTabItem item : folder.getItems()) {
                     if (item.getControl() == c) {
                       if (activeTabFolder != folder || folder.getSelection() 
!= item) {
@@ -508,6 +508,7 @@ public class ExplorerPerspective implements 
IHopPerspective, TabClosable, IFileD
       }
     }
     // Keep as last in the list...
+    fileTypes.add(new RawExplorerFileType());
     fileTypes.add(new GenericFileType());
     indexFileTypes();
   }
@@ -4869,7 +4870,7 @@ public class ExplorerPerspective implements 
IHopPerspective, TabClosable, IFileD
       return;
     }
     List<CTabFolder> docked = getDockedTabFolders();
-    CTabFolder target = docked.isEmpty() ? null : docked.get(0);
+    CTabFolder target = docked.isEmpty() ? null : docked.getFirst();
     if (target != null) {
       for (CTabItem item : detached.getItems()) {
         moveTabToFolder(item, target);
@@ -4889,7 +4890,7 @@ public class ExplorerPerspective implements 
IHopPerspective, TabClosable, IFileD
     detachedFolders.remove(folder);
     if (activeTabFolder == folder) {
       List<CTabFolder> docked = getDockedTabFolders();
-      activeTabFolder = docked.isEmpty() ? null : docked.get(0);
+      activeTabFolder = docked.isEmpty() ? null : docked.getFirst();
     }
     Shell shell = folder.getShell();
     if (shell != null && !shell.isDisposed()) {
@@ -5037,7 +5038,7 @@ public class ExplorerPerspective implements 
IHopPerspective, TabClosable, IFileD
     root.setLayoutData(new FormDataBuilder().fullSize().result());
     editorRoot = root;
     List<CTabFolder> leaves = getDockedTabFolders();
-    activeTabFolder = leaves.isEmpty() ? null : leaves.get(0);
+    activeTabFolder = leaves.isEmpty() ? null : leaves.getFirst();
     tabFolderWrapper.layout(true, true);
   }
 

Reply via email to