com.intellij.psi.codeStyle.FormattingModeAwareIndentAdjuster Java Examples

The following examples show how to use com.intellij.psi.codeStyle.FormattingModeAwareIndentAdjuster. 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: DelegatingCodeStyleManager.java    From spring-javaformat with Apache License 2.0 5 votes vote down vote up
@Override
public int adjustLineIndent(Document document, int offset, FormattingMode mode) {
	if (this.delegate instanceof FormattingModeAwareIndentAdjuster) {
		return ((FormattingModeAwareIndentAdjuster) this.delegate).adjustLineIndent(document, offset, mode);
	}
	return offset;
}
 
Example #2
Source File: DelegatingCodeStyleManager.java    From spring-javaformat with Apache License 2.0 5 votes vote down vote up
@Override
public FormattingMode getCurrentFormattingMode() {
	if (this.delegate instanceof FormattingModeAwareIndentAdjuster) {
		return ((FormattingModeAwareIndentAdjuster) this.delegate).getCurrentFormattingMode();
	}
	return FormattingMode.REFORMAT;
}
 
Example #3
Source File: DelegatingCodeStyleManager.java    From intellij with Apache License 2.0 5 votes vote down vote up
/** Uses same fallback as {@link CodeStyleManager#getCurrentFormattingMode}. */
@Override
public FormattingMode getCurrentFormattingMode() {
  if (delegate instanceof FormattingModeAwareIndentAdjuster) {
    return ((FormattingModeAwareIndentAdjuster) delegate).getCurrentFormattingMode();
  }
  return FormattingMode.REFORMAT;
}
 
Example #4
Source File: DelegatingCodeStyleManager.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public int adjustLineIndent(final Document document, final int offset, FormattingMode mode)
    throws IncorrectOperationException {
  if (delegate instanceof FormattingModeAwareIndentAdjuster) {
    return ((FormattingModeAwareIndentAdjuster) delegate)
        .adjustLineIndent(document, offset, mode);
  }
  return offset;
}
 
Example #5
Source File: CodeStyleManagerDecorator.java    From google-java-format with Apache License 2.0 5 votes vote down vote up
/** Uses same fallback as {@link CodeStyleManager#getCurrentFormattingMode}. */
@Override
public FormattingMode getCurrentFormattingMode() {
  if (delegate instanceof FormattingModeAwareIndentAdjuster) {
    return ((FormattingModeAwareIndentAdjuster) delegate).getCurrentFormattingMode();
  }
  return FormattingMode.REFORMAT;
}
 
Example #6
Source File: CodeStyleManagerDecorator.java    From google-java-format with Apache License 2.0 5 votes vote down vote up
@Override
public int adjustLineIndent(final Document document, final int offset, FormattingMode mode)
    throws IncorrectOperationException {
  if (delegate instanceof FormattingModeAwareIndentAdjuster) {
    return ((FormattingModeAwareIndentAdjuster) delegate)
        .adjustLineIndent(document, offset, mode);
  }
  return offset;
}
 
Example #7
Source File: ManualCodeStyleManagerDelegator.java    From EclipseCodeFormatter with Apache License 2.0 5 votes vote down vote up
@Override
public int adjustLineIndent(@NotNull Document document, int offset, FormattingMode formattingMode) {
	if (original instanceof FormattingModeAwareIndentAdjuster) {
		return ((FormattingModeAwareIndentAdjuster) original).adjustLineIndent(document, offset, formattingMode);
	} else {
		return offset;
	}
}
 
Example #8
Source File: ManualCodeStyleManagerDelegator.java    From EclipseCodeFormatter with Apache License 2.0 5 votes vote down vote up
@Override
public FormattingMode getCurrentFormattingMode() {
	if (original instanceof FormattingModeAwareIndentAdjuster) {
		return ((FormattingModeAwareIndentAdjuster) original).getCurrentFormattingMode();
	} else {
		return FormattingMode.REFORMAT;
	}
}
 
Example #9
Source File: FormatterBasedIndentAdjuster.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
  int lineStart = myDocument.getLineStartOffset(myLine);
  CommandProcessor.getInstance().runUndoTransparentAction(() -> ApplicationManager.getApplication().runWriteAction(() -> {
    CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(myProject);
    if (codeStyleManager instanceof FormattingModeAwareIndentAdjuster) {
      ((FormattingModeAwareIndentAdjuster)codeStyleManager).adjustLineIndent(myDocument, lineStart, FormattingMode.ADJUST_INDENT_ON_ENTER);
    }
  }));
}