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

(-)LocalFileSystemEx.java (-1 / +57 lines)
Lines 20-31 Link Here
20
package org.netbeans.core.startup.layers;
20
package org.netbeans.core.startup.layers;
21
21
22
import java.io.IOException;
22
import java.io.IOException;
23
import java.util.Enumeration;
23
import java.util.HashMap;
24
import java.util.HashMap;
24
import java.util.HashSet;
25
import java.util.HashSet;
25
import java.util.LinkedList;
26
import java.util.LinkedList;
26
import java.util.Map;
27
import java.util.Map;
27
import java.util.Set;
28
import java.util.Set;
28
import java.util.Iterator;
29
import java.util.Iterator;
30
import java.util.concurrent.Callable;
29
import java.util.logging.Level;
31
import java.util.logging.Level;
30
import java.util.logging.Logger;
32
import java.util.logging.Logger;
31
import org.openide.filesystems.*;
33
import org.openide.filesystems.*;
Lines 89-95 Link Here
89
91
90
    /** Creates new LocalFileSystemEx */
92
    /** Creates new LocalFileSystemEx */
91
    public LocalFileSystemEx () {
93
    public LocalFileSystemEx () {
92
        super ();
94
        this( false );
95
    }
96
    
97
    LocalFileSystemEx( boolean supportRemoveWritablesAttr ) {
98
        if( supportRemoveWritablesAttr ) {
99
            attr = new DelegatingAttributes( attr );
100
        }
93
    }
101
    }
94
102
95
    protected void lock (String name) throws IOException {
103
    protected void lock (String name) throws IOException {
Lines 125-129 Link Here
125
            }
133
            }
126
        }
134
        }
127
        super.unlock (name);
135
        super.unlock (name);
136
    }
137
    
138
    private class DelegatingAttributes implements AbstractFileSystem.Attr {
139
        
140
        private AbstractFileSystem.Attr a;
141
        
142
        public DelegatingAttributes( AbstractFileSystem.Attr a ) {
143
            this.a = a;
144
        }
145
146
        public Object readAttribute(String name, String attrName) {
147
            if( "removeWritables".equals( attrName ) ) {
148
                return new WritableRemover( name );
149
            }
150
            return a.readAttribute( name, attrName );
151
        }
152
153
        public void writeAttribute(String name, String attrName, Object value) throws IOException {
154
            a.writeAttribute( name, attrName, value );
155
        }
156
157
        public Enumeration<String> attributes(String name) {
158
            return a.attributes( name );
159
        }
160
161
        public void renameAttributes(String oldName, String newName) {
162
            a.readAttribute( oldName, newName );
163
        }
164
165
        public void deleteAttributes(String name) {
166
            a.deleteAttributes( name );
167
        }
168
    }
169
170
    private class WritableRemover implements Callable {
171
        private String name;
172
        public WritableRemover( String name ) {
173
            this.name = name;
174
        }
175
        
176
        public Object call() throws Exception {
177
            FileObject fo = findResource( name );
178
            if( null != fo ) {
179
                fo.delete();
180
            }
181
            return null;
182
        }
183
        
128
    }
184
    }
129
}
185
}
(-)SystemFileSystem.java (-1 / +2 lines)
Lines 248-254 Link Here
248
            if (!userDir.exists ()) {
248
            if (!userDir.exists ()) {
249
                userDir.mkdirs ();
249
                userDir.mkdirs ();
250
            }
250
            }
251
            LocalFileSystem l = new LocalFileSystemEx ();
251
            LocalFileSystem l = new LocalFileSystemEx ( true );
252
            l.setRootDirectory (userDir);
252
            l.setRootDirectory (userDir);
253
            user = l;
253
            user = l;
254
        } else {
254
        } else {
Lines 301-306 Link Here
301
        new NotSerializableException ("WARNING - SystemFileSystem is not designed to be serialized").printStackTrace (); // NOI18N
301
        new NotSerializableException ("WARNING - SystemFileSystem is not designed to be serialized").printStackTrace (); // NOI18N
302
        return new SingletonSerializer ();
302
        return new SingletonSerializer ();
303
    }
303
    }
304
    
304
    private static final class SingletonSerializer extends Object implements Serializable {
305
    private static final class SingletonSerializer extends Object implements Serializable {
305
        private static final long serialVersionUID = 6436781994611L;
306
        private static final long serialVersionUID = 6436781994611L;
306
        SingletonSerializer() {}
307
        SingletonSerializer() {}

Return to bug 79722