public abstract class LanguageCodeStyleSettingsProvider extends CodeStyleSettingsProvider
Modifier and Type | Class and Description |
---|---|
static class |
LanguageCodeStyleSettingsProvider.SettingsType |
Modifier and Type | Field and Description |
---|---|
static ExtensionPointName<LanguageCodeStyleSettingsProvider> |
EP_NAME |
EXTENSION_POINT_NAME
Constructor and Description |
---|
LanguageCodeStyleSettingsProvider() |
Modifier and Type | Method and Description |
---|---|
protected static java.util.List<LanguageCodeStyleSettingsProvider> |
calcSettingPagesProviders() |
CodeStyleConfigurable |
createConfigurable(CodeStyleSettings baseSettings,
CodeStyleSettings modelSettings)
Create a code style configurable for the given base settings and model settings.
|
static PsiFile |
createFileFromText(Language language,
Project project,
java.lang.String text) |
PsiFile |
createFileFromText(Project project,
java.lang.String text)
Allows to customize PSI file creation for a language settings preview panel.
|
protected void |
customizeDefaults(CommonCodeStyleSettings commonSettings,
CommonCodeStyleSettings.IndentOptions indentOptions)
Customize default settings: set values which are different from the ones after
CommonCodeStyleSettings initialization. |
void |
customizeSettings(CodeStyleSettingsCustomizable consumer,
LanguageCodeStyleSettingsProvider.SettingsType settingsType) |
static LanguageCodeStyleSettingsProvider |
findUsingBaseLanguage(Language language)
Searches a provider for a specific language or its base language.
|
static LanguageCodeStyleSettingsProvider |
forLanguage(Language language) |
CodeStyleFieldAccessor |
getAccessor(java.lang.Object codeStyleObject,
java.lang.reflect.Field field) |
java.util.List<CodeStylePropertyAccessor> |
getAdditionalAccessors(java.lang.Object codeStyleObject) |
java.util.List<Language> |
getApplicableLanguages() |
abstract java.lang.String |
getCodeSample(LanguageCodeStyleSettingsProvider.SettingsType settingsType) |
static java.lang.String |
getCodeSample(Language lang,
LanguageCodeStyleSettingsProvider.SettingsType settingsType) |
CommonCodeStyleSettings |
getDefaultCommonSettings()
Deprecated.
Override
#customizeDefaults(CommonCodeStyleSettings, IndentOptions) method instead. |
static CommonCodeStyleSettings |
getDefaultCommonSettings(Language lang) |
DisplayPriority |
getDisplayPriority() |
static DisplayPriority |
getDisplayPriority(Language language) |
DocCommentSettings |
getDocCommentSettings(CodeStyleSettings rootSettings)
Returns a wrapper around language's own code documentation comment settings from the given
rootSettings . |
java.lang.String |
getExternalLanguageId() |
java.lang.String |
getFileExt()
Override this method if file extension to be used with samples is different from the one returned by associated file type.
|
static java.lang.String |
getFileExt(Language lang) |
IndentOptionsEditor |
getIndentOptionsEditor() |
abstract Language |
getLanguage()
Specifies a language this provider applies to.
|
static Language |
getLanguage(java.lang.String langName) |
java.lang.String |
getLanguageName()
Override this method if language name shown in preview tab must be different from the name returned by Language class itself.
|
static java.lang.String |
getLanguageName(Language lang)
Returns a language name to be shown in UI.
|
static java.util.List<Language> |
getLanguagesWithCodeStyleSettings() |
PredefinedCodeStyle [] |
getPredefinedCodeStyles()
Deprecated.
use PredefinedCodeStyle extension point instead
|
AbstractCodeStylePropertyMapper |
getPropertyMapper(CodeStyleSettings settings) |
int |
getRightMargin(LanguageCodeStyleSettingsProvider.SettingsType settingsType) |
static int |
getRightMargin(Language lang,
LanguageCodeStyleSettingsProvider.SettingsType settingsType) |
static java.util.List<LanguageCodeStyleSettingsProvider> |
getSettingsPagesProviders() |
java.util.Set<java.lang.String> |
getSupportedFields() |
java.util.Set<java.lang.String> |
getSupportedFields(LanguageCodeStyleSettingsProvider.SettingsType type) |
static void |
resetSettingsPagesProviders() |
boolean |
supportsExternalFormats()
Tells is the provider supports external formats such as Json and .editorconfig.
|
createCustomSettings, createSettingsPage, getConfigurableDisplayName, getGroup, getPriority, hasSettingsPage
public static final ExtensionPointName<LanguageCodeStyleSettingsProvider> EP_NAME
public abstract java.lang.String getCodeSample(LanguageCodeStyleSettingsProvider.SettingsType settingsType)
public int getRightMargin(LanguageCodeStyleSettingsProvider.SettingsType settingsType)
public void customizeSettings(CodeStyleSettingsCustomizable consumer, LanguageCodeStyleSettingsProvider.SettingsType settingsType)
public java.lang.String getFileExt()
public java.lang.String getLanguageName()
public java.lang.String getExternalLanguageId()
public PsiFile createFileFromText(Project project, java.lang.String text)
IMPORTANT: The created file must be a non-physical one with PSI events disabled. For more information see
PsiFileFactory.createFileFromText(String, Language, CharSequence, boolean, boolean)
where
eventSystemEnabled
parameter must be false
project
- current projecttext
- code sample to demonstrate formatting settings (see getCodeSample(LanguageCodeStyleSettingsProvider.SettingsType)
@Deprecated public CommonCodeStyleSettings getDefaultCommonSettings()
#customizeDefaults(CommonCodeStyleSettings, IndentOptions)
method instead.CommonCodeStyleSettings
and sets initial default values for those
settings which differ from the original.CommonCodeStyleSettings
or null if associated language doesn't
use its own language-specific common settings (the settings are shared with other languages).protected void customizeDefaults(CommonCodeStyleSettings commonSettings, CommonCodeStyleSettings.IndentOptions indentOptions)
CommonCodeStyleSettings
initialization.commonSettings
- Customizable instance of common settings for the language.indentOptions
- Customizable instance of indent options for the language.@Deprecated public PredefinedCodeStyle [] getPredefinedCodeStyles()
public DisplayPriority getDisplayPriority()
public java.util.List<Language> getApplicableLanguages()
getLanguagesWithCodeStyleSettings()
public static java.util.List<Language> getLanguagesWithCodeStyleSettings()
LanguageCodeStyleSettingsProvider
exists.
The list is ordered by language names as returned by getLanguageName(Language)
method.public static java.lang.String getCodeSample(Language lang, LanguageCodeStyleSettingsProvider.SettingsType settingsType)
public static int getRightMargin(Language lang, LanguageCodeStyleSettingsProvider.SettingsType settingsType)
public abstract Language getLanguage()
CodeStyleSettingsProvider
getConfigurableDisplayName()
is not
overridden.getLanguage
in class CodeStyleSettingsProvider
public static Language getLanguage(java.lang.String langName)
public static CommonCodeStyleSettings getDefaultCommonSettings(Language lang)
public static java.lang.String getFileExt(Language lang)
public static java.lang.String getLanguageName(Language lang)
lang
- The language whose display name must be return.public static PsiFile createFileFromText(Language language, Project project, java.lang.String text)
public static LanguageCodeStyleSettingsProvider forLanguage(Language language)
public static LanguageCodeStyleSettingsProvider findUsingBaseLanguage(Language language)
language
- The original language.null
if it doesn't exist neither for the language itself nor for any of its base languages.public static DisplayPriority getDisplayPriority(Language language)
public IndentOptionsEditor getIndentOptionsEditor()
public java.util.Set<java.lang.String> getSupportedFields()
public java.util.Set<java.lang.String> getSupportedFields(LanguageCodeStyleSettingsProvider.SettingsType type)
public DocCommentSettings getDocCommentSettings(CodeStyleSettings rootSettings)
rootSettings
.rootSettings
- Root code style setting to retrieve doc comment settings from.DocCommentSettings
wrapper object object which allows to retrieve and modify language's own
settings related to doc comment. The object is used then by common platform doc comment handling algorithms.public CodeStyleConfigurable createConfigurable(CodeStyleSettings baseSettings, CodeStyleSettings modelSettings)
createConfigurable
in class CodeStyleSettingsProvider
baseSettings
- The base (initial) settings before changes.modelSettings
- The settings to which UI changes are applied.CodeStyleConfigurable
public static void resetSettingsPagesProviders()
public static java.util.List<LanguageCodeStyleSettingsProvider> getSettingsPagesProviders()
createConfigurable(CodeStyleSettings, CodeStyleSettings)
protected static java.util.List<LanguageCodeStyleSettingsProvider> calcSettingPagesProviders()
public final AbstractCodeStylePropertyMapper getPropertyMapper(CodeStyleSettings settings)
public CodeStyleFieldAccessor getAccessor(java.lang.Object codeStyleObject, java.lang.reflect.Field field)
public java.util.List<CodeStylePropertyAccessor> getAdditionalAccessors(java.lang.Object codeStyleObject)
public boolean supportsExternalFormats()
getAccessor()
method for fields using magic constants, specially encoded strings and etc. and
getAdditionalAccessors()
method for non-stanard properties using their own writer/readExternal() methods
for serialization.