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

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


The following commit(s) were added to refs/heads/delivery by this push:
     new 226367d465 Fix: Committing SQL files does not change blue color on the 
file tab in editor
     new 2f504a8249 Merge pull request #6265 from 
matthiasblaesing/sqleditor_versioning_state
226367d465 is described below

commit 226367d465122086d098b2112e713857310276b6
Author: Matthias Bläsing <[email protected]>
AuthorDate: Thu Jul 27 22:14:27 2023 +0200

    Fix: Committing SQL files does not change blue color on the file tab in 
editor
    
    The construction of the editor panel for SQL is a bit special to
    support both using it as SQL console and file editor and allow it to
    execute sql statements.
    
    In normal editors multiview elements are initialized by the
    infrastructure and #initializeCloneableEditor is called by it to
    connect the DataNode and the editor. This was missing for the SQLEditor.
    
    Closes: #6224
---
 .../org/netbeans/modules/db/sql/loader/SQLCloneableEditor.java    | 8 +++++---
 .../src/org/netbeans/modules/db/sql/loader/SQLEditorSupport.java  | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/ide/db.core/src/org/netbeans/modules/db/sql/loader/SQLCloneableEditor.java 
b/ide/db.core/src/org/netbeans/modules/db/sql/loader/SQLCloneableEditor.java
index e81e054952..f352e78d63 100644
--- a/ide/db.core/src/org/netbeans/modules/db/sql/loader/SQLCloneableEditor.java
+++ b/ide/db.core/src/org/netbeans/modules/db/sql/loader/SQLCloneableEditor.java
@@ -106,16 +106,18 @@ public final class SQLCloneableEditor extends 
CloneableEditor implements MultiVi
     private MultiViewElementCallback callback;
 
     public SQLCloneableEditor() {
+        // Constructor used for deserialization/persistence
         super(null);
         putClientProperty("oldInitialize", Boolean.TRUE); // NOI18N
     }
 
     public SQLCloneableEditor(Lookup context) {
+        // Normally used constructor
         super(context.lookup(SQLEditorSupport.class));
-        SQLEditorSupport support = context.lookup(SQLEditorSupport.class);
-        setActivatedNodes(new Node[] 
{support.getDataObject().getNodeDelegate()});
         putClientProperty("oldInitialize", Boolean.TRUE); // NOI18N
-        initialize();
+        SQLEditorSupport support = context.lookup(SQLEditorSupport.class);
+        setActivatedNodes(new 
Node[]{support.getDataObject().getNodeDelegate()});
+        support.initializeCloneableEditor(this);
     }
 
     void setResults(List<Component> results) {
diff --git 
a/ide/db.core/src/org/netbeans/modules/db/sql/loader/SQLEditorSupport.java 
b/ide/db.core/src/org/netbeans/modules/db/sql/loader/SQLEditorSupport.java
index 3d75da0a1e..046d80b37e 100644
--- a/ide/db.core/src/org/netbeans/modules/db/sql/loader/SQLEditorSupport.java
+++ b/ide/db.core/src/org/netbeans/modules/db/sql/loader/SQLEditorSupport.java
@@ -144,6 +144,8 @@ public class SQLEditorSupport extends DataEditorSupport
 
     @Override
     protected void initializeCloneableEditor(CloneableEditor editor) {
+        // Invoked when SQLCloneableEditor is deserialized and from the 
+        // SQLCloneableEditor(Lookup) constructor.
         super.initializeCloneableEditor(editor);
         ((SQLCloneableEditor) editor).initialize();
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to