This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 252073
Collapse All | Expand All

(-)a/openide.loaders/src/org/openide/loaders/DataNode.java (-19 / +76 lines)
Lines 582-588 Link Here
582
                    DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message));
582
                    DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message));
583
                    return;
583
                    return;
584
                }
584
                }
585
                DataNodeUtils.reqProcessor().post(new Runnable() { // #232671
585
                DataNodeUtils.reqProcessor(obj.getPrimaryFile()).post(new Runnable() { // #232671
586
                    @Override
586
                    @Override
587
                    public void run() {
587
                    public void run() {
588
                        setNewExt(newExt);
588
                        setNewExt(newExt);
Lines 841-860 Link Here
841
        
841
        
842
        if ( refresh ) {
842
        if ( refresh ) {
843
            // refresh current nodes display name
843
            // refresh current nodes display name
844
            DataNodeUtils.reqProcessor().post(new Runnable() {
844
            Map<RequestProcessor, List<DataObject>> mapping
845
                @Override
845
                    = new HashMap<RequestProcessor, List<DataObject>>();
846
                public void run () { 
846
            Iterator it = DataObjectPool.getPOOL().getActiveDataObjects();
847
                    Iterator it = DataObjectPool.getPOOL().getActiveDataObjects();
847
848
                    while ( it.hasNext() ) {
848
            // Assign DataNodes to RequestProcessors. See bug 252073 comment 17.
849
                        DataObject obj = ((DataObjectPool.Item)it.next()).getDataObjectOrNull();
849
            while (it.hasNext()) {
850
                        if ( obj != null && obj.getNodeDelegate() instanceof DataNode ) {
850
                DataObject obj = ((DataObjectPool.Item) it.next()).getDataObjectOrNull();
851
                            ((DataNode)obj.getNodeDelegate()).updateDisplayName();            
851
                if (obj != null && obj.getNodeDelegate() instanceof DataNode) {
852
                    RequestProcessor rp = DataNodeUtils.reqProcessor(obj.getPrimaryFile());
853
                    List<DataObject> list = mapping.get(rp);
854
                    if (list == null) {
855
                        list = new ArrayList<DataObject>();
856
                        mapping.put(rp, list);
857
                    }
858
                    list.add(obj);
859
                }
860
            }
861
862
            for (Map.Entry<RequestProcessor, List<DataObject>> e : mapping.entrySet()) {
863
                final List<DataObject> list = e.getValue();
864
                e.getKey().post(new Runnable() {
865
                    @Override
866
                    public void run() {
867
                        for (DataObject obj: list) {
868
                            ((DataNode) obj.getNodeDelegate()).updateDisplayName();
852
                        }
869
                        }
853
                    }        
870
                    }
854
                }
871
                }, 300, Thread.MIN_PRIORITY);
855
            }, 300, Thread.MIN_PRIORITY);                    
872
            }
856
        }        
873
        }
857
        
858
    }
874
    }
859
875
860
    private static Class defaultLookup;
876
    private static Class defaultLookup;
Lines 1005-1018 Link Here
1005
                }
1021
                }
1006
                refreshNamesIconsRunning = false;
1022
                refreshNamesIconsRunning = false;
1007
            }
1023
            }
1008
            for (int i = 0; i < _refreshNameNodes.length; i++) {
1024
            // refresh name nodes
1009
                _refreshNameNodes[i].fireChangeAccess(false, true);
1025
            for (final Map.Entry<RequestProcessor, List<DataNode>> e
1026
                    : groupByRP(_refreshNameNodes).entrySet()) {
1027
                e.getKey().post(new Runnable() { // post list to assigned RP
1028
                    @Override
1029
                    public void run() {
1030
                        for (DataNode n: e.getValue()) {
1031
                            n.fireChangeAccess(false, true);
1032
                        }
1033
                    }
1034
                });
1010
            }
1035
            }
1011
            for (int i = 0; i < _refreshIconNodes.length; i++) {
1036
            // refresh icon nodes
1012
                _refreshIconNodes[i].fireChangeAccess(true, false);
1037
            for (final Map.Entry<RequestProcessor, List<DataNode>> e
1038
                    : groupByRP(_refreshIconNodes).entrySet()) {
1039
                e.getKey().post(new Runnable() { // post list to assigned RP
1040
                    @Override
1041
                    public void run() {
1042
                        for (DataNode n: e.getValue()) {
1043
                            n.fireChangeAccess(true, false);
1044
                        }
1045
                    }
1046
                });
1013
            }
1047
            }
1014
        }
1048
        }
1015
        
1049
1050
        /**
1051
         * Group array of nodes by assigned RequestProcessors.
1052
         *
1053
         * @param nodes
1054
         * @return Mapping from RequestProcessor to list of nodes assigned to
1055
         * it.
1056
         */
1057
        private Map<RequestProcessor, List<DataNode>> groupByRP(DataNode nodes[]) {
1058
            Map<RequestProcessor, List<DataNode>> mapping
1059
                    = new HashMap<RequestProcessor, List<DataNode>>();
1060
            for (DataNode node : nodes) {
1061
                DataObject dob = node.getDataObject();
1062
                FileObject fo = dob == null ? null : dob.getPrimaryFile();
1063
                RequestProcessor rp = DataNodeUtils.reqProcessor(fo);
1064
                List<DataNode> set = mapping.get(rp);
1065
                if (set == null) {
1066
                    set = new ArrayList<DataNode>();
1067
                    mapping.put(rp, set);
1068
                }
1069
                set.add(node);
1070
            }
1071
            return mapping;
1072
        }
1016
    }
1073
    }
1017
1074
1018
    /** Handle for data object nodes */
1075
    /** Handle for data object nodes */
(-)a/openide.loaders/src/org/openide/loaders/FolderChildren.java (-5 / +1 lines)
Lines 133-142 Link Here
133
        this.pairs = pairs;
133
        this.pairs = pairs;
134
    }
134
    }
135
135
136
    static void waitRefresh() {
137
        DataNodeUtils.reqProcessor().post(Task.EMPTY, 0, Thread.MIN_PRIORITY).waitFinished();
138
    }
139
140
    /** If the folder changed its children we change our nodes.
136
    /** If the folder changed its children we change our nodes.
141
     */
137
     */
142
    @Override
138
    @Override
Lines 585-591 Link Here
585
        }
581
        }
586
582
587
        final synchronized void scheduleRefresh(String by) {
583
        final synchronized void scheduleRefresh(String by) {
588
            task = DataNodeUtils.reqProcessor().post(this);
584
            task = DataNodeUtils.reqProcessor(pair.primaryFile).post(this);
589
            err.log(Level.FINE, "Task initialized by {0} to {1} for {2}", new Object[] { by, task, this });
585
            err.log(Level.FINE, "Task initialized by {0} to {1} for {2}", new Object[] { by, task, this });
590
        }
586
        }
591
    }
587
    }

Return to bug 252073