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 251398
Collapse All | Expand All

(-)a/openide.loaders/src/org/openide/loaders/FolderOrder.java (-1 / +15 lines)
Lines 51-56 Link Here
51
import java.util.*;
51
import java.util.*;
52
52
53
import org.openide.filesystems.*;
53
import org.openide.filesystems.*;
54
import org.openide.filesystems.FileSystem.AtomicAction;
54
import org.openide.loaders.DataFolder.SortMode;
55
import org.openide.loaders.DataFolder.SortMode;
55
56
56
57
Lines 115-121 Link Here
115
    
116
    
116
    /** Changes the order of data objects.
117
    /** Changes the order of data objects.
117
     */
118
     */
118
    public synchronized void setOrder (DataObject[] arr) throws IOException {
119
    public void setOrder (final DataObject[] arr) throws IOException {
120
        // #251398: setOrder is internally synchronized(this) and fires FS events
121
        // while holding the lock over this FolderOrder, although the Order is
122
        // already updated. FSAA will defer event dispatch until after the FolderOrder
123
        // lock is released. Also helps Listeners to see the oder consistent, not
124
        // partially set as individual FObj attributes are changed.
125
        folder.getFileSystem().runAtomicAction(new AtomicAction() {
126
            public void run() throws IOException {
127
                doSetOrder(arr);
128
            }
129
        });
130
    }
131
        
132
    private synchronized void doSetOrder(DataObject[] arr) throws IOException {
119
        if (arr != null) {
133
        if (arr != null) {
120
            order = new HashMap<String, Integer> (arr.length * 4 / 3 + 1);
134
            order = new HashMap<String, Integer> (arr.length * 4 / 3 + 1);
121
135

Return to bug 251398