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 |
} |