Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Copy files from Plugin Subdirectory to Project Directory
Copy files from Plugin Subdirectory to Project Directory [message #289277] Wed, 03 August 2005 07:56 Go to next message
Eclipse UserFriend
Originally posted by: xewoox.yahoo.com

I am trying to copy files from a sub-directory within my Plugin directory
into a folder of a project that is created by my Plugin. Can anyone give
me some idea how this should be done? Thanks.

Eugene
Re: Copy files from Plugin Subdirectory to Project Directory [message #289332 is a reply to message #289277] Wed, 03 August 2005 19:15 Go to previous messageGo to next message
Andreas Herz is currently offline Andreas HerzFriend
Messages: 196
Registered: July 2009
Senior Member
Eugene Woo wrote:
> I am trying to copy files from a sub-directory within my Plugin
> directory into a folder of a project that is created by my Plugin. Can
> anyone give me some idea how this should be done? Thanks.
>
> Eugene
>

Hi here some snippets....



import org.apache.commons.io.IOUtils;


IJavaProject myJavaProject = JavaCore.create(JacobDesigner.getPlugin().getSelectedProject ());
IPackageFragmentRoot[] roots = myJavaProject.getAllPackageFragmentRoots();
IPath path = roots[0].getPath();
IProject project = myJavaProject.getProject();
IFolder srcFolder = project.getFolder(path.lastSegment());

String template = IOUtils.toString(JacobDesigner.getPlugin().find(new
Path("templates/AppLogger.java")).openStream());

IFile newFile = srcFolder.getFile("jacob/common/AppLogger.java");
newFile.create(new StringBufferInputStream(template), false, null);


greetings

Andreas
Re: Copy files from Plugin Subdirectory to Project Directory [message #289644 is a reply to message #289332] Tue, 09 August 2005 14:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

>
> String template = IOUtils.toString(JacobDesigner.getPlugin().find(new
> Path("templates/AppLogger.java")).openStream());
>

This is good, but unless IOUtils.toString() closes the stream, you
should get the stream into an InputStream variable, and then close it
when finished.
--
Thanks,
Rich Kulp
Re: Copy files from Plugin Subdirectory to Project Directory [message #290412 is a reply to message #289644] Thu, 25 August 2005 09:19 Go to previous message
Andreas Herz is currently offline Andreas HerzFriend
Messages: 196
Registered: July 2009
Senior Member
Rich Kulp wrote:
>>
>> String template = IOUtils.toString(JacobDesigner.getPlugin().find(new
>> Path("templates/AppLogger.java")).openStream());
>>
>
> This is good, but unless IOUtils.toString() closes the stream, you
> should get the stream into an InputStream variable, and then close it
> when finished.


uih - thanks!!


Andreas
Previous Topic:popup menu icon missing after export
Next Topic:Local Toolbar for Editor
Goto Forum:
  


Current Time: Fri Apr 26 11:57:35 GMT 2024

Powered by FUDForum. Page generated in 0.03251 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top