Example usage for com.intellij.openapi.ui DialogWrapper OK_EXIT_CODE

List of usage examples for com.intellij.openapi.ui DialogWrapper OK_EXIT_CODE

Introduction

In this page you can find the example usage for com.intellij.openapi.ui DialogWrapper OK_EXIT_CODE.

Prototype

int OK_EXIT_CODE

To view the source code for com.intellij.openapi.ui DialogWrapper OK_EXIT_CODE.

Click Source Link

Document

The default exit code for "OK" action.

Usage

From source file:com.microsoft.intellij.forms.OpenSSLFinderForm.java

License:Open Source License

@Override
protected void doOKAction() {
    DefaultLoader.getIdeHelper().setProperty("MSOpenSSLPath", txtFile.getText());

    close(DialogWrapper.OK_EXIT_CODE, true);
}

From source file:com.microsoft.intellij.forms.PermissionsEditorForm.java

License:Open Source License

@Override
protected void doOKAction() {
    if (onOK != null) {
        onOK.run();
    }
    close(DialogWrapper.OK_EXIT_CODE, true);
}

From source file:com.microsoft.intellij.forms.QueueMessageForm.java

License:Open Source License

@Override
protected void doOKAction() {

    final String message = messageTextArea.getText();
    final int expireSeconds = getExpireSeconds();

    ProgressManager.getInstance().run(new Task.Backgroundable(project, "Adding queue message", false) {
        @Override//from   www.  j a  v  a2 s  .c  o m
        public void run(@NotNull ProgressIndicator progressIndicator) {
            try {
                QueueMessage queueMessage = new QueueMessage("", queue.getName(), message,
                        new GregorianCalendar(), new GregorianCalendar(), 0);

                StorageClientSDKManagerImpl.getManager().createQueueMessage(storageAccount, queueMessage,
                        expireSeconds);

                if (onAddedMessage != null) {
                    ApplicationManager.getApplication().invokeLater(onAddedMessage);
                }
            } catch (AzureCmdException e) {
                String msg = "An error occurred while attempting to add queue message." + "\n"
                        + String.format(message("webappExpMsg"), e.getMessage());
                PluginUtil.displayErrorDialogAndLog(message("errTtl"), msg, e);
            }
        }
    });

    close(DialogWrapper.OK_EXIT_CODE, true);
}

From source file:com.microsoft.intellij.forms.TableForm.java

License:Open Source License

@Override
protected void doOKAction() {
    final String tableName = tableNameTextField.getText().trim();
    final TablePermissions tablePermissions = new TablePermissions();

    tablePermissions.setDelete(((PermissionItem) deletePermissionComboBox.getSelectedItem()).getType());
    tablePermissions.setUpdate(((PermissionItem) updatePermissionComboBox.getSelectedItem()).getType());
    tablePermissions.setRead(((PermissionItem) readPermissionComboBox.getSelectedItem()).getType());
    tablePermissions.setInsert(((PermissionItem) insertPermisssionComboBox.getSelectedItem()).getType());

    DefaultLoader.getIdeHelper().runInBackground(project, "Saving table", false, true, "Saving table...",
            new Runnable() {
                @Override//from  w w  w  .  j  a va2s.  c  o  m
                public void run() {
                    try {
                        if (editingTable == null) {
                            AzureManagerImpl.getManager().createTable(subscriptionId, serviceName, tableName,
                                    tablePermissions);
                        } else {
                            AzureManagerImpl.getManager().updateTable(subscriptionId, serviceName, tableName,
                                    tablePermissions);
                        }

                        DefaultLoader.getIdeHelper().invokeLater(new Runnable() {
                            @Override
                            public void run() {
                                if (afterSave != null) {
                                    afterSave.run();
                                }
                            }
                        });
                    } catch (Throwable e) {
                        AzurePlugin.log(e.getStackTrace().toString());
                        PluginUtil.displayErrorDialog(message("errTtl"),
                                "An error occurred while attempting to save the table.");
                    }
                }
            });

    close(DialogWrapper.OK_EXIT_CODE, true);
}

From source file:com.microsoft.intellij.forms.TablesQueryDesigner.java

License:Open Source License

@Override
protected void doOKAction() {
    onFinish.run();
    close(DialogWrapper.OK_EXIT_CODE, true);
}

From source file:com.microsoft.intellij.helpers.activityConfiguration.azureCustomWizardParameter.AzureParameterPane.java

License:Open Source License

