本文整理匯總了Java中com.intellij.psi.codeStyle.CodeStyleSettings.getDefaultRightMargin方法的典型用法代碼示例。如果您正苦於以下問題:Java CodeStyleSettings.getDefaultRightMargin方法的具體用法?Java CodeStyleSettings.getDefaultRightMargin怎麽用?Java CodeStyleSettings.getDefaultRightMargin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.psi.codeStyle.CodeStyleSettings
的用法示例。
在下文中一共展示了CodeStyleSettings.getDefaultRightMargin方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testCommentAfterDeclaration
import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的package包/類
public void testCommentAfterDeclaration() throws Exception {
CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getSettings(getProject());
CommonCodeStyleSettings javaSettings = codeStyleSettings.getCommonSettings(JavaLanguage.INSTANCE);
int oldMargin = codeStyleSettings.getDefaultRightMargin();
int oldWrap = javaSettings.ASSIGNMENT_WRAP;
try {
codeStyleSettings.setDefaultRightMargin(20);
javaSettings.ASSIGNMENT_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
doMethodTest(
"int i=0; //comment comment",
"int i =\n" +
" 0; //comment comment"
);
}
finally {
codeStyleSettings.setDefaultRightMargin(oldMargin);
javaSettings.ASSIGNMENT_WRAP = oldWrap;
}
}
示例2: RightMarginForm
import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的package包/類
public RightMarginForm(@NotNull Language language, @NotNull CodeStyleSettings settings) {
myLanguage = language;
myDefaultRightMargin = settings.getDefaultRightMargin();
myDefaultGeneralCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (myDefaultGeneralCheckBox.isSelected()) {
myRightMarginField.setText(Integer.toString(myDefaultRightMargin));
myRightMarginField.setEnabled(false);
}
else {
myRightMarginField.setEnabled(true);
}
}
});
//noinspection unchecked
myWrapOnTypingCombo.setModel(new DefaultComboBoxModel(
CodeStyleSettingsCustomizable.WRAP_ON_TYPING_OPTIONS
));
}
示例3: isModified
import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的package包/類
@Override
public boolean isModified(CodeStyleSettings settings) {
if (!Comparing.equal(getSelectedLineSeparator(), settings.LINE_SEPARATOR)) {
return true;
}
if (settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN ^ myCbWrapWhenTypingReachesRightMargin.isSelected()) {
return true;
}
if (getRightMargin() != settings.getDefaultRightMargin()) return true;
if (myEnableFormatterTags.isSelected()) {
if (
!settings.FORMATTER_TAGS_ENABLED ||
settings.FORMATTER_TAGS_ACCEPT_REGEXP != myAcceptRegularExpressionsCheckBox.isSelected() ||
!StringUtil.equals(myFormatterOffTagField.getText(), settings.FORMATTER_OFF_TAG) ||
!StringUtil.equals(myFormatterOnTagField.getText(), settings.FORMATTER_ON_TAG)) return true;
}
else {
if (settings.FORMATTER_TAGS_ENABLED) return true;
}
for (GeneralCodeStyleOptionsProvider option : myAdditionalOptions) {
if (option.isModified(settings)) return true;
}
if (settings.AUTODETECT_INDENTS != myAutodetectIndentsBox.isSelected()) return true;
if (myShowDetectedIndentNotification.isEnabled()
&& FileIndentOptionsProvider.isShowNotification() != myShowDetectedIndentNotification.isSelected())
{
return true;
}
return false;
}