mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 07:35:24 +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
|
@ -3,19 +3,20 @@
|
|||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* Uwe Stieber (Wind River) - Extended system type -> subsystemConfiguration association.
|
||||
* Martin Oberhuber (Wind River) - [185098] Provide constants for all well-known system types
|
||||
* 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
|
||||
|
@ -205,7 +227,7 @@ public interface IRSESystemType extends IAdaptable {
|
|||
|
||||
/**
|
||||
* Returns the translatable label for use in the UI.
|
||||
*
|
||||
*
|
||||
* @return The UI label or <code>null</code> if not set.
|
||||
*/
|
||||
public String getLabel();
|
||||
|
@ -213,7 +235,7 @@ public interface IRSESystemType extends IAdaptable {
|
|||
/**
|
||||
* Returns the name of the system type.
|
||||
* @return the name of the system type
|
||||
*
|
||||
*
|
||||
* @deprecated Use {@link #getId()} for accessing the unique id or {@link #getLabel()} for the UI label.
|
||||
*/
|
||||
public String getName();
|
||||
|
@ -227,7 +249,7 @@ public interface IRSESystemType extends IAdaptable {
|
|||
/**
|
||||
* Returns the property of this system type with the given key.
|
||||
* <code>null</code> is returned if there is no such key/value pair.
|
||||
*
|
||||
*
|
||||
* @param key the name of the property to return
|
||||
* @return the value associated with the given key or <code>null</code> if none
|
||||
*/
|
||||
|
@ -236,12 +258,12 @@ public interface IRSESystemType extends IAdaptable {
|
|||
/**
|
||||
* Tests whether the given boolean property matches the expected value
|
||||
* for this system type.
|
||||
*
|
||||
*
|
||||
* Clients can use their own properties with system types, but should
|
||||
* use reverse DNS notation to qualify their property keys (e.g.
|
||||
* <code>com.acme.isFoobarSystem</code>. Property keys without qualifying
|
||||
* namespace are reserved for RSE internal use.
|
||||
*
|
||||
*
|
||||
* @param key the name of the property to return
|
||||
* @param expectedValue the expected boolean value of the property.
|
||||
* @return <code>true</code> if the Property is set on the system type and
|
||||
|
@ -252,7 +274,7 @@ public interface IRSESystemType extends IAdaptable {
|
|||
|
||||
/**
|
||||
* Tests whether the system type is currently enabled.
|
||||
*
|
||||
*
|
||||
* The enabled state is a dynamic property of a system type, compared to the
|
||||
* static configuration by plugin markup. Enablement is a non-UI property,
|
||||
* which can be set by a Product in the Preferences or modified by a user to
|
||||
|
@ -261,7 +283,7 @@ public interface IRSESystemType extends IAdaptable {
|
|||
* Implementers of custom system types (which are registered by a
|
||||
* SystemTypeProvider) can override this method to provide more advanced
|
||||
* enabled checks e.g. based on license availability.
|
||||
*
|
||||
*
|
||||
* @return <code>true</code> if the system type is currently enabled, or
|
||||
* <code>false</code> otherwise.
|
||||
* @since org.eclipse.rse.core 3.0
|
||||
|
@ -303,7 +325,7 @@ public interface IRSESystemType extends IAdaptable {
|
|||
* Returns the bundle which is responsible for the definition of this system type.
|
||||
* Typically this is used as a base for searching for images and other files
|
||||
* that are needed in presenting the system type.
|
||||
*
|
||||
*
|
||||
* @return the bundle which defines this system type or <code>null</code> if none
|
||||
*/
|
||||
public Bundle getDefiningBundle();
|
||||
|
@ -317,7 +339,7 @@ public interface IRSESystemType extends IAdaptable {
|
|||
* <b>Note:</b> The list returned here does not imply that the corresponding
|
||||
* subsystem configurations exist. The list contains only possibilites not,
|
||||
* requirements.
|
||||
*
|
||||
*
|
||||
* @return The list of subsystem configuration id's. May be empty,
|
||||
* but never <code>null</code>.
|
||||
*/
|
||||
|
@ -326,7 +348,7 @@ public interface IRSESystemType extends IAdaptable {
|
|||
/**
|
||||
* Creates a new <code>IHost</code> object instance. This method is
|
||||
* called from {@link SystemHostPool#createHost(IRSESystemType, String, String, String, String, int)}.
|
||||
*
|
||||
*
|
||||
* @param profile The system profile to associate with the host.
|
||||
* @return A new <code>IHost</code> object instance.
|
||||
*/
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* David Dykstal (IBM) - 168870: move core function from UI to core
|
||||
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
||||
|
@ -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;
|
||||
|
@ -37,7 +38,7 @@ import org.eclipse.rse.services.IService;
|
|||
|
||||
/**
|
||||
* Subsystem Configuration interface.
|
||||
*
|
||||
*
|
||||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
* Subsystem configuration implementations must subclass
|
||||
* <code>SubSystemConfiguration</code> rather than implementing
|
||||
|
@ -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
|
||||
|
@ -154,22 +190,22 @@ public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvide
|
|||
|
||||
/**
|
||||
* Return true if deferred queries are supported.
|
||||
*
|
||||
*
|
||||
* Deferred queries work such that when a filter or element
|
||||
* children query is made, a WorkbenchJob is started to
|
||||
* perform the query in a background thread. The query can
|
||||
* take time to complete, but a negative side-effect of this
|
||||
* is that it will always take time to complete.
|
||||
*
|
||||
*
|
||||
* Alternative models can use asynchronous calls to populate
|
||||
* their model with data from the remote side, and refresh
|
||||
* the views when new data is in the model. Such subsystem
|
||||
* configurations should return <code>false</code> here.
|
||||
*
|
||||
*
|
||||
* The default implementation returns <code>true</code>, indicating
|
||||
* that deferred queries are supported for filters, and delegates
|
||||
* the check for model elements to the ISystemViewElementAdapter.
|
||||
*
|
||||
*
|
||||
* @return <code>true</code> if deferred queries are supported.
|
||||
*/
|
||||
public boolean supportsDeferredQueries();
|
||||
|
@ -179,7 +215,7 @@ public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvide
|
|||
* By default, the filter reference adapter treats a drop on a filter as an update to the list of filter
|
||||
* strings for a filter. For things like files, it is more desirable to treat the drop as a physical
|
||||
* resource copy, so in that case, custom drop makes sense.
|
||||
*
|
||||
*
|
||||
* By default this returns false.
|
||||
*/
|
||||
public boolean providesCustomDropInFilters();
|
||||
|
@ -403,7 +439,7 @@ public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvide
|
|||
* by a connector service manager known to this configuration. This must be
|
||||
* implemented by service subsystem configurations. Service subsystems allow
|
||||
* a connector service to be changed.
|
||||
*
|
||||
*
|
||||
* @param host the host for which to set this connector service.
|
||||
* @param connectorService the connector service associated with this host.
|
||||
* @since org.eclipse.rse.core 3.0
|
||||
|
@ -415,7 +451,7 @@ public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvide
|
|||
* configuration is not a service subsystem configuration it must return
|
||||
* <code>null</code>, otherwise it must return the interface class that
|
||||
* the underlying service layer implements.
|
||||
*
|
||||
*
|
||||
* @return an interface class that is implemented by the service layer used
|
||||
* by subsystems that have this configuration, or <code>null</code>
|
||||
* if this is not a service subsystem configuration.
|
||||
|
@ -429,7 +465,7 @@ public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvide
|
|||
* configuration then this must return <code>null</code>, otherwise it
|
||||
* must return the class that implements the interface specified in
|
||||
* {@link #getServiceType()}.
|
||||
*
|
||||
*
|
||||
* @return an implementation class that implements the interface specified
|
||||
* in {@link #getServiceType()}, or <code>null</code> if this is
|
||||
* not a service subsystem configuration.
|
||||
|
@ -442,7 +478,7 @@ public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvide
|
|||
* configuration is not a service subsystem this must return null. Otherwise
|
||||
* this must return the particular instance of the class returned by
|
||||
* {@link #getServiceImplType()} that is associated with this host instance.
|
||||
*
|
||||
*
|
||||
* @param host The host for which to retrieve the service.
|
||||
* @return The instance of {@link IService} which is associated with this
|
||||
* host, or <code>null</code> if this is not a service subsystem
|
||||
|
@ -542,7 +578,7 @@ public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvide
|
|||
/**
|
||||
* Get the filter pool manager for the given profile. A subsystem
|
||||
* configuration has a filter pool manager for each profile.
|
||||
*
|
||||
*
|
||||
* @param profile The system profile for which to get the manager.
|
||||
* @param force if true then create the default filters for this subsystem
|
||||
* configuration in this profile. This should only be done during
|
||||
|
@ -557,7 +593,7 @@ public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvide
|
|||
* configuration has a filter pool manager for each profile. Do not force
|
||||
* the creation of default filter pools. Fully equivalent to
|
||||
* getFilterPoolManager(profile, false).
|
||||
*
|
||||
*
|
||||
* @param profile The system profile for which to get the manager.
|
||||
* @return a filter pool manager
|
||||
*/
|
||||
|
@ -614,7 +650,7 @@ public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvide
|
|||
/**
|
||||
* Determines whether this factory is responsible for the creation of subsytems of the specified type
|
||||
* Subsystem factories should override this to indicate which subsystems they support.
|
||||
*
|
||||
*
|
||||
* @param subSystemType type of subsystem
|
||||
* @return whether this factory is for the specified subsystemtype
|
||||
*/
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
|
||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
||||
|
@ -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;
|
||||
|
@ -86,23 +88,23 @@ import com.ibm.icu.text.NumberFormat;
|
|||
public class SystemFilePropertyPage extends SystemBasePropertyPage
|
||||
implements SelectionListener
|
||||
{
|
||||
|
||||
protected Label labelNamePrompt, labelTypePrompt, labelPathPrompt, labelSizePrompt,
|
||||
|
||||
protected Label labelNamePrompt, labelTypePrompt, labelPathPrompt, labelSizePrompt,
|
||||
labelModifiedPrompt;
|
||||
//protected Button cbReadablePrompt, cbWritablePrompt;
|
||||
protected Button cbReadonlyPrompt, cbHiddenPrompt;
|
||||
protected Label labelName, labelType, labelPath, labelSize, labelModified, labelReadable, labelWritable, labelHidden;
|
||||
protected Button defaultEncodingButton, otherEncodingButton;
|
||||
protected Combo otherEncodingCombo;
|
||||
protected String errorMessage;
|
||||
protected String errorMessage;
|
||||
protected boolean initDone = false;
|
||||
protected boolean wasReadOnly = false;
|
||||
protected String prevEncoding;
|
||||
|
||||
|
||||
private boolean encodingFieldAdded = false;
|
||||
private String defaultEncoding = null;
|
||||
private boolean isValidBefore = true;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for SystemFilterPropertyPage
|
||||
*/
|
||||
|
@ -110,8 +112,8 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
{
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the page's GUI contents.
|
||||
*/
|
||||
|
@ -121,7 +123,7 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
|
||||
// Inner composite
|
||||
int nbrColumns = 2;
|
||||
Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
|
||||
Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
|
||||
|
||||
// Name display
|
||||
labelNamePrompt = SystemWidgetHelpers.createLabel(
|
||||
|
@ -170,12 +172,12 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
// Readonly display
|
||||
if (!file.isRoot())
|
||||
{
|
||||
if (file.showReadOnlyProperty())
|
||||
if (file.showReadOnlyProperty())
|
||||
{
|
||||
cbReadonlyPrompt = SystemWidgetHelpers.createCheckBox(
|
||||
composite_prompts, null, SystemFileResources.RESID_PP_FILE_READONLY_LABEL, SystemFileResources.RESID_PP_FILE_READONLY_TOOLTIP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// Readable display
|
||||
|
@ -200,13 +202,14 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
composite_prompts, null, SystemFileResources.RESID_PP_FILE_HIDDEN_LABEL, SystemFileResources.RESID_PP_FILE_HIDDEN_TOOLTIP);
|
||||
//((GridData)cbHiddenPrompt.getLayoutData()).horizontalSpan = nbrColumns;
|
||||
}
|
||||
|
||||
|
||||
// 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
|
||||
Group encodingGroup = SystemWidgetHelpers.createGroupComposite(composite_prompts, 2, SystemFileResources.RESID_PP_FILE_ENCODING_GROUP_LABEL);
|
||||
GridData data = new GridData();
|
||||
|
@ -216,32 +219,32 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
data.verticalAlignment = SWT.BEGINNING;
|
||||
data.grabExcessVerticalSpace = false;
|
||||
encodingGroup.setLayoutData(data);
|
||||
|
||||
|
||||
SelectionAdapter defaultButtonSelectionListener = new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
updateEncodingGroupState(defaultEncodingButton.getSelection());
|
||||
updateValidState();
|
||||
}
|
||||
};
|
||||
|
||||
// default encoding field
|
||||
|
||||
// default encoding field
|
||||
defaultEncoding = file.getParentRemoteFile().getEncoding();
|
||||
|
||||
|
||||
String defaultEncodingLabel = SystemFileResources.RESID_PP_FILE_ENCODING_DEFAULT_LABEL;
|
||||
int idx = defaultEncodingLabel.indexOf('%');
|
||||
|
||||
|
||||
if (idx != -1) {
|
||||
defaultEncodingLabel = defaultEncodingLabel.substring(0, idx) +
|
||||
defaultEncodingLabel = defaultEncodingLabel.substring(0, idx) +
|
||||
defaultEncoding +
|
||||
defaultEncodingLabel.substring(idx+2);
|
||||
}
|
||||
|
||||
|
||||
defaultEncodingButton = SystemWidgetHelpers.createRadioButton(encodingGroup, null, defaultEncodingLabel, SystemFileResources.RESID_PP_FILE_ENCODING_DEFAULT_TOOLTIP);
|
||||
data = new GridData();
|
||||
data.horizontalSpan = 2;
|
||||
defaultEncodingButton.setLayoutData(data);
|
||||
defaultEncodingButton.addSelectionListener(defaultButtonSelectionListener);
|
||||
|
||||
|
||||
Composite otherComposite = new Composite(encodingGroup, SWT.NONE);
|
||||
GridLayout otherLayout = new GridLayout();
|
||||
otherLayout.numColumns = 2;
|
||||
|
@ -252,14 +255,14 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
|
||||
// other encoding field
|
||||
otherEncodingButton = SystemWidgetHelpers.createRadioButton(otherComposite, null, SystemFileResources.RESID_PP_FILE_ENCODING_OTHER_LABEL, SystemFileResources.RESID_PP_FILE_ENCODING_OTHER_TOOLTIP);
|
||||
|
||||
|
||||
SelectionAdapter otherButtonSelectionListener = new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
updateEncodingGroupState(!otherEncodingButton.getSelection());
|
||||
updateValidState();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
otherEncodingButton.addSelectionListener(otherButtonSelectionListener);
|
||||
|
||||
// other encoding combo
|
||||
|
@ -280,26 +283,26 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
updateValidState();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
SystemWidgetHelpers.createLabel(encodingGroup, ""); //$NON-NLS-1$
|
||||
|
||||
SystemWidgetHelpers.createLabel(composite_prompts, "", 2); //$NON-NLS-1$
|
||||
|
||||
|
||||
encodingFieldAdded = true;
|
||||
}
|
||||
else {
|
||||
encodingFieldAdded = false;
|
||||
}
|
||||
|
||||
if (!initDone)
|
||||
doInitializeFields();
|
||||
|
||||
if (!file.isRoot() && file.showReadOnlyProperty())
|
||||
|
||||
if (!initDone)
|
||||
doInitializeFields();
|
||||
|
||||
if (!file.isRoot() && file.showReadOnlyProperty())
|
||||
cbReadonlyPrompt.addSelectionListener(this);
|
||||
|
||||
|
||||
return composite_prompts;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the encoding group state.
|
||||
* @param useDefault whether to update the state with default option on. <code>true</code> if the default option
|
||||
|
@ -308,24 +311,24 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
private void updateEncodingGroupState(boolean useDefault) {
|
||||
defaultEncodingButton.setSelection(useDefault);
|
||||
otherEncodingButton.setSelection(!useDefault);
|
||||
|
||||
|
||||
if (useDefault) {
|
||||
otherEncodingCombo.setText(getDefaultEncoding());
|
||||
}
|
||||
|
||||
|
||||
otherEncodingCombo.setEnabled(!useDefault);
|
||||
updateValidState();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the valid state of the encoding group.
|
||||
*/
|
||||
private void updateValidState() {
|
||||
boolean isValid = isEncodingValid();
|
||||
|
||||
|
||||
if (isValid != isValidBefore) {
|
||||
isValidBefore = isValid;
|
||||
|
||||
|
||||
if (isValidBefore) {
|
||||
clearErrorMessage();
|
||||
}
|
||||
|
@ -335,7 +338,7 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the default encoding.
|
||||
* @return the default encoding
|
||||
|
@ -343,7 +346,7 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
protected String getDefaultEncoding() {
|
||||
return defaultEncoding;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the currently selected encoding.
|
||||
* @return the currently selected encoding.
|
||||
|
@ -352,7 +355,7 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
if (defaultEncodingButton.getSelection()) {
|
||||
return defaultEncoding;
|
||||
}
|
||||
|
||||
|
||||
return otherEncodingCombo.getText();
|
||||
}
|
||||
|
||||
|
@ -363,7 +366,7 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
private boolean isEncodingValid() {
|
||||
return defaultEncodingButton.getSelection() || isEncodingValid(otherEncodingCombo.getText());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether or not the given encoding is valid.
|
||||
* @param encoding the encoding.
|
||||
|
@ -377,7 +380,7 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the input remote file object
|
||||
*/
|
||||
|
@ -385,7 +388,7 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
{
|
||||
Object element = getElement();
|
||||
IRemoteFile file = (IRemoteFile)element;
|
||||
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
|
@ -398,16 +401,16 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
IRemoteFile file = getRemoteFile();
|
||||
// name
|
||||
String name = file.getName();
|
||||
if (name.length() > 100)
|
||||
if (name.length() > 100)
|
||||
{
|
||||
String shortName = name.substring(0, 97).concat("..."); //$NON-NLS-1$
|
||||
labelName.setText(shortName);
|
||||
}
|
||||
labelName.setText(shortName);
|
||||
}
|
||||
else
|
||||
{
|
||||
labelName.setText(name);
|
||||
}
|
||||
|
||||
|
||||
// type
|
||||
if (file.isRoot())
|
||||
labelType.setText(SystemFileResources.RESID_PP_FILE_TYPE_ROOT_VALUE);
|
||||
|
@ -448,7 +451,7 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
if (file instanceof IVirtualRemoteFile)
|
||||
cbReadonlyPrompt.setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
// readable
|
||||
if (cbReadablePrompt != null)
|
||||
|
@ -460,16 +463,16 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
if (cbWritablePrompt != null)
|
||||
{
|
||||
cbWritablePrompt.setSelection(file.canWrite());
|
||||
cbWritablePrompt.setEnabled(false);
|
||||
cbWritablePrompt.setEnabled(false);
|
||||
}
|
||||
*/
|
||||
// hidden
|
||||
if (cbHiddenPrompt != null)
|
||||
{
|
||||
cbHiddenPrompt.setSelection(file.isHidden());
|
||||
cbHiddenPrompt.setEnabled(false);
|
||||
cbHiddenPrompt.setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
// the file encoding group
|
||||
if (encodingFieldAdded) {
|
||||
List encodings = IDEEncoding.getIDEEncodings();
|
||||
|
@ -479,7 +482,7 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
|
||||
String encoding = file.getEncoding();
|
||||
prevEncoding = encoding;
|
||||
|
||||
|
||||
// if the encoding is the same as the default encoding, then we want to choose the default encoding option
|
||||
if (encoding.equalsIgnoreCase(defaultEncoding)) {
|
||||
updateEncodingGroupState(true);
|
||||
|
@ -491,7 +494,7 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called by parent when user presses OK
|
||||
*/
|
||||
|
@ -500,9 +503,9 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
boolean ok = super.performOk();
|
||||
boolean readOnlySelected = cbReadonlyPrompt != null ? cbReadonlyPrompt.getSelection() : false;
|
||||
IRemoteFile remoteFile = getRemoteFile();
|
||||
|
||||
if (ok && (cbReadonlyPrompt!=null) &&
|
||||
((readOnlySelected && !wasReadOnly) ||
|
||||
|
||||
if (ok && (cbReadonlyPrompt!=null) &&
|
||||
((readOnlySelected && !wasReadOnly) ||
|
||||
(!readOnlySelected && wasReadOnly)))
|
||||
{
|
||||
try
|
||||
|
@ -510,7 +513,7 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
// get old can write attribute
|
||||
boolean oldCanWrite = remoteFile.canWrite();
|
||||
|
||||
//set readonly
|
||||
//set readonly
|
||||
remoteFile.getParentRemoteFileSubSystem().setReadOnly(remoteFile,readOnlySelected, new NullProgressMonitor());
|
||||
|
||||
// get the new can write attribute
|
||||
|
@ -522,17 +525,17 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
// Need to keep local copy and remote copies up to date
|
||||
editable.setReadOnly(readOnlySelected);
|
||||
}
|
||||
|
||||
// if the values haven't changed, then we need to
|
||||
// refresh
|
||||
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
|
||||
|
||||
|
||||
// if the values haven't changed, then we need to
|
||||
// refresh
|
||||
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
|
||||
|
||||
remoteFile.markStale(true);
|
||||
|
||||
|
||||
// oldCanWrite and updatedValue may not be the same depending on the underlying file service
|
||||
// If the file service updates the underlying object, then there is no need for a remote refresh
|
||||
if (oldCanWrite == updatedValue)
|
||||
{
|
||||
{
|
||||
if (remoteFile.isDirectory())
|
||||
{
|
||||
sr.fireEvent(new SystemResourceChangeEvent(remoteFile.getParentRemoteFile(),ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, null));
|
||||
|
@ -543,33 +546,33 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sr.fireEvent(new SystemResourceChangeEvent(remoteFile,ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE,null));
|
||||
{
|
||||
sr.fireEvent(new SystemResourceChangeEvent(remoteFile,ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE,null));
|
||||
}
|
||||
}
|
||||
catch (RemoteFileIOException exc) {
|
||||
String msgDetails = NLS.bind(FileResources.FILEMSG_IO_ERROR_DETAILS, exc.getMessage());
|
||||
setMessage(new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
setMessage(new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
ISystemFileConstants.FILEMSG_IO_ERROR,
|
||||
IStatus.ERROR, FileResources.FILEMSG_IO_ERROR, msgDetails));
|
||||
|
||||
}
|
||||
catch (RemoteFileSecurityException exc) {
|
||||
String msgDetails = NLS.bind(FileResources.FILEMSG_SECURITY_ERROR_DETAILS, exc.getMessage());
|
||||
setMessage(new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
setMessage(new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
ISystemFileConstants.FILEMSG_SECURITY_ERROR,
|
||||
IStatus.ERROR, FileResources.FILEMSG_SECURITY_ERROR, msgDetails));
|
||||
|
||||
|
||||
}
|
||||
catch (SystemMessageException e) {
|
||||
setMessage(e.getSystemMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// set the encoding
|
||||
String selectedEncoding = getSelectedEncoding();
|
||||
|
||||
|
||||
|
||||
|
||||
if (ok && encodingFieldAdded && prevEncoding != null && !prevEncoding.equals(selectedEncoding)) {
|
||||
IRemoteFile rfile = getRemoteFile();
|
||||
IRemoteFileSubSystem subsys = rfile.getParentRemoteFileSubSystem();
|
||||
|
@ -577,7 +580,7 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
|
||||
RemoteFileEncodingManager mgr = RemoteFileEncodingManager.getInstance();
|
||||
if (defaultEncodingButton.getSelection())
|
||||
{
|
||||
{
|
||||
mgr.setEncoding(hostName, rfile.getAbsolutePath(),null);
|
||||
}
|
||||
else
|
||||
|
@ -585,7 +588,7 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
mgr.setEncoding(hostName, rfile.getAbsolutePath(), getSelectedEncoding());
|
||||
}
|
||||
|
||||
|
||||
|
||||
SystemEditableRemoteFile editable = new SystemEditableRemoteFile(remoteFile);
|
||||
if (editable.checkOpenInEditor() != ISystemEditableRemoteObject.NOT_OPEN) {
|
||||
IFile file = editable.getLocalResource();
|
||||
|
@ -594,26 +597,26 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
protected boolean wantDefaultAndApplyButton()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected void performApply() {
|
||||
performOk();
|
||||
}
|
||||
|
||||
protected void performDefaults() {
|
||||
doInitializeFields();
|
||||
doInitializeFields();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Validate all the widgets on the page
|
||||
* <p>
|
||||
|
@ -627,11 +630,11 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
|
||||
public void widgetDefaultSelected(SelectionEvent event)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -643,13 +646,13 @@ public class SystemFilePropertyPage extends SystemBasePropertyPage
|
|||
{
|
||||
file = file.getParentRemoteFileSubSystem().getRemoteFileObject(file.getAbsolutePath(), new NullProgressMonitor());
|
||||
}
|
||||
catch (Exception e){
|
||||
catch (Exception e){
|
||||
}
|
||||
setElement((IAdaptable)file);
|
||||
|
||||
|
||||
// reset according to the changed file
|
||||
performDefaults();
|
||||
}
|
||||
}
|
||||
}
|
||||
super.setVisible(visible);
|
||||
}
|
||||
|
|
|
@ -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>.
|
||||
|
@ -534,7 +553,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
|
|||
* from static declaration in the
|
||||
* <tt>org.eclipse.rse.core.subsystemConfigurations</tt> and
|
||||
* <tt>org.eclipse.rse.core.systemTypes</tt> extension points.
|
||||
*
|
||||
*
|
||||
* @noextend This method is not intended to be extended by clients. It will
|
||||
* likely be declared <tt>final</tt> in the next release in
|
||||
* order to ensure consistency with static xml markup in the
|
||||
|
|
Loading…
Add table
Reference in a new issue