Java Code Examples for com.intellij.openapi.ui.DialogBuilder#setButtonsAlignment()
The following examples show how to use
com.intellij.openapi.ui.DialogBuilder#setButtonsAlignment() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PackagesNotificationPanel.java From vue-for-idea with BSD 3-Clause "New" or "Revised" License | 6 votes |
private static void doShowError(String title, String description, DialogBuilder builder) { builder.setTitle(title); final JTextArea textArea = new JTextArea(); textArea.setEditable(false); textArea.setText(description); textArea.setWrapStyleWord(false); textArea.setLineWrap(true); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(textArea); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); final JPanel panel = new JPanel(new BorderLayout(10, 0)); panel.setPreferredSize(new Dimension(600, 400)); panel.add(scrollPane, BorderLayout.CENTER); panel.add(new JBLabel("Details:", Messages.getErrorIcon(), SwingConstants.LEFT), BorderLayout.NORTH); builder.setCenterPanel(panel); builder.setButtonsAlignment(SwingConstants.CENTER); builder.addOkAction(); builder.show(); }
Example 2
Source File: DialogUtil.java From freeline with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * 创建普通对话框 * @param message * @param okText * @param cancelText * @return */ public static boolean createDialog(String message, String okText, String cancelText) { DialogBuilder builder = new DialogBuilder(); builder.setTitle("Dialog Message"); builder.resizable(false); builder.setCenterPanel(new JLabel(message, Messages.getInformationIcon(), SwingConstants.CENTER)); builder.addOkAction().setText(okText); builder.addCancelAction().setText(cancelText); builder.setButtonsAlignment(SwingConstants.CENTER); return builder.show() == 0; }
Example 3
Source File: ExecutionErrorDialog.java From consulo with Apache License 2.0 | 5 votes |
public static void show(final ExecutionException e, final String title, final Project project) { if (e instanceof RunCanceledByUserException) { return; } if (ApplicationManager.getApplication().isUnitTestMode()) { throw new RuntimeException(e.getLocalizedMessage()); } final String message = e.getMessage(); if (message == null || message.length() < 100) { Messages.showErrorDialog(project, message == null ? "exception was thrown" : message, title); return; } final DialogBuilder builder = new DialogBuilder(project); builder.setTitle(title); final JTextArea textArea = new JTextArea(); textArea.setEditable(false); textArea.setForeground(UIUtil.getLabelForeground()); textArea.setBackground(UIUtil.getLabelBackground()); textArea.setFont(UIUtil.getLabelFont()); textArea.setText(message); textArea.setWrapStyleWord(false); textArea.setLineWrap(true); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(textArea); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); final JPanel panel = new JPanel(new BorderLayout(10, 0)); panel.setPreferredSize(new Dimension(500, 200)); panel.add(scrollPane, BorderLayout.CENTER); panel.add(new JLabel(Messages.getErrorIcon()), BorderLayout.WEST); builder.setCenterPanel(panel); builder.setButtonsAlignment(SwingConstants.CENTER); builder.addOkAction(); builder.show(); }
Example 4
Source File: MemoryDiskConflictResolver.java From consulo with Apache License 2.0 | 4 votes |
boolean askReloadFromDisk(VirtualFile file, Document document) { if (myConflictAppeared != null) { Throwable trace = myConflictAppeared; myConflictAppeared = null; throw new IllegalStateException("Unexpected memory-disk conflict in tests for " + file.getPath() + ", please use FileDocumentManager#reloadFromDisk or avoid VFS refresh", trace); } String message = UIBundle.message("file.cache.conflict.message.text", file.getPresentableUrl()); DialogBuilder builder = new DialogBuilder(); builder.setCenterPanel(new JLabel(message, Messages.getQuestionIcon(), SwingConstants.CENTER)); builder.addOkAction().setText(UIBundle.message("file.cache.conflict.load.fs.changes.button")); builder.addCancelAction().setText(UIBundle.message("file.cache.conflict.keep.memory.changes.button")); builder.addAction(new AbstractAction(UIBundle.message("file.cache.conflict.show.difference.button")) { @Override public void actionPerformed(ActionEvent e) { Project project = ProjectLocator.getInstance().guessProjectForFile(file); String fsContent = LoadTextUtil.loadText(file).toString(); DocumentContent content1 = DiffContentFactory.getInstance().create(project, fsContent, file.getFileType()); DocumentContent content2 = DiffContentFactory.getInstance().create(project, document, file); String title = UIBundle.message("file.cache.conflict.for.file.dialog.title", file.getPresentableUrl()); String title1 = UIBundle.message("file.cache.conflict.diff.content.file.system.content"); String title2 = UIBundle.message("file.cache.conflict.diff.content.memory.content"); DiffRequest request = new SimpleDiffRequest(title, content1, content2, title1, title2); request.putUserData(DiffUserDataKeys.GO_TO_SOURCE_DISABLE, true); DialogBuilder diffBuilder = new DialogBuilder(project); DiffRequestPanel diffPanel = DiffManager.getInstance().createRequestPanel(project, diffBuilder, diffBuilder.getWindow()); diffPanel.setRequest(request); diffBuilder.setCenterPanel(diffPanel.getComponent()); diffBuilder.setDimensionServiceKey("FileDocumentManager.FileCacheConflict"); diffBuilder.addOkAction().setText(UIBundle.message("file.cache.conflict.save.changes.button")); diffBuilder.addCancelAction(); diffBuilder.setTitle(title); if (diffBuilder.show() == DialogWrapper.OK_EXIT_CODE) { builder.getDialogWrapper().close(DialogWrapper.CANCEL_EXIT_CODE); } } }); builder.setTitle(UIBundle.message("file.cache.conflict.dialog.title")); builder.setButtonsAlignment(SwingConstants.CENTER); builder.setHelpId("reference.dialogs.fileCacheConflict"); return builder.show() == 0; }