Cleanup (formatting)

This commit is contained in:
Roman Shevchenko
2019-02-06 16:48:31 +01:00
parent d9412eba69
commit 0722796ad7
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 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.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.ui;
import com.intellij.openapi.project.Project;
@@ -23,6 +9,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
public abstract class MessageDialogBuilder<T extends MessageDialogBuilder> {
protected final String myMessage;
@@ -30,7 +17,6 @@ public abstract class MessageDialogBuilder<T extends MessageDialogBuilder> {
protected String myYesText;
protected String myNoText;
protected Project myProject;
protected Icon myIcon;
protected DialogWrapper.DoNotAskOption myDoNotAskOption;
@@ -100,13 +86,14 @@ public abstract class MessageDialogBuilder<T extends MessageDialogBuilder> {
String noText = ObjectUtils.chooseNotNull(myNoText, Messages.NO_BUTTON);
try {
if (Messages.canShowMacSheetPanel() && !Messages.isApplicationInUnitTestOrHeadless()) {
return MacMessages.getInstance().showYesNoDialog(myTitle, myMessage, yesText, noText, WindowManager.getInstance().suggestParentWindow(myProject), myDoNotAskOption);
Window window = WindowManager.getInstance().suggestParentWindow(myProject);
return MacMessages.getInstance().showYesNoDialog(myTitle, myMessage, yesText, noText, window, myDoNotAskOption);
}
}
catch (Exception ignored) {
}
catch (Exception ignored) { }
return Messages.showDialog(myProject, myMessage, myTitle, new String[]{yesText, noText}, 0, myIcon, myDoNotAskOption) == 0 ? Messages.YES : Messages.NO;
String[] options = {yesText, noText};
return Messages.showDialog(myProject, myMessage, myTitle, options, 0, myIcon, myDoNotAskOption) == 0 ? Messages.YES : Messages.NO;
}
public boolean isYes() {
@@ -138,14 +125,15 @@ public abstract class MessageDialogBuilder<T extends MessageDialogBuilder> {
String cancelText = ObjectUtils.chooseNotNull(myCancelText, Messages.CANCEL_BUTTON);
try {
if (Messages.canShowMacSheetPanel() && !Messages.isApplicationInUnitTestOrHeadless()) {
return MacMessages.getInstance().showYesNoCancelDialog(myTitle, myMessage, yesText, noText, cancelText, WindowManager.getInstance().suggestParentWindow(myProject), myDoNotAskOption);
Window window = WindowManager.getInstance().suggestParentWindow(myProject);
return MacMessages.getInstance().showYesNoCancelDialog(myTitle, myMessage, yesText, noText, cancelText, window, myDoNotAskOption);
}
}
catch (Exception ignored) {}
int buttonNumber = Messages.showDialog(myProject, myMessage, myTitle, new String[]{yesText, noText, cancelText}, 0, myIcon, myDoNotAskOption);
String[] options = {yesText, noText, cancelText};
int buttonNumber = Messages.showDialog(myProject, myMessage, myTitle, options, 0, myIcon, myDoNotAskOption);
return buttonNumber == 0 ? Messages.YES : buttonNumber == 1 ? Messages.NO : Messages.CANCEL;
}
}
}
}