예제 #1
0
 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;
   }
 }
예제 #2
0
 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);
 }
예제 #4
0
 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);
 }
예제 #10
0
 public T getCredentials(UserDataHolderBase dataHolder) {
   return dataHolder.getUserData(getCredentialsKey());
 }