1 /* 2 * Copyright (c) 2022 Guangzhou Digitalchina Information Technology Co., Ltd. 3 * All rights reserved. 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.sk.dialog; 17 18 import com.intellij.openapi.ui.DialogWrapper; 19 import org.jetbrains.annotations.Nullable; 20 import javax.swing.JComponent; 21 22 /** 23 * 自定义确认对话框Wrapper 24 * 25 * @author: xudong 26 * @see: tool conversion plug-in 27 * @version: v1.0.0 28 * @since 2022-02-21 29 */ 30 public class ConfirmDialog extends DialogWrapper { 31 private final ConfirmDiagPane confirmDiagPane; 32 33 /** 34 * 构造函数 35 * @param message 弹出框信息内容 36 */ ConfirmDialog(String message)37 public ConfirmDialog(String message) { 38 super(true); 39 confirmDiagPane = new ConfirmDiagPane(message); 40 setOKButtonText("Yes"); 41 setCancelButtonText("No"); 42 setUndecorated(true); 43 setResizable(false); 44 init(); 45 } 46 47 @Override 48 @Nullable createCenterPanel()49 protected JComponent createCenterPanel() { 50 return confirmDiagPane.getContentPanel(); 51 } 52 53 } 54