You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by lk...@apache.org on 2021/01/11 16:29:55 UTC

[netbeans] branch release120 updated: [NETBEANS-3409] Missing popup menu for sql editor tabs

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

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


The following commit(s) were added to refs/heads/release120 by this push:
     new 2601979  [NETBEANS-3409] Missing popup menu for sql editor tabs
2601979 is described below

commit 2601979e6a3e404aec448b5406442bd3c85f6d9d
Author: Matthias Bläsing <mb...@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.
---
 platform/openide.filesystems.compat8/manifest.mf             |  2 +-
 .../src/org/openide/filesystems/FileSystemCompat.java        | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/platform/openide.filesystems.compat8/manifest.mf b/platform/openide.filesystems.compat8/manifest.mf
index 067125e..947d570 100644
--- a/platform/openide.filesystems.compat8/manifest.mf
+++ b/platform/openide.filesystems.compat8/manifest.mf
@@ -1,6 +1,6 @@
 Manifest-Version: 1.0
 OpenIDE-Module: org.openide.filesystems.compat8
 OpenIDE-Module-Localizing-Bundle: org/openide/filesystems/compat8/Bundle.properties
-OpenIDE-Module-Specification-Version: 9.17
+OpenIDE-Module-Specification-Version: 9.17.1
 OpenIDE-Module-Fragment-Host: org.openide.filesystems
 
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-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

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