com.intellij.openapi.editor.Editor.getUserData()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中com.intellij.openapi.editor.Editor.getUserData()方法的一些代码示例,展示了Editor.getUserData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Editor.getUserData()方法的具体详情如下:
包路径:com.intellij.openapi.editor.Editor
类名称:Editor
方法名:getUserData

Editor.getUserData介绍

暂无

代码示例

代码示例来源:origin: JetBrains/ideavim

/**
 * Sets the visual block mode flag in the beginning of handling visual operator actions
 */
public static boolean wasVisualBlockMode(@NotNull Editor editor) {
 Boolean res = editor.getUserData(WAS_VISUAL_BLOCK_MODE);
 return res != null && res;
}

代码示例来源:origin: JetBrains/ideavim

/**
 * Checks whether a keeping visual mode visual operator action is performed on editor.
 */
public static boolean isKeepingVisualOperatorAction(@NotNull Editor editor) {
 Boolean res = editor.getUserData(IS_KEEPING_VISUAL_OPERATOR_ACTION);
 if (res == null) {
  return false;
 }
 else {
  return res;
 }
}

代码示例来源:origin: JetBrains/ideavim

public static boolean getChangeGroup(@NotNull Editor editor) {
 Boolean res = editor.getUserData(CHANGE_GROUP);
 if (res != null) {
  return res;
 }
 else {
  return false;
 }
}

代码示例来源:origin: JetBrains/ideavim

/**
 * Asks whether next down move should be ignored.
 */
public static boolean shouldIgnoreNextMove(@NotNull Editor editor) {
 Boolean ret = editor.getUserData(IGNORE_NEXT_MOVE);
 if (ret == null) {
  return false;
 }
 else {
  return ret;
 }
}

代码示例来源:origin: JetBrains/ideavim

public static boolean getMotionGroup(@NotNull Editor editor) {
 return editor.getUserData(MOTION_GROUP) == Boolean.TRUE;
}

代码示例来源:origin: JetBrains/ideavim

public static boolean isLineNumbersShown(@NotNull Editor editor) {
 return editor.getUserData(LINE_NUMBERS_SHOWN) == Boolean.TRUE;
}

代码示例来源:origin: JetBrains/ideavim

public static boolean getEditorGroup(@NotNull Editor editor) {
 return editor.getUserData(EDITOR_GROUP) == Boolean.TRUE;
}

代码示例来源:origin: JetBrains/ideavim

/**
 * Gets the mode to which the editor should switch after a change/visual action.
 */
@Nullable
public static CommandState.Mode getChangeSwitchMode(@NotNull Editor editor) {
 return editor.getUserData(CHANGE_ACTION_SWITCH_MODE);
}

代码示例来源:origin: JetBrains/ideavim

/**
 * Gets the last caret used in down movement.
 */
@Nullable
public static Caret getLastDownCaret(@NotNull Editor editor) {
 return editor.getUserData(LAST_DOWN_CARET);
}

代码示例来源:origin: JetBrains/ideavim

@Nullable
public static CommandState getCommandState(@NotNull Editor editor) {
 return editor.getUserData(COMMAND_STATE);
}

代码示例来源:origin: JetBrains/ideavim

@Nullable
public static TestInputModel getTestInputModel(@NotNull Editor editor) {
 return editor.getUserData(TEST_INPUT_MODEL);
}

代码示例来源:origin: JetBrains/ideavim

@Nullable
public static String getLastSearch(@NotNull Editor editor) {
 return editor.getUserData(LAST_SEARCH);
}

代码示例来源:origin: JetBrains/ideavim

@Nullable
public static Collection<RangeHighlighter> getLastHighlights(@NotNull Editor editor) {
 return editor.getUserData(LAST_HIGHLIGHTS);
}

代码示例来源:origin: JetBrains/ideavim

@Nullable
public static ExOutputPanel getMorePanel(@NotNull Editor editor) {
 return editor.getUserData(MORE_PANEL);
}

代码示例来源:origin: JetBrains/ideavim

@Nullable
public static ExOutputModel getExOutputModel(@NotNull Editor editor) {
 return editor.getUserData(EX_OUTPUT_MODEL);
}

代码示例来源:origin: JetBrains/ideavim

/**
 * Gets the visual block end for the editor.
 *
 * @param editor The editor
 */
public static int getVisualBlockEnd(@NotNull Editor editor) {
 Integer visualBlockEnd = editor.getUserData(VISUAL_BLOCK_END);
 if (visualBlockEnd == null) {
  return editor.getCaretModel().getPrimaryCaret().getOffset();
 }
 else {
  return visualBlockEnd;
 }
}

代码示例来源:origin: JetBrains/ideavim

/**
 * Gets the visual block start for the editor.
 *
 * @param editor The editor
 */
public static int getVisualBlockStart(@NotNull Editor editor) {
 Integer visualBlockStart = editor.getUserData(VISUAL_BLOCK_START);
 if (visualBlockStart == null) {
  return editor.getCaretModel().getPrimaryCaret().getOffset();
 }
 else {
  return visualBlockStart;
 }
}

代码示例来源:origin: JetBrains/ideavim

/**
 * Gets the visual block offset for the editor.
 *
 * @param editor The editor
 */
public static int getVisualBlockOffset(@NotNull Editor editor) {
 Integer visualBlockOffset = editor.getUserData(VISUAL_BLOCK_OFFSET);
 if (visualBlockOffset == null) {
  return editor.getCaretModel().getPrimaryCaret().getOffset();
 }
 else {
  return visualBlockOffset;
 }
}

代码示例来源:origin: JetBrains/ideavim

private MyFontMetrics getFontMetrics(Editor editor) {
 String familyName = UIManager.getFont("Label.font").getFamily();
 int size = (int)(Math.max(1, editor.getColorsScheme().getEditorFontSize() - 1) * factor);
 MyFontMetrics metrics = editor.getUserData(HINT_FONT_METRICS);
 if (metrics != null && !metrics.isActual(editor, familyName, size)) {
  metrics = null;
 }
 if (metrics == null) {
  metrics = new MyFontMetrics(editor, familyName, size);
  editor.putUserData(HINT_FONT_METRICS, metrics);
 }
 return metrics;
}

代码示例来源:origin: antlr/intellij-plugin-v4

@Override
  public void editorReleased(@NotNull EditorFactoryEvent event) {
    Editor editor = event.getEditor();
    if (editor.getProject() != null && editor.getProject() != project) {
      return;
    }
    GrammarEditorMouseAdapter listener = editor.getUserData(EDITOR_MOUSE_LISTENER_KEY);
    if (listener != null) {
      editor.removeEditorMouseListener(listener);
      editor.putUserData(EDITOR_MOUSE_LISTENER_KEY, null);
    }
  }
}

相关文章