public AzureParameterPane() {
    super(new BorderLayout());

    this.add(mainPanel, BorderLayout.CENTER);

    document = new PlainDocument();

    mobileServicesCheckBox.addActionListener(new ActionListener() {
        @Override/*from w  w  w.  ja v  a  2s. c  o  m*/
        public void actionPerformed(ActionEvent actionEvent) {
            mobileServicesConfigureButton.setEnabled(mobileServicesCheckBox.isSelected());
            updateDocument();
        }
    });
    notificationHubCheckBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            notificationHubConfigureButton.setEnabled(notificationHubCheckBox.isSelected());
            updateDocument();
        }
    });

    mobileServicesConfigureButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            DataContext dataContext = DataManager.getInstance().getDataContext(mainPanel);
            final Project project = DataKeys.PROJECT.getData(dataContext);

            final MobileServiceConfigForm form = new MobileServiceConfigForm(project);

            if (selectedMobileService != null) {
                form.setSelectedMobileService(selectedMobileService);
            }

            form.show();

            if (form.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
                selectedMobileService = form.getSelectedMobileService();

            }

            updateDocument();

        }
    });

    notificationHubConfigureButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            try {
                DataContext dataContext = DataManager.getInstance().getDataContext(mainPanel);
                Project project = DataKeys.PROJECT.getData(dataContext);

                Module module = null;
                Object selectedElement = ProjectView.getInstance(project).getCurrentProjectViewPane()
                        .getSelectedElement();

                if (selectedElement instanceof PsiElement) {
                    PsiElement psiSelectedElement = (PsiElement) selectedElement;
                    module = ModuleUtil.findModuleForPsiElement(psiSelectedElement);
                } else if (selectedElement instanceof AndroidFacet) {
                    module = ((AndroidFacet) selectedElement).getModule();
                } else if (selectedElement instanceof Module) {
                    module = (Module) selectedElement;
                }

                if (module != null) {
                    final NotificationHubConfigForm form = new NotificationHubConfigForm(module);

                    if (connectionString != null) {
                        form.setConnectionString(connectionString);
                    }
                    if (senderID != null) {
                        form.setSenderID(senderID);
                    }
                    if (hubName != null) {
                        form.setHubName(hubName);
                    }

                    form.show();

                    if (form.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
                        connectionString = form.getConnectionString();
                        hubName = form.getHubName();
                        senderID = form.getSenderID();
                    }

                    updateDocument();
                }
            } catch (Throwable e) {
                DefaultLoader.getUIHelper().showException(
                        "An error occurred while attempting to load notification " + "hubs configuration", e,
                        "Microsoft Cloud Services For Android - Error Loading NH Configuration", false, true);
            }
        }
    });
}

From source file:com.microsoft.intellij.helpers.activityConfiguration.office365CustomWizardParameter.Office365ParameterPane.java

License:Open Source License

public Office365ParameterPane() {
    super(new BorderLayout());

    add(mainPanel, BorderLayout.CENTER);

    document = new PlainDocument();

    oneNoteCheckBox.addActionListener(new ActionListener() {
        @Override/*  w w w  . ja v a  2  s.  com*/
        public void actionPerformed(ActionEvent actionEvent) {
            configureOneNoteButton.setEnabled(oneNoteCheckBox.isSelected());

            updateDocument();
        }

    });

    ActionListener actionListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            configureOffice365Button.setEnabled(outlookServicesCheckBox.isSelected()
                    || sharepointListsCheckBox.isSelected() || fileServicesCheckBox.isSelected());

            updateDocument();
        }
    };
    outlookServicesCheckBox.addActionListener(actionListener);
    sharepointListsCheckBox.addActionListener(actionListener);
    fileServicesCheckBox.addActionListener(actionListener);

    configureOffice365Button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            DataContext dataContext = DataManager.getInstance().getDataContext(mainPanel);
            final Project project = DataKeys.PROJECT.getData(dataContext);

            Office365ConfigForm form = new Office365ConfigForm(project, sharepointListsCheckBox.isSelected(),
                    fileServicesCheckBox.isSelected(), outlookServicesCheckBox.isSelected());

            form.show();

            if (form.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
                selectedApplication = form.getApplication();
            }

            updateDocument();
        }
    });

    configureOneNoteButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            DataContext dataContext = DataManager.getInstance().getDataContext(mainPanel);
            final Project project = DataKeys.PROJECT.getData(dataContext);

            OneNoteConfigForm form = new OneNoteConfigForm(project);
            form.show();

            if (form.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
                selectedClientID = form.getClientId();
            }

            updateDocument();
        }
    });
}

From source file:com.microsoft.intellij.serviceexplorer.azure.docker.DeployDockerContainerAction.java

License:Open Source License

