Package org.eclipse.ui.ide.dialogs
Class ResourceEncodingFieldEditor
- java.lang.Object
-
- org.eclipse.jface.preference.FieldEditor
-
- org.eclipse.ui.ide.dialogs.AbstractEncodingFieldEditor
-
- org.eclipse.ui.ide.dialogs.ResourceEncodingFieldEditor
-
public final class ResourceEncodingFieldEditor extends AbstractEncodingFieldEditor
The ResourceEncodingFieldEditor is a field editor for editing the encoding of a resource and does not use a preference store.This class may be instantiated; it is not intended to be subclassed.
- Since:
- 3.1
-
-
Field Summary
-
Fields inherited from class org.eclipse.jface.preference.FieldEditor
HORIZONTAL_GAP, IS_VALID, VALUE
-
-
Constructor Summary
Constructors Constructor Description ResourceEncodingFieldEditor(String labelText, Composite parent, IResource charsetResource)
Creates a new encoding field editor for setting the encoding on the given resource.ResourceEncodingFieldEditor(String labelText, Composite parent, IResource charsetResource, String groupTitle)
Creates a new encoding field editor for setting the encoding on the given resource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Composite
createEncodingGroup(Composite parent, int numColumns)
Creates a composite with all the encoding controls.protected String
defaultButtonText()
Returns the text for the default encoding button.protected void
doLoadDefault()
Initializes this field editor with the default preference value from the preference store.protected void
doStore()
Stores the preference value from this field editor into the preference store.protected String
findDefaultEncoding()
Returns the default encoding for the object being shown.protected String
getStoredValue()
Returns the value that is currently stored for the encoding.void
load()
Initializes this field editor with the preference value from the preference store.void
loadDefault()
Initializes this field editor with the default preference value from the preference store.void
setEnabled(boolean enabled, Composite parent)
Set whether or not the controls in the field editor are enabled.void
store()
Stores this field editor's value back into the preference store.-
Methods inherited from class org.eclipse.ui.ide.dialogs.AbstractEncodingFieldEditor
adjustForNumColumns, doFillIntoGrid, doLoad, getDefaultEnc, getNumberOfControls, getSelectedEncoding, hasSameEncoding, isValid, refreshValidState, setGroupTitle, setPreferenceStore
-
Methods inherited from class org.eclipse.jface.preference.FieldEditor
applyFont, checkParent, clearErrorMessage, clearMessage, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, createControl, dispose, fillIntoGrid, fireStateChanged, fireValueChanged, getFieldEditorFontName, getLabelControl, getLabelControl, getLabelText, getPage, getPreferenceName, getPreferencePage, getPreferenceStore, init, presentsDefaultValue, setButtonLayoutData, setFocus, setLabelText, setPage, setPreferenceName, setPreferencePage, setPresentsDefaultValue, setPropertyChangeListener, showErrorMessage, showMessage
-
-
-
-
Constructor Detail
-
ResourceEncodingFieldEditor
public ResourceEncodingFieldEditor(String labelText, Composite parent, IResource charsetResource)
Creates a new encoding field editor for setting the encoding on the given resource.- Parameters:
labelText
- the label text of the field editorparent
- the parent of the field editor's controlcharsetResource
- must be anIContainer
or anIFile
.- See Also:
IContainer.getDefaultCharset()
,IFile.getCharset()
-
ResourceEncodingFieldEditor
public ResourceEncodingFieldEditor(String labelText, Composite parent, IResource charsetResource, String groupTitle)
Creates a new encoding field editor for setting the encoding on the given resource.- Parameters:
labelText
- the label text of the field editorparent
- the parent of the field editor's controlcharsetResource
- must be anIContainer
or anIFile
.groupTitle
- the title for the field editor's control. If groupTitle isnull
the control will be unlabelled (by default aComposite
instead of aGroup
.- Since:
- 3.3
- See Also:
IContainer.getDefaultCharset()
,IFile.getCharset()
,AbstractEncodingFieldEditor.setGroupTitle(String)
-
-
Method Detail
-
getStoredValue
protected String getStoredValue()
Description copied from class:AbstractEncodingFieldEditor
Returns the value that is currently stored for the encoding.- Specified by:
getStoredValue
in classAbstractEncodingFieldEditor
- Returns:
- the currently stored encoding
-
doStore
protected void doStore()
Description copied from class:FieldEditor
Stores the preference value from this field editor into the preference store.Subclasses must implement this method to save the entered value into the preference store.
- Specified by:
doStore
in classFieldEditor
-
store
public void store()
Description copied from class:FieldEditor
Stores this field editor's value back into the preference store.- Overrides:
store
in classFieldEditor
-
load
public void load()
Description copied from class:FieldEditor
Initializes this field editor with the preference value from the preference store.- Overrides:
load
in classFieldEditor
-
loadDefault
public void loadDefault()
Description copied from class:FieldEditor
Initializes this field editor with the default preference value from the preference store.- Overrides:
loadDefault
in classFieldEditor
-
doLoadDefault
protected void doLoadDefault()
Description copied from class:FieldEditor
Initializes this field editor with the default preference value from the preference store.Subclasses must implement this method to properly initialize the field editor.
- Overrides:
doLoadDefault
in classAbstractEncodingFieldEditor
-
findDefaultEncoding
protected String findDefaultEncoding()
Description copied from class:AbstractEncodingFieldEditor
Returns the default encoding for the object being shown.- Overrides:
findDefaultEncoding
in classAbstractEncodingFieldEditor
- Returns:
- the default encoding for the object being shown
-
defaultButtonText
protected String defaultButtonText()
Description copied from class:AbstractEncodingFieldEditor
Returns the text for the default encoding button.- Overrides:
defaultButtonText
in classAbstractEncodingFieldEditor
- Returns:
- the text for the default encoding button
-
createEncodingGroup
protected Composite createEncodingGroup(Composite parent, int numColumns)
Description copied from class:AbstractEncodingFieldEditor
Creates a composite with all the encoding controls.Subclasses may extend.
- Overrides:
createEncodingGroup
in classAbstractEncodingFieldEditor
- Parameters:
parent
- the parent widgetnumColumns
- the number of columns in the parent- Returns:
- the group control
-
setEnabled
public void setEnabled(boolean enabled, Composite parent)
Description copied from class:FieldEditor
Set whether or not the controls in the field editor are enabled.- Overrides:
setEnabled
in classAbstractEncodingFieldEditor
- Parameters:
enabled
- The enabled state.parent
- The parent of the controls in the group. Used to create the controls if required.
-
-