Example usage for com.intellij.openapi.ui Messages NO

List of usage examples for com.intellij.openapi.ui Messages NO

Introduction

In this page you can find the example usage for com.intellij.openapi.ui Messages NO.

Prototype

int NO

To view the source code for com.intellij.openapi.ui Messages NO.

Click Source Link

Usage

From source file:com.microsoft.intellij.ui.libraries.LibraryPropertiesPanel.java

License:Open Source License

private ActionListener createRequiredHttpsCheckListener() {
    return new ActionListener() {
        @Override/*from  w  w w.  j  a va2  s. c om*/
        public void actionPerformed(ActionEvent e) {
            if (requiresHttpsCheck.isSelected()) {
                //Do nothing
            } else {
                int choice = Messages.showYesNoDialog(message("requiresHttpsDlgMsg"),
                        message("requiresHttpsDlgTitle"), Messages.getQuestionIcon());
                if (choice == Messages.NO) {
                    requiresHttpsCheck.setSelected(true);
                }
            }
        }
    };
}

From source file:com.microsoftopentechnologies.intellij.ui.azureroles.ComponentsPanel.java

License:Apache License

/**
 * Listener method for remove button which
 * deletes the selected component./*  w ww.  j a v  a2 s .  c om*/
 */
private void removeComponent() {
    WindowsAzureRoleComponent component = tblComponents.getSelectedObject();
    //        IWorkspace workspace = ResourcesPlugin.getWorkspace();
    //        IWorkspaceRoot root = workspace.getRoot();
    //        WindowsAzureRoleComponent component = listComponents.get(selIndex);
    try {
        /* First condition: Checks component is part of a JDK,
        * server configuration
        * Second condition: For not showing error message
        * "Disable Server JDK Configuration"
        * while removing server application
        * when server or JDK  is already disabled.
        */
        if (component.getIsPreconfigured() && (!(component.getType().equals(message("typeSrvApp"))
                && windowsAzureRole.getServerName() == null))) {
            PluginUtil.displayErrorDialog(message("jdkDsblErrTtl"), message("jdkDsblErrMsg"));
        } else {
            int choice = Messages.showYesNoDialog(message("cmpntRmvMsg"), message("cmpntRmvTtl"),
                    Messages.getQuestionIcon());
            if (choice == Messages.YES) {
                String cmpntPath = String.format("%s%s%s%s%s",
                        PluginUtil.getModulePath(ModuleManager.getInstance(project)
                                .findModuleByName(waProjManager.getProjectName())),
                        File.separator, windowsAzureRole.getName(), message("approot"),
                        component.getDeployName());
                File file = new File(cmpntPath);
                // Check import source is equal to approot
                if (component.getImportPath().isEmpty() && file.exists()) {
                    int selected = Messages.showYesNoCancelDialog(message("cmpntSrcRmvMsg"),
                            message("cmpntSrcRmvTtl"), Messages.getQuestionIcon());
                    switch (selected) {
                    case Messages.YES:
                        //yes
                        component.delete();
                        //                                tblViewer.refresh();
                        fileToDel.add(file);
                        break;
                    case Messages.NO:
                        //no
                        component.delete();
                        //                                tblViewer.refresh();
                        break;
                    case Messages.CANCEL:
                        //cancel
                        break;
                    default:
                        break;
                    }
                } else {
                    component.delete();
                    //                        tblViewer.refresh();
                    fileToDel.add(file);
                }
                myModified = true;
            }
        }
        //            if (tblComponents.getItemCount() == 0) {
        //                // table is empty i.e. number of rows = 0
        //                btnRemove.setEnabled(false);
        //                btnEdit.setEnabled(false);
        //            }
    } catch (WindowsAzureInvalidProjectOperationException e) {
        PluginUtil.displayErrorDialogAndLog(message("cmpntSetErrTtl"), message("cmpntRmvErrMsg"), e);
    }
}

From source file:org.jetbrains.idea.maven.importing.MavenProjectImporter.java

License:Apache License

private boolean deleteObsoleteModules() {
    final List<Module> obsoleteModules = collectObsoleteModules();
    if (obsoleteModules.isEmpty()) {
        return false;
    }//www. j  a v  a2  s . c  om

    setMavenizedModules(obsoleteModules, false);

    final int[] result = new int[1];
    MavenUtil.invokeAndWait(myProject, myModelsProvider.getModalityStateForQuestionDialogs(), new Runnable() {
        @Override
        public void run() {
            result[0] = Messages.showYesNoDialog(myProject,
                    ProjectBundle.message("maven.import.message.delete.obsolete",
                            formatModules(obsoleteModules)),
                    ProjectBundle.message("maven.project.import.title"), Messages.getQuestionIcon());
        }
    });

    if (result[0] == Messages.NO) {
        return false;// NO
    }

    for (Module each : obsoleteModules) {
        if (!each.isDisposed()) {
            myModuleModel.disposeModule(each);
        }
    }

    return true;
}

