Difference between revisions of "PDT Dev2Dev - Copy Files the Eclipse way"

From Eclipsepedia

Jump to: navigation, search
 
Line 12: Line 12:
  
 
PS: Thank you very much.. quite handy.
 
PS: Thank you very much.. quite handy.
 +
 +
PPS: This worked with Helios SR2.
  
 
--[[User:Mstorer3772.gmail.com|Mstorer3772.gmail.com]] 19:27, 23 March 2011 (UTC)
 
--[[User:Mstorer3772.gmail.com|Mstorer3772.gmail.com]] 19:27, 23 March 2011 (UTC)

Latest revision as of 15:28, 23 March 2011

In case you want a convenient way to copy files the way Eclipse does, plus to have ability to copy directories, to track errors and have progress reported by monitor and several additional options, you are welcome:

new LocalFile(new File(source)).copy(new LocalFile(new File(destination)), EFS.NONE, monitor);

--Seva Lapsha 11:59, 6 November 2007 (EST)

Note that LocalFile has "discouraged access", and will result in a warning given the typical Java compiler settings within Eclipse. This can be avoided by adding an annotation to the function thusly:

@SuppressWarnings("restriction")

Alternatively, you can disable the restriction warning in Window->Preferences...->Java->Compiler->Errors/Warnings->Deprecated and restricted API

PS: Thank you very much.. quite handy.

PPS: This worked with Helios SR2.

--Mstorer3772.gmail.com 19:27, 23 March 2011 (UTC)