use of com.microsoft.azure.toolkit.intellij.redis.RedisCachePropertyView in project azure-tools-for-java by Microsoft.
the class UIHelperImpl method openRedisPropertyView.
@Override
public void openRedisPropertyView(@NotNull RedisCacheNode node) {
EventUtil.executeWithLog(TelemetryConstants.REDIS, TelemetryConstants.REDIS_READPROP, (operation) -> {
String redisName = node.getName() != null ? node.getName() : RedisCacheNode.TYPE;
String sid = node.getSubscriptionId();
String resId = node.getResourceId();
if (isSubscriptionIdAndResourceIdEmpty(sid, resId)) {
return;
}
Project project = (Project) node.getProject();
FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
if (fileEditorManager == null) {
showError(CANNOT_GET_FILE_EDITOR_MANAGER, UNABLE_TO_OPEN_EDITOR_WINDOW);
return;
}
LightVirtualFile itemVirtualFile = searchExistingFile(fileEditorManager, RedisCachePropertyViewProvider.TYPE, resId);
if (itemVirtualFile == null) {
itemVirtualFile = createVirtualFile(redisName, sid, resId);
itemVirtualFile.setFileType(new AzureFileType(RedisCachePropertyViewProvider.TYPE, AzureIconLoader.loadIcon(AzureIconSymbol.RedisCache.MODULE)));
}
FileEditor[] editors = fileEditorManager.openFile(itemVirtualFile, true, true);
for (FileEditor editor : editors) {
if (editor.getName().equals(RedisCachePropertyView.ID) && editor instanceof RedisCachePropertyView) {
((RedisCachePropertyView) editor).onReadProperty(sid, resId);
}
}
});
}
Aggregations