List of usage examples for com.intellij.openapi.ui DialogBuilder title
@NotNull
public DialogBuilder title(@NotNull String title)
From source file:com.intellij.uiDesigner.designSurface.GuiEditor.java
License:Apache License
public void showFormSource() { EditorFactory editorFactory = EditorFactory.getInstance(); Editor editor = editorFactory.createViewer(myDocument, myProject); try {//w w w . j ava 2 s. com ((EditorEx) editor).setHighlighter(new LexerEditorHighlighter(new XmlFileHighlighter(), EditorColorsManager.getInstance().getGlobalScheme())); JComponent component = editor.getComponent(); component.setPreferredSize(new Dimension(640, 480)); DialogBuilder dialog = new DialogBuilder(myProject); dialog.title("Form - " + myFile.getPresentableName()).dimensionKey("GuiDesigner.FormSource.Dialog"); dialog.centerPanel(component).setPreferredFocusComponent(editor.getContentComponent()); dialog.addOkAction(); dialog.show(); } finally { editorFactory.releaseEditor(editor); } }
From source file:consulo.devkit.module.library.ConsuloPluginLibraryType.java
License:Apache License
@Nullable @Override//from ww w .java 2s . c o m public NewLibraryConfiguration createNewLibrary(@NotNull JComponent jComponent, @Nullable VirtualFile virtualFile, @NotNull Project project) { DialogBuilder builder = new DialogBuilder(); builder.title("Enter Plugin ID"); ChoosePluginPanel centerPanel = new ChoosePluginPanel(project); builder.centerPanel(centerPanel); builder.setPreferredFocusComponent(centerPanel.getTextField()); builder.dimensionKey("ConsuloPluginLibraryType#ChoosePluginPanel"); if (!builder.showAndGet()) { return null; } IdeaPluginDescriptor pluginDescriptor = centerPanel.getPluginDescriptor(); if (pluginDescriptor == null) { Messages.showErrorDialog(project, "Plugin is not found", ApplicationInfo.getInstance().getFullVersion()); return null; } Ref<VirtualFile> libRef = Ref.create(); String pluginId = pluginDescriptor.getPluginId().getIdString(); new Task.Modal(project, "Downloading plugin: " + pluginDescriptor.getPluginId().getIdString(), false) { @Override public void run(@NotNull ProgressIndicator progressIndicator) { String url = RepositoryHelper.buildUrlForDownload(UpdateSettings.getInstance().getChannel(), pluginId, null, true, false); try { File tempFile = FileUtil.createTempFile("download", "zip"); HttpRequests.request(url).saveToFile(tempFile, progressIndicator); File depDir = new File(project.getBasePath(), DEP_LIBRARY); depDir.mkdir(); ZipUtil.extract(tempFile, depDir, null); tempFile.delete(); libRef.set(LocalFileSystem.getInstance() .refreshAndFindFileByIoFile(new File(depDir, pluginId + "/lib"))); } catch (IOException e) { // } } }.queue(); VirtualFile libDirectory = libRef.get(); if (libDirectory == null) { Messages.showErrorDialog(project, "Plugin directory is not found", ApplicationInfo.getInstance().getFullVersion()); return null; } return new NewLibraryConfiguration(LIBRARY_PREFIX + pluginId, this, DummyLibraryProperties.INSTANCE) { @Override public void addRoots(@NotNull LibraryEditor libraryEditor) { for (VirtualFile file : libDirectory.getChildren()) { if (file.isDirectory()) { continue; } VirtualFile localVirtualFileByPath = ArchiveVfsUtil.getArchiveRootForLocalFile(file); if (localVirtualFileByPath == null) { continue; } libraryEditor.addRoot(localVirtualFileByPath, BinariesOrderRootType.getInstance()); } } }; }