Lines 47-52
Link Here
|
47 |
import java.io.IOException; |
47 |
import java.io.IOException; |
48 |
import java.io.StringWriter; |
48 |
import java.io.StringWriter; |
49 |
import java.io.Writer; |
49 |
import java.io.Writer; |
|
|
50 |
import java.net.MalformedURLException; |
51 |
import java.net.URI; |
52 |
import java.net.URISyntaxException; |
53 |
import java.net.URL; |
50 |
import java.util.ArrayList; |
54 |
import java.util.ArrayList; |
51 |
import java.util.List; |
55 |
import java.util.List; |
52 |
import java.util.concurrent.Callable; |
56 |
import java.util.concurrent.Callable; |
Lines 61-67
Link Here
|
61 |
import org.netbeans.modules.remote.support.RemoteLogger; |
65 |
import org.netbeans.modules.remote.support.RemoteLogger; |
62 |
import org.openide.filesystems.FileLock; |
66 |
import org.openide.filesystems.FileLock; |
63 |
import org.openide.filesystems.FileObject; |
67 |
import org.openide.filesystems.FileObject; |
|
|
68 |
import org.openide.filesystems.FileStateInvalidException; |
64 |
import org.openide.filesystems.FileUtil; |
69 |
import org.openide.filesystems.FileUtil; |
|
|
70 |
import org.openide.util.Exceptions; |
65 |
import org.openide.util.RequestProcessor; |
71 |
import org.openide.util.RequestProcessor; |
66 |
import org.openide.util.Utilities; |
72 |
import org.openide.util.Utilities; |
67 |
|
73 |
|
Lines 245-250
Link Here
|
245 |
} |
251 |
} |
246 |
|
252 |
|
247 |
@Override |
253 |
@Override |
|
|
254 |
public boolean delete() { |
255 |
if (fo == null) { |
256 |
fo = FileSystemProvider.getFileObject(env, path); |
257 |
} |
258 |
if (fo != null) { |
259 |
try { |
260 |
fo.delete(); |
261 |
return true; |
262 |
} catch (IOException ex) { |
263 |
return false; |
264 |
} |
265 |
} |
266 |
return false; |
267 |
} |
268 |
|
269 |
@Override |
270 |
public URL toURL() throws MalformedURLException { |
271 |
URL url = getURL(env, path, isDirectory()); |
272 |
return url; |
273 |
} |
274 |
|
275 |
private static URL getURL(ExecutionEnvironment env, String path, boolean folder) throws MalformedURLException { |
276 |
String host = env.getUser() + '@' + env.getHost(); |
277 |
URL url = new URL("file", host, env.getSSHPort(), path); |
278 |
String ext = url.toExternalForm() + (folder ? "/" : ""); // is there a way to set authority? // NOI18N |
279 |
return new URL(ext); |
280 |
} |
281 |
|
282 |
|
283 |
@Override |
284 |
public URI toURI() { |
285 |
try { |
286 |
return toURL().toURI(); |
287 |
} catch (URISyntaxException ex) { |
288 |
throw new Error(ex); // should never happen |
289 |
} catch (MalformedURLException ex) { |
290 |
throw new Error(ex); // should never happen |
291 |
} |
292 |
} |
293 |
|
294 |
@Override |
248 |
public String getName() { |
295 |
public String getName() { |
249 |
return (fo == null) ? PathUtilities.getBaseName(path): fo.getNameExt(); |
296 |
return (fo == null) ? PathUtilities.getBaseName(path): fo.getNameExt(); |
250 |
} |
297 |
} |