use of com.intellij.openapi.externalSystem.util.IntegrationKey in project intellij-community by JetBrains.
the class ExternalSystemFacadeManager method getFacade.
/**
* @return external system api facade to use
* @throws Exception in case of inability to return the facade
*/
@NotNull
public RemoteExternalSystemFacade getFacade(@Nullable Project project, @NotNull String externalProjectPath, @NotNull ProjectSystemId externalSystemId) throws Exception {
if (project == null) {
project = ProjectManager.getInstance().getDefaultProject();
}
IntegrationKey key = new IntegrationKey(project, externalSystemId, externalProjectPath);
final RemoteExternalSystemFacade facade = myFacadeWrappers.get(key);
if (facade == null) {
final RemoteExternalSystemFacade newFacade = (RemoteExternalSystemFacade) Proxy.newProxyInstance(ExternalSystemFacadeManager.class.getClassLoader(), new Class[] { RemoteExternalSystemFacade.class, Consumer.class }, new MyHandler(key));
myFacadeWrappers.putIfAbsent(key, newFacade);
}
return myFacadeWrappers.get(key);
}
use of com.intellij.openapi.externalSystem.util.IntegrationKey in project intellij-community by JetBrains.
the class ExternalSystemFacadeManager method onProjectRename.
private static <V> void onProjectRename(@NotNull Map<IntegrationKey, V> data, @NotNull String oldName, @NotNull String newName) {
Set<IntegrationKey> keys = ContainerUtilRt.newHashSet(data.keySet());
for (IntegrationKey key : keys) {
if (!key.getIdeProjectName().equals(oldName)) {
continue;
}
IntegrationKey newKey = new IntegrationKey(newName, key.getIdeProjectLocationHash(), key.getExternalSystemId(), key.getExternalProjectConfigPath());
V value = data.get(key);
data.put(newKey, value);
data.remove(key);
if (value instanceof Consumer) {
//noinspection unchecked
((Consumer) value).consume(newKey);
}
}
}
Aggregations