Bug 56957 [Encoding] Reusable EncodingFieldEditor
I have added the ability to set an encoding for a repository so that commit messages and file names can be properly translated between a client and server whose encodings differ. I have extracted much of the code from IDEEditorsPreferencePage into an EncodingFieldEditor class so I could us it. I was planning on providing a patch to the UI with the hope that this class could be API but there is a roadblock that prevents this. Basically, the encoding preference is in a org.eclipse.core.Preferences node but a field editor requires an IPreferenceStore. There are already two adapters for this is the platform but one is a private inner class of AbstractUIPlugin and the other lives in the text plugin. Instead of creating a patch, I'm just attaching the EncodingFieldEditor class for future consideration.
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java
data.horizontalAlignment = GridData.FILL;
		composite.setLayoutData(data);
		composite.setFont(font);
		Label timeStampLabel = new Label(composite, SWT.NONE);
		timeStampLabel.setText(TIMESTAMP_TITLE);
		timeStampLabel.setFont(font);
		
		Text timeStampValue = new Text(composite, SWT.READ_ONLY);
		timeStampValue.setText(getDateStringValue(resource));
		timeStampValue.setFont(font);
		timeStampValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
				| GridData.GRAB_HORIZONTAL));
		
		if (resource.getType() != IResource.PROJECT) {
			createEditableButton(composite);
			createDerivedButton(composite);
		}
	}
	private void createEncodingGroup(Composite parent, IResource resource) {
		Font font = parent.getFont();
		Group group = new Group(parent, SWT.NONE);
		GridLayout layout = new GridLayout();
		layout.numColumns = 2;
		group.setLayout(layout);
		if (resource instanceof IContainer)
			group.setText(CONTAINER_ENCODING_TITLE);
		else
			group.setText(FILE_ENCODING_TITLE);
		group.setFont(font);
		SelectionAdapter buttonListener = new SelectionAdapter() {