Search in sources :

Example 1 with MySQLPropertyView

use of com.microsoft.azure.toolkit.intellij.mysql.MySQLPropertyView in project azure-tools-for-java by Microsoft.

the class UIHelperImpl method openMySQLPropertyView.

@Override
public void openMySQLPropertyView(@NotNull String id, @NotNull Object project) {
    EventUtil.executeWithLog(ActionConstants.MySQL.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, MySQLPropertyViewProvider.TYPE, resourceId.id());
        if (itemVirtualFile == null) {
            itemVirtualFile = createVirtualFile(resourceId.name(), resourceId.subscriptionId(), resourceId.id());
            itemVirtualFile.setFileType(new AzureFileType(MySQLPropertyViewProvider.TYPE, AzureIconLoader.loadIcon(AzureIconSymbol.MySQL.MODULE)));
        }
        FileEditor[] editors = fileEditorManager.openFile(itemVirtualFile, true, true);
        for (FileEditor editor : editors) {
            if (editor.getName().equals(MySQLPropertyView.ID) && editor instanceof MySQLPropertyView) {
                ((MySQLPropertyView) 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) ResourceId(com.azure.resourcemanager.resources.fluentcore.arm.ResourceId) LightVirtualFile(com.intellij.testFramework.LightVirtualFile) MySQLPropertyView(com.microsoft.azure.toolkit.intellij.mysql.MySQLPropertyView)

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 MySQLPropertyView (com.microsoft.azure.toolkit.intellij.mysql.MySQLPropertyView)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