Search in sources :

Example 1 with SqlServerPropertyView

use of com.microsoft.azure.toolkit.intellij.sqlserver.properties.SqlServerPropertyView in project azure-tools-for-java by Microsoft.

the class UIHelperImpl method openSqlServerPropertyView.

@Override
public void openSqlServerPropertyView(@NotNull String id, @NotNull Object project) {
    EventUtil.executeWithLog(ActionConstants.SqlServer.SHOW_PROPERTIES, (operation) -> {
        final ResourceId resourceId = ResourceId.fromString(id);
        final FileEditorManager fileEditorManager = getFileEditorManager(resourceId.subscriptionId(), resourceId.id(), (Project) project);
        if (fileEditorManager == null) {
            return;
        }
        LightVirtualFile itemVirtualFile = searchExistingFile(fileEditorManager, SqlServerPropertyViewProvider.TYPE, resourceId.id());
        if (itemVirtualFile == null) {
            itemVirtualFile = createVirtualFile(resourceId.name(), resourceId.subscriptionId(), resourceId.id());
            itemVirtualFile.setFileType(new AzureFileType(SqlServerPropertyViewProvider.TYPE, AzureIconLoader.loadIcon(AzureIconSymbol.SqlServer.MODULE)));
        }
        FileEditor[] editors = fileEditorManager.openFile(itemVirtualFile, true, true);
        for (FileEditor editor : editors) {
            if (editor.getName().equals(SqlServerPropertyView.ID) && editor instanceof SqlServerPropertyView) {
                ((SqlServerPropertyView) editor).onReadProperty(resourceId.subscriptionId(), resourceId.resourceGroupName(), resourceId.name());
            }
        }
    });
}
Also used : FileEditorManager(com.intellij.openapi.fileEditor.FileEditorManager) TableFileEditor(com.microsoft.intellij.helpers.storage.TableFileEditor) FileEditor(com.intellij.openapi.fileEditor.FileEditor) QueueFileEditor(com.microsoft.intellij.helpers.storage.QueueFileEditor) BlobExplorerFileEditor(com.microsoft.intellij.helpers.storage.BlobExplorerFileEditor) SqlServerPropertyView(com.microsoft.azure.toolkit.intellij.sqlserver.properties.SqlServerPropertyView) ResourceId(com.azure.resourcemanager.resources.fluentcore.arm.ResourceId) LightVirtualFile(com.intellij.testFramework.LightVirtualFile)

Aggregations

ResourceId (com.azure.resourcemanager.resources.fluentcore.arm.ResourceId)1 FileEditor (com.intellij.openapi.fileEditor.FileEditor)1 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)1 LightVirtualFile (com.intellij.testFramework.LightVirtualFile)1 SqlServerPropertyView (com.microsoft.azure.toolkit.intellij.sqlserver.properties.SqlServerPropertyView)1 BlobExplorerFileEditor (com.microsoft.intellij.helpers.storage.BlobExplorerFileEditor)1 QueueFileEditor (com.microsoft.intellij.helpers.storage.QueueFileEditor)1 TableFileEditor (com.microsoft.intellij.helpers.storage.TableFileEditor)1