diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/propertypages/SystemFilePropertyPage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/propertypages/SystemFilePropertyPage.java
index 6d951d1c649..80d2b842279 100644
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/propertypages/SystemFilePropertyPage.java
+++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/propertypages/SystemFilePropertyPage.java
@@ -33,6 +33,7 @@ import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
@@ -52,9 +53,15 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
//protected Button cbReadablePrompt, cbWritablePrompt;
protected Button cbReadonlyPrompt, cbHiddenPrompt;
protected Label labelName, labelType, labelPath, labelSize, labelModified, labelReadable, labelWritable, labelHidden;
+ protected Button inheritedEncodingButton, otherEncodingButton;
+ protected Combo otherEncodingCombo;
protected String errorMessage;
protected boolean initDone = false;
protected boolean wasReadOnly = false;
+
+ private boolean encodingFieldAdded = false;
+ private String defaultEncoding = null;
+ private boolean isValidBefore = true;
/**
* Constructor for SystemFilterPropertyPage
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/files/DStoreFileService.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/files/DStoreFileService.java
index 682f2abe5c0..bebca2357d5 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/files/DStoreFileService.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/files/DStoreFileService.java
@@ -61,6 +61,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
private int _bufferUploadSize = IUniversalDataStoreConstants.BUFFER_SIZE;
private int _bufferDownloadSize = IUniversalDataStoreConstants.BUFFER_SIZE;
protected ISystemFileTypes _fileTypeRegistry;
+ private String remoteEncoding;
private static String _percentMsg = SystemMessage.sub(SystemMessage.sub(SystemMessage.sub(ServiceResources.DStore_Service_Percent_Complete_Message, "&0", "{0}"), "&1", "{1}"), "&2", "{2}"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
@@ -1274,6 +1275,26 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
return false;
}
+ /**
+ * Queries the remote system for the platform encoding.
+ * @see org.eclipse.rse.services.files.IFileService#getEncoding(org.eclipse.core.runtime.IProgressMonitor)
+ * @since 2.0
+ */
+ public String getEncoding(IProgressMonitor monitor) throws SystemMessageException {
+
+ if (remoteEncoding == null) {
+
+ DataStore ds = getDataStore();
+ DataElement encodingElement = ds.createObject(null, UNIVERSAL_TEMP_DESCRIPTOR, ""); //$NON-NLS-1$
+ DataElement queryCmd = ds.localDescriptorQuery(encodingElement.getDescriptor(), C_SYSTEM_ENCODING);
+
+ DataElement status = ds.command(queryCmd, encodingElement, true);
+
+ remoteEncoding = encodingElement.getValue();
+ }
+
+ return remoteEncoding;
+ }
}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/files/LocalFileService.java b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/files/LocalFileService.java
index d4d92c590ac..d7172dd9c24 100644
--- a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/files/LocalFileService.java
+++ b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/services/local/files/LocalFileService.java
@@ -88,8 +88,6 @@ public class LocalFileService extends AbstractFileService implements IFileServic
public LocalFileService(ISystemFileTypes fileTypeRegistry)
{
-
-
_fileTypeRegistry = fileTypeRegistry;
}
diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/AbstractFileService.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/AbstractFileService.java
index 3044c7269ee..bfb21115cd4 100644
--- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/AbstractFileService.java
+++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/AbstractFileService.java
@@ -93,6 +93,13 @@ public abstract class AbstractFileService implements IFileService
}
return ok;
}
-
-
+
+ /**
+ * Returns the local platform encoding by default. Subclasses should override to return the actual remote encoding.
+ * @see org.eclipse.rse.services.files.IFileService#getEncoding(org.eclipse.core.runtime.IProgressMonitor)
+ * @since 2.0
+ */
+ public String getEncoding(IProgressMonitor monitor) throws SystemMessageException {
+ return System.getProperty("file.encoding");
+ }
}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/IFileService.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/IFileService.java
index e6d48513fa2..5da6a8e5c8a 100644
--- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/IFileService.java
+++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/IFileService.java
@@ -284,4 +284,13 @@ public interface IFileService extends IService
* @return true if the readonly permission was changed successfully
*/
public boolean setReadOnly(IProgressMonitor monitor, String parent, String name, boolean readOnly) throws SystemMessageException;
+
+ /**
+ * Gets the remote encoding.
+ * @param monitor the progress monitor.
+ * @return the encoding.
+ * @throws SystemMessageException if an error occurs.
+ * @since 2.0
+ */
+ public String getEncoding(IProgressMonitor monitor) throws SystemMessageException;
}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java
index 5b0536cdbfe..b117ad9b611 100644
--- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java
+++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java
@@ -118,13 +118,6 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
{
return _hostFileToRemoteFileAdapter;
}
-
-
-
- public String getRemoteEncoding()
- {
- return System.getProperty("file.encoding"); //$NON-NLS-1$
- }
public void setHostFileToRemoteFileAdapter(IHostFileToRemoteFileAdapter hostFileAdapter)
{
@@ -899,4 +892,22 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
_userHome = null;
}
-}
\ No newline at end of file
+ /**
+ * Returns the encoding from the file service being used by this subsystem.
+ * @see RemoteFileSubSystem#getRemoteEncoding()
+ */
+ public String getRemoteEncoding() {
+ String encoding = null;
+
+ try {
+ encoding = getFileService().getEncoding(null);
+ }
+ catch (SystemMessageException e) {
+ SystemMessageDialog dlg = new SystemMessageDialog(getShell(), e.getSystemMessage());
+ dlg.open();
+ encoding = super.getRemoteEncoding();
+ }
+
+ return encoding;
+ }
+}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java
index 6aff0ab722f..2854ab5aa99 100644
--- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java
+++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java
@@ -212,14 +212,30 @@ public interface IRemoteFileSubSystem extends ISubSystem{
* Given a folder or file, return its parent folder name, fully qualified
* @param folderOrFile folder or file to return parent of.
*/
- public String getParentFolderName(IRemoteFile folderOrFile);
+ public String getParentFolderName(IRemoteFile folderOrFile);
+
+ /**
+ * Returns whether the file subsystem supports encodings. There are file subsystems that deal with codepages and encodings
+ * using other mechanisms besides encodings, and such platforms should return false
. Other file subsystems
+ * may not deal with encodings at all.
+ * @return true if the file subsystem supports encodings, false
otherwise.
+ * @since 2.0
+ */
+ public boolean supportsEncoding();
/**
- * Get the default encoding of the target system
- * @return the encoding
+ * Returns the encoding of the remote system.
+ * @return the encoding of the remote system.
*/
public String getRemoteEncoding();
+ /**
+ * Returns the encoding of the file with the remote path.
+ * @param remotePath the remote path of the file.
+ * @return the encoding of the remote file.
+ */
+ // public String getEncoding(String remotePath);
+
/**
* Given a set of fully qualified file or folder names, return an ISystemResourceSet object for it.
* @param folderOrFileNames Fully qualified folder or file names
diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java
index f43d12153b6..4a7e9d27d43 100644
--- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java
+++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java
@@ -1742,8 +1742,6 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
return null;
}
-
-
/**
* @deprecated
*/
@@ -1752,4 +1750,21 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
// TODO Auto-generated method stub
}
+
+ /**
+ * Returns true
by default. Subclasses should override if they do not support encodings.
+ * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#supportsEncoding()
+ * @since 2.0
+ */
+ public boolean supportsEncoding() {
+ return true;
+ }
+
+ /**
+ * Returns the local platform encoding by default. Subclasses should override to return the actual remote encoding.
+ * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#getRemoteEncoding()
+ */
+ public String getRemoteEncoding() {
+ return System.getProperty("file.encoding");
+ }
}
\ No newline at end of file