[hg] main-silver: #232559: use base model to signal events, not ...

  • From: Svata Dedic < >
  • To:
  • Subject: [hg] main-silver: #232559: use base model to signal events, not ...
  • Date: Fri, 12 Jul 2013 08:53:40 -0700

changeset 098a5a98b85c in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/098a5a98b85c
description:
        #232559: use base model to signal events, not filtered one

diffstat:

 csl.api/src/org/netbeans/modules/csl/hints/infrastructure/HintsPanel.java    
  |   5 +++-
 
csl.api/src/org/netbeans/modules/csl/hints/infrastructure/HintsPanelLogic.java
 |   6 +++-
 
options.editor/src/org/netbeans/modules/options/editor/spi/OptionsFilter.java 
 |  11 +++++++++-
 3 files changed, 18 insertions(+), 4 deletions(-)

diffs (104 lines):

diff --git 
a/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/HintsPanel.java 
b/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/HintsPanel.java
--- 
a/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/HintsPanel.java
+++ 
b/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/HintsPanel.java
@@ -55,6 +55,7 @@
 import javax.swing.UIManager;
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeCellRenderer;
+import javax.swing.tree.DefaultTreeModel;
 import javax.swing.tree.TreeCellRenderer;
 import javax.swing.tree.TreeNode;
 import javax.swing.tree.TreeSelectionModel;
@@ -72,6 +73,7 @@
     private HintsPanelLogic logic;
     private GsfHintsManager manager;
     private OptionsFilter filter;
+    private DefaultTreeModel baseModel;
       
     public HintsPanel(OptionsFilter filter, 
             javax.swing.tree.TreeModel treeModel, GsfHintsManager manager) { 
       
@@ -103,6 +105,7 @@
 
         //errorTree.setModel( RulesManager.getInstance().getHintsTreeModel() 
);
         errorTree.setModel(treeModel);
+        this.baseModel = (DefaultTreeModel)treeModel;
         
         if (filter != null) {
             filter.installFilteringModel(errorTree, treeModel, new 
AcceptorImpl());
@@ -288,7 +291,7 @@
             logic.disconnect();
         }
         logic = new HintsPanelLogic(manager);
-        logic.connect(errorTree, severityComboBox, toProblemCheckBox, 
customizerPanel, descriptionTextArea);
+        logic.connect(errorTree, baseModel, severityComboBox, 
toProblemCheckBox, customizerPanel, descriptionTextArea);
     }
     
     public void cancel() {
diff --git 
a/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/HintsPanelLogic.java
 
b/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/HintsPanelLogic.java
--- 
a/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/HintsPanelLogic.java
+++ 
b/csl.api/src/org/netbeans/modules/csl/hints/infrastructure/HintsPanelLogic.java
@@ -131,17 +131,19 @@
     private JPanel customizerPanel;
     private JEditorPane descriptionTextArea;
     private GsfHintsManager manager;
+    private DefaultTreeModel errModel;
     
     HintsPanelLogic(GsfHintsManager manager) {
         this.manager = manager;
         changes = new HashMap<UserConfigurableRule, ModifiedPreferences>();  
      
     }
     
-    void connect( JTree errorTree, JComboBox severityComboBox, 
+    void connect( JTree errorTree, DefaultTreeModel errModel, JComboBox 
severityComboBox, 
                   JCheckBox tasklistCheckBox, JPanel customizerPanel,
                   JEditorPane descriptionTextArea) {
         
         this.errorTree = errorTree;
+        this.errModel = errModel;
         this.severityComboBox = severityComboBox;
         this.tasklistCheckBox = tasklistCheckBox;
         this.customizerPanel = customizerPanel;
@@ -399,7 +401,7 @@
 
         Object o = getUserObject(treePath);
 
-        DefaultTreeModel model = (DefaultTreeModel) errorTree.getModel();
+        DefaultTreeModel model = errModel;
         DefaultMutableTreeNode node = (DefaultMutableTreeNode) 
treePath.getLastPathComponent();
 
 
diff --git 
a/options.editor/src/org/netbeans/modules/options/editor/spi/OptionsFilter.java
 
b/options.editor/src/org/netbeans/modules/options/editor/spi/OptionsFilter.java
--- 
a/options.editor/src/org/netbeans/modules/options/editor/spi/OptionsFilter.java
+++ 
b/options.editor/src/org/netbeans/modules/options/editor/spi/OptionsFilter.java
@@ -43,6 +43,7 @@
 package org.netbeans.modules.options.editor.spi;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -56,6 +57,7 @@
 import javax.swing.text.BadLocationException;
 import javax.swing.text.Document;
 import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreeNode;
 import javax.swing.tree.TreePath;
 import org.netbeans.spi.options.OptionsPanelController;
 
@@ -234,7 +236,14 @@
             List<Integer> childIndices = new LinkedList<Integer>();
             List<Object> children = new LinkedList<Object>();
 
-            for (Object c : e.getChildren()) {
+            Object[] ch = e.getChildren();
+            
+            // special case for root node: include all children
+            if (ch == null) {
+                List l = 
Collections.list(((TreeNode)e.getTreePath().getLastPathComponent()).children());
+                ch = l.toArray(new Object[l.size()]);
+            }
+            for (Object c : ch) {
                 int i = 
getIndexOfChild(e.getTreePath().getLastPathComponent(), 
e.getTreePath().getLastPathComponent());
 
                 if (i == (-1)) continue;

[hg] main-silver: #232559: use base model to signal events, not ...

Svata Dedic 07/12/2013

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 147 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close