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

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

Introduction

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

Prototype

int YES

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

Click Source Link

Usage

From source file:org.jetbrains.plugins.groovy.console.GroovyShellActionBase.java

License:Apache License

@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = e.getData(CommonDataKeys.PROJECT);
    assert project != null;

    CompilerManager.getInstance(project).make(new CompileStatusNotification() {
        @Override/*  w  w w .  ja  va 2 s  .co  m*/
        public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
            if (aborted)
                return;

            final Project project = compileContext.getProject();

            if (errors == 0 || Messages.showYesNoDialog(project,
                    "Compilation failed with errors. Do you want to run " + getTitle() + " anyway?", getTitle(),
                    JetgroovyIcons.Groovy.Groovy_32x32) == Messages.YES) {
                runGroovyShell(project);
            }
        }
    });
}

From source file:org.jetbrains.tfsIntegration.core.tfs.operations.ApplyGetOperations.java

License:Apache License

private boolean canOverrideLocalConflictingItem(final GetOperation operation, boolean sourceNotTarget)
        throws TfsException {
    if (myDownloadMode == DownloadMode.FORCE || myDownloadMode == DownloadMode.MERGE) {
        return true;
    }/* w  ww.  j av  a 2s .  c  o m*/

    LocalConflictHandlingType conflictHandlingType = getLocalConflictHandlingType();
    if (conflictHandlingType == LocalConflictHandlingType.ERROR) {
        throw new OperationFailedException(
                "Local conflict detected for " + VersionControlPath.localPathFromTfsRepresentation(
                        sourceNotTarget ? operation.getSlocal() : operation.getTlocal()));
    } else if (conflictHandlingType == LocalConflictHandlingType.SHOW_MESSAGE) {
        String path = VersionControlPath.localPathFromTfsRepresentation(
                sourceNotTarget ? operation.getSlocal() : operation.getTlocal());
        final String message = MessageFormat.format("Local conflict detected. Override local item?\n {0}",
                path);
        // TODO: more detailed message needed
        final String title = "Modify Files";
        final Ref<Integer> result = new Ref<Integer>();
        WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(new Runnable() {
            public void run() {
                result.set(Messages.showYesNoDialog(message, title, Messages.getQuestionIcon()));
            }
        });

        if (result.get() == Messages.YES) {
            return true;
        } else {
            reportLocalConflict(operation, sourceNotTarget);
            return false;
        }
    } else {
        throw new IllegalArgumentException("Unknown conflict handling type: " + conflictHandlingType);
    }
}

From source file:org.jetbrains.tfsIntegration.ui.ManageWorkspacesForm.java

License:Apache License

private void removeServer(final @NotNull ServerInfo server) {
    String warning = TFSBundle.message("remove.server.prompt", server.getPresentableUri());
    if (Messages.showYesNoDialog(myContentPane, warning, TFSBundle.message("remove.server.title"),
            Messages.getWarningIcon()) == Messages.YES) {
        Workstation.getInstance().removeServer(server);
        updateControls(null);//from   w ww .j  a va2 s  . c o m
    }
}

From source file:org.jetbrains.tfsIntegration.ui.ManageWorkspacesForm.java

License:Apache License

private void deleteWorkspace(@NotNull WorkspaceInfo workspace) {
    if (Messages.showYesNoDialog(myContentPane,
            TFSBundle.message("delete.workspace.prompt", workspace.getName()),
            TFSBundle.message("delete.workspace.title"), Messages.getWarningIcon()) != Messages.YES) {
        return;/*from   w  w w  .  ja  v  a2 s  . c  om*/
    }

    try {
        workspace.getServer().deleteWorkspace(workspace, myContentPane, true);
        updateControls(workspace);
    } catch (UserCancelledException e) {
        // ignore
    } catch (TfsException e) {
        Messages.showErrorDialog(myProject, e.getMessage(), TFSBundle.message("delete.workspace.title"));
    }
}

From source file:org.jetbrains.tfsIntegration.ui.ProjectConfigurableForm.java

License:Apache License

public ProjectConfigurableForm(final Project project) {
    myProject = project;//from   ww  w.j a  va  2 s.c om

    myManageButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            ManageWorkspacesDialog d = new ManageWorkspacesDialog(myProject);
            d.show();
        }
    });

    myUseIdeaHttpProxyCheckBox.setSelected(TFSConfigurationManager.getInstance().useIdeaHttpProxy());

    myResetPasswordsButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            final String title = "Reset Stored Passwords";
            if (Messages.showYesNoDialog(myProject, "Do you want to reset all stored passwords?", title,
                    Messages.getQuestionIcon()) == Messages.YES) {
                TFSConfigurationManager.getInstance().resetStoredPasswords();
                Messages.showInfoMessage(myProject, "Passwords reset successfully.", title);
            }
        }
    });

    ActionListener l = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateNonInstalledCheckbox();
        }
    };
    myStatefulCheckBox.addActionListener(l);
    myTFSCheckBox.addActionListener(l);
}

From source file:org.jetbrains.tfsIntegration.ui.TfsLoginDialog.java

License:Apache License

@Override
protected void doOKAction() {
    if (shouldPromptForProxyPassword(false)) {
        HttpConfigurable hc = HttpConfigurable.getInstance();
        hc.setPlainProxyPassword(myLoginForm.getProxyPassword());
    }//  w w  w .  j  a  v  a  2  s .  c  o  m

    if (myLoginForm.getCredentials().getType() == Credentials.Type.Alternate
            && "http".equals(getUri().getScheme())) {
        if (Messages.showYesNoDialog(myLoginForm.getContentPane(),
                "You're about to send your credentials over unsecured HTTP connection. Continue?", getTitle(),
                null) != Messages.YES) {
            return;
        }
    }

    if (myOkActionCallback == null || myOkActionCallback.value(this)) {
        super.doOKAction();
    }
}

