List of usage examples for com.intellij.openapi.ui Messages showErrorDialog
public static void showErrorDialog(String message, @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title)
From source file:com.microsoft.intellij.util.PluginUtil.java
License:Open Source License
/** * This method will display the error message box when any error occurs.It takes two parameters * * @param title the text or title of the window. * @param message the message which is to be displayed */// w ww . j a v a2s. c o m public static void displayErrorDialog(String title, String message) { Messages.showErrorDialog(message, title); }
From source file:com.samebug.clients.idea.ui.SettingsDialog.java
License:Apache License
private void onOK() { try {//from ww w .j av a 2 s .c o m apply(); dispose(); } catch (ConfigurationException e) { Messages.showErrorDialog(e.getMessage(), "Samebug Settings Error"); } }
From source file:com.sylvanaar.idea.Lua.debugger.LuaDebugProcess.java
License:Apache License
public void sessionInitialized() { super.sessionInitialized(); ProgressManager.getInstance().run(new Task.Backgroundable(null, "Connecting to debugger", false) { public void run(@NotNull ProgressIndicator indicator) { indicator.setText("Connecting to debugger..."); log.debug("connecting"); try { controller.waitForConnect(); log.debug("connected"); indicator.setText("... Debugger connected"); getSession().rebuildViews(); registerBreakpoints();/*from ww w .j a v a 2s . c om*/ controller.resume(); } catch (final Exception e) { if (executionResult != null && executionResult.getProcessHandler() != null) executionResult.getProcessHandler().destroyProcess(); if (!myClosing) SwingUtilities.invokeLater(new Runnable() { public void run() { Messages.showErrorDialog((new StringBuilder()) .append("Unable to establish connection with debugger:\n") .append(e.getMessage()).toString(), "Connecting to Debugger"); } }); } } }); }
From source file:com.thoughtworks.gauge.formatter.SpecFormatter.java
License:Open Source License
@Override public void actionPerformed(AnActionEvent anActionEvent) { final Project project = anActionEvent.getData(LangDataKeys.PROJECT); if (project == null) { return;//from ww w . j a v a 2 s. c o m } String projectDir = project.getBasePath(); if (projectDir == null) { return; } FileEditorManager fileEditorManager = FileEditorManager.getInstance(project); VirtualFile selectedFile = fileEditorManager.getSelectedFiles()[0]; String fileName = selectedFile.getCanonicalPath(); Document doc = FileDocumentManager.getInstance().getDocument(selectedFile); if (doc != null) { FileDocumentManager.getInstance().saveDocument(doc); } try { GaugeSettingsModel settings = getGaugeSettings(); ProcessBuilder processBuilder = new ProcessBuilder(settings.getGaugePath(), Constants.FORMAT, fileName); GaugeUtil.setGaugeEnvironmentsTo(processBuilder, settings); processBuilder.directory(new File(projectDir)); Process process = processBuilder.start(); int exitCode = process.waitFor(); if (exitCode != 0) { String output = String.format("<pre>%s</pre>", GaugeUtil.getOutput(process.getInputStream(), "\n") .replace("<", "<").replace(">", ">")); Notifications.Bus.notify(new Notification("Spec Formatting", "Error: Spec Formatting", output, NotificationType.ERROR)); return; } VirtualFileManager.getInstance().syncRefresh(); selectedFile.refresh(false, false); } catch (Exception e) { e.printStackTrace(); Messages.showErrorDialog("Error on formatting spec", "Format Error"); } }
From source file:com.wakatime.intellij.plugin.WakaTime.java
public void initComponent() { VERSION = PluginManager.getPlugin(PluginId.getId("com.wakatime.intellij.plugin")).getVersion(); log.info("Initializing WakaTime plugin v" + VERSION + " (https://wakatime.com/)"); //System.out.println("Initializing WakaTime plugin v" + VERSION + " (https://wakatime.com/)"); // Set runtime constants IDE_NAME = "Consulo"; IDE_VERSION = ApplicationInfo.getInstance().getFullVersion(); setupDebugging();// w w w .j a v a2s . c om setLoggingLevel(); Dependencies.configureProxy(); checkApiKey(); setupMenuItem(); if (Dependencies.isPythonInstalled()) { checkCore(); setupEventListeners(); setupQueueProcessor(); checkDebug(); log.info("Finished initializing WakaTime plugin"); } else { ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { public void run() { log.info("Python not found, downloading python..."); // download and install python Dependencies.installPython(); if (Dependencies.isPythonInstalled()) { log.info("Finished installing python..."); checkCore(); setupEventListeners(); setupQueueProcessor(); checkDebug(); log.info("Finished initializing WakaTime plugin"); } else { ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() { Messages.showErrorDialog( "WakaTime requires Python to be installed.\nYou can install it from https://www.python.org/downloads/\nAfter installing Python, restart your IDE.", "Error"); } }); } } }); } }
From source file:de.mobilej.plugin.adc.ToolWindowFactory.java
License:Apache License
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) { ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); JPanel framePanel = createPanel(project); disableAll();//from w ww. j a v a 2 s . c o m final File adb = AndroidSdkUtils.getAdb(project); if (adb == null) { return; } ListenableFuture<AndroidDebugBridge> future = AdbService.getInstance().getDebugBridge(adb); Futures.addCallback(future, new FutureCallback<AndroidDebugBridge>() { @Override public void onSuccess(@Nullable AndroidDebugBridge bridge) { ToolWindowFactory.this.adBridge = bridge; Logger.getInstance(AndroidToolWindowFactory.class).info("Successfully obtained debug bridge"); AndroidDebugBridge.addDeviceChangeListener(deviceChangeListener); updateDeviceComboBox(); } @Override public void onFailure(@NotNull Throwable t) { // If we cannot connect to ADB in a reasonable amount of time (10 seconds timeout in AdbService), then something is seriously // wrong. The only identified reason so far is that some machines have incompatible versions of adb that were already running. // e.g. Genymotion, some HTC flashing software, Ubuntu's adb package may all conflict with the version of adb in the SDK. Logger.getInstance(AndroidToolWindowFactory.class).info("Unable to obtain debug bridge", t); String msg = MessageFormat.format(resourceBundle.getString("error.message.adb"), adb.getAbsolutePath()); Messages.showErrorDialog(msg, resourceBundle.getString("error.title.adb")); } }, EdtExecutor.INSTANCE); Content content = contentFactory.createContent(framePanel, "", false); toolWindow.getContentManager().addContent(content); }
From source file:de.mprengemann.intellij.plugin.androidicons.dialogs.AndroidMultiDrawableImporter.java
License:Apache License
private void importZipArchive(VirtualFile virtualFile) { final String filePath = virtualFile.getCanonicalPath(); if (filePath == null) { return;/*from w ww .j a v a 2 s . co m*/ } final File tempDir = new File(ImageInformation.getTempDir(), virtualFile.getNameWithoutExtension()); final String archiveName = virtualFile.getName(); new Task.Modal(project, "Importing Archive...", true) { @Override public void run(@NotNull final ProgressIndicator progressIndicator) { progressIndicator.setIndeterminate(true); try { FileUtils.forceMkdir(tempDir); ZipUtil.extract(new File(filePath), tempDir, new FilenameFilter() { @Override public boolean accept(File dir, String name) { final String mimeType = new MimetypesFileTypeMap().getContentType(name); final String type = mimeType.split("/")[0]; return type.equals("image"); } }, true); progressIndicator.checkCanceled(); final Iterator<File> fileIterator = FileUtils.iterateFiles(tempDir, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE); while (fileIterator.hasNext()) { File file = fileIterator.next(); if (file.isDirectory() || file.isHidden()) { continue; } final String fileRoot = file.getParent().toUpperCase(); final String name = FilenameUtils.getBaseName(file.toString()); if (name.startsWith(".") || fileRoot.contains("__MACOSX")) { continue; } for (Resolution resolution : RESOLUTIONS) { if (name.toUpperCase().contains("-" + resolution) || name.toUpperCase().contains("_" + resolution) || fileRoot.contains(resolution.toString())) { controller.addZipImage(file, resolution); break; } } } progressIndicator.checkCanceled(); final Map<Resolution, List<ImageInformation>> zipImages = controller.getZipImages(); final List<Resolution> foundResolutions = new ArrayList<Resolution>(); int foundAssets = 0; for (Resolution resolution : zipImages.keySet()) { final List<ImageInformation> assetInformation = zipImages.get(resolution); if (assetInformation != null && !assetInformation.isEmpty()) { foundAssets += assetInformation.size(); foundResolutions.add(resolution); } } progressIndicator.checkCanceled(); final int finalFoundAssets = foundAssets; UIUtil.invokeLaterIfNeeded(new DumbAwareRunnable() { public void run() { final String title = String.format("Import '%s'", archiveName); if (foundResolutions.isEmpty() || finalFoundAssets == 0) { Messages.showErrorDialog("No assets found.", title); FileUtils.deleteQuietly(tempDir); return; } final String[] options = new String[] { "Import", "Cancel" }; final String description = String.format("Import %d assets for %s to %s.", finalFoundAssets, StringUtils.join(foundResolutions, ", "), controller.getTargetRoot()); final int selection = Messages.showDialog(description, title, options, 0, Messages.getQuestionIcon()); if (selection == 0) { controller.getZipTask(project, tempDir).queue(); close(0); } else { FileUtils.deleteQuietly(tempDir); } } }); } catch (ProcessCanceledException e) { FileUtils.deleteQuietly(tempDir); } catch (IOException e) { LOGGER.error(e); } } }.queue(); }
From source file:defrac.intellij.sdk.DefracSdkType.java
License:Apache License
@SuppressWarnings("Contract") @Override/*from w ww .j av a 2s . c o m*/ public boolean setupSdkPaths(@NotNull final Sdk sdk, @NotNull final SdkModel sdkModel) { final List<String> javaSdks = new ArrayList<String>(); final Sdk[] sdks = sdkModel.getSdks(); // (1) search for applicable jdk for (final Sdk jdk : sdks) { if (isApplicableJdk(jdk)) { javaSdks.add(jdk.getName()); } } if (javaSdks.isEmpty()) { Messages.showErrorDialog(DefracBundle.message("sdk.error.jdkNotFound.message"), DefracBundle.message("sdk.error.jdkNotFound.title")); return false; } // (2) search fro valid defrac sdk final DefracSdkData sdkData = DefracSdkData.getSdkData(sdk); if (sdkData == null) { Messages.showErrorDialog(DefracBundle.message("sdk.error.parse.message"), DefracBundle.message("sdk.error.parse.title")); return false; } final DefracVersion[] versions = sdkData.getVersions(); if (versions.length == 0) { Messages.showErrorDialog("No defrac version found. Please run \"defrac --force-update\" first.", "Defrac Not Installed"); //TODO(joa): allow user to run from idea return false; } // (3) convert defrac versions to names, find <current> final ArrayList<String> versionNames = Lists.newArrayListWithCapacity(versions.length); DefracVersion currentVersion = null; for (final DefracVersion version : versions) { if (version.isCurrent()) { currentVersion = version; } versionNames.add(version.getName()); } // (4) let user select jdk and defrac version final NewDefracSdkDialog dialog = new NewDefracSdkDialog(null, javaSdks, javaSdks.get(0), versionNames, currentVersion == null ? versionNames.get(0) : currentVersion.getName()); dialog.show(); if (!dialog.isOK()) { return false; } // (5) feed sdk final String name = javaSdks.get(dialog.getSelectedJavaSdkIndex()); final Sdk jdk = sdkModel.findSdk(name); final DefracVersion version = versions[dialog.getSelectedDefracVersionIndex()]; final String sdkName = DefracSdkUtil.chooseNameForNewLibrary(version); DefracSdkUtil.setupSdk(sdk, sdkName, sdks, version, jdk, /*addRoots=*/true); return true; }
From source file:geneon.intellij.plugin.jenkins.ui.EditServerDialog.java
License:Open Source License
private void testSettings() { String error = ServiceManager.getService(JenkinsService.class) .testServerConnectivity(urlTextField.getText()); if (error == null) { Messages.showInfoMessage("Connected succesfully", "Success"); } else {//from w ww. j a v a 2 s . c om Messages.showErrorDialog("Could not connect:\n" + error, "Failed"); } }
From source file:git4idea.actions.ShowAllSubmittedFilesAction.java
License:Apache License
public static void showSubmittedFiles(final Project project, final GitFileRevision gitRevision) { final Ref<GitCommitChangeList> cl = new Ref<GitCommitChangeList>(); final GitRevisionNumber revisionNumber = (GitRevisionNumber) gitRevision.getRevisionNumber(); String title = getTitle(revisionNumber.getShortRev()); final GitFileRevision gfr = gitRevision; final Project proj = project; try {//w w w . j av a2 s . c om final boolean result = VcsUtil.runVcsProcessWithProgress(new VcsRunnable() { public void run() throws VcsException { GitCommand command = new GitCommand(proj, GitVcs.getInstance(project).getSettings(), VcsUtil.getVcsRootFor(project, gfr.getFilePath())); Collection<Change> changes = command.getChangesForCommit(revisionNumber.getRev()); GitVcs vcs = GitVcs.getInstance(proj); cl.set(new GitCommitChangeList(vcs, gitRevision, changes)); } }, GitBundle.message("show.all.files.from.change.list.searching.for.changed.files.progress.title"), true, project); if (result) { AbstractVcsHelper.getInstance(project).showChangesBrowser(cl.get(), title); } } catch (VcsException ex) { Messages.showErrorDialog(GitBundle.message("message.text.cannot.show.commit", ex.getLocalizedMessage()), title); } }