Search in sources :

Example 1 with DefaultDialogWrapper

use of com.microsoft.intellij.ui.components.DefaultDialogWrapper in project azure-tools-for-java by Microsoft.

the class ApplicatioInsightsAction method onActionPerformed.

@Override
public void onActionPerformed(AnActionEvent event) {
    final Module module = event.getData(LangDataKeys.MODULE);
    DefaultDialogWrapper dialog = new DefaultDialogWrapper(module.getProject(), new ApplicationInsightsPanel(module));
    dialog.show();
}
Also used : ApplicationInsightsPanel(com.microsoft.intellij.ui.libraries.ApplicationInsightsPanel) DefaultDialogWrapper(com.microsoft.intellij.ui.components.DefaultDialogWrapper) Module(com.intellij.openapi.module.Module)

Example 2 with DefaultDialogWrapper

use of com.microsoft.intellij.ui.components.DefaultDialogWrapper in project azure-tools-for-java by Microsoft.

the class LibrariesConfigurationDialog method editLibrary.

private void editLibrary() {
    AzureLibrary azureLibrary = (AzureLibrary) librariesList.getSelectedValue();
    final ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel();
    OrderEntry libraryOrderEntry = null;
    for (OrderEntry orderEntry : modifiableModel.getOrderEntries()) {
        if (orderEntry instanceof ModuleLibraryOrderEntryImpl && azureLibrary.getName().equals(((ModuleLibraryOrderEntryImpl) orderEntry).getLibraryName())) {
            libraryOrderEntry = orderEntry;
            break;
        }
    }
    if (libraryOrderEntry != null) {
        LibraryPropertiesPanel libraryPropertiesPanel = new LibraryPropertiesPanel(module, azureLibrary, true, ((ModuleLibraryOrderEntryImpl) libraryOrderEntry).isExported());
        DefaultDialogWrapper libraryProperties = new DefaultDialogWrapper(module.getProject(), libraryPropertiesPanel);
        libraryProperties.show();
        if (libraryProperties.isOK()) {
            AccessToken token = WriteAction.start();
            try {
                ((ModuleLibraryOrderEntryImpl) libraryOrderEntry).setExported(libraryPropertiesPanel.isExported());
                modifiableModel.commit();
            } finally {
                token.finish();
            }
            LocalFileSystem.getInstance().findFileByPath(PluginUtil.getModulePath(module)).refresh(true, true);
        }
    } else {
        PluginUtil.displayInfoDialog("Library not found", "Library was not found");
    }
}
Also used : ModifiableRootModel(com.intellij.openapi.roots.ModifiableRootModel) OrderEntry(com.intellij.openapi.roots.OrderEntry) AccessToken(com.intellij.openapi.application.AccessToken) DefaultDialogWrapper(com.microsoft.intellij.ui.components.DefaultDialogWrapper) ModuleLibraryOrderEntryImpl(com.intellij.openapi.roots.impl.ModuleLibraryOrderEntryImpl)

Aggregations

DefaultDialogWrapper (com.microsoft.intellij.ui.components.DefaultDialogWrapper)2 AccessToken (com.intellij.openapi.application.AccessToken)1 Module (com.intellij.openapi.module.Module)1 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)1 OrderEntry (com.intellij.openapi.roots.OrderEntry)1 ModuleLibraryOrderEntryImpl (com.intellij.openapi.roots.impl.ModuleLibraryOrderEntryImpl)1 ApplicationInsightsPanel (com.microsoft.intellij.ui.libraries.ApplicationInsightsPanel)1