當前位置: 首頁>>代碼示例>>Java>>正文


Java CodeStyleSettings.getDefaultRightMargin方法代碼示例

本文整理匯總了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;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:JavaFormatterTest.java

示例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
  ));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:RightMarginForm.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:38,代碼來源:GeneralCodeStylePanel.java


注:本文中的com.intellij.psi.codeStyle.CodeStyleSettings.getDefaultRightMargin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。