Java 类com.intellij.openapi.editor.impl.DefaultEditorTextRepresentationHelper 实例源码

项目:tools-idea    文件:SoftWrapApplianceOnDocumentModificationTest.java   
private void init(final int visibleWidth, @NotNull String fileText, @NotNull TestFileType fileType, final int symbolWidth) throws IOException {
  init(fileText, fileType);
  myEditor.getSettings().setUseSoftWraps(true);
  SoftWrapModelImpl model = (SoftWrapModelImpl)myEditor.getSoftWrapModel();
  model.reinitSettings();

  SoftWrapApplianceManager applianceManager = model.getApplianceManager();
  applianceManager.setWidthProvider(new SoftWrapApplianceManager.VisibleAreaWidthProvider() {
    @Override
    public int getVisibleAreaWidth() {
      return visibleWidth;
    }
  });

  if (symbolWidth > 0) {
    applianceManager.setRepresentationHelper(new DefaultEditorTextRepresentationHelper(myEditor) {
      @Override
      public int charWidth(char c, int fontType) {
        return symbolWidth;
      }
    });
  }

  applianceManager.registerSoftWrapIfNecessary();
}