Move files that are within IProject [message #326564] |
Tue, 25 March 2008 07:21 |
Eclipse User |
|
|
|
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()));
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.05301 seconds