mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
[226574][api] Add ISubSystemConfiguration#supportsEncoding()
This commit is contained in:
parent
bfbabda969
commit
56237a00c6
4 changed files with 197 additions and 117 deletions
|
@ -16,6 +16,7 @@
|
|||
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
|
||||
* Martin Oberhuber (Wind River) - [218655][api] Provide SystemType enablement info in non-UI
|
||||
* Martin Oberhuber (Wind River) - [cleanup] Add API "since" Javadoc tags
|
||||
* Martin Oberhuber (Wind River) - [226574][api] Add ISubSystemConfiguration#supportsEncoding()
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.core;
|
||||
|
@ -23,6 +24,7 @@ package org.eclipse.rse.core;
|
|||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.model.ISystemProfile;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||
import org.eclipse.rse.internal.core.model.SystemHostPool;
|
||||
import org.osgi.framework.Bundle;
|
||||
|
||||
|
@ -197,6 +199,26 @@ public interface IRSESystemType extends IAdaptable {
|
|||
*/
|
||||
public static final String PROPERTY_IS_CASE_SENSITIVE = "isCaseSensitive"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* System type Property Key (value: "supportsEncoding") indicating whether a
|
||||
* given system type supports the user specifying an encoding to use for
|
||||
* translating binary data to Java Unicode Strings when working on
|
||||
* subsystems.
|
||||
*
|
||||
* It is up to the subsystems registered against a given system type whether
|
||||
* they observe the system type's setting or not; the default
|
||||
* implementations do observe it. Given that all subsystem configurations
|
||||
* registered against a given system type do not support encodings, the
|
||||
* corresponding RSE controls for allowing the user to change encodings will
|
||||
* be disabled.
|
||||
*
|
||||
* Expected default value of this Property is "true" if not set.
|
||||
*
|
||||
* @see ISubSystemConfiguration#supportsEncoding(IHost)
|
||||
* @since org.eclipse.rse.core 3.0
|
||||
*/
|
||||
public static final String PROPERTY_SUPPORTS_ENCODING = "supportsEncoding"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Returns the id of the system type.
|
||||
* @return the id of the system type
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
|
||||
* Martin Oberhuber (Wind River) - [cleanup] Add API "since" Javadoc tags
|
||||
* David Dykstal (IBM) - [168976][api] move ISystemNewConnectionWizardPage from core to UI
|
||||
* Martin Oberhuber (Wind River) - [226574][api] Add ISubSystemConfiguration#supportsEncoding()
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.core.subsystems;
|
||||
|
@ -65,6 +66,41 @@ public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvide
|
|||
// ---------------------------------
|
||||
// CRITICAL METHODS...
|
||||
// ---------------------------------
|
||||
|
||||
/**
|
||||
* Test whether subsystems managed by this configuration support custom
|
||||
* encodings.
|
||||
*
|
||||
* Encodings specify the way how binary data on the remote system is
|
||||
* translated into Java Unicode Strings. RSE provides some means for the
|
||||
* User to specify a particular encoding to use; typically, all subsystems
|
||||
* that do support custom encodings specified should use the same encoding
|
||||
* such that they can interoperate. Therefore, encodings are usually
|
||||
* obtained from {@link IHost#getDefaultEncoding(boolean)}.
|
||||
*
|
||||
* It's possible, however, that a particular subsystem "knows" that its
|
||||
* resources are always encoded in a particular way, and there is no
|
||||
* possibility to ever change that. The Subsystem Configuration would return
|
||||
* <code>false</code> here in this case. Another possibility is that
|
||||
* encodings for a particular subsystem can be changed, but in a way that's
|
||||
* different than what RSE usually does. The default case, however, should
|
||||
* be that subsystems fall back to the setting specified by the host or its
|
||||
* underlying system type such that existing subsystem configurations can be
|
||||
* re-used in an environment where the encoding to use is pre-defined by the
|
||||
* system type or host connection.
|
||||
*
|
||||
* If no subsystem registered against a given host supports encodings, the
|
||||
* corresponding UI controls on the IHost level are disabled in order to
|
||||
* avoid confusion to the user.
|
||||
*
|
||||
* @return <code>true<code> if the RSE mechanisms for specifying custom
|
||||
* encodings are observed and supported by the subsystems managed
|
||||
* by this configuration for the given host.
|
||||
* @see IRSESystemType#PROPERTY_SUPPORTS_ENCODING
|
||||
* @since org.eclipse.rse.core 3.0
|
||||
*/
|
||||
public boolean supportsEncoding(IHost host);
|
||||
|
||||
/**
|
||||
* Return true if the subsystem supports more than one filter string
|
||||
* <p>RETURNS true BY DEFAULT
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* David McKnight (IBM) - [209703] apply encoding and updating remote file when apply on property page
|
||||
* 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) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
||||
* Martin Oberhuber (Wind River) - [226574][api] Add ISubSystemConfiguration#supportsEncoding()
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.files.ui.propertypages;
|
||||
|
@ -41,6 +42,7 @@ import org.eclipse.osgi.util.NLS;
|
|||
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.IHost;
|
||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||
import org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile;
|
||||
import org.eclipse.rse.internal.files.ui.Activator;
|
||||
|
@ -203,8 +205,9 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
|
||||
// check if an encodings field should be added. Add only if the subsystem
|
||||
// indicates that it supports encodings
|
||||
if (file.getParentRemoteFileSubSystem().supportsEncoding()) {
|
||||
|
||||
IRemoteFileSubSystem subSys = file.getParentRemoteFileSubSystem();
|
||||
IHost host = subSys.getHost();
|
||||
if (subSys.getSubSystemConfiguration().supportsEncoding(host)) {
|
||||
SystemWidgetHelpers.createLabel(composite_prompts, "", 2); //$NON-NLS-1$
|
||||
|
||||
// encoding field
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
* Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
|
||||
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
|
||||
* David Dykstal (IBM) - [168976][api] move ISystemNewConnectionWizardPage from core to UI
|
||||
* Martin Oberhuber (Wind River) - [226574][api] Add ISubSystemConfiguration#supportsEncoding()
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.core.subsystems;
|
||||
|
@ -188,6 +189,24 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
|
|||
// CRITICAL METHODS...
|
||||
// ---------------------------------
|
||||
|
||||
/**
|
||||
* Test whether this subsystem configuration supports custom encodings. We
|
||||
* fall back to the setting provided by the host, or its underlying system
|
||||
* type by default.
|
||||
*
|
||||
* @see ISubSystemConfiguration#supportsEncoding(IHost)
|
||||
* @since org.eclipse.rse.core 3.0
|
||||
*/
|
||||
public boolean supportsEncoding(IHost host) {
|
||||
// support encodings by default
|
||||
boolean rv = true;
|
||||
if (host.getSystemType().testProperty(IRSESystemType.PROPERTY_SUPPORTS_ENCODING, false)) {
|
||||
// switched off on system type level
|
||||
rv = false;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if instance of this subsystem configuration's subsystems support connect and disconnect actions.
|
||||
* <b>By default, returns true</b>.
|
||||
|
|
Loading…
Add table
Reference in a new issue