use of com.intellij.util.keyFMap.KeyFMap in project intellij-community by JetBrains.
the class ExportableUserDataHolderBase method exportUserData.
@NotNull
public final Map<Key, Object> exportUserData() {
final Map<Key, Object> result = new HashMap<>();
KeyFMap map = getUserMap();
Key[] keys = map.getKeys();
for (Key<?> k : keys) {
final Object data = map.get(k);
if (data != null) {
result.put(k, data);
}
}
return result;
}
use of com.intellij.util.keyFMap.KeyFMap in project intellij-community by JetBrains.
the class ExternalSystemExecuteTaskTask method doExecute.
@SuppressWarnings("unchecked")
@Override
protected void doExecute() throws Exception {
final ExternalSystemFacadeManager manager = ServiceManager.getService(ExternalSystemFacadeManager.class);
ExternalSystemExecutionSettings settings = ExternalSystemApiUtil.getExecutionSettings(getIdeProject(), getExternalProjectPath(), getExternalSystemId());
KeyFMap keyFMap = getUserMap();
for (Key key : keyFMap.getKeys()) {
settings.putUserData(key, keyFMap.get(key));
}
RemoteExternalSystemFacade facade = manager.getFacade(getIdeProject(), getExternalProjectPath(), getExternalSystemId());
RemoteExternalSystemTaskManager taskManager = facade.getTaskManager();
List<String> taskNames = ContainerUtilRt.map2List(myTasksToExecute, ExternalTaskPojo::getName);
final List<String> vmOptions = parseCmdParameters(myVmOptions);
final List<String> arguments = parseCmdParameters(myArguments);
settings.withVmOptions(vmOptions).withArguments(arguments);
taskManager.executeTasks(getId(), taskNames, getExternalProjectPath(), settings, myJvmAgentSetup);
}
use of com.intellij.util.keyFMap.KeyFMap in project intellij-community by JetBrains.
the class UserDataHolderBase method putUserDataIfAbsent.
@Override
@NotNull
public <T> T putUserDataIfAbsent(@NotNull final Key<T> key, @NotNull final T value) {
while (true) {
KeyFMap map = getUserMap();
T oldValue = map.get(key);
if (oldValue != null) {
return oldValue;
}
KeyFMap newMap = map.plus(key, value);
if (newMap == map || changeUserMap(map, newMap)) {
return value;
}
}
}
use of com.intellij.util.keyFMap.KeyFMap in project intellij-community by JetBrains.
the class UserDataHolderBase method putCopyableUserData.
public <T> void putCopyableUserData(@NotNull Key<T> key, T value) {
while (true) {
KeyFMap map = getUserMap();
KeyFMap copyableMap = map.get(COPYABLE_USER_MAP_KEY);
if (copyableMap == null) {
copyableMap = KeyFMap.EMPTY_MAP;
}
KeyFMap newCopyableMap = value == null ? copyableMap.minus(key) : copyableMap.plus(key, value);
KeyFMap newMap = newCopyableMap.isEmpty() ? map.minus(COPYABLE_USER_MAP_KEY) : map.plus(COPYABLE_USER_MAP_KEY, newCopyableMap);
if (newMap == map || changeUserMap(map, newMap)) {
return;
}
}
}
Aggregations