Java Code Examples for com.intellij.openapi.editor.Caret#getUserData()

The following examples show how to use com.intellij.openapi.editor.Caret#getUserData() . 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: CloneCaretActionHandler.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static int getLevel(Caret caret) {
  if (isRepeatedActionInvocation()) {
    Integer value = caret.getUserData(LEVEL);
    return value == null ? 0 : value;
  }
  else {
    caret.putUserData(LEVEL, null);
    return 0;
  }
}
 
Example 2
Source File: CodeCompletionHandlerBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static Caret getNextCaretToProcess(@Nonnull Editor editor) {
  for (Caret caret : editor.getCaretModel().getAllCarets()) {
    if (caret.getUserData(CARET_PROCESSED) == null) {
      return caret;
    }
  }
  return null;
}
 
Example 3
Source File: TabOutScopesTrackerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private List<RangeMarker> getCurrentScopes(boolean create) {
  Caret currentCaret = myEditor.getCaretModel().getCurrentCaret();
  List<RangeMarker> result = currentCaret.getUserData(TRACKED_SCOPES);
  if (result == null && create) {
    currentCaret.putUserData(TRACKED_SCOPES, result = new ArrayList<>());
  }
  return result;
}