mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-123409 Sheet dialogs: Order of buttons and their sizes and positions are incorrect
This commit is contained in:
+141
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* 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.internal.validation;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
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() {
|
||||
|
||||
|
||||
// Case 1
|
||||
|
||||
Messages.showDialog("unchecked unfocused checkbox, [Proceed], ____,Cancel, *Show ussages*",
|
||||
"Message 1", new String [] {"Show usages", "Cancel", "Proceed"}, 0, 0,
|
||||
Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption());
|
||||
|
||||
// Case 2
|
||||
|
||||
Messages.showDialog("unchecked unfocused checkbox, [Proceed], ____,Cancel, *Show ussages*",
|
||||
"Message 2", new String [] {"Show usages", "Cancel", "Proceed"}, 0, 1,
|
||||
Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption());
|
||||
|
||||
// Case 3
|
||||
|
||||
Messages.showDialog("unchecked unfocused checkbox, [Proceed], ____, *Cancel*, Show ussages",
|
||||
"Message 3", new String [] {"Show usages", "Cancel", "Proceed"}, 1, 0,
|
||||
Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption());
|
||||
|
||||
// Case 4
|
||||
|
||||
Messages.showDialog("unchecked unfocused checkbox, [Proceed], ____, *Cancel*, Show ussages",
|
||||
"Message 4", new String [] {"Show usages", "Cancel", "Proceed"}, 1, 1,
|
||||
Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption());
|
||||
|
||||
// Case 5
|
||||
|
||||
Messages.showDialog("[Proceed], ____, Cancel, *Show ussages*",
|
||||
"Message 5", new String [] {"Show usages", "Cancel", "Proceed"}, 0, 1,
|
||||
Messages.getQuestionIcon(), null);
|
||||
|
||||
// Case 6
|
||||
|
||||
Messages.showYesNoCancelDialog("unchecked unfocused checkbox, [New Window], ____, Cancel, *This Window*",
|
||||
"Message 6",
|
||||
"This window",
|
||||
"New Window",
|
||||
CommonBundle.getCancelButtonText(),
|
||||
Messages.getQuestionIcon(),
|
||||
new ProjectNewWindowDoNotAskOption());
|
||||
|
||||
// Case 7
|
||||
|
||||
Messages.showDialog("[Variant 1], Variant 2, Variant 3, Cancel, *Ok*",
|
||||
"Message 7",
|
||||
new String[]{"Ok", "Cancel", "Variant 3", "Variant 2", "Variant 1"},
|
||||
0, 1, Messages.getQuestionIcon(), null);
|
||||
|
||||
// Case 8
|
||||
|
||||
Messages.showDialog( "unchecked unfocused checkbox, [Variant 1], Variant 2, Variant 3, Cancel, *Ok*",
|
||||
"Message 8",
|
||||
new String [] {"Ok", "Cancel", "Variant 3", "Variant 2", "Variant 1"},
|
||||
0, 0, Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption());
|
||||
|
||||
// Case 9
|
||||
|
||||
Messages.showDialog( "unchecked unfocused checkbox, [Variant 1], Variant 2, Variant 3, *Cancel*, Ok",
|
||||
"Message 9",
|
||||
new String [] {"Ok", "Cancel", "Variant 3", "Variant 2", "Variant 1"},
|
||||
1, 1, Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption());
|
||||
|
||||
// Case 10
|
||||
|
||||
Messages.showDialog( "unchecked unfocused checkbox, [Variant 1], Variant 2, Variant 3, Cancel, *Ok*",
|
||||
"Message 10",
|
||||
new String [] {"Ok", "Cancel", "Variant 3", "Variant 2", "Variant 1"},
|
||||
0, 1, Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption());
|
||||
|
||||
// Case 11
|
||||
|
||||
Messages.showDialog( "unchecked unfocused checkbox, [Variant 1], Variant 2, Variant 3, Cancel, *Ok*",
|
||||
"Message 11",
|
||||
new String [] {"Ok", "Cancel", "Variant 3", "Variant 2", "Variant 1"},
|
||||
0, 1, Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption());
|
||||
|
||||
// Case 12
|
||||
|
||||
Messages.showDialog( "unchecked unfocused checkbox, [Cancel], Variant 1, Variant 2, Variant 3, *Ok*",
|
||||
"Message 12",
|
||||
new String [] {"Ok", "Variant 3", "Variant 2", "Variant 1", "Cancel"},
|
||||
0, 1, Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption());
|
||||
|
||||
// Case 13
|
||||
|
||||
Messages.showDialog( "unchecked unfocused checkbox, [Cancel], Variant 1, Ok, Variant 2, Variant 3, *Ok*",
|
||||
"Message 13",
|
||||
new String [] {"Variant 3", "Variant 2", "Ok", "Variant 1", "Cancel"},
|
||||
0, 1, Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}.start();
|
||||
|
||||
}
|
||||
}
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* 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();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -111,6 +111,9 @@ public class SheetController {
|
||||
|
||||
myResult = null;
|
||||
|
||||
int defaultButtonIndex = -1;
|
||||
int focusedButtonIndex = -1;
|
||||
|
||||
for (int i = 0; i < buttons.length; i++) {
|
||||
String buttonTitle = buttonTitles[i];
|
||||
|
||||
@@ -119,13 +122,18 @@ public class SheetController {
|
||||
handleMnemonics(i, buttonTitle);
|
||||
|
||||
if (buttonTitle.equals(defaultButtonTitle)) {
|
||||
myDefaultButton = buttons[i];
|
||||
defaultButtonIndex = i;
|
||||
}
|
||||
if (buttonTitle.equals(focusedButton)) {
|
||||
myFocusedButton = buttons[i];
|
||||
focusedButtonIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
myFocusedButton = (focusedButtonIndex == -1) ? buttons[buttons.length - 1] : buttons[focusedButtonIndex];
|
||||
myDefaultButton = (defaultButtonIndex == -1 && focusedButtonIndex != defaultButtonIndex) ? buttons[0] : buttons[defaultButtonIndex];
|
||||
|
||||
myDefaultButton = buttons[0];
|
||||
|
||||
if (myFocusedButton == null) {
|
||||
myFocusedButton = myDefaultButton;
|
||||
}
|
||||
|
||||
@@ -635,7 +635,7 @@
|
||||
<action id="TestMessageBoxAction" internal="true" class="com.intellij.diagnostic.TestMessageBoxAction" text="Show Test Dialog"/>
|
||||
<separator/>
|
||||
<group id="Internal.focusAndModality" popup="true" text="Focus and modality testing">
|
||||
<action id="CheckMessagesButtonsOrderAction" internal="true" class="com.intellij.notification.impl.actions.CheckMessagesButtonsOrderAction"
|
||||
<action id="CheckMessagesButtonsOrderAction" internal="true" class="com.intellij.internal.validation.CheckMessagesButtonsOrderAction"
|
||||
text="Check Messages Buttons Order"/>
|
||||
<action id="ShowDelayedMessageInternalAction" internal="true" class="com.intellij.notification.impl.actions.ShowDelayedMessageInternalAction"
|
||||
text="Show Delayed Message"/>
|
||||
|
||||
Reference in New Issue
Block a user