Java 类com.intellij.ui.EditorCustomization 实例源码

项目:intellij-ce-playground    文件:SpellCheckingEditorCustomizationTest.java   
private void doTest(boolean enabled, String document) {
  InspectionProfileImpl.INIT_INSPECTIONS = true;
  try {
    myFixture.configureByText(PlainTextFileType.INSTANCE, document);
    myFixture.enableInspections(new SpellCheckingInspection());

    EditorCustomization customization = SpellCheckingEditorCustomizationProvider.getInstance().getCustomization(enabled);
    assertNotNull(customization);
    customization.customize((EditorEx)myFixture.getEditor());

    myFixture.checkHighlighting();
  }
  finally {
    InspectionProfileImpl.INIT_INSPECTIONS = false;
  }
}
项目:intellij-ce-playground    文件:MultilinePopupBuilder.java   
@NotNull
private static EditorTextField createTextField(@NotNull Project project) {
  final EditorTextFieldProvider service = ServiceManager.getService(project, EditorTextFieldProvider.class);
  List<EditorCustomization> features = ContainerUtil.packNullables(SoftWrapsEditorCustomization.ENABLED,
                                                                   SpellCheckingEditorCustomizationProvider.getInstance().getDisabledCustomization());
  EditorTextField textField = service.getEditorField(FileTypes.PLAIN_TEXT.getLanguage(), project, features);
  textField.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), textField.getBorder()));
  textField.setOneLineMode(false);
  return textField;
}
项目:intellij-ce-playground    文件:PushTargetTextField.java   
@Override
protected EditorEx createEditor() {
  // editor created lazy, so we need to update editor customization after initialization
  EditorEx editorEx = super.createEditor();
  EditorCustomization customization = SpellCheckingEditorCustomizationProvider.getInstance().getDisabledCustomization();
  if (customization != null) {
    customization.customize(editorEx);
  }
  return editorEx;
}
项目:intellij    文件:VcsEditorConfigurationCompatUtils.java   
public static List<EditorCustomization> getVcsConfigurationCustomizations(
    Project project, VcsConfiguration config) {
  return ImmutableList.of(
      new RightMarginEditorCustomization(
          config.USE_COMMIT_MESSAGE_MARGIN,
          CommitMessageInspectionProfile.getBodyRightMargin(project)));
}
项目:intellij    文件:VcsEditorConfigurationCompatUtils.java   
public static List<EditorCustomization> getVcsConfigurationCustomizations(
    Project project, VcsConfiguration config) {
  return ImmutableList.of(
      SpellCheckingEditorCustomization.getInstance(config.CHECK_COMMIT_MESSAGE_SPELLING),
      new RightMarginEditorCustomization(
          config.USE_COMMIT_MESSAGE_MARGIN, config.COMMIT_MESSAGE_MARGIN_SIZE));
}
项目:intellij    文件:VcsEditorConfigurationCompatUtils.java   
public static List<EditorCustomization> getVcsConfigurationCustomizations(
    Project project, VcsConfiguration config) {
  return ImmutableList.of(
      new RightMarginEditorCustomization(
          config.USE_COMMIT_MESSAGE_MARGIN,
          CommitMessageInspectionProfile.getBodyRightMargin(project)));
}
项目:review-board-idea-plugin    文件:MultiValueAutoComplete.java   
public static EditorTextField create(Project project, DataProvider dataProvider) {
    List<EditorCustomization> customizations =
            Arrays.<EditorCustomization>asList(SoftWrapsEditorCustomization.ENABLED, SpellCheckingEditorCustomization.DISABLED);
    EditorTextField editorField = ServiceManager.getService(project, EditorTextFieldProvider.class)
            .getEditorField(FileTypes.PLAIN_TEXT.getLanguage(), project, customizations);
    new CommaSeparatedTextFieldCompletion(dataProvider).apply(editorField);
    return editorField;

}
项目:consulo    文件:TextFieldWithCompletion.java   
@Override
protected EditorEx createEditor() {
  EditorEx editor = super.createEditor();
  EditorCustomization disableSpellChecking = SpellCheckingEditorCustomizationProvider.getInstance().getDisabledCustomization();
  if (disableSpellChecking != null) disableSpellChecking.customize(editor);
  editor.putUserData(AutoPopupController.ALWAYS_AUTO_POPUP, myForceAutoPopup);

  if (myShowHint) {
    TextCompletionUtil.installCompletionHint(editor);
  }

  return editor;
}
项目:intellij-ce-playground    文件:SpellCheckingEditorCustomizationProviderImpl.java   
@Nullable
@Override
public EditorCustomization getEnabledCustomization() {
  return ENABLED;
}
项目:intellij-ce-playground    文件:SpellCheckingEditorCustomizationProviderImpl.java   
@Nullable
@Override
public EditorCustomization getDisabledCustomization() {
  return DISABLED;
}
项目:intellij-ce-playground    文件:TextFieldWithProgress.java   
public TextFieldWithProgress(@NotNull Project project, @NotNull Collection<String> variants) {
  super(new BorderLayout());
  setBorder(IdeBorderFactory.createEmptyBorder(3));

  myProgressIcon = new AsyncProcessIcon("Loading commits");
  myTextField =
    new TextFieldWithAutoCompletion<String>(project, new TextFieldWithAutoCompletion.StringsCompletionProvider(variants, null), false,
                                            null) {
      @Override
      public void setBackground(Color bg) {
        super.setBackground(bg);
        myProgressIcon.setBackground(bg);
      }

      @Override
      protected EditorEx createEditor() {
        // spell check is not needed
        EditorEx editor = super.createEditor();
        EditorCustomization customization = SpellCheckingEditorCustomizationProvider.getInstance().getDisabledCustomization();
        if (customization != null) {
          customization.customize(editor);
        }
        return editor;
      }

      @Override
      protected boolean processKeyBinding(KeyStroke ks, final KeyEvent e, int condition, boolean pressed) {
        if (e.getKeyCode() == KeyEvent.VK_ENTER) {
          onOk();
          return true;
        }
        return false;
      }
    };
  myTextField.setBorder(IdeBorderFactory.createEmptyBorder());

  myProgressIcon.setOpaque(true);
  myProgressIcon.setBackground(myTextField.getBackground());

  add(myTextField, BorderLayout.CENTER);
  add(myProgressIcon, BorderLayout.EAST);

  hideProgress();
}
项目:intellij-ce-playground    文件:SpellCheckingEditorCustomizationProvider.java   
@Nullable
public final EditorCustomization getCustomization(boolean enabled) {
  return enabled ? getEnabledCustomization() : getDisabledCustomization();
}
项目:intellij-ce-playground    文件:SpellCheckingEditorCustomizationProvider.java   
@Nullable
public EditorCustomization getEnabledCustomization() {
  return null;
}
项目:intellij-ce-playground    文件:SpellCheckingEditorCustomizationProvider.java   
@Nullable
public EditorCustomization getDisabledCustomization() {
  return null;
}
项目:consulo    文件:SpellCheckerCustomization.java   
@Nonnull
public EditorCustomization getCustomization(boolean enabled) {
  throw new UnsupportedOperationException();
}
项目:consulo    文件:SpellCheckingEditorCustomizationProvider.java   
@Nullable
public final EditorCustomization getCustomization(boolean enabled) {
  return enabled ? getEnabledCustomization() : getDisabledCustomization();
}
项目:consulo    文件:SpellCheckingEditorCustomizationProvider.java   
@Nullable
public EditorCustomization getEnabledCustomization() {
  SpellCheckerCustomization spellCheckerCustomization = SpellCheckerCustomization.getInstance();
  return spellCheckerCustomization.isEnabled() ? spellCheckerCustomization.getCustomization(true) : null;
}
项目:consulo    文件:SpellCheckingEditorCustomizationProvider.java   
@Nullable
public EditorCustomization getDisabledCustomization() {
  SpellCheckerCustomization spellCheckerCustomization = SpellCheckerCustomization.getInstance();
  return spellCheckerCustomization.isEnabled() ? spellCheckerCustomization.getCustomization(false) : null;
}