1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-02 22:55:26 +02:00

[272708] [import/export] fix various bugs with the synchronization support

-added warning message for user who is about to disconnect from an existing team provider
This commit is contained in:
David McKnight 2009-04-28 15:32:36 +00:00
parent d1c500e76b
commit 13f77d87d0
3 changed files with 30 additions and 1 deletions

View file

@ -78,6 +78,8 @@ public class SystemImportExportResources extends NLS {
public static String RESID_SYNCHRONIZE_ACTIONS_MERGE_LABEL;
public static String RESID_SYNCHRONIZE_ACTIONS_MERGE_ALL_LABEL;
public static String RESID_SYNCHRONIZE_DISCONNECT_WARNING;
static {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, SystemImportExportResources.class);

View file

@ -98,3 +98,7 @@ RESID_SYNCHRONIZE_ACTIONS_GET_LABEL=Get
RESID_SYNCHRONIZE_ACTIONS_GET_ALL_LABEL=Get All
RESID_SYNCHRONIZE_ACTIONS_MERGE_LABEL=Merge
RESID_SYNCHRONIZE_ACTIONS_MERGE_ALL_LABEL=Merge All
RESID_SYNCHRONIZE_DISCONNECT_WARNING=This operation will remove previous team sharing settings you had with {0}. Are you sure you want to do this?

View file

@ -22,10 +22,18 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
import org.eclipse.rse.internal.importexport.SystemImportExportResources;
import org.eclipse.rse.internal.importexport.files.UniFilePlus;
import org.eclipse.rse.internal.synchronize.ISynchronizeData;
import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.messages.SystemMessageDialog;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
@ -68,7 +76,22 @@ public class Synchronizer implements ISynchronizer {
data.getSynchronizeType() == ISynchronizeOperation.SYNC_MODE_OVERRIDE_SOURCE ||
data.getSynchronizeType() == ISynchronizeOperation.SYNC_MODE_UI_REVIEW_INITIAL) {
for (int i = 0; i < projects.length; i++) {
connector.disconnect(projects[i]);
IProject project = projects[i];
// user should be prompted before disconnect or he/she will lose team synch info
if (connector.isConnected(project)){
String msg = NLS.bind(SystemImportExportResources.RESID_SYNCHRONIZE_DISCONNECT_WARNING, project.getName());
SystemMessage msgObj = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID, IStatus.WARNING, msg);
SystemMessageDialog dlg = new SystemMessageDialog(SystemBasePlugin.getActiveWorkbenchShell(), msgObj);
if (dlg.openQuestionNoException(true)){
connector.disconnect(project);
}
else {
return false;
}
}
}
}