1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

[191558] [importexport][efs] Import to Project doesn't work with remote EFS projects

This commit is contained in:
David McKnight 2010-06-24 18:39:20 +00:00
parent c26a494528
commit 1449cb4254
2 changed files with 37 additions and 12 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2009 IBM Corporation and others. * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,6 +13,7 @@
* David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
* David McKnight (IBM) - [276535] File Conflict when Importing Remote Folder with Case-Differentiated-Only Filenames into Project * David McKnight (IBM) - [276535] File Conflict when Importing Remote Folder with Case-Differentiated-Only Filenames into Project
* David McKnight (IBM) - [191558] [importexport][efs] Import to Project doesn't work with remote EFS projects
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.importexport.files; package org.eclipse.rse.internal.importexport.files;
@ -20,6 +21,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -506,8 +508,22 @@ public class RemoteFileImportOperation extends WorkspaceModifyOperation {
return; return;
} }
if (targetResource.getLocation() == null){
rfss.download(((UniFilePlus) fileObject).remoteFile, targetResource.getLocation().makeAbsolute().toOSString(), encoding, null); // an EFS file destination
String remoteFileName = ((UniFilePlus) fileObject).remoteFile.getName();
String remoteParentPath = ((UniFilePlus) fileObject).remoteFile.getParentPath();
InputStream instream = rfss.getInputStream(remoteParentPath, remoteFileName, true, monitor);
if (!targetResource.exists()){
targetResource.create(instream, IResource.FORCE, monitor);
}
else {
targetResource.setContents(instream, IResource.FORCE, monitor);
}
}
else {
rfss.download(((UniFilePlus) fileObject).remoteFile, targetResource.getLocation().makeAbsolute().toOSString(), encoding, null);
}
try { try {
// refresh workspace with just added resource // refresh workspace with just added resource
targetResource.refreshLocal(IResource.DEPTH_ZERO, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)); targetResource.refreshLocal(IResource.DEPTH_ZERO, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2009 IBM Corporation and others. * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -17,6 +17,7 @@
* Takuya Miyamoto - [185925] Integrate Platform/Team Synchronization * Takuya Miyamoto - [185925] Integrate Platform/Team Synchronization
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
* David McKnight (IBM) - [276535] File Conflict when Importing Remote Folder with Case-Differentiated-Only Filenames into Project * David McKnight (IBM) - [276535] File Conflict when Importing Remote Folder with Case-Differentiated-Only Filenames into Project
* David McKnight (IBM) - [191558] [importexport][efs] Import to Project doesn't work with remote EFS projects
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.importexport.files; package org.eclipse.rse.internal.importexport.files;
@ -152,14 +153,15 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
public IStatus run(IProgressMonitor monitor){ public IStatus run(IProgressMonitor monitor){
_isActive = true; _isActive = true;
Display.getDefault().asyncExec(new Runnable(){
public void run(){
updateWidgetEnablements();
selectionGroup.setAllSelections(true);
}
});
query(_fileSystemObject, _element, monitor); query(_fileSystemObject, _element, monitor);
_isActive = false; _isActive = false;
Display.getDefault().asyncExec(new Runnable(){
public void run(){
updateWidgetEnablements();
selectionGroup.setAllSelections(true);
}
});
return Status.OK_STATUS; return Status.OK_STATUS;
} }
@ -1454,8 +1456,15 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
IContainer container = getSpecifiedContainer(); IContainer container = getSpecifiedContainer();
if (container == null) if (container == null)
return false; return false;
else else {
return getSpecifiedContainer().getLocation().isPrefixOf(sourcePath); if (container.getLocation() == null){
// this is an EFS project
return false;
}
else {
return container.getLocation().isPrefixOf(sourcePath);
}
}
} }
/* (non-Javadoc) /* (non-Javadoc)