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
* @param resource
	 *            resource to test
	 * @return boolean <code>true</code> the given resource is a linked
	 *         resource bound to a path variable. <code>false</code> the given
	 *         resource is either not a linked resource or it is not using a
	 *         path variable.
	 */
	private boolean isPathVariable(IResource resource) {
		if (!resource.isLinked())
			return false;
		IPath resolvedLocation = resource.getLocation();
		if (resolvedLocation == null) {
			
			return true;
		}
		IPath rawLocation = resource.getRawLocation();
		if (resolvedLocation.equals(rawLocation))
			return false;
		return true;
	}
	/**
	 * Reset the editableBox to the false.
	 */
	protected void performDefaults() {
		
		if (this.editableBox != null)
			this.editableBox.setSelection(false);
		
		if (this.derivedBox != null)
			this.derivedBox.setSelection(false);