Search in sources :

Example 1 with StorageEditorInput

use of com.microsoft.azuretools.azureexplorer.editors.StorageEditorInput in project azure-tools-for-java by Microsoft.

the class UIHelperImpl method openItem.

@Override
public <T extends StorageServiceTreeItem> void openItem(Object projectObject, final StorageAccount storageAccount, final T item, String itemType, String itemName, String iconName) {
    //        Display.getDefault().syncExec(new Runnable() {
    //            @Override
    //            public void run() {
    //                try {
    //                    BlobExplorerView view = (BlobExplorerView) PlatformUI
    //                            .getWorkbench().getActiveWorkbenchWindow()
    //                            .getActivePage().showView("com.microsoft.azureexplorer.views.BlobExplorerView");
    //                    view.init(storageAccount, (BlobContainer) blobContainer);
    //                } catch (PartInitException e) {
    //                    Activator.getDefault().log("Error opening container", e);
    //                }
    //            }
    //        });
    IWorkbench workbench = PlatformUI.getWorkbench();
    IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().findEditor(type2Editor.get(item.getClass()));
    try {
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        IEditorPart newEditor = page.openEditor(new StorageEditorInput(storageAccount.name(), StorageClientSDKManager.getConnectionString(storageAccount), item), editorDescriptor.getId());
    } catch (PartInitException e) {
        Activator.getDefault().log("Error opening " + item.getName(), e);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) StorageEditorInput(com.microsoft.azuretools.azureexplorer.editors.StorageEditorInput) IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException)

Example 2 with StorageEditorInput

use of com.microsoft.azuretools.azureexplorer.editors.StorageEditorInput in project azure-tools-for-java by Microsoft.

the class UIHelperImpl method openItem.

@Override
public <T extends StorageServiceTreeItem> void openItem(Object projectObject, final ClientStorageAccount clientStorageAccount, final T item, String itemType, String itemName, String iconName) {
    //        Display.getDefault().syncExec(new Runnable() {
    //            @Override
    //            public void run() {
    //                try {
    //                    BlobExplorerView view = (BlobExplorerView) PlatformUI
    //                            .getWorkbench().getActiveWorkbenchWindow()
    //                            .getActivePage().showView("com.microsoft.azureexplorer.views.BlobExplorerView");
    //                    view.init(storageAccount, (BlobContainer) blobContainer);
    //                } catch (PartInitException e) {
    //                    Activator.getDefault().log("Error opening container", e);
    //                }
    //            }
    //        });
    IWorkbench workbench = PlatformUI.getWorkbench();
    IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().findEditor(type2Editor.get(item.getClass()));
    try {
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        IEditorPart newEditor = page.openEditor(new StorageEditorInput(clientStorageAccount.getName(), clientStorageAccount.getConnectionString(), item), editorDescriptor.getId());
    } catch (PartInitException e) {
        Activator.getDefault().log("Error opening " + item.getName(), e);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) StorageEditorInput(com.microsoft.azuretools.azureexplorer.editors.StorageEditorInput) IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

StorageEditorInput (com.microsoft.azuretools.azureexplorer.editors.StorageEditorInput)2 IEditorDescriptor (org.eclipse.ui.IEditorDescriptor)2 IEditorPart (org.eclipse.ui.IEditorPart)2 IWorkbench (org.eclipse.ui.IWorkbench)2 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)2 PartInitException (org.eclipse.ui.PartInitException)2