[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tm-cvs-commit] dmcknight org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages SystemFilePropertyPage.java

Update of /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages
In directory dev1:/tmp/cvs-serv3304/src/org/eclipse/rse/internal/files/ui/propertypages

Modified Files:
      Tag: R3_2_maintenance
	SystemFilePropertyPage.java 
Log Message:
[373085] Changing the remote code page for a file transferred as text causes problems


Index: SystemFilePropertyPage.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/SystemFilePropertyPage.java,v
retrieving revision 1.23
retrieving revision 1.23.4.1
diff -C2 -d -r1.23 -r1.23.4.1
*** SystemFilePropertyPage.java	27 May 2008 21:31:03 -0000	1.23
--- SystemFilePropertyPage.java	5 Mar 2012 19:43:01 -0000	1.23.4.1
***************
*** 1,4 ****
  /*******************************************************************************
!  * Copyright (c) 2002, 2008 IBM Corporation and others.
   * All rights reserved. This program and the accompanying materials
   * are made available under the terms of the Eclipse Public License v1.0
--- 1,4 ----
  /*******************************************************************************
!  * Copyright (c) 2002, 2012 IBM Corporation and others.
   * All rights reserved. This program and the accompanying materials
   * are made available under the terms of the Eclipse Public License v1.0
***************
*** 29,32 ****
--- 29,33 ----
   * David McKnight   (IBM)        - [230001] Property page contains invalid values
   * David McKnight   (IBM)        - [199596] [refresh][ftp] Changing a file/folder's Read-Only attribute doesn't always update IRemoteFile
+  * David McKnight   (IBM)        - [373085] Changing the remote code page for a file transferred as text causes problems
   *******************************************************************************/
  
***************
*** 57,60 ****
--- 58,62 ----
  import org.eclipse.rse.services.files.RemoteFileIOException;
  import org.eclipse.rse.services.files.RemoteFileSecurityException;
+ import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
  import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
  import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
***************
*** 605,618 ****
  			}
  
! 
  			SystemEditableRemoteFile editable = new SystemEditableRemoteFile(remoteFile);
! 			if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN) {
  				IFile file = editable.getLocalResource();
! 				try {
! 					file.setCharset(selectedEncoding, null);
! 				} catch (CoreException e) {
  				}
  			}
! 
  		}
  
--- 607,638 ----
  			}
  
! 			boolean isBinary = remoteFile.isBinary();
  			SystemEditableRemoteFile editable = new SystemEditableRemoteFile(remoteFile);
! 			if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN) { // if the file is open								
  				IFile file = editable.getLocalResource();
! 				if (isBinary){ // if binary, then we just need to change the encoding of the IFile so the editor can load properly					
! 					try {
! 						file.setCharset(selectedEncoding, null);
! 					} catch (CoreException e) {
! 					}
! 				}
! 				else {
! 					// we need to re-download and convert the file
! 					SystemIFileProperties properties = new SystemIFileProperties(file);
! 					properties.setRemoteFileTimeStamp(0); // clear the timestamp - so we can re-download
! 					
! 					try { 
! 						editable.download(getShell());
! 					} catch (Exception e) {
! 						// TODO Auto-generated catch block
! 						e.printStackTrace();
! 					}
  				}
  			}
! 			 else if (!isBinary){
! 					// we need to re-download and convert the file
! 					SystemIFileProperties properties = new SystemIFileProperties(editable.getLocalResource());
! 					properties.setRemoteFileTimeStamp(0); // clear the timestamp - so we can re-download				
! 				}
  		}