@Nullable private IndentOptions getLanguageIndentOptions(@Nullable FileType fileType) { if (fileType == null || !(fileType instanceof LanguageFileType)) return null; Language lang = ((LanguageFileType) fileType).getLanguage(); CommonCodeStyleSettings langSettings = getCommonSettings(lang); return langSettings == this ? null : langSettings.getIndentOptions(); }
/** * Assigns another right margin for the language or (if it is null) to root (default) margin. * * @param language The language to assign the right margin to or null if root (default) right * margin is to be changed. * @param rightMargin New right margin. */ public void setRightMargin(@Nullable Language language, int rightMargin) { if (language != null) { CommonCodeStyleSettings langSettings = getCommonSettings(language); if (langSettings != null) { langSettings.RIGHT_MARGIN = rightMargin; return; } } setDefaultRightMargin(rightMargin); }
private void copyOldIndentOptions(@NonNls final String extension, final IndentOptions options) { final FileType fileType = FileTypeManager.getInstance().getFileTypeByExtension(extension); if (fileType != FileTypes.UNKNOWN && fileType != FileTypes.PLAIN_TEXT && !myAdditionalIndentOptions.containsKey(fileType) && !fileType.getDefaultExtension().isEmpty()) { registerAdditionalIndentOptions(fileType, options); // // Upgrade to version 11 // if (fileType instanceof LanguageFileType) { Language lang = ((LanguageFileType) fileType).getLanguage(); CommonCodeStyleSettings langSettings = myCommonSettingsManager.getCommonSettings(lang); if (langSettings != this && langSettings.getIndentOptions() != null) { langSettings.importOldIndentOptions(this); } } } }