1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 07:05:24 +02:00

[179937] Add the encoding to the Get from remote system string in the property page to show the encoding that was obtained.

This commit is contained in:
Kushal Munir 2007-05-25 01:15:23 +00:00
parent 6dce90afc5
commit 9cacea7c6d
3 changed files with 41 additions and 10 deletions

View file

@ -1229,6 +1229,7 @@ public class SystemResources extends NLS
public static String RESID_HOST_ENCODING_SETTING_NOTE;
public static String RESID_HOST_ENCODING_SETTING_MSG;
public static String RESID_HOST_ENCODING_REMOTE_LABEL;
public static String RESID_HOST_ENCODING_REMOTE_ENCODING_LABEL;
public static String RESID_HOST_ENCODING_REMOTE_TOOLTIP;
public static String RESID_HOST_ENCODING_OTHER_LABEL;
public static String RESID_HOST_ENCODING_OTHER_TOOLTIP;

View file

@ -1425,6 +1425,7 @@ RESID_HOST_ENCODING_GROUP_LABEL=Default encoding
RESID_HOST_ENCODING_SETTING_NOTE=Note:
RESID_HOST_ENCODING_SETTING_MSG=This setting can only be changed when no subsystem is connected
RESID_HOST_ENCODING_REMOTE_LABEL=Default from remote system
RESID_HOST_ENCODING_REMOTE_ENCODING_LABEL=Default from remote system (%1)
RESID_HOST_ENCODING_REMOTE_TOOLTIP=The default encoding of the platform obtained from the remote system
RESID_HOST_ENCODING_OTHER_LABEL=Other:
RESID_HOST_ENCODING_OTHER_TOOLTIP=Specify a different encoding

View file

@ -827,13 +827,6 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab
data.grabExcessVerticalSpace = false;
encodingGroup.setLayoutData(data);
SelectionAdapter buttonSelectionListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateEncodingGroupState(remoteEncodingButton.getSelection());
validateEncoding();
}
};
Composite messageComposite = new Composite(encodingGroup, SWT.NONE);
GridLayout messageLayout = new GridLayout();
messageLayout.numColumns = 2;
@ -862,12 +855,38 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab
// remote encoding field
String defaultEncodingLabel = SystemResources.RESID_HOST_ENCODING_REMOTE_LABEL;
// check if user set encoding
// if so, we leave default encoding label as is
// if not, we check if remote encoding is set, and if it is, include the encoding in the label
if (conn.getDefaultEncoding(false) == null) {
String remoteEncoding = conn.getDefaultEncoding(true);
if (remoteEncoding != null) {
defaultEncodingLabel = SystemResources.RESID_HOST_ENCODING_REMOTE_ENCODING_LABEL;
int idx = defaultEncodingLabel.indexOf('%');
if (idx != -1) {
defaultEncodingLabel = defaultEncodingLabel.substring(0, idx) + remoteEncoding + defaultEncodingLabel.substring(idx+2);
}
}
}
remoteEncodingButton = SystemWidgetHelpers.createRadioButton(encodingGroup, null, defaultEncodingLabel, SystemResources.RESID_HOST_ENCODING_REMOTE_TOOLTIP);
data = new GridData();
data.horizontalSpan = 2;
data.grabExcessHorizontalSpace = true;
remoteEncodingButton.setLayoutData(data);
remoteEncodingButton.addSelectionListener(buttonSelectionListener);
SelectionAdapter remoteButtonSelectionListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateEncodingGroupState(remoteEncodingButton.getSelection());
validateEncoding();
}
};
remoteEncodingButton.addSelectionListener(remoteButtonSelectionListener);
Composite otherComposite = new Composite(encodingGroup, SWT.NONE);
GridLayout otherLayout = new GridLayout();
@ -882,7 +901,15 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab
data = new GridData();
data.grabExcessHorizontalSpace = false;
otherEncodingButton.setLayoutData(data);
otherEncodingButton.addSelectionListener(buttonSelectionListener);
SelectionAdapter otherButtonSelectionListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateEncodingGroupState(!otherEncodingButton.getSelection());
validateEncoding();
}
};
otherEncodingButton.addSelectionListener(otherButtonSelectionListener);
// other encoding combo
otherEncodingCombo = SystemWidgetHelpers.createCombo(otherComposite, null, SystemResources.RESID_HOST_ENCODING_ENTER_TOOLTIP);
@ -935,7 +962,6 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab
}
}
otherEncodingCombo.setEnabled(!useDefault);
validateEncoding();
}
@ -1217,6 +1243,9 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab
// disable if any subsystem is connected
if (!conn.getSystemType().getId().equalsIgnoreCase(IRSESystemType.SYSTEMTYPE_LOCAL_ID) && sr.isAnySubSystemConnected(conn)) {
encodingGroup.setEnabled(false);
remoteEncodingButton.setEnabled(false);
otherEncodingButton.setEnabled(false);
otherEncodingCombo.setEnabled(false);
}
}