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
locationValue.setFont(font);
		if (isPathVariable(resource)) {
			Label resolvedLocationTitle = new Label(basicInfoComposite,
					SWT.LEFT);
			resolvedLocationTitle.setText(RESOLVED_LOCATION_TITLE);
			gd = new GridData();
			gd.verticalAlignment = SWT.TOP;
			resolvedLocationTitle.setLayoutData(gd);
			resolvedLocationTitle.setFont(font);
			Text resolvedLocationValue = new Text(basicInfoComposite, SWT.WRAP
					| SWT.READ_ONLY);
			resolvedLocationValue.setText(getResolvedLocationText(resource));
			gd = new GridData();
			gd.widthHint = convertWidthInCharsToPixels(MAX_VALUE_WIDTH);
			gd.grabExcessHorizontalSpace = true;
			gd.horizontalAlignment = GridData.FILL;
			resolvedLocationValue.setLayoutData(gd);
			resolvedLocationValue.setFont(font);
		}
		if (resource.getType() == IResource.FILE) {
			
			Label sizeTitle = new Label(basicInfoComposite, SWT.LEFT);
			sizeTitle.setText(SIZE_TITLE);
			sizeTitle.setFont(font);
			Text sizeValue = new Text(basicInfoComposite, SWT.LEFT
					| SWT.READ_ONLY);
			sizeValue.setText(getSizeString((IFile) resource));
			gd = new GridData();
			gd.widthHint = convertWidthInCharsToPixels(MAX_VALUE_WIDTH);
			gd.grabExcessHorizontalSpace = true;