com.intellij.psi.codeStyle.Indent Java Examples

The following examples show how to use com.intellij.psi.codeStyle.Indent. 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: CodeStyleManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public String fillIndent(Indent indent, FileType fileType) {
  IndentImpl indent1 = (IndentImpl)indent;
  int indentLevel = indent1.getIndentLevel();
  int spaceCount = indent1.getSpaceCount();
  final CodeStyleSettings settings = CodeStyle.getSettings(myProject);
  if (indentLevel < 0) {
    spaceCount += indentLevel * settings.getIndentSize(fileType);
    indentLevel = 0;
    if (spaceCount < 0) {
      spaceCount = 0;
    }
  }
  else {
    if (spaceCount < 0) {
      int v = (-spaceCount + settings.getIndentSize(fileType) - 1) / settings.getIndentSize(fileType);
      indentLevel -= v;
      spaceCount += v * settings.getIndentSize(fileType);
      if (indentLevel < 0) {
        indentLevel = 0;
      }
    }
  }
  return IndentHelperImpl.fillIndent(myProject, fileType, indentLevel * IndentHelperImpl.INDENT_FACTOR + spaceCount);
}
 
Example #2
Source File: CodeStyleManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Indent getIndent(String text, FileType fileType) {
  int indent = IndentHelperImpl.getIndent(CodeStyle.getSettings(myProject).getIndentOptions(fileType), text, true);
  int indentLevel = indent / IndentHelperImpl.INDENT_FACTOR;
  int spaceCount = indent - indentLevel * IndentHelperImpl.INDENT_FACTOR;
  return new IndentImpl(CodeStyle.getSettings(myProject), indentLevel, spaceCount, fileType);
}
 
Example #3
Source File: DelegatingCodeStyleManager.java    From EclipseCodeFormatter with Apache License 2.0 4 votes vote down vote up
@Override
public Indent zeroIndent() {
	return original.zeroIndent();
}
 
Example #4
Source File: IndentImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Indent subtract(Indent indent) {
  IndentImpl indent1 = (IndentImpl)indent;
  return new IndentImpl(mySettings, myIndentLevel - indent1.myIndentLevel, mySpaceCount - indent1.mySpaceCount, myFileType);
}
 
Example #5
Source File: IndentImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Indent add(Indent indent) {
  IndentImpl indent1 = (IndentImpl)indent;
  return new IndentImpl(mySettings, myIndentLevel + indent1.myIndentLevel, mySpaceCount + indent1.mySpaceCount, myFileType);
}
 
Example #6
Source File: IndentImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Indent max(Indent anotherIndent) {
  return isGreaterThan(anotherIndent) ? this : anotherIndent;
}
 
Example #7
Source File: IndentImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Indent min(Indent anotherIndent) {
  return isGreaterThan(anotherIndent) ? anotherIndent : this;
}
 
Example #8
Source File: IndentImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isGreaterThan(Indent indent) {
  return getSize() > ((IndentImpl)indent).getSize();
}
 
Example #9
Source File: CodeStyleManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Indent zeroIndent() {
  return new IndentImpl(CodeStyle.getSettings(myProject), 0, 0, null);
}
 
Example #10
Source File: DelegatingCodeStyleManager.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public Indent getIndent(String text, FileType fileType) {
  return delegate.getIndent(text, fileType);
}
 
Example #11
Source File: DelegatingCodeStyleManager.java    From EclipseCodeFormatter with Apache License 2.0 4 votes vote down vote up
@Override
public String fillIndent(Indent indent, FileType fileType) {
	return original.fillIndent(indent, fileType);
}
 
Example #12
Source File: DelegatingCodeStyleManager.java    From EclipseCodeFormatter with Apache License 2.0 4 votes vote down vote up
@Override
public Indent getIndent(String text, FileType fileType) {
	return original.getIndent(text, fileType);
}
 
Example #13
Source File: CodeStyleManagerDecorator.java    From google-java-format with Apache License 2.0 4 votes vote down vote up
@Override
public Indent zeroIndent() {
  return delegate.zeroIndent();
}
 
Example #14
Source File: CodeStyleManagerDecorator.java    From google-java-format with Apache License 2.0 4 votes vote down vote up
@Override
public String fillIndent(Indent indent, FileType fileType) {
  return delegate.fillIndent(indent, fileType);
}
 
Example #15
Source File: CodeStyleManagerDecorator.java    From google-java-format with Apache License 2.0 4 votes vote down vote up
@Override
public Indent getIndent(String text, FileType fileType) {
  return delegate.getIndent(text, fileType);
}
 
Example #16
Source File: DelegatingCodeStyleManager.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public Indent zeroIndent() {
  return delegate.zeroIndent();
}
 
Example #17
Source File: DelegatingCodeStyleManager.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public String fillIndent(Indent indent, FileType fileType) {
  return delegate.fillIndent(indent, fileType);
}