Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Move files that are within IProject
Move files that are within IProject [message #326564] Tue, 25 March 2008 07:21
Eclipse UserFriend
Originally posted by: mikaelpetterson.ericsson.com

Hi,

Within my project tree I have java packages ( directories). When I have
created a new package with a file ( java file) and want to add it to
source code repos I need to add each directory first going down the tree
to the java file last. The renameTo-method fails.
Is there a way to move directories in using the eclipse API ( eclipse 3.3)?

Where can I find an example?

cheers,

//mike

for (int i = 1; i < nonCCResurces.size(); i++) {
IResource nonCCResource = (IResource)
nonCCResurces.get(nonCCResurces.size() - i);
if (nonCCResource.getType() == IResource.FOLDER) {
File tmpDir = null;
if (!hasRemote(nonCCResource)) {
boolean success = tmpDir.mkdirs();
tmpDir = new File
(nonCCResource.getParent().getLocation().toString(),nonCCRes ource.getName()+ ".tmp");
File dir = new
File(nonCCResource.getParent().getLocation().toString(),
nonCCResource.getName());
boolean dirToBeRenamesExists = dir.exists();
boolean success1 = dir.renameTo(tmpDir);
//Create the new directory as cc
element. ClearcasePlugin.getEngine().add(nonCCResource.getLocation(). toOSString(),
true,getComment(), ClearCase.NO_CHECK_OUT, null);
//If ok the move renamed into new cc dir.
boolean success2 = tmpDir.renameTo(new
File(nonCCResource.getLocation().toOSString(), nonCCResource.getName()));
}
}
Previous Topic:How access instance of my Application class?
Next Topic:CompareEditor ; StructureInputPane
Goto Forum:
  


Current Time: Sat May 10 07:33:15 EDT 2025

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

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

Back to the top