diff --git a/platform/platform-impl/src/com/intellij/notification/impl/actions/CheckMessagesButtonsOrderAction.java b/platform/platform-impl/src/com/intellij/notification/impl/actions/CheckMessagesButtonsOrderAction.java
new file mode 100644
index 000000000000..e622e71777d0
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/notification/impl/actions/CheckMessagesButtonsOrderAction.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2000-2015 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.notification.impl.actions;
+
+import com.intellij.CommonBundle;
+import com.intellij.ide.IdeBundle;
+import com.intellij.ide.impl.ProjectNewWindowDoNotAskOption;
+import com.intellij.openapi.actionSystem.AnAction;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.project.DumbAware;
+import com.intellij.openapi.ui.Messages;
+
+import javax.swing.*;
+
+/**
+ * @author Denis Fokin
+ */
+public class CheckMessagesButtonsOrderAction extends AnAction implements DumbAware {
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+
+ new Thread() {
+ @Override
+ public void run() {
+ super.run();
+
+ //noinspection SSBasedInspection
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ String message = "Proceed - focused, [space] ,Cancel - Nothing, Show ussages - default";
+ String[] options = {"Show usages", "Cancel", "Proceed"};
+ Messages.showDialog(message, "First Message", options, 0, 1, Messages.getQuestionIcon(), null);
+
+
+ Messages.showYesNoCancelDialog("unchecked unfocused checkbox, Yes - focused, space, Cancel, No Text - default",
+ IdeBundle.message("title.open.project"),
+ "This window",
+ "New Window",
+ CommonBundle.getCancelButtonText(),
+ Messages.getQuestionIcon(),
+ new ProjectNewWindowDoNotAskOption());
+ }
+ });
+
+ }
+ }.start();
+
+ }
+}
diff --git a/platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java b/platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java
index 25e70af0d629..1a9b5413dec4 100644
--- a/platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java
+++ b/platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java
@@ -49,7 +49,9 @@ public class JBMacMessages extends MacMessagesEmulation {
window = getForemostWindow(null);
}
SheetMessage sheetMessage = new SheetMessage(window, title, message, UIUtil.getQuestionIcon(),
- new String [] {defaultButton, alternateButton, otherButton}, doNotAskOption, defaultButton, alternateButton);
+ new String [] {defaultButton, otherButton, alternateButton},
+ doNotAskOption, defaultButton, alternateButton);
+
String resultString = sheetMessage.getResult();
int result = resultString.equals(defaultButton) ? Messages.YES : resultString.equals(alternateButton) ? Messages.NO : Messages.CANCEL;
if (doNotAskOption != null) {
@@ -73,12 +75,8 @@ public class JBMacMessages extends MacMessagesEmulation {
Icon icon = errorStyle ? UIUtil.getErrorIcon() : UIUtil.getInformationIcon();
- if (focusedOptionIndex != -1) {
- focusedOptionIndex = (defaultOptionIndex == focusedOptionIndex) ? buttons.length - 1 : focusedOptionIndex;
- }
-
- final String defaultOptionTitle = defaultOptionIndex == -1 ? null : buttons[defaultOptionIndex];
- final String focusedButtonTitle = focusedOptionIndex == -1 ? null : buttons[focusedOptionIndex];
+ final String defaultOptionTitle = defaultOptionIndex != -1 ? buttons[buttons.length - 1 - defaultOptionIndex] : null;
+ final String focusedButtonTitle = focusedOptionIndex != -1 ? buttons[buttons.length - 1 - focusedOptionIndex] : null;
final SheetMessage sheetMessage = new SheetMessage(window, title, message, icon, buttons, doNotAskDialogOption, defaultOptionTitle, focusedButtonTitle);
String result = sheetMessage.getResult();
diff --git a/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java b/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java
index ab3ad1779546..4dff65a20d06 100755
--- a/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java
+++ b/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java
@@ -171,12 +171,11 @@ public class SheetController {
}
void requestFocus() {
- final JComponent focusedComponent = (myDoNotAskOption == null) ? myFocusedButton : doNotAskCheckBox;
- if (focusedComponent == null) return; // it might be we have only one button. it is a default one in that case
+ if (myFocusedButton == null) return; // it might be we have only one button. it is a default one in that case
if (SystemInfo.isAppleJvm) {
- focusedComponent.requestFocus();
+ myFocusedButton.requestFocus();
} else {
- focusedComponent.requestFocusInWindow();
+ myFocusedButton.requestFocusInWindow();
}
}
diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml
index 32408b9aa945..c5b004b0b1d9 100644
--- a/platform/platform-resources/src/idea/PlatformActions.xml
+++ b/platform/platform-resources/src/idea/PlatformActions.xml
@@ -629,11 +629,16 @@
+
+
+