From source file:org.jetbrains.idea.svn.actions.CreateBranchOrTagAction.java

License:Apache License

protected void perform(final Project project, final SvnVcs activeVcs, VirtualFile file, DataContext context)
        throws VcsException {
    CreateBranchOrTagDialog dialog = new CreateBranchOrTagDialog(project, true, new File(file.getPath()));
    dialog.show();//w w  w  .  j a v  a2 s  . c  o m
    if (dialog.isOK()) {
        final String dstURL = dialog.getToURL();
        final SVNRevision revision = dialog.getRevision();
        final String comment = dialog.getComment();
        final Ref<Exception> exception = new Ref<Exception>();
        final boolean isSrcFile = dialog.isCopyFromWorkingCopy();
        final File srcFile = new File(dialog.getCopyFromPath());
        final SVNURL srcUrl;
        final SVNURL dstSvnUrl;
        final SVNURL parentUrl;
        try {
            srcUrl = SVNURL.parseURIEncoded(dialog.getCopyFromUrl());
            dstSvnUrl = SVNURL.parseURIEncoded(dstURL);
            parentUrl = dstSvnUrl.removePathTail();

            if (!dirExists(activeVcs, project, parentUrl)) {
                int rc = Messages.showYesNoDialog(project,
                        "The repository path '" + parentUrl + "' does not exist. Would you like to create it?",
                        "Branch or Tag", Messages.getQuestionIcon());
                if (rc == Messages.NO) {
                    return;
                }
            }

        } catch (SVNException e) {
            throw new VcsException(e);
        }

        Runnable copyCommand = new Runnable() {
            public void run() {
                try {
                    ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
                    CommitEventHandler handler = null;
                    if (progress != null) {
                        progress.setText(SvnBundle.message("progress.text.copy.to", dstURL));
                        handler = new IdeaCommitHandler(progress);
                    }
                    checkCreateDir(parentUrl, activeVcs, comment);

                    SvnTarget source = isSrcFile ? SvnTarget.fromFile(srcFile, revision)
                            : SvnTarget.fromURL(srcUrl, revision);
                    long newRevision = activeVcs.getFactory(source).createCopyMoveClient().copy(source,
                            SvnTarget.fromURL(dstSvnUrl), revision, true, comment, handler);

                    updateStatusBar(newRevision, project);
                } catch (Exception e) {
                    exception.set(e);
                }
            }
        };
        ProgressManager.getInstance().runProcessWithProgressSynchronously(copyCommand,
                SvnBundle.message("progress.title.copy"), false, project);
        if (!exception.isNull()) {
            throw new VcsException(exception.get());
        }

        if (dialog.isCopyFromWorkingCopy() && dialog.isSwitchOnCreate()) {
            SingleRootSwitcher switcher = new SingleRootSwitcher(project,
                    VcsUtil.getFilePath(srcFile, srcFile.isDirectory()), dstSvnUrl.toDecodedString());

            AutoSvnUpdater.run(switcher, SvnBundle.message("action.name.switch"));
        }
    }
}

From source file:org.jetbrains.kotlin.idea.refactoring.JetRefactoringUtil.java

License:Apache License

@NotNull
private static List<? extends PsiElement> askUserForMethodsToSearch(@NotNull KtDeclaration declaration,
        @NotNull CallableDescriptor declarationDescriptor,
        @NotNull Map<PsiElement, CallableDescriptor> overriddenElementsToDescriptor,
        @NotNull List<String> superClasses, @NotNull String actionStringKey) {
    if (ApplicationManager.getApplication().isUnitTestMode()) {
        return ContainerUtil.newArrayList(overriddenElementsToDescriptor.keySet());
    }//  w  w  w .  j av a  2s  .  c o  m

    String superClassesStr = "\n" + StringUtil.join(superClasses, "");
    String message = KotlinBundle.message("x.overrides.y.in.class.list",
            DescriptorRenderer.COMPACT_WITH_SHORT_TYPES.render(declarationDescriptor),
            IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_IN_TYPES
                    .render(declarationDescriptor.getContainingDeclaration()),
            superClassesStr, KotlinBundle.message(actionStringKey));

    int exitCode = Messages.showYesNoCancelDialog(declaration.getProject(), message,
            IdeBundle.message("title.warning"), Messages.getQuestionIcon());
    switch (exitCode) {
    case Messages.YES:
        return ContainerUtil.newArrayList(overriddenElementsToDescriptor.keySet());
    case Messages.NO:
        return Collections.singletonList(declaration);
    default:
        return Collections.emptyList();
    }
}