com.intellij.psi.codeStyle.DocCommentSettings Java Examples

The following examples show how to use com.intellij.psi.codeStyle.DocCommentSettings. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CodeDocumentationUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static String createLine(String lineData, CodeDocumentationAwareCommenter commenter, DocCommentSettings settings) {
  if (!settings.isLeadingAsteriskEnabled()) {
    return " " + lineData + " ";
  }
  else {
    if (lineData.length() == 0) {
      return commenter.getDocumentationCommentLinePrefix() + " ";
    }
    else {
      return commenter.getDocumentationCommentLinePrefix() + " " + lineData + " ";
    }

  }
}
 
Example #2
Source File: FixDocCommentAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void reformatCommentKeepingEmptyTags(@Nonnull PsiFile file, @Nonnull Project project, int start, int end) {
  CodeStyleSettings tempSettings = CodeStyle.getSettings(file).clone();
  LanguageCodeStyleSettingsProvider langProvider = LanguageCodeStyleSettingsProvider.forLanguage(file.getLanguage());
  if (langProvider != null) {
    DocCommentSettings docCommentSettings = langProvider.getDocCommentSettings(tempSettings);
    docCommentSettings.setRemoveEmptyTags(false);
  }
  CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(project);
  CodeStyle.doWithTemporarySettings(project, tempSettings, () -> codeStyleManager.reformatText(file, start, end));
}
 
Example #3
Source File: DelegatingCodeStyleManager.java    From spring-javaformat with Apache License 2.0 4 votes vote down vote up
@Override
public DocCommentSettings getDocCommentSettings(PsiFile file) {
	return this.delegate.getDocCommentSettings(file);
}
 
Example #4
Source File: CodeStyleManagerDecorator.java    From google-java-format with Apache License 2.0 4 votes vote down vote up
@Override
public DocCommentSettings getDocCommentSettings(PsiFile file) {
  return delegate.getDocCommentSettings(file);
}
 
Example #5
Source File: CodeDocumentationUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * @deprecated Use createDocCommentLine(lineData,file,commenter) instead.
 */
@SuppressWarnings("unused")
@Deprecated
public static String createDocCommentLine(String lineData, Project project, CodeDocumentationAwareCommenter commenter) {
  return createLine(lineData, commenter, DocCommentSettings.DEFAULTS);
}
 
Example #6
Source File: CodeDocumentationUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String createDocCommentLine(String lineData, PsiFile file, CodeDocumentationAwareCommenter commenter) {
  DocCommentSettings settings = CodeStyleManager.getInstance(file.getProject()).getDocCommentSettings(file);
  return createLine(lineData, commenter, settings);
}