Package org.eclipse.core.runtime.content
Interface IContentTypeSettings
- All Known Subinterfaces:
IContentType
public interface IContentTypeSettings
Gives access to the user settings for a content type.
This interface is not intended to be implemented by clients.
- Since:
- 3.1
- See Also:
- Restriction:
- This interface is not intended to be implemented by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
File spec type constant, indicating a file extension specification.static final int
File spec type constant, indicating a file name specification.static final int
File spec type constant, indicating a file pattern specification -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFileSpec
(String fileSpec, int type) Adds a user-defined file specification to the corresponding content type.Returns the default charset for the corresponding content type if it has been set, ornull
otherwise.String[]
getFileSpecs
(int type) Returns the file specifications for the corresponding content type.getId()
Returns the corresponding content type's unique identifier.boolean
void
removeFileSpec
(String fileSpec, int type) Removes a user-defined file specification from the corresponding content type.void
setDefaultCharset
(String userCharset) Sets the default charset for the corresponding content type.
-
Field Details
-
FILE_EXTENSION_SPEC
static final int FILE_EXTENSION_SPECFile spec type constant, indicating a file extension specification.- See Also:
-
FILE_NAME_SPEC
static final int FILE_NAME_SPECFile spec type constant, indicating a file name specification.- See Also:
-
FILE_PATTERN_SPEC
static final int FILE_PATTERN_SPECFile spec type constant, indicating a file pattern specification- Since:
- 3.7
- See Also:
-
-
Method Details
-
addFileSpec
Adds a user-defined file specification to the corresponding content type. Has no effect if the given file specification is already defined.- Parameters:
fileSpec
- the file specificationtype
- the type of the file specification. One ofFILE_NAME_SPEC
,FILE_EXTENSION_SPEC
,FILE_PATTERN_SPEC
.- Throws:
IllegalArgumentException
- if the type bit mask is incorrectCoreException
- if this method fails. Reasons include:- An error occurred persisting this setting.
- See Also:
-
getDefaultCharset
String getDefaultCharset()Returns the default charset for the corresponding content type if it has been set, ornull
otherwise.- Returns:
- the default charset, or
null
-
getFileSpecs
Returns the file specifications for the corresponding content type. The type mask is a bit-wise or of file specification type constants indicating the file specification types of interest.- Parameters:
type
- a bit-wise or of file specification type constants. Valid flags are one ofFILE_EXTENSION_SPEC
orFILE_NAME_SPEC
- Returns:
- the file specification
- See Also:
-
getId
String getId()Returns the corresponding content type's unique identifier. Each content type has an identifier by which they can be retrieved from the content type catalog.- Returns:
- the content type unique identifier
-
removeFileSpec
Removes a user-defined file specification from the corresponding content type. Has no effect if the given file specification was not defined by the user.- Parameters:
fileSpec
- the file specificationtype
- the type of the file specification. One ofFILE_NAME_SPEC
,FILE_EXTENSION_SPEC
,FILE_PATTERN_SPEC
.- Throws:
IllegalArgumentException
- if the type bit mask is incorrectCoreException
- if this method fails. Reasons include:- An error occurred persisting this setting.
- See Also:
-
setDefaultCharset
Sets the default charset for the corresponding content type. Ifnull
is provided, restores the pre-defined default charset.- Parameters:
userCharset
- the new charset for the content type, ornull
- Throws:
CoreException
- if this method fails. Reasons include:- An error occurred persisting this setting.
-
isUserDefined
boolean isUserDefined()- Returns:
- whether the content-type was defined via user action, using
IContentTypeManager.addContentType(String, String, IContentType)
- Since:
- 3.6
-