List of usage examples for com.intellij.openapi.ui DialogBuilder addCloseButton
public CustomizableAction addCloseButton()
From source file:com.intellij.util.xml.ui.TextControl.java
License:Apache License
@Override protected TextPanel createMainComponent(TextPanel boundedComponent, final Project project) { if (boundedComponent == null) { boundedComponent = new TextPanel(); }/*from www . ja va 2s .co m*/ boundedComponent.removeAll(); final Function<String, Document> factory = new Function<String, Document>() { @Override public Document fun(final String s) { return PsiDocumentManager.getInstance(project).getDocument(PsiFileFactory.getInstance(project) .createFileFromText("a.txt", PlainTextLanguage.INSTANCE, "", true, false)); } }; final TextPanel boundedComponent1 = boundedComponent; final EditorTextField editorTextField = new EditorTextField(factory.fun(""), project, PlainTextFileType.INSTANCE) { @Override protected EditorEx createEditor() { final EditorEx editor = super.createEditor(); return boundedComponent1 instanceof MultiLineTextPanel ? makeBigEditor(editor, ((MultiLineTextPanel) boundedComponent1).getRowCount()) : editor; } }; editorTextField.setOneLineMode(false); if (boundedComponent instanceof BigTextPanel) { final ReferenceEditorWithBrowseButton editor = new ReferenceEditorWithBrowseButton(null, editorTextField, factory); boundedComponent.add(editor); editor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { EditorTextField textArea = new EditorTextField(editorTextField.getDocument(), project, PlainTextFileType.INSTANCE) { @Override protected EditorEx createEditor() { final EditorEx editor = super.createEditor(); editor.setEmbeddedIntoDialogWrapper(true); return makeBigEditor(editor, 5); } }; textArea.setOneLineMode(false); DialogBuilder builder = new DialogBuilder(project); builder.setDimensionServiceKey("TextControl"); builder.setCenterPanel(textArea); builder.setPreferredFocusComponent(textArea); builder.setTitle(UIBundle.message("big.text.control.window.title")); builder.addCloseButton(); builder.show(); } }); return boundedComponent; } boundedComponent.add(editorTextField); return boundedComponent; }
From source file:net.stevechaloner.intellijad.actions.ViewMemoryFileSystemAction.java
License:Apache License
/** {@inheritDoc} */ public void actionPerformed(AnActionEvent e) { Project project = DataKeys.PROJECT.getData(e.getDataContext()); if (project != null) { DialogBuilder builder = new DialogBuilder(project); builder.setTitle(IntelliJadResourceBundle.message("plugin.IntelliJad.name")); builder.addCloseButton(); MemoryFileSystemManager mfsPopup = new MemoryFileSystemManager( DataKeys.PROJECT.getData(e.getDataContext())); builder.setCenterPanel(mfsPopup.getRoot()); builder.setHelpId(IntelliJadConstants.CONFIGURATION_HELP_TOPIC); builder.setTitle(IntelliJadResourceBundle.message("message.intellijad-memory-fs-manager")); builder.show();/*from w ww .j a v a 2 s .c o m*/ } }
From source file:org.twodividedbyzero.idea.findbugs.gui.common.AnalysisRunDetailsDialog.java
License:Open Source License
public static DialogBuilder create(final Project project, final int bugCount, final ProjectStats projectStats, final FindBugsProject bugsProject) { final int numAnalysedClasses = projectStats.getNumClasses(); final List<String> fileList = bugsProject.getFileList(); final List<String> auxClasspathEntries = bugsProject.getAuxClasspathEntryList(); final List<String> configuredOutputFiles = bugsProject.getConfiguredOutputFiles(); final StringBuilder html = new StringBuilder(); html.append("<html><body>"); html.append("<p><h2>").append(VersionManager.getName()).append(": <b>found ").append(bugCount) .append(" bugs in ").append(numAnalysedClasses) .append(numAnalysedClasses > 1 ? " classes" : " class").append("</b>").append("</h2></p>"); html.append("<p>").append("<font size='10px'>using ").append(VersionManager.getFullVersion()) .append(" with Findbugs version ").append(FindBugsUtil.getFindBugsFullVersion()).append("</font>") .append("</p>"); if (!configuredOutputFiles.isEmpty()) { html.append("<p><h3>Configured Output Files/Paths - the analysis entry point") .append(" <font color='gray'>(").append(configuredOutputFiles.size()).append(")</h3></p>"); html.append("<ul>"); for (final String file : configuredOutputFiles) { html.append("<li>"); html.append(file);/*from w ww .j a v a 2 s .com*/ html.append("</li>"); } html.append("</ul>"); } html.append("<p><h3>Compile Output Path").append(" <font size='9px' color='gray'>(") .append("IDEA)</h3></p>"); html.append("<ul>"); for (final String resolved : bugsProject.getResolvedSourcePaths()) { html.append("<li>"); html.append(resolved); html.append("</li>"); } html.append("</ul>"); html.append("<p><h3>Sources Dir List ").append(" <font size='9px' color='gray'>(") .append(bugsProject.getNumSourceDirs()).append(")</h3></p>"); html.append("<ul>"); final List<String> sourceDirList = bugsProject.getSourceDirList(); for (final String sourceDir : sourceDirList) { html.append("<li>"); html.append(sourceDir); html.append("</li>"); } html.append("</ul>"); html.append("<p><h3>Analyzed Classes List ").append(" <font size='9px' color='gray'>(") .append(bugsProject.getFileCount()).append(")</h3></p>"); html.append("<ul>"); for (final String file : fileList) { html.append("<li>"); html.append(file); html.append("</li>"); } html.append("</ul>"); html.append("<p><h3>Aux Classpath Entries ").append(" <font size='9px' color='gray'>(") .append(bugsProject.getNumAuxClasspathEntries()).append(")</h3></p>"); html.append("<ul>"); for (final String auxClasspathEntry : auxClasspathEntries) { html.append("<li>"); html.append(auxClasspathEntry); html.append("</li>"); } html.append("</ul>"); html.append("</html></body>"); final DialogBuilder dialogBuilder = new DialogBuilder(project); dialogBuilder.addCloseButton(); dialogBuilder.setTitle("FindBugs analysis settings"); final JComponent panel = new JPanel(new BorderLayout()); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); final HTMLEditorKit htmlEditorKit = new HTMLEditorKit(); htmlEditorKit.setStyleSheet(GuiResources.EDITORPANE_STYLESHEET); final JEditorPane jEditorPane = new JEditorPane() { @Override protected void paintComponent(final Graphics g) { super.paintComponent(g); final Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); } }; jEditorPane.setPreferredSize(new Dimension(550, 650)); jEditorPane.setEditable(false); jEditorPane.setContentType("text/html"); jEditorPane.setEditorKit(htmlEditorKit); jEditorPane.setText(html.toString()); panel.add(ScrollPaneFacade.createScrollPane(jEditorPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED)); panel.setBorder(BorderFactory.createTitledBorder("FindBugs analysis run configuration")); dialogBuilder.setCenterPanel(panel); SwingUtilities.invokeLater(new Runnable() { public void run() { jEditorPane.scrollRectToVisible(new Rectangle(0, 0)); } }); return dialogBuilder; }