From source file:org.mustbe.consulo.csharp.ide.refactoring.rename.CSharpOverrideElementProcessor.java

License:Apache License

@Override
public void prepareRenaming(PsiElement element, String newName, Map<PsiElement, String> allRenames,
        SearchScope scope) {/*from  w  w  w  .j  a v a 2 s .  c  om*/

    // if name is empty that mean start rename
    if (StringUtil.isEmpty(newName)) {
        myLastResult = -1;
    }

    if (myLastResult == -1) {
        Set<DotNetVirtualImplementOwner> allElements = getAllElements(element);
        if (!allElements.isEmpty()) {
            MessageDialogBuilder.YesNo builder = MessageDialogBuilder.yesNo("Rename",
                    "Rename all override/implement methods or this method?");
            builder = builder.yesText("All Methods");
            builder = builder.noText("This Method");

            if ((myLastResult = builder.show()) == Messages.YES) {
                for (DotNetVirtualImplementOwner tempElement : allElements) {
                    allRenames.put(tempElement, newName);
                }
            }
        }
    } else if (myLastResult == Messages.YES) {
        Set<DotNetVirtualImplementOwner> allElements = getAllElements(element);
        for (DotNetVirtualImplementOwner tempElement : allElements) {
            allRenames.put(tempElement, newName);
        }
    }
}

From source file:org.sonar.ide.intellij.config.SonarQubeSettingsForm.java

License:Open Source License

public SonarQubeSettingsForm() {
    addButton.addActionListener(new ActionListener() {
        @Override//w  w w .j  a  va  2 s  . c  o  m
        public void actionPerformed(ActionEvent e) {
            SonarQubeServerDialog dialog = new SonarQubeServerDialog(formComponent, null, getServers());
            dialog.show();
            if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
                serversList.addItem(dialog.getServer());
                serversList.setSelectedItem(dialog.getServer());
                modified = true;
                refreshButtons();
            }
        }
    });
    serversList.setRenderer(new ListCellRendererWrapper() {

        @Override
        public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
            setText(value != null ? ((SonarQubeServer) value).getId()
                    : SonarQubeBundle.message("sonarqube.settings.server.no_server"));
        }

    });
    editButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            SonarQubeServerDialog dialog = new SonarQubeServerDialog(formComponent,
                    (SonarQubeServer) serversList.getSelectedItem(), getServers());
            dialog.show();
            if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
                DefaultComboBoxModel model = (DefaultComboBoxModel) serversList.getModel();
                int selectedIndex = model.getIndexOf(model.getSelectedItem());
                model.removeElementAt(selectedIndex);
                model.insertElementAt(dialog.getServer(), selectedIndex);
                model.setSelectedItem(dialog.getServer());
                modified = true;
                refreshButtons();
            }
        }
    });
    removeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            SonarQubeServer server = (SonarQubeServer) serversList.getSelectedItem();
            if (server != null && Messages.showYesNoDialog(formComponent,
                    SonarQubeBundle.message("sonarqube.settings.server.remove.msg", server.getId()),
                    SonarQubeBundle.message("sonarqube.settings.server.remove.title"),
                    Messages.getQuestionIcon()) == Messages.YES) {
                serversList.removeItem(serversList.getSelectedItem());
                modified = true;
                refreshButtons();
            }
        }
    });
}

From source file:org.sonarlint.intellij.trigger.SonarLintCheckinHandler.java

License:Open Source License

private ReturnResult showYesNoCancel(String resultStr) {
    final int answer = Messages.showYesNoCancelDialog(project, resultStr, "SonarLint Analysis Results",
            "Review Issues", "Commit Anyway", "Close", UIUtil.getWarningIcon());

    if (answer == Messages.YES) {
        showChangedFilesTab();//  w  w w.  j a  va  2s.  c o m
        return ReturnResult.CLOSE_WINDOW;
    } else if (answer == Messages.CANCEL) {
        return ReturnResult.CANCEL;
    } else {
        return ReturnResult.COMMIT;
    }
}

From source file:org.twodividedbyzero.idea.findbugs.core.AbstractSuggestionNotificationListener.java

License:Open Source License

@Override
public final void hyperlinkUpdate(@NotNull final Notification notification,
        @NotNull final HyperlinkEvent event) {
    if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
        final String desc = event.getDescription();
        if (desc.equals(A_HREF_DISABLE_ANCHOR)) {
            final int result = Messages.showYesNoDialog(project,
                    "Notification will be disabled for all projects.\n\n"
                            + "Settings | Appearance & Behavior | Notifications | " + notificationGroupId
                            + "\ncan be used to configure the notification.",
                    "FindBugs Plugin Suggestion Notification", "Disable Notification",
                    CommonBundle.getCancelButtonText(), Messages.getWarningIcon());
            if (result == Messages.YES) {
                NotificationUtil.getNotificationsConfigurationImpl().changeSettings(notificationGroupId,
                        NotificationDisplayType.NONE, false, false);
                notification.expire();//from w w  w.  ja v  a2s.com
            } else {
                notification.hideBalloon();
            }
        } else {
            linkClicked(notification, desc);
        }
    }
}