mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 12:05:21 +02:00
[272708] [import/export] fix various bugs with the synchronization support
This commit is contained in:
parent
cc0ede5184
commit
239bbf7d15
22 changed files with 518 additions and 79 deletions
|
@ -29,7 +29,7 @@ David McKnight (IBM) - [272708] [import/export] fix various bugs with t
|
||||||
<wizard
|
<wizard
|
||||||
name="%RemoteFileSystemImportWizard.label"
|
name="%RemoteFileSystemImportWizard.label"
|
||||||
icon="icons/full/etool16/file_import.gif"
|
icon="icons/full/etool16/file_import.gif"
|
||||||
category="org.eclipse.rse.importexport.importexportWizards"
|
category="org.eclipse.rse.importexport.importWizards"
|
||||||
class="org.eclipse.rse.internal.importexport.files.RemoteImportWizard"
|
class="org.eclipse.rse.internal.importexport.files.RemoteImportWizard"
|
||||||
id="org.eclipse.rse.files.importexport.fileImportWizard">
|
id="org.eclipse.rse.files.importexport.fileImportWizard">
|
||||||
<description>
|
<description>
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
|
* David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
|
||||||
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
||||||
* 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
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.importexport.files;
|
package org.eclipse.rse.internal.importexport.files;
|
||||||
|
|
||||||
|
@ -102,6 +103,7 @@ class RemoteExportWizardPage1 extends WizardExportResourcesPage implements Liste
|
||||||
private static final int MY_SIZING_TEXT_FIELD_WIDTH = 250;
|
private static final int MY_SIZING_TEXT_FIELD_WIDTH = 250;
|
||||||
// dialog store id constants
|
// dialog store id constants
|
||||||
private static final String STORE_DESTINATION_NAMES_ID = "RemoteExportWizard.STORE_DESTINATION_NAMES_ID"; //$NON-NLS-1$
|
private static final String STORE_DESTINATION_NAMES_ID = "RemoteExportWizard.STORE_DESTINATION_NAMES_ID"; //$NON-NLS-1$
|
||||||
|
private static final String STORE_REVIEW_SYNCHRONIZE_ID = "RemoteExportWizard.STORE_REVIEW_SYNCHRONIZE_ID"; //$NON-NLS-1$
|
||||||
private static final String STORE_OVERWRITE_EXISTING_FILES_ID = "RemoteExportWizard.STORE_OVERWRITE_EXISTING_FILES_ID"; //$NON-NLS-1$
|
private static final String STORE_OVERWRITE_EXISTING_FILES_ID = "RemoteExportWizard.STORE_OVERWRITE_EXISTING_FILES_ID"; //$NON-NLS-1$
|
||||||
private static final String STORE_CREATE_STRUCTURE_ID = "RemoteExportWizard.STORE_CREATE_STRUCTURE_ID"; //$NON-NLS-1$
|
private static final String STORE_CREATE_STRUCTURE_ID = "RemoteExportWizard.STORE_CREATE_STRUCTURE_ID"; //$NON-NLS-1$
|
||||||
private static final String STORE_CREATE_DESCRIPTION_FILE_ID = "RemoteExportWizard.STORE_CREATE_DESCRIPTION_FILE_ID"; //$NON-NLS-1$
|
private static final String STORE_CREATE_DESCRIPTION_FILE_ID = "RemoteExportWizard.STORE_CREATE_DESCRIPTION_FILE_ID"; //$NON-NLS-1$
|
||||||
|
@ -404,7 +406,10 @@ class RemoteExportWizardPage1 extends WizardExportResourcesPage implements Liste
|
||||||
if (resourcesToExport.size() > 0) {
|
if (resourcesToExport.size() > 0) {
|
||||||
// export data
|
// export data
|
||||||
RemoteFileExportData data = new RemoteFileExportData();
|
RemoteFileExportData data = new RemoteFileExportData();
|
||||||
|
|
||||||
|
data.setContainerPath( null);
|
||||||
data.setElements(resourcesToExport);
|
data.setElements(resourcesToExport);
|
||||||
|
data.setReviewSynchronize(reviewSynchronizeCheckbox.getSelection());
|
||||||
data.setCreateDirectoryStructure(createDirectoryStructureButton.getSelection());
|
data.setCreateDirectoryStructure(createDirectoryStructureButton.getSelection());
|
||||||
data.setCreateSelectionOnly(createSelectionOnlyButton.getSelection());
|
data.setCreateSelectionOnly(createSelectionOnlyButton.getSelection());
|
||||||
data.setOverWriteExistingFiles(overwriteExistingFilesCheckbox.getSelection());
|
data.setOverWriteExistingFiles(overwriteExistingFilesCheckbox.getSelection());
|
||||||
|
@ -576,6 +581,7 @@ class RemoteExportWizardPage1 extends WizardExportResourcesPage implements Liste
|
||||||
directoryNames = addToHistory(directoryNames, getDestinationValue());
|
directoryNames = addToHistory(directoryNames, getDestinationValue());
|
||||||
settings.put(STORE_DESTINATION_NAMES_ID, directoryNames);
|
settings.put(STORE_DESTINATION_NAMES_ID, directoryNames);
|
||||||
// options
|
// options
|
||||||
|
settings.put(STORE_REVIEW_SYNCHRONIZE_ID, reviewSynchronizeCheckbox.getSelection());
|
||||||
settings.put(STORE_OVERWRITE_EXISTING_FILES_ID, overwriteExistingFilesCheckbox.getSelection());
|
settings.put(STORE_OVERWRITE_EXISTING_FILES_ID, overwriteExistingFilesCheckbox.getSelection());
|
||||||
settings.put(STORE_CREATE_STRUCTURE_ID, createDirectoryStructureButton.getSelection());
|
settings.put(STORE_CREATE_STRUCTURE_ID, createDirectoryStructureButton.getSelection());
|
||||||
settings.put(STORE_CREATE_DESCRIPTION_FILE_ID, isSaveSettings());
|
settings.put(STORE_CREATE_DESCRIPTION_FILE_ID, isSaveSettings());
|
||||||
|
@ -625,6 +631,7 @@ class RemoteExportWizardPage1 extends WizardExportResourcesPage implements Liste
|
||||||
// options
|
// options
|
||||||
// no export data to initialize from, so prefill from previous export
|
// no export data to initialize from, so prefill from previous export
|
||||||
if (!isInitializingFromExportData) {
|
if (!isInitializingFromExportData) {
|
||||||
|
reviewSynchronizeCheckbox.setSelection(settings.getBoolean(STORE_REVIEW_SYNCHRONIZE_ID));
|
||||||
overwriteExistingFilesCheckbox.setSelection(settings.getBoolean(STORE_OVERWRITE_EXISTING_FILES_ID));
|
overwriteExistingFilesCheckbox.setSelection(settings.getBoolean(STORE_OVERWRITE_EXISTING_FILES_ID));
|
||||||
boolean createDirectories = settings.getBoolean(STORE_CREATE_STRUCTURE_ID);
|
boolean createDirectories = settings.getBoolean(STORE_CREATE_STRUCTURE_ID);
|
||||||
createDirectoryStructureButton.setSelection(createDirectories);
|
createDirectoryStructureButton.setSelection(createDirectories);
|
||||||
|
@ -644,6 +651,7 @@ class RemoteExportWizardPage1 extends WizardExportResourcesPage implements Liste
|
||||||
// initialize from export data
|
// initialize from export data
|
||||||
else {
|
else {
|
||||||
RemoteFileExportData data = parentWizard.getExportData();
|
RemoteFileExportData data = parentWizard.getExportData();
|
||||||
|
reviewSynchronizeCheckbox.setSelection(data.isReviewSynchronize());
|
||||||
overwriteExistingFilesCheckbox.setSelection(data.isOverWriteExistingFiles());
|
overwriteExistingFilesCheckbox.setSelection(data.isOverWriteExistingFiles());
|
||||||
createDirectoryStructureButton.setSelection(data.isCreateDirectoryStructure());
|
createDirectoryStructureButton.setSelection(data.isCreateDirectoryStructure());
|
||||||
createSelectionOnlyButton.setSelection(data.isCreateSelectionOnly());
|
createSelectionOnlyButton.setSelection(data.isCreateSelectionOnly());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2007 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 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
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.importexport.files;
|
package org.eclipse.rse.internal.importexport.files;
|
||||||
|
|
||||||
|
@ -25,11 +26,15 @@ import org.eclipse.rse.ui.SystemBasePlugin;
|
||||||
*/
|
*/
|
||||||
public class RemoteFileExportData {
|
public class RemoteFileExportData {
|
||||||
private String destination;
|
private String destination;
|
||||||
|
|
||||||
|
private IPath containerPath;
|
||||||
|
private boolean reviewSynchronize;
|
||||||
private boolean overWriteExistingFiles;
|
private boolean overWriteExistingFiles;
|
||||||
private boolean createDirectoryStructure;
|
private boolean createDirectoryStructure;
|
||||||
private boolean createSelectionOnly;
|
private boolean createSelectionOnly;
|
||||||
private boolean saveSettings;
|
private boolean saveSettings;
|
||||||
private String descriptionFilePath;
|
private String descriptionFilePath;
|
||||||
|
|
||||||
// export elements
|
// export elements
|
||||||
private List elements;
|
private List elements;
|
||||||
|
|
||||||
|
@ -37,6 +42,7 @@ public class RemoteFileExportData {
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
public RemoteFileExportData() {
|
public RemoteFileExportData() {
|
||||||
|
setContainerPath(null);
|
||||||
setDestination(null);
|
setDestination(null);
|
||||||
setOverWriteExistingFiles(false);
|
setOverWriteExistingFiles(false);
|
||||||
setCreateDirectoryStructure(false);
|
setCreateDirectoryStructure(false);
|
||||||
|
@ -72,6 +78,14 @@ public class RemoteFileExportData {
|
||||||
this.descriptionFilePath = descriptionFilePath;
|
this.descriptionFilePath = descriptionFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setContainerPath(IPath location){
|
||||||
|
this.containerPath = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IPath getContainerPath(){
|
||||||
|
return containerPath;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the destination.
|
* @return Returns the destination.
|
||||||
*/
|
*/
|
||||||
|
@ -116,6 +130,15 @@ public class RemoteFileExportData {
|
||||||
this.overWriteExistingFiles = overWriteExistingFiles;
|
this.overWriteExistingFiles = overWriteExistingFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isReviewSynchronize(){
|
||||||
|
return reviewSynchronize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReviewSynchronize(boolean reviewSynchronize){
|
||||||
|
this.reviewSynchronize = reviewSynchronize;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the saveSettings.
|
* @return Returns the saveSettings.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2007 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 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
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
|
* Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.importexport.files;
|
package org.eclipse.rse.internal.importexport.files;
|
||||||
|
|
||||||
|
@ -100,6 +101,7 @@ public class RemoteFileExportDescriptionReader implements IRemoteFileExportDescr
|
||||||
|
|
||||||
private void xmlReadOptions(RemoteFileExportData exportData, Element element) throws IOException {
|
private void xmlReadOptions(RemoteFileExportData exportData, Element element) throws IOException {
|
||||||
if (element.getNodeName().equals("options")) { //$NON-NLS-1$
|
if (element.getNodeName().equals("options")) { //$NON-NLS-1$
|
||||||
|
exportData.setReviewSynchronize(getBooleanAttribute(element, "reviewSynchronize")); //$NON-NLS-1$
|
||||||
exportData.setOverWriteExistingFiles(getBooleanAttribute(element, "overWriteExistingFiles")); //$NON-NLS-1$
|
exportData.setOverWriteExistingFiles(getBooleanAttribute(element, "overWriteExistingFiles")); //$NON-NLS-1$
|
||||||
exportData.setCreateDirectoryStructure(getBooleanAttribute(element, "createDirectoryStructure")); //$NON-NLS-1$
|
exportData.setCreateDirectoryStructure(getBooleanAttribute(element, "createDirectoryStructure")); //$NON-NLS-1$
|
||||||
exportData.setCreateSelectionOnly(getBooleanAttribute(element, "createSelectedOnly")); //$NON-NLS-1$
|
exportData.setCreateSelectionOnly(getBooleanAttribute(element, "createSelectedOnly")); //$NON-NLS-1$
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2007 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 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
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
|
* Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.importexport.files;
|
package org.eclipse.rse.internal.importexport.files;
|
||||||
|
|
||||||
|
@ -108,6 +109,7 @@ public class RemoteFileExportDescriptionWriter implements IRemoteFileExportDescr
|
||||||
private void xmlWriteOptions(RemoteFileExportData exportData, Document document, Element xmlFileDesc) throws DOMException {
|
private void xmlWriteOptions(RemoteFileExportData exportData, Document document, Element xmlFileDesc) throws DOMException {
|
||||||
Element options = document.createElement("options"); //$NON-NLS-1$
|
Element options = document.createElement("options"); //$NON-NLS-1$
|
||||||
xmlFileDesc.appendChild(options);
|
xmlFileDesc.appendChild(options);
|
||||||
|
options.setAttribute("reviewSynchronize", "" + exportData.isReviewSynchronize()); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
options.setAttribute("overWriteExistingFiles", "" + exportData.isOverWriteExistingFiles()); //$NON-NLS-1$ //$NON-NLS-2$
|
options.setAttribute("overWriteExistingFiles", "" + exportData.isOverWriteExistingFiles()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
options.setAttribute("createDirectoryStructure", "" + exportData.isCreateDirectoryStructure()); //$NON-NLS-1$ //$NON-NLS-2$
|
options.setAttribute("createDirectoryStructure", "" + exportData.isCreateDirectoryStructure()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
options.setAttribute("createSelectedOnly", "" + exportData.isCreateSelectionOnly()); //$NON-NLS-1$ //$NON-NLS-2$
|
options.setAttribute("createSelectedOnly", "" + exportData.isCreateSelectionOnly()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 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
|
||||||
|
@ -11,6 +11,7 @@
|
||||||
* Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
|
* Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
|
||||||
* David McKnight (IBM) - [191479] refreshing destination directory after export
|
* David McKnight (IBM) - [191479] refreshing destination directory after export
|
||||||
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
|
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.importexport.files;
|
package org.eclipse.rse.internal.importexport.files;
|
||||||
|
|
||||||
|
@ -67,6 +68,9 @@ class RemoteFileExportOperation implements IRunnableWithProgress {
|
||||||
private RemoteFileExportData exportData;
|
private RemoteFileExportData exportData;
|
||||||
private boolean saveSettings;
|
private boolean saveSettings;
|
||||||
private String descriptionFilePath;
|
private String descriptionFilePath;
|
||||||
|
|
||||||
|
private boolean reviewSynchronize = true;
|
||||||
|
|
||||||
// the constants for the overwrite 3 state
|
// the constants for the overwrite 3 state
|
||||||
private static final int OVERWRITE_NOT_SET = 0;
|
private static final int OVERWRITE_NOT_SET = 0;
|
||||||
private static final int OVERWRITE_NONE = 1;
|
private static final int OVERWRITE_NONE = 1;
|
||||||
|
@ -95,6 +99,7 @@ class RemoteFileExportOperation implements IRunnableWithProgress {
|
||||||
this.saveSettings = data.isSaveSettings();
|
this.saveSettings = data.isSaveSettings();
|
||||||
this.descriptionFilePath = data.getDescriptionFilePath();
|
this.descriptionFilePath = data.getDescriptionFilePath();
|
||||||
setCreateLeadupStructure(data.isCreateDirectoryStructure());
|
setCreateLeadupStructure(data.isCreateDirectoryStructure());
|
||||||
|
setReviewSynchronize(data.isReviewSynchronize());
|
||||||
setOverwriteFiles(data.isOverWriteExistingFiles());
|
setOverwriteFiles(data.isOverWriteExistingFiles());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,4 +560,14 @@ class RemoteFileExportOperation implements IRunnableWithProgress {
|
||||||
overwriteState = OVERWRITE_ALL;
|
overwriteState = OVERWRITE_ALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set this boolean indicating whether exported resources should automatically
|
||||||
|
* be reviewed/synchronized
|
||||||
|
*
|
||||||
|
* @param value boolean
|
||||||
|
*/
|
||||||
|
public void setReviewSynchronize(boolean value) {
|
||||||
|
reviewSynchronize = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2007 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 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
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.importexport.files;
|
package org.eclipse.rse.internal.importexport.files;
|
||||||
|
|
||||||
|
@ -36,6 +37,8 @@ public class RemoteFileImportData {
|
||||||
private HashMap map;
|
private HashMap map;
|
||||||
private List elements;
|
private List elements;
|
||||||
|
|
||||||
|
private boolean reviewSynchronize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -161,6 +164,14 @@ public class RemoteFileImportData {
|
||||||
this.overWriteExistingFiles = overWriteExistingFiles;
|
this.overWriteExistingFiles = overWriteExistingFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isReviewSynchronize(){
|
||||||
|
return reviewSynchronize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReviewSynchronize(boolean reviewSynchronize){
|
||||||
|
this.reviewSynchronize = reviewSynchronize;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the saveSettings.
|
* @return Returns the saveSettings.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 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
|
||||||
|
@ -11,6 +11,7 @@
|
||||||
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
|
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
|
||||||
* David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others
|
* David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others
|
||||||
* 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
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.importexport.files;
|
package org.eclipse.rse.internal.importexport.files;
|
||||||
|
|
||||||
|
@ -79,6 +80,8 @@ public class RemoteFileImportOperation extends WorkspaceModifyOperation {
|
||||||
private static final int OVERWRITE_ALL = 2;
|
private static final int OVERWRITE_ALL = 2;
|
||||||
private int overwriteState = OVERWRITE_NOT_SET;
|
private int overwriteState = OVERWRITE_NOT_SET;
|
||||||
|
|
||||||
|
private boolean reviewSynchronize = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new operation that recursively imports the entire contents of the
|
* Creates a new operation that recursively imports the entire contents of the
|
||||||
* specified root file system object.
|
* specified root file system object.
|
||||||
|
@ -158,6 +161,7 @@ public class RemoteFileImportOperation extends WorkspaceModifyOperation {
|
||||||
this(data.getContainerPath(), data.getSource(), provider, overwriteImplementor);
|
this(data.getContainerPath(), data.getSource(), provider, overwriteImplementor);
|
||||||
setFilesToImport(data.getElements());
|
setFilesToImport(data.getElements());
|
||||||
setOverwriteResources(data.isOverWriteExistingFiles());
|
setOverwriteResources(data.isOverWriteExistingFiles());
|
||||||
|
setReviewSynchronize(data.isReviewSynchronize());
|
||||||
setCreateContainerStructure(data.isCreateDirectoryStructure());
|
setCreateContainerStructure(data.isCreateDirectoryStructure());
|
||||||
this.importData = data;
|
this.importData = data;
|
||||||
this.saveSettings = data.isSaveSettings();
|
this.saveSettings = data.isSaveSettings();
|
||||||
|
@ -639,4 +643,14 @@ public class RemoteFileImportOperation extends WorkspaceModifyOperation {
|
||||||
public void setOverwriteResources(boolean value) {
|
public void setOverwriteResources(boolean value) {
|
||||||
if (value) this.overwriteState = OVERWRITE_ALL;
|
if (value) this.overwriteState = OVERWRITE_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set this boolean indicating whether exported resources should automatically
|
||||||
|
* be reviewed/synchronized
|
||||||
|
*
|
||||||
|
* @param value boolean
|
||||||
|
*/
|
||||||
|
public void setReviewSynchronize(boolean value) {
|
||||||
|
reviewSynchronize = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
||||||
* David McKnight (IBM) - [219792][importexport][ftp] RSE hangs on FTP import
|
* David McKnight (IBM) - [219792][importexport][ftp] RSE hangs on FTP import
|
||||||
* 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
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.importexport.files;
|
package org.eclipse.rse.internal.importexport.files;
|
||||||
|
|
||||||
|
@ -255,6 +256,7 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
|
||||||
protected boolean initSourceNameSet = false;
|
protected boolean initSourceNameSet = false;
|
||||||
// dialog store id constants
|
// dialog store id constants
|
||||||
private final static String STORE_SOURCE_NAMES_ID = "RemoteImportWizardPage1.STORE_SOURCE_NAMES_ID"; //$NON-NLS-1$
|
private final static String STORE_SOURCE_NAMES_ID = "RemoteImportWizardPage1.STORE_SOURCE_NAMES_ID"; //$NON-NLS-1$
|
||||||
|
private final static String STORE_REVIEW_SYNCHRONIZE_ID = "RemoteImportWizardPage1.STORE_REVIEW_SYNCHRONIZE_ID"; //$NON-NLS-1$
|
||||||
private final static String STORE_OVERWRITE_EXISTING_RESOURCES_ID = "RemoteImportWizardPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID"; //$NON-NLS-1$
|
private final static String STORE_OVERWRITE_EXISTING_RESOURCES_ID = "RemoteImportWizardPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID"; //$NON-NLS-1$
|
||||||
private final static String STORE_CREATE_CONTAINER_STRUCTURE_ID = "RemoteImportWizardPage1.STORE_CREATE_CONTAINER_STRUCTURE_ID"; //$NON-NLS-1$
|
private final static String STORE_CREATE_CONTAINER_STRUCTURE_ID = "RemoteImportWizardPage1.STORE_CREATE_CONTAINER_STRUCTURE_ID"; //$NON-NLS-1$
|
||||||
private static final String STORE_CREATE_DESCRIPTION_FILE_ID = "RemoteImportWizardPage1.STORE_CREATE_DESCRIPTION_FILE_ID"; //$NON-NLS-1$
|
private static final String STORE_CREATE_DESCRIPTION_FILE_ID = "RemoteImportWizardPage1.STORE_CREATE_DESCRIPTION_FILE_ID"; //$NON-NLS-1$
|
||||||
|
@ -1000,6 +1002,7 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
|
||||||
boolean isInitializingFromImportData = parentWizard.getInitializeFromImportData();
|
boolean isInitializingFromImportData = parentWizard.getInitializeFromImportData();
|
||||||
if (!isInitializingFromImportData) {
|
if (!isInitializingFromImportData) {
|
||||||
// radio buttons and checkboxes
|
// radio buttons and checkboxes
|
||||||
|
reviewSynchronizeCheckbox.setSelection(settings.getBoolean(STORE_REVIEW_SYNCHRONIZE_ID));
|
||||||
overwriteExistingResourcesCheckbox.setSelection(settings.getBoolean(STORE_OVERWRITE_EXISTING_RESOURCES_ID));
|
overwriteExistingResourcesCheckbox.setSelection(settings.getBoolean(STORE_OVERWRITE_EXISTING_RESOURCES_ID));
|
||||||
boolean createStructure = settings.getBoolean(STORE_CREATE_CONTAINER_STRUCTURE_ID);
|
boolean createStructure = settings.getBoolean(STORE_CREATE_CONTAINER_STRUCTURE_ID);
|
||||||
createContainerStructureButton.setSelection(createStructure);
|
createContainerStructureButton.setSelection(createStructure);
|
||||||
|
@ -1019,6 +1022,7 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
|
||||||
setContainerFieldValue(containerPath);
|
setContainerFieldValue(containerPath);
|
||||||
}
|
}
|
||||||
// radio buttons and checkboxes
|
// radio buttons and checkboxes
|
||||||
|
reviewSynchronizeCheckbox.setSelection(importData.isReviewSynchronize());
|
||||||
overwriteExistingResourcesCheckbox.setSelection(importData.isOverWriteExistingFiles());
|
overwriteExistingResourcesCheckbox.setSelection(importData.isOverWriteExistingFiles());
|
||||||
createContainerStructureButton.setSelection(importData.isCreateDirectoryStructure());
|
createContainerStructureButton.setSelection(importData.isCreateDirectoryStructure());
|
||||||
createOnlySelectedButton.setSelection(importData.isCreateSelectionOnly());
|
createOnlySelectedButton.setSelection(importData.isCreateSelectionOnly());
|
||||||
|
@ -1067,6 +1071,7 @@ class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listen
|
||||||
sourceNames = addToHistory(sourceNames, getSourceDirectoryName());
|
sourceNames = addToHistory(sourceNames, getSourceDirectoryName());
|
||||||
settings.put(STORE_SOURCE_NAMES_ID, sourceNames);
|
settings.put(STORE_SOURCE_NAMES_ID, sourceNames);
|
||||||
// radio buttons and checkboxes
|
// radio buttons and checkboxes
|
||||||
|
settings.put(STORE_REVIEW_SYNCHRONIZE_ID, reviewSynchronizeCheckbox.getSelection());
|
||||||
settings.put(STORE_OVERWRITE_EXISTING_RESOURCES_ID, overwriteExistingResourcesCheckbox.getSelection());
|
settings.put(STORE_OVERWRITE_EXISTING_RESOURCES_ID, overwriteExistingResourcesCheckbox.getSelection());
|
||||||
settings.put(STORE_CREATE_CONTAINER_STRUCTURE_ID, createContainerStructureButton.getSelection());
|
settings.put(STORE_CREATE_CONTAINER_STRUCTURE_ID, createContainerStructureButton.getSelection());
|
||||||
settings.put(STORE_CREATE_DESCRIPTION_FILE_ID, isSaveSettings());
|
settings.put(STORE_CREATE_DESCRIPTION_FILE_ID, isSaveSettings());
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
|
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
|
||||||
* David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService
|
* David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService
|
||||||
* 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
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.importexport.files;
|
package org.eclipse.rse.internal.importexport.files;
|
||||||
|
|
||||||
|
@ -420,4 +421,12 @@ public class UniFilePlus extends File {
|
||||||
return this.remoteFile.getParentRemoteFileSubSystem().getInputStream(this.remoteFile.getParentPath(), this.remoteFile.getName(), this.remoteFile.isBinary(), null);
|
return this.remoteFile.getParentRemoteFileSubSystem().getInputStream(this.remoteFile.getParentPath(), this.remoteFile.getName(), this.remoteFile.isBinary(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void synchRemoteFile() {
|
||||||
|
// get the latest version of the remote file
|
||||||
|
remoteFile.markStale(true);
|
||||||
|
try {
|
||||||
|
remoteFile = remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
|
||||||
|
}
|
||||||
|
catch (Exception e){}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008 Takuya Miyamoto and others.
|
* Copyright (c) 2008, 2009 Takuya Miyamoto 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
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Takuya Miyamoto - initial API and implementation
|
* Takuya Miyamoto - initial API and implementation
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.synchronize;
|
package org.eclipse.rse.internal.synchronize;
|
||||||
|
|
||||||
|
@ -14,6 +15,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store synchronize information. This class is needed per each synchronize
|
* Store synchronize information. This class is needed per each synchronize
|
||||||
|
@ -33,14 +35,28 @@ public interface ISynchronizeData {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getDestination();
|
public String getRemoteLocation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set destination path
|
* Set the remote path
|
||||||
*
|
*
|
||||||
* @param destinationPath
|
* @param location
|
||||||
*/
|
*/
|
||||||
public void setDestination(String destination);
|
public void setRemoteLocation(String location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the local path.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public IPath getLocalLocation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the local path
|
||||||
|
*
|
||||||
|
* @param location
|
||||||
|
*/
|
||||||
|
public void setLocalLocation(IPath location);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the synchronize type of this operation.
|
* Return the synchronize type of this operation.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008 Takuya Miyamoto and others.
|
* Copyright (c) 2008, 2009 Takuya Miyamoto 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
|
||||||
|
@ -7,24 +7,132 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Takuya Miyamoto - initial API and implementation
|
* Takuya Miyamoto - initial API and implementation
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.synchronize;
|
package org.eclipse.rse.internal.synchronize;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IContainer;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemResourceVariant;
|
import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemResourceVariant;
|
||||||
|
import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
|
||||||
import org.eclipse.team.core.variants.IResourceVariant;
|
import org.eclipse.team.core.variants.IResourceVariant;
|
||||||
import org.eclipse.team.core.variants.ThreeWayResourceComparator;
|
import org.eclipse.team.core.variants.ThreeWayResourceComparator;
|
||||||
import org.eclipse.team.core.variants.ThreeWaySynchronizer;
|
import org.eclipse.team.core.variants.ThreeWaySynchronizer;
|
||||||
|
import org.eclipse.team.internal.core.mapping.LocalResourceVariant;
|
||||||
|
|
||||||
public class RSEResourceVariantComparator extends ThreeWayResourceComparator {
|
public class RSEResourceVariantComparator extends ThreeWayResourceComparator {
|
||||||
|
private ThreeWaySynchronizer _synchronizer;
|
||||||
public RSEResourceVariantComparator(ThreeWaySynchronizer synchronizer){
|
public RSEResourceVariantComparator(ThreeWaySynchronizer synchronizer){
|
||||||
super(synchronizer);
|
super(synchronizer);
|
||||||
|
_synchronizer = synchronizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean compare(IResource local, IResourceVariant remote) {
|
public boolean compare(IResource local, IResourceVariant remote) {
|
||||||
return super.compare(local, remote) && equalSize(local, remote);
|
// return super.compare(local, remote) && equalSize(local, remote);
|
||||||
|
if(local instanceof IContainer) {
|
||||||
|
if(remote.isContainer()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(local instanceof IFile && remote instanceof FileSystemResourceVariant) {
|
||||||
|
FileSystemResourceVariant myE2 = (FileSystemResourceVariant)remote;
|
||||||
|
myE2.synchRemoteFile(); // make sure we've got the latest remote file
|
||||||
|
|
||||||
|
SystemIFileProperties properties = new SystemIFileProperties(local);
|
||||||
|
|
||||||
|
long remoteTimeStamp = myE2.lastModified();
|
||||||
|
|
||||||
|
if (remoteTimeStamp == 0){
|
||||||
|
// file no longer exists
|
||||||
|
properties.setRemoteFileTimeStamp(0);
|
||||||
|
properties.setDownloadFileTimeStamp(0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
long storedTimeStamp = properties.getRemoteFileTimeStamp();
|
||||||
|
long storedLocalTimeStamp = properties.getDownloadFileTimeStamp();
|
||||||
|
long localTimeStamp = local.getLocalTimeStamp();
|
||||||
|
|
||||||
|
if (storedTimeStamp == 0){
|
||||||
|
// never been stored before
|
||||||
|
// assuming up-to-date file and now marking this timestamp
|
||||||
|
properties.setRemoteFileTimeStamp(remoteTimeStamp);
|
||||||
|
properties.setDownloadFileTimeStamp(local.getLocalTimeStamp());
|
||||||
|
|
||||||
|
storedTimeStamp = remoteTimeStamp;
|
||||||
|
storedLocalTimeStamp = localTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean result = storedTimeStamp == remoteTimeStamp && storedLocalTimeStamp == localTimeStamp;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else if (local instanceof IFile && remote instanceof LocalResourceVariant){
|
||||||
|
return true; // local resource variant is for local
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
public boolean compare(IResource local, IResourceVariant remote) {
|
||||||
|
// First, ensure the resources are the same gender
|
||||||
|
if ((local.getType() == IResource.FILE) == remote.isContainer()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// If the file is locally modified, it cannot be in sync
|
||||||
|
if (local.getType() == IResource.FILE && _synchronizer.isLocallyModified(local)) {
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there is no base, the local cannot match the remote
|
||||||
|
if (_synchronizer.getBaseBytes(local) == null) return false;
|
||||||
|
|
||||||
|
// Otherwise, assume they are the same if the remote equals the base
|
||||||
|
return equals(_synchronizer.getBaseBytes(local), getBytes(remote));
|
||||||
|
} catch (TeamException e) {
|
||||||
|
TeamPlugin.log(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean compare(IResourceVariant e1, IResourceVariant e2) {
|
||||||
|
if(e1.isContainer()) {
|
||||||
|
if(e2.isContainer()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(e1 instanceof FileSystemResourceVariant && e2 instanceof FileSystemResourceVariant) {
|
||||||
|
FileSystemResourceVariant myE1 = (FileSystemResourceVariant)e1;
|
||||||
|
FileSystemResourceVariant myE2 = (FileSystemResourceVariant)e2;
|
||||||
|
return myE1.lastModified() == myE2.lastModified();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] getBytes(IResourceVariant remote) {
|
||||||
|
return remote.asBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean equals(byte[] syncBytes, byte[] oldBytes) {
|
||||||
|
if (syncBytes == null || oldBytes == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (syncBytes.length != oldBytes.length) return false;
|
||||||
|
for (int i = 0; i < oldBytes.length; i++) {
|
||||||
|
if (oldBytes[i] != syncBytes[i]) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return if the size of local and remote file are the same.
|
* Return if the size of local and remote file are the same.
|
||||||
* @param local
|
* @param local
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008 Takuya Miyamoto and others.
|
* Copyright (c) 2008, 2009 Takuya Miyamoto 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
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Takuya Miyamoto - initial API and implementation
|
* Takuya Miyamoto - initial API and implementation
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.synchronize;
|
package org.eclipse.rse.internal.synchronize;
|
||||||
|
|
||||||
|
@ -32,7 +33,8 @@ import org.eclipse.rse.ui.SystemBasePlugin;
|
||||||
|
|
||||||
public class SynchronizeData implements ISynchronizeData {
|
public class SynchronizeData implements ISynchronizeData {
|
||||||
private String descriptionFilePath;
|
private String descriptionFilePath;
|
||||||
private String destination;
|
private String remoteLocation;
|
||||||
|
private IPath localLocation;
|
||||||
private List<IResource> elements;
|
private List<IResource> elements;
|
||||||
private int synchronizeType;
|
private int synchronizeType;
|
||||||
private boolean saveSettings;
|
private boolean saveSettings;
|
||||||
|
@ -43,7 +45,8 @@ public class SynchronizeData implements ISynchronizeData {
|
||||||
|
|
||||||
public SynchronizeData() {
|
public SynchronizeData() {
|
||||||
setDescriptionFilePath(null);
|
setDescriptionFilePath(null);
|
||||||
setDestination(null);
|
setRemoteLocation(null);
|
||||||
|
setLocalLocation(null);
|
||||||
setElements(null);
|
setElements(null);
|
||||||
setSynchronizeType(0);
|
setSynchronizeType(0);
|
||||||
setSaveSettings(false);
|
setSaveSettings(false);
|
||||||
|
@ -54,12 +57,14 @@ public class SynchronizeData implements ISynchronizeData {
|
||||||
|
|
||||||
public SynchronizeData(RemoteFileExportData data) {
|
public SynchronizeData(RemoteFileExportData data) {
|
||||||
setDescriptionFilePath(data.getDescriptionFilePath());
|
setDescriptionFilePath(data.getDescriptionFilePath());
|
||||||
setDestination(data.getDestination());
|
setRemoteLocation(data.getDestination());
|
||||||
setElements(data.getElements());
|
setElements(data.getElements()); // for an export, the elements determine the source
|
||||||
|
setLocalLocation(data.getContainerPath());
|
||||||
setSynchronizeType(ISynchronizeOperation.SYNC_MODE_OVERRIDE_DEST);
|
setSynchronizeType(ISynchronizeOperation.SYNC_MODE_OVERRIDE_DEST);
|
||||||
setSaveSettings(data.isSaveSettings());
|
setSaveSettings(data.isSaveSettings());
|
||||||
setCreateDirectoryStructure(data.isCreateDirectoryStructure());
|
setCreateDirectoryStructure(data.isCreateDirectoryStructure());
|
||||||
setCreateSelectionOnly(data.isCreateSelectionOnly());
|
setCreateSelectionOnly(data.isCreateSelectionOnly());
|
||||||
|
setReviewSynchronzie(data.isReviewSynchronize());
|
||||||
setOverWriteExistingFiles(data.isOverWriteExistingFiles());
|
setOverWriteExistingFiles(data.isOverWriteExistingFiles());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,8 +84,9 @@ public class SynchronizeData implements ISynchronizeData {
|
||||||
|
|
||||||
RSESyncUtils.getSynchronizeResources(localRoot, remoteRoot, remoteRoot, filter, localResource);
|
RSESyncUtils.getSynchronizeResources(localRoot, remoteRoot, remoteRoot, filter, localResource);
|
||||||
|
|
||||||
|
setLocalLocation(data.getContainerPath());
|
||||||
setDescriptionFilePath(data.getDescriptionFilePath());
|
setDescriptionFilePath(data.getDescriptionFilePath());
|
||||||
setDestination(((UniFilePlus)data.getSource()).getRemoteFile().getAbsolutePathPlusConnection());
|
setRemoteLocation(((UniFilePlus)data.getSource()).getRemoteFile().getAbsolutePathPlusConnection());
|
||||||
setElements(localResource);
|
setElements(localResource);
|
||||||
setSynchronizeType(ISynchronizeOperation.SYNC_MODE_OVERRIDE_SOURCE);
|
setSynchronizeType(ISynchronizeOperation.SYNC_MODE_OVERRIDE_SOURCE);
|
||||||
setSaveSettings(data.isSaveSettings());
|
setSaveSettings(data.isSaveSettings());
|
||||||
|
@ -110,14 +116,23 @@ public class SynchronizeData implements ISynchronizeData {
|
||||||
this.descriptionFilePath = descriptionFilePath;
|
this.descriptionFilePath = descriptionFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDestination() {
|
public String getRemoteLocation() {
|
||||||
return destination;
|
return remoteLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDestination(String destination) {
|
public void setRemoteLocation(String location) {
|
||||||
this.destination = destination;
|
this.remoteLocation = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IPath getLocalLocation() {
|
||||||
|
return localLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocalLocation(IPath location) {
|
||||||
|
this.localLocation = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<IResource> getElements() {
|
public List<IResource> getElements() {
|
||||||
return elements;
|
return elements;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +197,7 @@ public class SynchronizeData implements ISynchronizeData {
|
||||||
data.setOverWriteExistingFiles(isOverWriteExistingFiles());
|
data.setOverWriteExistingFiles(isOverWriteExistingFiles());
|
||||||
data.setSaveSettings(isSaveSettings());
|
data.setSaveSettings(isSaveSettings());
|
||||||
data.setDescriptionFilePath(getDescriptionFilePath());
|
data.setDescriptionFilePath(getDescriptionFilePath());
|
||||||
data.setDestination(getDestination());
|
data.setDestination(getRemoteLocation());
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 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
|
||||||
|
@ -9,6 +9,7 @@
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Andreas Voss <av@tonbeller.com> - Bug 181141 [Examples] Team: filesystem provider example can not handle deletions
|
* Andreas Voss <av@tonbeller.com> - Bug 181141 [Examples] Team: filesystem provider example can not handle deletions
|
||||||
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemOperations
|
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemOperations
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.synchronize.filesystem;
|
package org.eclipse.rse.internal.synchronize.filesystem;
|
||||||
|
|
||||||
|
@ -31,6 +32,8 @@ import org.eclipse.rse.internal.importexport.files.UniFilePlus;
|
||||||
import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemResourceVariant;
|
import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemResourceVariant;
|
||||||
import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemSubscriber;
|
import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemSubscriber;
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||||
|
import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
|
||||||
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
import org.eclipse.team.core.RepositoryProvider;
|
import org.eclipse.team.core.RepositoryProvider;
|
||||||
import org.eclipse.team.core.TeamException;
|
import org.eclipse.team.core.TeamException;
|
||||||
import org.eclipse.team.core.variants.IResourceVariant;
|
import org.eclipse.team.core.variants.IResourceVariant;
|
||||||
|
@ -349,8 +352,17 @@ public class FileSystemOperations {
|
||||||
if(localFile.isAccessible()){
|
if(localFile.isAccessible()){
|
||||||
localFile.getResourceAttributes().setReadOnly(true);
|
localFile.getResourceAttributes().setReadOnly(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
localFile.getParent().refreshLocal(IResource.DEPTH_ONE, progress);
|
||||||
|
|
||||||
// update sync status
|
// update sync status
|
||||||
synchronizer.setBaseBytes(localFile, remote.asBytes());
|
synchronizer.setBaseBytes(localFile, remote.asBytes());
|
||||||
|
|
||||||
|
// update stored timestamp
|
||||||
|
SystemIFileProperties properties = new SystemIFileProperties(localFile);
|
||||||
|
properties.setRemoteFileTimeStamp(remoteFile.lastModified());
|
||||||
|
properties.setDownloadFileTimeStamp(localFile.getLocalTimeStamp());
|
||||||
|
|
||||||
} catch (SystemMessageException e) {
|
} catch (SystemMessageException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -404,6 +416,7 @@ public class FileSystemOperations {
|
||||||
FileSystemProvider provider = getProvider(localFile);
|
FileSystemProvider provider = getProvider(localFile);
|
||||||
IResourceVariant base = provider.getResourceVariant(localFile, baseBytes);
|
IResourceVariant base = provider.getResourceVariant(localFile, baseBytes);
|
||||||
|
|
||||||
|
overrideIncoming = true; // DKM - test
|
||||||
// Check whether we are overriding a remote change
|
// Check whether we are overriding a remote change
|
||||||
if (base == null && remote != null && !overrideIncoming) {
|
if (base == null && remote != null && !overrideIncoming) {
|
||||||
// The remote is an incoming (or conflicting) addition.
|
// The remote is an incoming (or conflicting) addition.
|
||||||
|
@ -453,6 +466,16 @@ public class FileSystemOperations {
|
||||||
// Update the synchronizer base bytes
|
// Update the synchronizer base bytes
|
||||||
remote = getExportResourceVariant(localFile);
|
remote = getExportResourceVariant(localFile);
|
||||||
synchronizer.setBaseBytes(localFile, remote.asBytes());
|
synchronizer.setBaseBytes(localFile, remote.asBytes());
|
||||||
|
|
||||||
|
// update stored timestamp
|
||||||
|
// make sure the remote file is up-to-date
|
||||||
|
remoteFile.getRemoteFile().markStale(true);
|
||||||
|
IRemoteFile updatedRemoteFile = remoteFile.getRemoteFile().getParentRemoteFileSubSystem().getRemoteFileObject(remoteFile.getRemoteFile().getAbsolutePath(), progress);
|
||||||
|
|
||||||
|
SystemIFileProperties properties = new SystemIFileProperties(localFile);
|
||||||
|
properties.setRemoteFileTimeStamp(updatedRemoteFile.getLastModified());
|
||||||
|
properties.setDownloadFileTimeStamp(localFile.getLocalTimeStamp());
|
||||||
|
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
throw FileSystemPlugin.wrapException(e);
|
throw FileSystemPlugin.wrapException(e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -490,8 +513,15 @@ public class FileSystemOperations {
|
||||||
toDelete.add(diskFile);
|
toDelete.add(diskFile);
|
||||||
} else if (folder.exists() && remote == null) {
|
} else if (folder.exists() && remote == null) {
|
||||||
// Create the remote directory and sync up the local
|
// Create the remote directory and sync up the local
|
||||||
diskFile.mkdir();
|
diskFile.mkdirs();
|
||||||
synchronizer.setBaseBytes(folder, provider.getExportResourceVariant(folder).asBytes());
|
|
||||||
|
IResourceVariant variant = provider.getExportResourceVariant(folder);
|
||||||
|
if (variant == null){
|
||||||
|
// remote directory does not exist
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
synchronizer.setBaseBytes(folder, variant.asBytes());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (container.getType() == IResource.PROJECT) {
|
} else if (container.getType() == IResource.PROJECT) {
|
||||||
IProject project = (IProject) container;
|
IProject project = (IProject) container;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 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
|
||||||
|
@ -8,10 +8,13 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemProvider
|
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemProvider
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.synchronize.filesystem;
|
package org.eclipse.rse.internal.synchronize.filesystem;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IFileModificationValidator;
|
import org.eclipse.core.resources.IFileModificationValidator;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -77,9 +80,12 @@ public class FileSystemProvider extends RepositoryProvider {
|
||||||
};
|
};
|
||||||
|
|
||||||
// The location of the folder on file system where the repository is stored.
|
// The location of the folder on file system where the repository is stored.
|
||||||
private IPath rootPath;
|
private IPath remoteRootPath;
|
||||||
|
private IPath localRootPath;
|
||||||
private UniFilePlus remoteRoot;
|
private UniFilePlus remoteRoot;
|
||||||
|
|
||||||
|
private Map _resourceMap;
|
||||||
|
|
||||||
// The QualifiedName that is used to persist the location across workspace
|
// The QualifiedName that is used to persist the location across workspace
|
||||||
// as a persistent property on a resource
|
// as a persistent property on a resource
|
||||||
private static QualifiedName FILESYSTEM_REPO_LOC = new QualifiedName(RSESyncUtils.PLUGIN_ID, "disk_location"); //$NON-NLS-1$
|
private static QualifiedName FILESYSTEM_REPO_LOC = new QualifiedName(RSESyncUtils.PLUGIN_ID, "disk_location"); //$NON-NLS-1$
|
||||||
|
@ -89,6 +95,12 @@ public class FileSystemProvider extends RepositoryProvider {
|
||||||
*/
|
*/
|
||||||
public FileSystemProvider() {
|
public FileSystemProvider() {
|
||||||
super();
|
super();
|
||||||
|
_resourceMap = new HashMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
_resourceMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,11 +147,11 @@ public class FileSystemProvider extends RepositoryProvider {
|
||||||
* be stored.
|
* be stored.
|
||||||
* @throws TeamException
|
* @throws TeamException
|
||||||
*/
|
*/
|
||||||
public void setTargetLocation(String location) throws TeamException {
|
public void setRemoteLocation(String location) throws TeamException {
|
||||||
// location = transformRSEtoNormal(location);
|
// location = transformRSEtoNormal(location);
|
||||||
|
|
||||||
// set the instance variable to the provided path
|
// set the instance variable to the provided path
|
||||||
rootPath = new Path(location);
|
remoteRootPath = new Path(location);
|
||||||
|
|
||||||
// ensure that the location is a folder (if it exists)
|
// ensure that the location is a folder (if it exists)
|
||||||
File file = new File(location);
|
File file = new File(location);
|
||||||
|
@ -156,6 +168,10 @@ public class FileSystemProvider extends RepositoryProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLocalLocation(IPath location){
|
||||||
|
localRootPath = location;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the folder in the file system to which the provider is connected.
|
* Returns the folder in the file system to which the provider is connected.
|
||||||
* Return <code>null</code> if there is no location or there was a problem
|
* Return <code>null</code> if there is no location or there was a problem
|
||||||
|
@ -163,14 +179,14 @@ public class FileSystemProvider extends RepositoryProvider {
|
||||||
*
|
*
|
||||||
* @return IPath The path to the root of the repository.
|
* @return IPath The path to the root of the repository.
|
||||||
*/
|
*/
|
||||||
public IPath getRoot() {
|
public IPath getRemoteRoot() {
|
||||||
if (rootPath == null) {
|
if (remoteRootPath == null) {
|
||||||
try {
|
try {
|
||||||
String location = getProject().getPersistentProperty(FILESYSTEM_REPO_LOC);
|
String location = getProject().getPersistentProperty(FILESYSTEM_REPO_LOC);
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
rootPath = new Path(location);
|
remoteRootPath = new Path(location);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// log the problem and carry on
|
// log the problem and carry on
|
||||||
FileSystemPlugin.log(e);
|
FileSystemPlugin.log(e);
|
||||||
|
@ -178,7 +194,7 @@ public class FileSystemProvider extends RepositoryProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// System.out.println(root);
|
// System.out.println(root);
|
||||||
return rootPath;
|
return remoteRootPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -264,39 +280,56 @@ public class FileSystemProvider extends RepositoryProvider {
|
||||||
* @return the file that the resource maps to.
|
* @return the file that the resource maps to.
|
||||||
*/
|
*/
|
||||||
public File getExportFile(IResource resource) {
|
public File getExportFile(IResource resource) {
|
||||||
UniFilePlus file = null;
|
UniFilePlus file = (UniFilePlus)_resourceMap.get(resource);
|
||||||
try {
|
//if (file == null)
|
||||||
if (resource.getProject().equals(getProject())) {
|
{
|
||||||
UniFilePlus root = getRemoteRootFolder();
|
try {
|
||||||
String relativePath = transformInDependency(root.getRemoteFile().getHost(), resource.getFullPath().toString());
|
if (resource.getProject().equals(getProject())) {
|
||||||
// MOB BUGBUG//IRemoteFile remoteFile =
|
UniFilePlus root = getRemoteRootFolder();
|
||||||
// root.getRemoteFile().getParentRemoteFileSubSystem
|
|
||||||
// ().getRemoteFileObject(root.getRemoteFile(),relativePath,
|
|
||||||
// null);
|
|
||||||
IRemoteFile remoteFile = root.getRemoteFile().getParentRemoteFileSubSystem().getRemoteFileObject(root.getRemoteFile().getAbsolutePath() + relativePath, null);
|
|
||||||
file = new UniFilePlus(remoteFile);
|
|
||||||
|
|
||||||
|
String relativePath = transformInDependency(root.getRemoteFile().getHost(), resource.getFullPath().toString());
|
||||||
|
|
||||||
|
|
||||||
|
// MOB BUGBUG//IRemoteFile remoteFile =
|
||||||
|
// root.getRemoteFile().getParentRemoteFileSubSystem
|
||||||
|
// ().getRemoteFileObject(root.getRemoteFile(),relativePath,
|
||||||
|
// null);
|
||||||
|
|
||||||
|
String path = root.getRemoteFile().getAbsolutePath() + relativePath;
|
||||||
|
IRemoteFile remoteFile = root.getRemoteFile().getParentRemoteFileSubSystem().getRemoteFileObject(path,null);
|
||||||
|
//String remotePath = root.getAbsolutePath() + root.getRemoteFile().getParentRemoteFileSubSystem().getSeparatorChar() + resource.getName();
|
||||||
|
//IRemoteFile remoteFile = root.getRemoteFile().getParentRemoteFileSubSystem().getRemoteFileObject(remotePath, null);
|
||||||
|
file = new UniFilePlus(remoteFile);
|
||||||
|
_resourceMap.put(resource, file);
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (SystemMessageException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (SystemMessageException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getImportFile(IResource resource){
|
public File getImportFile(IResource resource){
|
||||||
UniFilePlus file = null;
|
UniFilePlus file = (UniFilePlus)_resourceMap.get(resource);
|
||||||
try {
|
//if (file == null){
|
||||||
if (resource.getProject().equals(getProject())) {
|
{
|
||||||
UniFilePlus root = getRemoteRootFolder();
|
try {
|
||||||
String relativePath = transformInDependency(root.getRemoteFile().getHost(), IPath.SEPARATOR + resource.getProjectRelativePath().toString());
|
if (resource.getProject().equals(getProject())) {
|
||||||
IRemoteFile remoteFile = root.getRemoteFile().getParentRemoteFileSubSystem().getRemoteFileObject(root.getRemoteFile().getAbsolutePath() + relativePath, null);
|
UniFilePlus root = getRemoteRootFolder();
|
||||||
file = new UniFilePlus(remoteFile);
|
String relativePath = transformInDependency(root.getRemoteFile().getHost(), resource.getFullPath().toString());
|
||||||
|
//String relativePath = transformInDependency(root.getRemoteFile().getHost(), IPath.SEPARATOR + resource.getProjectRelativePath().toString());
|
||||||
|
|
||||||
|
String path = root.getRemoteFile().getAbsolutePath() + relativePath;
|
||||||
|
IRemoteFile remoteFile = root.getRemoteFile().getParentRemoteFileSubSystem().getRemoteFileObject(path, null);
|
||||||
|
file = new UniFilePlus(remoteFile);
|
||||||
|
_resourceMap.put(resource, file);
|
||||||
|
}
|
||||||
|
} catch (SystemMessageException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (SystemMessageException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
@ -356,7 +389,7 @@ public class FileSystemProvider extends RepositoryProvider {
|
||||||
*/
|
*/
|
||||||
public UniFilePlus getRemoteRootFolder() {
|
public UniFilePlus getRemoteRootFolder() {
|
||||||
if (remoteRoot == null) {
|
if (remoteRoot == null) {
|
||||||
IPath remoteRootDir = getRoot();
|
IPath remoteRootDir = getRemoteRoot();
|
||||||
String remoteRootDirString = transformRSEtoNormal(remoteRootDir.toString());
|
String remoteRootDirString = transformRSEtoNormal(remoteRootDir.toString());
|
||||||
IHost conn = Utilities.parseForSystemConnection(remoteRootDir.toString());
|
IHost conn = Utilities.parseForSystemConnection(remoteRootDir.toString());
|
||||||
String absolutePath = transformInDependency(conn, remoteRootDirString);
|
String absolutePath = transformInDependency(conn, remoteRootDirString);
|
||||||
|
@ -374,6 +407,29 @@ public class FileSystemProvider extends RepositoryProvider {
|
||||||
} else {
|
} else {
|
||||||
ret = original.replace("\\", "/");
|
ret = original.replace("\\", "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// make sure the mapping corresponds to the correct local location
|
||||||
|
if (localRootPath != null){
|
||||||
|
String[] lsegs = localRootPath.segments();
|
||||||
|
String[] rsegs = ret.substring(1).split("/");
|
||||||
|
|
||||||
|
// relative path should not start with the localRoot path
|
||||||
|
StringBuffer newPath = new StringBuffer();
|
||||||
|
for (int i = 0; i < rsegs.length; i++){
|
||||||
|
if (lsegs.length > i){
|
||||||
|
if (!lsegs[i].equals(rsegs[i])){
|
||||||
|
newPath.append("/");
|
||||||
|
newPath.append(rsegs[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
newPath.append("/");
|
||||||
|
newPath.append(rsegs[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret = newPath.toString();
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 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
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemRemoteTree
|
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemRemoteTree
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.synchronize.filesystem.subscriber;
|
package org.eclipse.rse.internal.synchronize.filesystem.subscriber;
|
||||||
|
|
||||||
|
@ -71,4 +72,7 @@ public class FileSystemRemoteTree extends ThreeWayRemoteTree {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 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
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemResourceVariant
|
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemResourceVariant
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.synchronize.filesystem.subscriber;
|
package org.eclipse.rse.internal.synchronize.filesystem.subscriber;
|
||||||
|
@ -171,4 +172,15 @@ public class FileSystemResourceVariant extends CachedResourceVariant {
|
||||||
return ioFile;
|
return ioFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long lastModified(){
|
||||||
|
return ioFile.lastModified();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString(){
|
||||||
|
return ioFile.getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void synchRemoteFile() {
|
||||||
|
ioFile.synchRemoteFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 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
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemSubscriber
|
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemSubscriber
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.synchronize.filesystem.subscriber;
|
package org.eclipse.rse.internal.synchronize.filesystem.subscriber;
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ import org.eclipse.core.runtime.QualifiedName;
|
||||||
import org.eclipse.rse.internal.synchronize.RSEResourceVariantComparator;
|
import org.eclipse.rse.internal.synchronize.RSEResourceVariantComparator;
|
||||||
import org.eclipse.rse.internal.synchronize.RSESyncUtils;
|
import org.eclipse.rse.internal.synchronize.RSESyncUtils;
|
||||||
import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
|
import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
|
||||||
|
import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
|
||||||
import org.eclipse.team.core.RepositoryProvider;
|
import org.eclipse.team.core.RepositoryProvider;
|
||||||
import org.eclipse.team.core.TeamException;
|
import org.eclipse.team.core.TeamException;
|
||||||
import org.eclipse.team.core.synchronize.SyncInfo;
|
import org.eclipse.team.core.synchronize.SyncInfo;
|
||||||
|
@ -30,6 +32,7 @@ import org.eclipse.team.core.variants.IResourceVariant;
|
||||||
import org.eclipse.team.core.variants.ThreeWayRemoteTree;
|
import org.eclipse.team.core.variants.ThreeWayRemoteTree;
|
||||||
import org.eclipse.team.core.variants.ThreeWaySubscriber;
|
import org.eclipse.team.core.variants.ThreeWaySubscriber;
|
||||||
import org.eclipse.team.core.variants.ThreeWaySynchronizer;
|
import org.eclipse.team.core.variants.ThreeWaySynchronizer;
|
||||||
|
import org.eclipse.team.internal.core.mapping.LocalResourceVariant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is an example file system subscriber that overrides ThreeWaySubscriber.
|
* This is an example file system subscriber that overrides ThreeWaySubscriber.
|
||||||
|
@ -148,8 +151,36 @@ public class FileSystemSubscriber extends ThreeWaySubscriber {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected SyncInfo getSyncInfo(IResource local, IResourceVariant base, IResourceVariant remote) throws TeamException {
|
protected SyncInfo getSyncInfo(IResource local, IResourceVariant base, IResourceVariant remote) throws TeamException {
|
||||||
// Override to use a custom sync info
|
|
||||||
// FileSystemSyncInfo info = new FileSystemSyncInfo(local, base, remote, this.getResourceComparator());
|
FileSystemResourceVariant rv = null;
|
||||||
|
|
||||||
|
if (remote instanceof FileSystemResourceVariant){
|
||||||
|
rv = (FileSystemResourceVariant)remote;
|
||||||
|
rv.synchRemoteFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (base == null && local.exists()){
|
||||||
|
base = remote;
|
||||||
|
}
|
||||||
|
if (base != null) {
|
||||||
|
boolean exists = rv.getFile().remoteFile.exists();
|
||||||
|
if (!exists){
|
||||||
|
base = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
if (rv != null){
|
||||||
|
long remoteModificationTime = rv.lastModified();
|
||||||
|
SystemIFileProperties properties = new SystemIFileProperties(local);
|
||||||
|
long storedModificationTime = properties.getRemoteFileTimeStamp();
|
||||||
|
|
||||||
|
if (remoteModificationTime > storedModificationTime){
|
||||||
|
base = new LocalResourceVariant(local);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileSystemSyncInfo info = new FileSystemSyncInfo(local, base, remote, new RSEResourceVariantComparator(getSynchronizer()));
|
FileSystemSyncInfo info = new FileSystemSyncInfo(local, base, remote, new RSEResourceVariantComparator(getSynchronizer()));
|
||||||
info.init();
|
info.init();
|
||||||
return info;
|
return info;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 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
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemSyncInfo
|
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemSyncInfo
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.synchronize.filesystem.subscriber;
|
package org.eclipse.rse.internal.synchronize.filesystem.subscriber;
|
||||||
|
|
||||||
|
@ -42,7 +43,13 @@ public class FileSystemSyncInfo extends SyncInfo {
|
||||||
return IN_SYNC;
|
return IN_SYNC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.calculateKind();
|
int kind = super.calculateKind();
|
||||||
|
if ((kind & SyncInfo.PSEUDO_CONFLICT) != 0){
|
||||||
|
kind = IN_SYNC;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2008 IBM Corporation and others.
|
* Copyright (c) 2005, 2009 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
|
||||||
|
@ -8,9 +8,11 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / GetOperation
|
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / GetOperation
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.synchronize.filesystem.ui;
|
package org.eclipse.rse.internal.synchronize.filesystem.ui;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.mapping.ResourceTraversal;
|
import org.eclipse.core.resources.mapping.ResourceTraversal;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
@ -51,6 +53,9 @@ public class GetOperation extends FileSystemOperation {
|
||||||
if (!isOverwriteOutgoing() && hasIncomingChanges(traversals)) {
|
if (!isOverwriteOutgoing() && hasIncomingChanges(traversals)) {
|
||||||
throw new TeamException("Could not get all changes due to conflicts.");
|
throw new TeamException("Could not get all changes due to conflicts.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provider.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2008 IBM Corporation and others.
|
* Copyright (c) 2005, 2009 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
|
||||||
|
@ -8,15 +8,21 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / PutOperation
|
* Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / PutOperation
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.synchronize.filesystem.ui;
|
package org.eclipse.rse.internal.synchronize.filesystem.ui;
|
||||||
|
|
||||||
import org.eclipse.core.resources.mapping.ResourceTraversal;
|
import org.eclipse.core.resources.mapping.ResourceTraversal;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.rse.core.RSECorePlugin;
|
||||||
|
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
|
||||||
|
import org.eclipse.rse.core.events.SystemResourceChangeEvent;
|
||||||
|
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||||
import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
|
import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
|
||||||
import org.eclipse.rse.internal.synchronize.filesystem.Policy;
|
import org.eclipse.rse.internal.synchronize.filesystem.Policy;
|
||||||
import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemSubscriber;
|
import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemSubscriber;
|
||||||
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
import org.eclipse.team.core.diff.IDiff;
|
import org.eclipse.team.core.diff.IDiff;
|
||||||
import org.eclipse.team.core.diff.IDiffVisitor;
|
import org.eclipse.team.core.diff.IDiffVisitor;
|
||||||
import org.eclipse.team.core.diff.IThreeWayDiff;
|
import org.eclipse.team.core.diff.IThreeWayDiff;
|
||||||
|
@ -54,6 +60,18 @@ public class PutOperation extends FileSystemOperation {
|
||||||
@Override
|
@Override
|
||||||
protected void execute(FileSystemProvider provider, ResourceTraversal[] traversals, IProgressMonitor monitor) throws CoreException {
|
protected void execute(FileSystemProvider provider, ResourceTraversal[] traversals, IProgressMonitor monitor) throws CoreException {
|
||||||
provider.getOperations().checkin(traversals, isOverwriteIncoming(), monitor);
|
provider.getOperations().checkin(traversals, isOverwriteIncoming(), monitor);
|
||||||
|
|
||||||
|
// refresh RSE
|
||||||
|
IRemoteFile rootFolder = provider.getRemoteRootFolder().getRemoteFile();
|
||||||
|
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
|
||||||
|
|
||||||
|
try {
|
||||||
|
rootFolder = rootFolder.getParentRemoteFileSubSystem().getRemoteFileObject(rootFolder.getAbsolutePath(), monitor);
|
||||||
|
rootFolder.markStale(true);
|
||||||
|
sr.fireEvent(new SystemResourceChangeEvent(rootFolder, ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, rootFolder.getAbsolutePath()));
|
||||||
|
}
|
||||||
|
catch (Exception e){}
|
||||||
|
|
||||||
// if (!isOverwriteIncoming() && hasOutgoingChanges(traversals)) {
|
// if (!isOverwriteIncoming() && hasOutgoingChanges(traversals)) {
|
||||||
// throw new
|
// throw new
|
||||||
// TeamException("Could not put all changes due to conflicts.");
|
// TeamException("Could not put all changes due to conflicts.");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008 Takuya Miyamoto and others.
|
* Copyright (c) 2008, 2009 Takuya Miyamoto 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
|
||||||
|
@ -7,16 +7,22 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Takuya Miyamoto - initial API and implementation
|
* Takuya Miyamoto - initial API and implementation
|
||||||
|
* David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.internal.synchronize.provisional;
|
package org.eclipse.rse.internal.synchronize.provisional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IContainer;
|
||||||
|
import org.eclipse.core.resources.IFolder;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.rse.internal.importexport.files.UniFilePlus;
|
import org.eclipse.rse.internal.importexport.files.UniFilePlus;
|
||||||
import org.eclipse.rse.internal.synchronize.ISynchronizeData;
|
import org.eclipse.rse.internal.synchronize.ISynchronizeData;
|
||||||
import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
|
import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
|
||||||
|
@ -44,6 +50,12 @@ public class Synchronizer implements ISynchronizer {
|
||||||
|
|
||||||
for (IResource resource : elements) {
|
for (IResource resource : elements) {
|
||||||
projectSet.add(resource.getProject());
|
projectSet.add(resource.getProject());
|
||||||
|
if (!resource.exists()){
|
||||||
|
IContainer parent = resource.getParent();
|
||||||
|
if (!parent.exists()){
|
||||||
|
createEmptyFolders(parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get resources to synchronize in the type of Array.
|
// get resources to synchronize in the type of Array.
|
||||||
|
@ -66,11 +78,16 @@ public class Synchronizer implements ISynchronizer {
|
||||||
IProject project = projects[i];
|
IProject project = projects[i];
|
||||||
connector.connect(project);
|
connector.connect(project);
|
||||||
FileSystemProvider provider = (FileSystemProvider) RepositoryProvider.getProvider(project);
|
FileSystemProvider provider = (FileSystemProvider) RepositoryProvider.getProvider(project);
|
||||||
String destination = data.getDestination();
|
provider.reset();
|
||||||
provider.setTargetLocation(data.getDestination());
|
String remoteLocation = data.getRemoteLocation();
|
||||||
|
IPath localLocation = data.getLocalLocation();
|
||||||
|
provider.setRemoteLocation(remoteLocation);
|
||||||
|
provider.setLocalLocation(localLocation);
|
||||||
this.remoteRoot = provider.getRemoteRootFolder();
|
this.remoteRoot = provider.getRemoteRootFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// run actual synchronize operation.
|
// run actual synchronize operation.
|
||||||
// TODO currently, not support last synchronization date.
|
// TODO currently, not support last synchronization date.
|
||||||
operation.synchronize(data.getElements(), remoteRoot.remoteFile, null, null, data.getSynchronizeType());
|
operation.synchronize(data.getElements(), remoteRoot.remoteFile, null, null, data.getSynchronizeType());
|
||||||
|
@ -82,4 +99,35 @@ public class Synchronizer implements ISynchronizer {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createEmptyFolders(IContainer container){
|
||||||
|
List emptyParent = new ArrayList();
|
||||||
|
boolean go = true;
|
||||||
|
|
||||||
|
IContainer empty = container;
|
||||||
|
|
||||||
|
//check to see which parent folders need to be created
|
||||||
|
while(go) {
|
||||||
|
if(!empty.exists() && empty instanceof IFolder){
|
||||||
|
emptyParent.add(empty);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
go=false;
|
||||||
|
}
|
||||||
|
empty = empty.getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
IFolder emptyFolder = null;
|
||||||
|
|
||||||
|
// create empty parent folders
|
||||||
|
for(int j=emptyParent.size()-1;j>=0;j--){
|
||||||
|
emptyFolder = (IFolder) emptyParent.get(j);
|
||||||
|
if(!emptyFolder.exists()){
|
||||||
|
try {
|
||||||
|
emptyFolder.create(true, true, new NullProgressMonitor());
|
||||||
|
}
|
||||||
|
catch (CoreException e){}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue