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

neilcsmith pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new f75d998  [NETBEANS-3409] Missing popup menu for sql editor tabs
     new 6f6b51a  Merge pull request #2306 from matthiasblaesing/netbeans-3409
f75d998 is described below

commit f75d99836af9a8ce2e51d3c547bad22e610557c8
Author: Matthias Bläsing <mblaes...@doppel-helix.eu>
AuthorDate: Mon Aug 10 22:08:28 2020 +0200

    [NETBEANS-3409] Missing popup menu for sql editor tabs
    
    The Filesystems API compatibility module provides implementations for
    Filesystem#getActions for several filesystems. Most filesystem
    implementations are covered by the implementation in
    AbstractFileSystemCompat, but this does not cover implementations
    directly inheriting from Filesystem.
    
    One such filesystem is BinaryFS.
    
    In the SQL Editor the command window function (temp files for SQL
    execution) is backed by a file in the SystemFileSystem, which delegates
    in the end to BinaryFS:
    
    SystemFileSystem->
      ModuleLayeredFileSystem ->
        BinaryFS
    
    As BinaryFS does not implement getActions and no patch is provided for
    this class, an AbstractMethodError is raised.
    
    Instead of bailing out with an Error, the compatibility implementation
    now returns an empty array to satisfy the Filesystem#getActions contract.
---
 .../src/org/openide/filesystems/FileSystemCompat.java        | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/platform/openide.filesystems.compat8/src/org/openide/filesystems/FileSystemCompat.java
 
b/platform/openide.filesystems.compat8/src/org/openide/filesystems/FileSystemCompat.java
index 0455f9c..460ea8c 100644
--- 
a/platform/openide.filesystems.compat8/src/org/openide/filesystems/FileSystemCompat.java
+++ 
b/platform/openide.filesystems.compat8/src/org/openide/filesystems/FileSystemCompat.java
@@ -43,6 +43,9 @@ import org.openide.util.actions.SystemAction;
  */
 @PatchFor(FileSystem.class)
 public abstract class FileSystemCompat {
+    /** system actions for this FS */
+    private static final SystemAction[] NO_SYSTEM_ACTIONS = new 
SystemAction[0];
+
     /** Property name giving capabilities state. @deprecated No more 
capabilities. */
     static final String PROP_CAPABILITIES = "capabilities"; // NOI18N    
 
@@ -67,7 +70,14 @@ public abstract class FileSystemCompat {
     *
     * @return array of available actions
     */
-    public abstract SystemAction[] getActions();
+    @SuppressWarnings("ReturnOfCollectionOrArrayField")
+    public SystemAction[] getActions() {
+        // If implementations don't override getActions, an empty array is
+        // returned to satisfy the FileSystem#getActions contract. As the
+        // empty array is immutable, it is save to return a singleton in this
+        // case
+        return NO_SYSTEM_ACTIONS;
+    }
 
     /**
      * Get actions appropriate to a certain file selection.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to