Lines 10-15
Link Here
|
10 |
* |
10 |
* |
11 |
* Contributors: |
11 |
* Contributors: |
12 |
* {Name} (company) - description of contribution. |
12 |
* {Name} (company) - description of contribution. |
|
|
13 |
* Kevin Doyle (IBM) - [191548] Deleting Read-Only directory removes it from view and displays no error |
13 |
********************************************************************************/ |
14 |
********************************************************************************/ |
14 |
package org.eclipse.rse.internal.dstore.universal.miners.filesystem; |
15 |
package org.eclipse.rse.internal.dstore.universal.miners.filesystem; |
15 |
|
16 |
|
Lines 114-120
Link Here
|
114 |
virtualPath = avp.getVirtualPart(); |
115 |
virtualPath = avp.getVirtualPart(); |
115 |
fileobj = new File(rootPath); |
116 |
fileobj = new File(rootPath); |
116 |
|
117 |
|
117 |
if (fileobj.exists()) { |
118 |
if (fileobj.exists() && mgr.getVirtualObject(path).exists()) { |
118 |
|
119 |
|
119 |
if (_foldersOnly) { |
120 |
if (_foldersOnly) { |
120 |
children = mgr.getFolderContents(fileobj, |
121 |
children = mgr.getFolderContents(fileobj, |
Lines 132-137
Link Here
|
132 |
if (isCancelled()) |
133 |
if (isCancelled()) |
133 |
return; |
134 |
return; |
134 |
} else { |
135 |
} else { |
|
|
136 |
// Update the properties so the file's exists() will return false |
137 |
_subject.setAttribute(DE.A_TYPE, IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR); |
138 |
_subject.setAttribute(DE.A_SOURCE, setProperties(fileobj)); |
139 |
_status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED_WITH_DOES_NOT_EXIST); |
140 |
|
141 |
// Update all the children showing that they are deleted. |
142 |
if (_subject.getNestedSize() > 0) |
143 |
{ |
144 |
List nestedChildren = _subject.getNestedData(); |
145 |
for (int i = nestedChildren.size() - 1; i >= 0; i--) |
146 |
{ |
147 |
_dataStore.deleteObject(_subject, (DataElement) nestedChildren.get(i)); |
148 |
} |
149 |
} |
135 |
_dataStore.trace("problem with File:" + rootPath); //$NON-NLS-1$ |
150 |
_dataStore.trace("problem with File:" + rootPath); //$NON-NLS-1$ |
136 |
} |
151 |
} |
137 |
} |
152 |
} |
Lines 226-288
Link Here
|
226 |
// Check if the current Objects in the DataStore are valid... exist |
241 |
// Check if the current Objects in the DataStore are valid... exist |
227 |
// on the remote host |
242 |
// on the remote host |
228 |
try { |
243 |
try { |
229 |
boolean found = false; |
244 |
if (list != null) { |
230 |
for (int j = 0; j < list.length; ++j) { |
245 |
boolean found = false; |
231 |
if (isCancelled()) |
246 |
for (int j = 0; j < list.length; ++j) { |
232 |
return; |
247 |
if (isCancelled()) |
233 |
|
248 |
return; |
234 |
found = false; |
249 |
|
235 |
DataElement previousElement = (DataElement) filteredChildren |
250 |
found = false; |
236 |
.get(list[j].name); |
251 |
DataElement previousElement = (DataElement) filteredChildren |
237 |
if (previousElement != null && !previousElement.isDeleted()) { |
252 |
.get(list[j].name); |
238 |
// Type have to be equal as well |
253 |
if (previousElement != null && !previousElement.isDeleted()) { |
239 |
String type = previousElement.getType(); |
254 |
// Type have to be equal as well |
240 |
boolean isfile = !list[j].isDirectory; |
255 |
String type = previousElement.getType(); |
241 |
if (type |
256 |
boolean isfile = !list[j].isDirectory; |
242 |
.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) |
257 |
if (type |
243 |
|| (type |
258 |
.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) |
244 |
.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR) && !isfile)) { |
259 |
|| (type |
245 |
filteredChildren.remove(list[j].name); |
260 |
.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR) && !isfile)) { |
246 |
found = true; |
261 |
filteredChildren.remove(list[j].name); |
|
|
262 |
found = true; |
263 |
} |
247 |
} |
264 |
} |
248 |
} |
265 |
DataElement deObj = null; |
249 |
DataElement deObj = null; |
266 |
VirtualChild child = list[j]; |
250 |
VirtualChild child = list[j]; |
267 |
|
251 |
|
268 |
if (found) { |
252 |
if (found) { |
269 |
deObj = previousElement; |
253 |
deObj = previousElement; |
|
|
254 |
} |
255 |
if (deObj == null) { |
256 |
if (child.isDirectory) { |
257 |
deObj = _dataStore |
258 |
.createObject( |
259 |
subject, |
260 |
IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR, |
261 |
child.name); |
262 |
} else // file |
263 |
{ |
264 |
deObj = _dataStore |
265 |
.createObject( |
266 |
subject, |
267 |
IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR, |
268 |
child.name); |
269 |
} |
270 |
} |
270 |
|
271 |
if (deObj == null) { |
271 |
} |
272 |
if (child.isDirectory) { |
272 |
String oldValue = deObj.getAttribute(DE.A_VALUE); |
273 |
deObj = _dataStore |
273 |
String newValue = rootPath |
274 |
.createObject( |
274 |
+ ArchiveHandlerManager.VIRTUAL_SEPARATOR + virtualPath; |
275 |
subject, |
275 |
if (!oldValue.equals(newValue)) { |
276 |
IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR, |
276 |
deObj.setAttribute(DE.A_VALUE, newValue); |
277 |
child.name); |
277 |
} |
278 |
} else // file |
278 |
String oldSource = deObj.getAttribute(DE.A_SOURCE); |
279 |
{ |
279 |
String newSource = setProperties(child); |
280 |
deObj = _dataStore |
280 |
if (!oldSource.startsWith(newSource)) { |
281 |
.createObject( |
281 |
deObj.setAttribute(DE.A_SOURCE, newSource); |
282 |
subject, |
282 |
} |
283 |
IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR, |
283 |
|
284 |
child.name); |
284 |
} // end for j |
285 |
} |
285 |
|
286 |
|
|
|
287 |
} |
288 |
String oldValue = deObj.getAttribute(DE.A_VALUE); |
289 |
String newValue = rootPath |
290 |
+ ArchiveHandlerManager.VIRTUAL_SEPARATOR + virtualPath; |
291 |
if (!oldValue.equals(newValue)) { |
292 |
deObj.setAttribute(DE.A_VALUE, newValue); |
293 |
} |
294 |
String oldSource = deObj.getAttribute(DE.A_SOURCE); |
295 |
String newSource = setProperties(child); |
296 |
if (!oldSource.startsWith(newSource)) { |
297 |
deObj.setAttribute(DE.A_SOURCE, newSource); |
298 |
} |
299 |
|
300 |
} // end for j |
301 |
} |
286 |
// Object left over in the filteredChildren is no longer in the |
302 |
// Object left over in the filteredChildren is no longer in the |
287 |
// system any more. Need to remove. |
303 |
// system any more. Need to remove. |
288 |
Iterator myIterator = filteredChildren.keySet().iterator(); |
304 |
Iterator myIterator = filteredChildren.keySet().iterator(); |