com.intellij.openapi.util.UserDataHolder Java Examples

The following examples show how to use com.intellij.openapi.util.UserDataHolder. 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: CsvColorSettings.java    From intellij-csv-validator with Apache License 2.0 6 votes vote down vote up
public static TextAttributes getTextAttributesOfColumn(int columnIndex, UserDataHolder userDataHolder) {
    List<TextAttributes> textAttributeList = userDataHolder.getUserData(COLUMN_HIGHLIGHT_TEXT_ATTRIBUTES_KEY);
    if (textAttributeList == null) {
        EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
        textAttributeList = new ArrayList<>();
        int maxIndex = 0;
        for (int colorDescriptorIndex = 0; colorDescriptorIndex < MAX_COLUMN_HIGHLIGHT_COLORS; ++colorDescriptorIndex) {
            TextAttributesKey textAttributesKey = COLUMN_HIGHLIGHT_ATTRIBUTES.get(colorDescriptorIndex);
            TextAttributes textAttributes = editorColorsScheme.getAttributes(textAttributesKey);
            textAttributeList.add(textAttributes);
            if (!textAttributesKey.getDefaultAttributes().equals(textAttributes)) {
                maxIndex = colorDescriptorIndex;
            }
        }
        textAttributeList = textAttributeList.subList(0, maxIndex + 1);
        userDataHolder.putUserData(COLUMN_HIGHLIGHT_TEXT_ATTRIBUTES_KEY, textAttributeList);
    }
    return textAttributeList.isEmpty() ? null : textAttributeList.get(columnIndex % textAttributeList.size());
}
 
Example #2
Source File: MultiLineCellRenderer.java    From intellij-csv-validator with Apache License 2.0 5 votes vote down vote up
public MultiLineCellRenderer(CsvTableEditorKeyListener keyListener, UserDataHolder userDataHolderParam) {
    this.myUserDataHolder = userDataHolderParam;
    myTextArea = new JTextArea();
    myTextArea.setLineWrap(true);
    myTextArea.setWrapStyleWord(true);
    myTextArea.setOpaque(true);
    myTextArea.setRequestFocusEnabled(true);
    myTextArea.addKeyListener(keyListener);
    this.setOpaque(true);
    this.setBorder(null);
    this.setViewportView(myTextArea);
}
 
Example #3
Source File: UserMapKeys.java    From sqlitemagic with Apache License 2.0 4 votes vote down vote up
public static void updateSqliteMagicPresent(@NotNull UserDataHolder element, boolean isPresent) {
  element.putUserData(HAS_SQLITEMAGIC_KEY, isPresent);
}
 
Example #4
Source File: UserMapKeys.java    From sqlitemagic with Apache License 2.0 4 votes vote down vote up
public static boolean isSqliteMagicPossiblePresent(@NotNull UserDataHolder element) {
  Boolean userData = element.getUserData(HAS_SQLITEMAGIC_KEY);
  return null == userData || userData;
}