@Override
public void actionPerformed(NodeActionEvent e) {
    try {//from   w ww .  j  a  v a2s.  c  o  m
        if (!AzureSignInAction.doSignIn(AuthMethodManager.getInstance(), project))
            return;
        if (dockerManager.getSubscriptionsMap().isEmpty()) {
            PluginUtil.displayErrorDialog("Publish Docker Container",
                    "Must select an Azure subscription first");
            return;
        }

        AzureDockerImageInstance dockerImageDescription = dockerManager
                .getDefaultDockerImageDescription(project.getName(), dockerHost);

        AzureSelectDockerWizardModel model = new AzureSelectDockerWizardModel(project, dockerManager,
                dockerImageDescription);
        AzureSelectDockerWizardDialog wizard = new AzureSelectDockerWizardDialog(model);
        model.selectDefaultDockerHost(dockerHost, false);
        wizard.show();

        if (wizard.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
            try {
                String url = wizard.deploy();
                System.out.println("Container published at: " + url);
            } catch (Exception ex) {
                PluginUtil.displayErrorDialogAndLog(message("webAppDplyErr"), ex.getMessage(), ex);
            }
        }
    } catch (Exception ex1) {
        LOGGER.error("actionPerformed", ex1);
        ex1.printStackTrace();
    }
}

From source file:com.microsoft.intellij.ui.debug.AzureRemoteConfigurable.java

License:Apache License

private Action createLinkAction() {
    return new AbstractAction("Azure Web App") {
        @Override/*w  ww . j  a v  a  2s  . c  om*/
        public void actionPerformed(ActionEvent e) {
            String prevSelection = (String) webAppCombo.getSelectedItem();
            Module module = PluginUtil.getSelectedModule();
            if (module == null && !modules.isEmpty()) {
                module = modules.iterator().next();
                WebSiteDeployForm form = new WebSiteDeployForm(module);
                form.show();
                if (form.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
                    try {
                        String url = form.deploy();
                        WebSiteDeployTask task = new WebSiteDeployTask(project, form.getSelectedWebSite(), url);
                        task.queue();
                    } catch (AzureCmdException ex) {
                        PluginUtil.displayErrorDialogAndLog(message("webAppDplyErr"), ex.getMessage(), ex);
                    }
                }
                List<String> listToDisplay = loadWebApps();
                if (!listToDisplay.isEmpty()) {
                    if (!prevSelection.isEmpty() && listToDisplay.contains(prevSelection)) {
                        webAppCombo.setSelectedItem(prevSelection);
                    } else {
                        webAppCombo.setSelectedItem(listToDisplay.get(0));
                    }
                }
            } else {
                Messages.showErrorDialog(message("noModule"), message("error"));
            }
        }
    };
}

From source file:com.perl5.lang.perl.extensions.generation.PerlCodeGeneratorImpl.java

License:Apache License

@Override
public void generateOverrideMethod(PsiElement anchor, Editor editor) {
    if (anchor != null) {
        final List<PerlMethodMember> subDefinitions = new ArrayList<PerlMethodMember>();

        PerlPackageUtil.processNotOverridedMethods(
                PsiTreeUtil.getParentOfType(anchor, PerlNamespaceDefinition.class),
                new Processor<PerlSubBase>() {
                    @Override/*from w  w  w  .j a  v a2s.com*/
                    public boolean process(PerlSubBase subDefinitionBase) {
                        subDefinitions.add(new PerlMethodMember(subDefinitionBase));
                        return true;
                    }
                });

        final MemberChooser<PerlMethodMember> chooser = new MemberChooser<PerlMethodMember>(
                subDefinitions.toArray(new PerlMethodMember[subDefinitions.size()]), false, true,
                anchor.getProject()) {
            @Override
            protected SpeedSearchComparator getSpeedSearchComparator() {
                return new SpeedSearchComparator(false) {
                    @Nullable
                    @Override
                    public Iterable<TextRange> matchingFragments(String pattern, String text) {
                        return super.matchingFragments(PerlMethodMember.trimUnderscores(pattern), text);
                    }
                };
            }

            @Override
            protected ShowContainersAction getShowContainersAction() {
                return new ShowContainersAction(IdeBundle.message("action.show.classes"),
                        PerlIcons.PACKAGE_GUTTER_ICON);
            }
        };

        chooser.setTitle("Override/Implement Method");
        chooser.setCopyJavadocVisible(false);
        chooser.show();
        if (chooser.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
            return;
        }

        StringBuilder generatedCode = new StringBuilder("");

        if (chooser.getSelectedElements() != null) {
            for (PerlMethodMember methodMember : chooser.getSelectedElements()) {
                String code = getOverrideCodeText(methodMember.getPsiElement());
                if (StringUtil.isNotEmpty(code)) {
                    generatedCode.append(code);
                    generatedCode.append("\n\n");
                }
            }

            insertCodeAfterElement(anchor, generatedCode.toString(), editor);
        }
    }
}