List of usage examples for com.intellij.openapi.ui Messages showErrorDialog
public static void showErrorDialog(@Nullable Component component, String message, @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title)
From source file:org.jetbrains.idea.svn.config.SvnConfigureProxiesDialog.java
License:Apache License
public void execute(final String url) { Messages.showInfoMessage(myProject,//www .ja v a2s . c om SvnBundle.message("dialog.edit.http.proxies.settings.test.connection.settings.will.be.stored.text"), SvnBundle.message( "dialog.edit.http.proxies.settings.test.connection.settings.will.be.stored.title")); if (!applyImpl()) { return; } final Ref<SVNException> excRef = new Ref<SVNException>(); final ProgressManager pm = ProgressManager.getInstance(); pm.runProcessWithProgressSynchronously(new Runnable() { public void run() { final ProgressIndicator pi = pm.getProgressIndicator(); if (pi != null) { pi.setText("Connecting to " + url); } SVNRepository repository = null; try { repository = SvnVcs.getInstance(myProject).createRepository(url); repository.testConnection(); } catch (SVNException exc) { excRef.set(exc); } finally { if (repository != null) { repository.closeSession(); } } } }, "Test connection", true, myProject); if (!excRef.isNull()) { Messages.showErrorDialog(myProject, excRef.get().getMessage(), SvnBundle.message("dialog.edit.http.proxies.settings.test.connection.error.title")); } else { Messages.showInfoMessage(myProject, SvnBundle.message("dialog.edit.http.proxies.settings.test.connection.succes.text"), SvnBundle.message("dialog.edit.http.proxies.settings.test.connection.succes.title")); } }
From source file:org.jetbrains.idea.svn.dialogs.BranchConfigurationDialog.java
License:Apache License
public static void configureBranches(final Project project, final VirtualFile file, final boolean isRoot) { final VirtualFile vcsRoot = (isRoot) ? file : getRoot(project, file); if (vcsRoot == null) { return;// w ww.j a va 2s.c o m } final VirtualFile directory = SvnUtil.correctRoot(project, file); if (directory == null) { return; } final RootUrlInfo wcRoot = SvnVcs.getInstance(project).getSvnFileUrlMapping() .getWcRootForFilePath(new File(directory.getPath())); if (wcRoot == null) { return; } final SVNURL rootUrl = wcRoot.getRepositoryUrlUrl(); if (rootUrl == null) { Messages.showErrorDialog(project, SvnBundle.message("configure.branches.error.no.connection.title"), SvnBundle.message("configure.branches.title")); return; } SvnBranchConfigurationNew configuration; try { configuration = SvnBranchConfigurationManager.getInstance(project).get(vcsRoot); } catch (VcsException ex) { Messages.showErrorDialog(project, "Error loading branch configuration: " + ex.getMessage(), SvnBundle.message("configure.branches.title")); return; } final SvnBranchConfigurationNew clonedConfiguration = configuration.copy(); BranchConfigurationDialog dlg = new BranchConfigurationDialog(project, clonedConfiguration, rootUrl, vcsRoot, wcRoot.getUrl()); dlg.show(); if (dlg.isOK()) { SvnBranchConfigurationManager.getInstance(project).setConfiguration(vcsRoot, clonedConfiguration); } }
From source file:org.jetbrains.idea.svn.dialogs.SelectLocationDialog.java
License:Apache License
@Nullable public static String selectLocation(Project project, String url) { try {/* w ww. j a v a 2 s . com*/ SVNURL.parseURIEncoded(url); final SVNURL svnurl = initRoot(project, url); if (svnurl == null) { Messages.showErrorDialog(project, "Can not detect repository root for URL: " + url, SvnBundle.message("dialog.title.select.repository.location")); return null; } SelectLocationDialog dialog = new SelectLocationDialog(project, svnurl, null, null, true); dialog.show(); if (!dialog.isOK()) return null; return dialog.getSelectedURL(); } catch (SVNException e) { Messages.showErrorDialog(project, e.getMessage(), SvnBundle.message("dialog.title.select.repository.location")); return null; } }
From source file:org.jetbrains.idea.svn.dialogs.SelectLocationDialog.java
License:Apache License
@Nullable public static String selectCopyDestination(Project project, String url, String dstLabel, String dstName, boolean showFiles) { try {//www .ja va2s . com SVNURL.parseURIEncoded(url); final SVNURL svnurl = initRoot(project, url); SelectLocationDialog dialog = new SelectLocationDialog(project, svnurl, dstLabel, dstName, showFiles); dialog.show(); if (!dialog.isOK()) return null; final String result = dialog.getSelectedURL(); final String name = dialog.getDestinationName(); return SVNPathUtil.append(result, name); } catch (SVNException e) { Messages.showErrorDialog(project, SvnBundle.message("select.location.invalid.url.message", url), SvnBundle.message("dialog.title.select.repository.location")); return null; } }
From source file:org.jetbrains.idea.svn.treeConflict.ApplyPatchSaveToFileExecutor.java
License:Apache License
@Override public void apply(MultiMap<VirtualFile, FilePatchInProgress> patchGroups, LocalChangeList localList, String fileName,/* w w w .ja va 2 s .c om*/ TransparentlyFailedValueI<Map<String, Map<String, CharSequence>>, PatchSyntaxException> additionalInfo) { final FileSaverDialog dialog = FileChooserFactory.getInstance() .createSaveFileDialog(new FileSaverDescriptor("Save patch to", ""), myProject); final VirtualFile baseDir = myProject.getBaseDir(); final VirtualFileWrapper save = dialog.save(baseDir, "TheirsChanges.patch"); if (save != null) { final CommitContext commitContext = new CommitContext(); final VirtualFile baseForPatch = myBaseForPatch == null ? baseDir : myBaseForPatch; try { final List<FilePatch> textPatches = patchGroupsToOneGroup(patchGroups, baseForPatch); commitContext.putUserData(BaseRevisionTextPatchEP.ourPutBaseRevisionTextKey, false); PatchWriter.writePatches(myProject, save.getFile().getPath(), textPatches, commitContext, CharsetToolkit.UTF8_CHARSET); } catch (final IOException e) { LOG.info(e); WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { Messages.showErrorDialog(myProject, VcsBundle.message("create.patch.error.title", e.getMessage()), CommonBundle.getErrorTitle()); } }, null, myProject); } } }
From source file:org.jetbrains.idea.svn.update.AbstractSvnUpdateIntegrateEnvironment.java
License:Apache License
@NotNull public UpdateSession updateDirectories(@NotNull final FilePath[] contentRoots, final UpdatedFiles updatedFiles, final ProgressIndicator progressIndicator, @NotNull final Ref<SequentialUpdatesContext> context) throws ProcessCanceledException { if (context.isNull()) { context.set(new SvnUpdateContext(myVcs, contentRoots)); }/*from ww w .j a v a 2s . c om*/ final ArrayList<VcsException> exceptions = new ArrayList<VcsException>(); UpdateEventHandler eventHandler = new UpdateEventHandler(myVcs, progressIndicator, (SvnUpdateContext) context.get()); eventHandler.setUpdatedFiles(updatedFiles); boolean totalUpdate = true; AbstractUpdateIntegrateCrawler crawler = createCrawler(eventHandler, totalUpdate, exceptions, updatedFiles); Collection<VirtualFile> updatedRoots = new HashSet<VirtualFile>(); Arrays.sort(contentRoots, new Comparator<FilePath>() { public int compare(FilePath o1, FilePath o2) { return SystemInfo.isFileSystemCaseSensitive ? o1.getPath().replace("/", "\\").compareTo(o2.getPath().replace("/", "\\")) : o1.getPath().replace("/", "\\").compareToIgnoreCase(o2.getPath().replace("/", "\\")); } }); for (FilePath contentRoot : contentRoots) { if (progressIndicator != null) { progressIndicator.checkCanceled(); } final File ioRoot = contentRoot.getIOFile(); if (!((SvnUpdateContext) context.get()).shouldRunFor(ioRoot)) continue; Collection<VirtualFile> roots = SvnUtil.crawlWCRoots(myVcs.getProject(), ioRoot, crawler, progressIndicator); updatedRoots.addAll(roots); } if (updatedRoots.isEmpty()) { WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() { public void run() { Messages.showErrorDialog(myVcs.getProject(), SvnBundle.message("message.text.update.no.directories.found"), SvnBundle.message("messate.text.update.error")); } }, null, myVcs.getProject()); return new UpdateSessionAdapter(Collections.<VcsException>emptyList(), true); } return new MyUpdateSessionAdapter(contentRoots, updatedFiles, exceptions); }
From source file:org.jetbrains.jet.plugin.configuration.KotlinMavenConfigurator.java
License:Apache License
protected static void showErrorMessage(@NotNull Project project, @Nullable String message) { Messages.showErrorDialog(project, "<html>Couldn't configure kotlin-maven plugin automatically.<br/>" + (message != null ? message : "") + "See manual installation instructions <a href=\"http://confluence.jetbrains.com/display/Kotlin/Kotlin+Build+Tools#KotlinBuildTools-Maven\">here</a></html>", "Configure Kotlin-Maven Plugin"); }
From source file:org.jetbrains.jet.plugin.configuration.KotlinWithGradleConfigurator.java
License:Apache License
protected static void showErrorMessage(@NotNull Project project, @Nullable String message) { Messages.showErrorDialog(project, "<html>Couldn't configure kotlin-gradle plugin automatically.<br/>" + (message != null ? message : "") + "See manual installation instructions <a href=\"http://confluence.jetbrains.com/display/Kotlin/Kotlin+Build+Tools#KotlinBuildTools-Gradle\">here</a></html>", "Configure Kotlin-Gradle Plugin"); }
From source file:org.jetbrains.jet.plugin.OutdatedKotlinRuntimeNotification.java
License:Apache License
private void updateRuntime() { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override/*from www . j a va2 s . c om*/ public void run() { File runtimePath = PathUtil.getDefaultRuntimePath(); if (runtimePath == null) { Messages.showErrorDialog(myProject, "kotlin-runtime.jar is not found. Make sure plugin is properly installed.", "No Runtime Found"); return; } VirtualFile runtimeJar = getKotlinRuntimeJar(); assert runtimeJar != null; VirtualFile jarFile = JarFileSystem.getInstance().getVirtualFileForJar(runtimeJar); if (jarFile != null) { runtimeJar = jarFile; } try { FileUtil.copy(runtimePath, new File(runtimeJar.getPath())); } catch (IOException e) { throw new AssertionError(e); } runtimeJar.refresh(true, true); } }); }
From source file:org.jetbrains.jet.plugin.quickfix.ConfigureKotlinLibraryNotificationProvider.java
License:Apache License
private Library findOrCreateRuntimeLibrary() { LibraryTable table = ProjectLibraryTable.getInstance(myProject); Library kotlinRuntime = table.getLibraryByName(LIBRARY_NAME); if (kotlinRuntime != null) { for (VirtualFile root : kotlinRuntime.getFiles(OrderRootType.CLASSES)) { if (root.getName().equals(KOTLIN_RUNTIME_JAR)) { return kotlinRuntime; }//from w w w. ja va 2s . com } } File runtimePath = PathUtil.getDefaultRuntimePath(); if (runtimePath == null) { Messages.showErrorDialog(myProject, "kotlin-runtime.jar is not found. Make sure plugin is properly installed.", "No Runtime Found"); return null; } ChoosePathDialog dlg = new ChoosePathDialog(myProject); dlg.show(); if (!dlg.isOK()) return null; String path = dlg.getPath(); final File targetJar = new File(path, "kotlin-runtime.jar"); try { FileUtil.copy(runtimePath, targetJar); VirtualFile jarVfs = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(targetJar); if (jarVfs != null) { jarVfs.refresh(false, false); } } catch (IOException e) { Messages.showErrorDialog(myProject, "Error copying jar: " + e.getLocalizedMessage(), "Error Copying File"); return null; } if (kotlinRuntime == null) { kotlinRuntime = table.createLibrary("KotlinRuntime"); } final Library finalKotlinRuntime = kotlinRuntime; ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() { Library.ModifiableModel model = finalKotlinRuntime.getModifiableModel(); model.addRoot(VfsUtil.getUrlForLibraryRoot(targetJar), OrderRootType.CLASSES); model.addRoot(VfsUtil.getUrlForLibraryRoot(targetJar) + "src", OrderRootType.SOURCES); model.commit(); } }); return kotlinRuntime; }