public void copyUserDataTo(UserDataHolderBase other) { ConcurrentMap<Key, Object> map = myUserMap; if (map == null) { other.myUserMap = null; } else { ConcurrentMap<Key, Object> fresh = createDataMap(map.size()); fresh.putAll(map); other.myUserMap = fresh; } }
protected Object clone() { try { UserDataHolderBase clone = (UserDataHolderBase) super.clone(); clone.myUserMap = null; copyCopyableDataTo(clone); return clone; } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } }
@Override public <T> T getUserData(@NotNull Key<T> key) { final TextEditor textEditor = myPanel.getFileEditor(); if (textEditor != null) { return textEditor.getUserData(key); } return myUserDataHolder.getUserData(key); }
public void copyCopyableDataTo(@NotNull UserDataHolderBase clone) { Map<Key, Object> copyableMap = getUserData(COPYABLE_USER_MAP_KEY); if (copyableMap != null) { ConcurrentMap<Key, Object> copy = createDataMap(copyableMap.size()); copy.putAll(copyableMap); copyableMap = copy; } clone.putUserData(COPYABLE_USER_MAP_KEY, copyableMap); }
@Override public <T> void putUserData(@NotNull Key<T> key, @Nullable T value) { final TextEditor textEditor = myPanel.getFileEditor(); if (textEditor != null) { textEditor.putUserData(key, value); } else { myUserDataHolder.putUserData(key, value); } }
@Override public <T> void putUserData(@NotNull Key<T> key, @Nullable T value) { myUserDataHolder.putUserData(key, value); }
@Nullable @Override public <T> T getUserData(@NotNull Key<T> key) { return myUserDataHolder.getUserData(key); }
@Override public <T> T getUserData(@NotNull Key<T> key) { return myDataHolderBase.getUserData(key); }
public void putCredentials(UserDataHolderBase dataHolder, T credentials) { dataHolder.putUserData(getCredentialsKey(), credentials); }
public T getCredentials(UserDataHolderBase dataHolder) { return dataHolder.getUserData(getCredentialsKey()); }