Lines 15-20
Link Here
|
15 |
* {Name} (company) - description of contribution. |
15 |
* {Name} (company) - description of contribution. |
16 |
* Xuan Chen (IBM) - [189041] incorrect file name after rename a file inside a zip file - DStore Windows |
16 |
* Xuan Chen (IBM) - [189041] incorrect file name after rename a file inside a zip file - DStore Windows |
17 |
* Xuan Chen (IBM) - [187548] Editor shows incorrect file name after renaming file on Linux dstore |
17 |
* Xuan Chen (IBM) - [187548] Editor shows incorrect file name after renaming file on Linux dstore |
|
|
18 |
* Kevin Doyle (IBM) - [191548] Various NPE fixes |
18 |
*******************************************************************************/ |
19 |
*******************************************************************************/ |
19 |
|
20 |
|
20 |
package org.eclipse.rse.internal.services.dstore.files; |
21 |
package org.eclipse.rse.internal.services.dstore.files; |
Lines 90-96
Link Here
|
90 |
{ |
91 |
{ |
91 |
// filter doesn't separate path from name |
92 |
// filter doesn't separate path from name |
92 |
String path = _element.getName(); |
93 |
String path = _element.getName(); |
93 |
return getNameFromPath(path); |
94 |
// if path is null then the file has been deleted |
|
|
95 |
if (path != null) { |
96 |
return getNameFromPath(path); |
97 |
} else |
98 |
{ |
99 |
return path; |
100 |
} |
94 |
} |
101 |
} |
95 |
else if (isRoot()) |
102 |
else if (isRoot()) |
96 |
{ |
103 |
{ |
Lines 99-121
Link Here
|
99 |
else |
106 |
else |
100 |
{ |
107 |
{ |
101 |
String name = _element.getName(); |
108 |
String name = _element.getName(); |
102 |
String parentPath = getParentPath(); |
109 |
// if name is null then the file has been deleted |
103 |
if (name.length() == 0 && |
110 |
if (name != null) |
104 |
(parentPath.equals("/") || parentPath.endsWith(":\\"))) //$NON-NLS-1$ //$NON-NLS-2$ |
|
|
105 |
{ |
106 |
|
107 |
return parentPath; |
108 |
} |
109 |
if (name.length() == 0) |
110 |
{ |
111 |
{ |
111 |
String path = _element.getValue(); |
112 |
String parentPath = getParentPath(); |
112 |
int lastSep = path.lastIndexOf('/'); |
113 |
if (name.length() == 0 && |
113 |
if (lastSep == -1) |
114 |
(parentPath.equals("/") || parentPath.endsWith(":\\"))) //$NON-NLS-1$ //$NON-NLS-2$ |
114 |
lastSep = path.lastIndexOf('\\'); |
115 |
{ |
115 |
name = path.substring(lastSep + 1); |
116 |
|
116 |
return name; |
117 |
return parentPath; |
|
|
118 |
} |
119 |
if (name.length() == 0) |
120 |
{ |
121 |
String path = _element.getValue(); |
122 |
int lastSep = path.lastIndexOf('/'); |
123 |
if (lastSep == -1) |
124 |
lastSep = path.lastIndexOf('\\'); |
125 |
name = path.substring(lastSep + 1); |
126 |
return name; |
127 |
} |
117 |
} |
128 |
} |
118 |
|
|
|
119 |
return name; |
129 |
return name; |
120 |
} |
130 |
} |
121 |
} |
131 |
} |
Lines 127-137
Link Here
|
127 |
{ |
137 |
{ |
128 |
// filter doesn't separate path from name |
138 |
// filter doesn't separate path from name |
129 |
String path = _element.getName(); |
139 |
String path = _element.getName(); |
130 |
return getParentPathFromPath(path); |
140 |
// path is null if the file has been deleted. |
|
|
141 |
if (path != null) { |
142 |
return getParentPathFromPath(path); |
143 |
} else { |
144 |
return path; |
145 |
} |
131 |
} |
146 |
} |
132 |
else |
147 |
else |
133 |
{ |
148 |
{ |
134 |
if (_element.getName().length() == 0) |
149 |
// Name can be null if file has been deleted |
|
|
150 |
if (_element.getName() != null && _element.getName().length() == 0) |
135 |
{ |
151 |
{ |
136 |
// derive from value |
152 |
// derive from value |
137 |
String fullPath = _element.getValue(); |
153 |
String fullPath = _element.getValue(); |
Lines 192-201
Link Here
|
192 |
{ |
208 |
{ |
193 |
String parentPath = _element.getValue(); |
209 |
String parentPath = _element.getValue(); |
194 |
String name = _element.getName(); |
210 |
String name = _element.getName(); |
195 |
if (parentPath == null || |
211 |
// If name is null then file has been deleted |
|
|
212 |
if (name != null && (parentPath == null || |
196 |
parentPath.length() == 0 || |
213 |
parentPath.length() == 0 || |
197 |
(name.length() == 0 && (parentPath.equals("/") || parentPath.endsWith(":\\")) || //$NON-NLS-1$ //$NON-NLS-2$ |
214 |
(name.length() == 0 && (parentPath.equals("/") || parentPath.endsWith(":\\")) || //$NON-NLS-1$ //$NON-NLS-2$ |
198 |
(name.equals(parentPath) && parentPath.endsWith(":\\"))) //$NON-NLS-1$ |
215 |
(name.equals(parentPath) && parentPath.endsWith(":\\")))) //$NON-NLS-1$ |
199 |
) |
216 |
) |
200 |
|
217 |
|
201 |
{ |
218 |
{ |
Lines 210-218
Link Here
|
210 |
public boolean isFile() |
227 |
public boolean isFile() |
211 |
{ |
228 |
{ |
212 |
String type = _element.getType(); |
229 |
String type = _element.getType(); |
213 |
if (type != null && type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR) |
230 |
if (type != null && (type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR) |
214 |
|| type.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) |
231 |
|| type.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) |
215 |
|| type.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR)) |
232 |
|| type.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR))) |
216 |
{ |
233 |
{ |
217 |
return true; |
234 |
return true; |
218 |
} |
235 |
} |