List of usage examples for com.intellij.openapi.ui Messages showMessageDialog
public static void showMessageDialog(String message, @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title, @Nullable Icon icon)
From source file:net.groboclown.idea.p4ic.ui.sync.SyncPanel.java
License:Apache License
public SyncPanel(@NotNull final SyncOptionConfigurable parent) { syncTypeGroup = new ButtonGroup(); $$$setupUI$$$();/*from w w w .j ava 2 s .c om*/ syncTypeGroup.add(mySyncHead); mySyncHead.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { setPairState(false, myRevLabel, myRevision); setPairState(false, myOtherLabel, myOther); updateValues(parent); } }); syncTypeGroup.add(mySyncRev); mySyncRev.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { setPairState(true, myRevLabel, myRevision); setPairState(false, myOtherLabel, myOther); updateValues(parent); } }); syncTypeGroup.add(mySyncChangelist); mySyncChangelist.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { setPairState(false, myRevLabel, myRevision); setPairState(true, myOtherLabel, myOther); updateValues(parent); } }); myRevision.addPropertyChangeListener("value", new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent evt) { if (getSelectedSyncType() == SyncType.REV && getRevValue() == null) { Messages.showMessageDialog(P4Bundle.message("sync.options.rev.error"), P4Bundle.message("sync.options.rev.error.title"), Messages.getErrorIcon()); } else { updateValues(parent); } } }); myOther.addPropertyChangeListener("value", new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent evt) { updateValues(parent); } }); // initialize the parent values to the current settings. updateValues(parent); }
From source file:org.cordovastudio.actions.NewProjectAction.java
License:Apache License
@Override public void actionPerformed(AnActionEvent anActionEvent) { CordovaStudioNewProjectDialog dialog = new CordovaStudioNewProjectDialog(); dialog.show();/* ww w .j a v a 2s . co m*/ if (dialog.isOK()) { LOG.info("Creating new Cordova project..."); /* * Create project with details from dialog */ final ProjectManager pm = ProjectManager.getInstance(); final String projectPath = dialog.getProjectPath(); final String projectName = dialog.getProjectName(); final String projectId = dialog.getProjectId(); if ("".equals(projectPath)) { Messages.showMessageDialog("Project Path can not be empty!", ERROR_MESSAGE_TITLE, Messages.getErrorIcon()); return; } File projectPathFileHandle = new File(projectPath); /* * Check if parent path exists, else create it (createParentDirs() does both of it) */ if (!FileUtilRt.createParentDirs(projectPathFileHandle)) { Messages.showMessageDialog("Project Path could not be created!", ERROR_MESSAGE_TITLE, Messages.getErrorIcon()); return; } File parentPath = projectPathFileHandle.getParentFile(); if (projectPathFileHandle.exists()) { if (projectPathFileHandle.list().length > 0) { Messages.showMessageDialog( "The specified project directory contains files. Cordova project can not be created there. You need to specify a non existent or empty directory.", ERROR_MESSAGE_TITLE, Messages.getErrorIcon()); return; } else { /* Delete File */ if (!FileUtilRt.delete(projectPathFileHandle)) { Messages.showMessageDialog( "The specified project directory could not be altered. Cordova project can not be created there. You need to have write access.", ERROR_MESSAGE_TITLE, Messages.getErrorIcon()); return; } } } /* * Attention! Cordova will try to create the TARGET directory, so it MUST NOT exist already. * The target's PARENT directory, though, MUST exist. */ String execStatement; if (DEBUG) { execStatement = PathMacros.getInstance().getValue("CORDOVA_EXECUTABLE") + " -d create " + projectPath + "/ " + projectId + " " + projectName; } else { execStatement = PathMacros.getInstance().getValue("CORDOVA_EXECUTABLE") + " create " + projectPath + "/ " + projectId + " " + projectName; } try { LOG.info("Trying to execute '" + execStatement + "'..."); Process proc = Runtime.getRuntime().exec(execStatement); proc.waitFor(); int exitCode = proc.exitValue(); if (exitCode > 0) { BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getErrorStream())); StringBuffer output = new StringBuffer(); String line = ""; while ((line = reader.readLine()) != null) { output.append(line + "\n"); } LOG.warn("Cordova process returned with ExitCode " + exitCode + ". Message: " + output.toString()); if (output.toString().contains("node: No such file or directory")) { Messages.showMessageDialog( "NodeJS binary not found. Please install NodeJS (from http://nodejs.org/) and check PATH environment variable.", ERROR_MESSAGE_TITLE, Messages.getErrorIcon()); } else { Messages.showMessageDialog("Cordova could not be executed. Exit code: " + exitCode + ". Message:\n" + output.toString(), ERROR_MESSAGE_TITLE, Messages.getErrorIcon()); } return; } else { BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream())); StringBuffer output = new StringBuffer(); String line = ""; while ((line = reader.readLine()) != null) { output.append(line + "\n"); } LOG.info(output.toString()); LOG.info("Cordova project created. (ExitCode " + exitCode + ")"); } } catch (IOException e) { Messages.showMessageDialog("Cordova binaries could not be executed.\n" + e.getMessage(), ERROR_MESSAGE_TITLE, Messages.getErrorIcon()); } catch (InterruptedException e) { e.printStackTrace(); } /* Create IDEA project files (i.e. .idea directory) */ final Project project = pm.createProject(projectName, projectPath); LOG.assertTrue(project != null, "Project is null"); /* Create Cordova project */ ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { Module module = ModuleManager.getInstance(project).newModule( projectPath + "/" + projectName + ".iml", CordovaModuleTypeId.CORDOVA_MODULE); CordovaModuleBuilder moduleBuilder = CordovaModuleType.getInstance().createModuleBuilder(); moduleBuilder.commitModule(project, ModuleManager.getInstance(project).getModifiableModel()); FacetType type = FacetTypeRegistry.getInstance().findFacetType("cordova"); Facet facet = type.createFacet(module, "Cordova Facet", type.createDefaultConfiguration(), null); ModifiableFacetModel model = FacetManager.getInstance(module).createModifiableModel(); model.addFacet(facet); model.commit(); project.save(); } }); /* Load project */ // try { // pm.loadAndOpenProject(project.getBasePath()); // // /* Open /www/index.html in Editor */ // VirtualFile indexHtmlFile = LocalFileSystem.getInstance().findFileByIoFile(new File(project.getBasePath()+"/www/index.html")); // // if(indexHtmlFile == null) { // Messages.showMessageDialog("File '/www/index.html' could not be opened. Please check if it exists and try to reopen.", ERROR_MESSAGE_TITLE, Messages.getErrorIcon()); // return; // } // // //FileEditorManager.getInstance(project).openTextEditor(new OpenFileDescriptor(project, indexHtmlFile), true); // // } catch (Exception e) { // Messages.showMessageDialog(e.getMessage(), ERROR_MESSAGE_TITLE, Messages.getErrorIcon()); // } } }
From source file:org.cordovastudio.editors.designer.propertyTable.PropertyTable.java
License:Apache License
private static void showInvalidInput(Exception e) { Throwable cause = e.getCause(); String message = cause == null ? e.getMessage() : cause.getMessage(); if (message == null || message.length() == 0) { message = "No message"; }/* w ww .jav a 2 s . c om*/ Messages.showMessageDialog(MessageFormat.format("Error setting value: {0}", message), "Invalid Input", Messages.getErrorIcon()); }
From source file:org.cordovastudio.startup.CordovaStudioInitializer.java
License:Apache License
/** * Check for existence of Cordova executable and set (if applicable) path variables. * * @author Christoffer T. Timm <kontakt@christoffertimm.de> */// w ww . j av a 2 s . c o m private static void initializePathVariables() { PathMacros pathMacros = PathMacros.getInstance(); String cordovaPath = pathMacros.getValue("CORDOVA_EXECUTABLE"); if (cordovaPath == null) { if (new File(DEFAULT_CORDOVA_EXECUTABLE_PATH).exists()) { pathMacros.setMacro("CORDOVA_EXECUTABLE", "/usr/local/bin/cordova"); } else { pathMacros.setMacro("CORDOVA_EXECUTABLE", ""); Messages.showMessageDialog( "Path to Cordova binary can not be found in default location (/usr/local/bin/). Please set 'CORDOVA_EXECUTABLE' in Path Variables in preferences!", "Cordova not found!", Messages.getErrorIcon()); } } }
From source file:org.intellij.plugins.xpathView.XPathEvalAction.java
License:Apache License
private boolean evaluateExpression(EvalExpressionDialog.Context context, XmlElement contextNode, Editor editor, Config cfg) {/*from w w w . j a va 2 s.c om*/ final Project project = editor.getProject(); try { final XPathSupport support = XPathSupport.getInstance(); final XPath xpath = support.createXPath((XmlFile) contextNode.getContainingFile(), context.input.expression, context.input.namespaces); xpath.setVariableContext(new CachedVariableContext(context.input.variables, xpath, contextNode)); // evaluate the expression on the whole document final Object result = xpath.evaluate(contextNode); LOG.debug("result = " + result); LOG.assertTrue(result != null, "null result?"); if (result instanceof List<?>) { final List<?> list = (List<?>) result; if (!list.isEmpty()) { if (cfg.HIGHLIGHT_RESULTS) { highlightResult(contextNode, editor, list); } if (cfg.SHOW_USAGE_VIEW) { showUsageView(editor, xpath, contextNode, list); } if (!cfg.SHOW_USAGE_VIEW && !cfg.HIGHLIGHT_RESULTS) { final String s = StringUtil.pluralize("match", list.size()); Messages.showInfoMessage(project, "Expression produced " + list.size() + " " + s, "XPath Result"); } } else { return Messages.showOkCancelDialog(project, "Sorry, your expression did not return any result", "XPath Result", "OK", "Edit Expression", Messages.getInformationIcon()) == 1; } } else if (result instanceof String) { Messages.showMessageDialog("'" + result.toString() + "'", "XPath result (String)", Messages.getInformationIcon()); } else if (result instanceof Number) { Messages.showMessageDialog(result.toString(), "XPath result (Number)", Messages.getInformationIcon()); } else if (result instanceof Boolean) { Messages.showMessageDialog(result.toString(), "XPath result (Boolean)", Messages.getInformationIcon()); } else { LOG.error("Unknown XPath result: " + result); } } catch (XPathSyntaxException e) { LOG.debug(e); // TODO: Better layout of the error message with non-fixed size fonts return Messages.showOkCancelDialog(project, e.getMultilineMessage(), "XPath syntax error", "Edit Expression", "Cancel", Messages.getErrorIcon()) == 0; } catch (SAXPathException e) { LOG.debug(e); Messages.showMessageDialog(project, e.getMessage(), "XPath error", Messages.getErrorIcon()); } return false; }
From source file:org.jetbrains.idea.maven.indices.MavenRepositoriesConfigurable.java
License:Apache License
private void testServiceConnection(String url) { myTestButton.setEnabled(false);//from w ww. j a v a 2 s .co m RepositoryAttachHandler.searchRepositories(myProject, Collections.singletonList(url), new Processor<Collection<MavenRepositoryInfo>>() { @Override public boolean process(Collection<MavenRepositoryInfo> infos) { myTestButton.setEnabled(true); if (infos.isEmpty()) { Messages.showMessageDialog("No repositories found", "Service Connection Failed", Messages.getWarningIcon()); } else { final StringBuilder sb = new StringBuilder(); sb.append(infos.size()).append(infos.size() == 1 ? "repository" : " repositories") .append(" found"); //for (MavenRepositoryInfo info : infos) { // sb.append("\n "); // sb.append(info.getId()).append(" (").append(info.getName()).append(")").append(": ").append(info.getUrl()); //} Messages.showMessageDialog(sb.toString(), "Service Connection Successful", Messages.getInformationIcon()); } return true; } }); }
From source file:org.jetbrains.idea.svn.integrate.SvnIntegrateChangesTask.java
License:Apache License
private void afterExecution(final boolean wasCanceled) { if (!myRecentlyUpdatedFiles.isEmpty()) { myResolveWorker.execute(myRecentlyUpdatedFiles); }/*from w ww. j a va 2 s.co m*/ final boolean haveConflicts = ResolveWorker.haveUnresolvedConflicts(myRecentlyUpdatedFiles); accomulate(); if ((!myMerger.hasNext()) || haveConflicts || (!myExceptions.isEmpty()) || myAccomulatedFiles.containErrors() || wasCanceled) { initMergeTarget(); if (myAccomulatedFiles.isEmpty() && myExceptions.isEmpty() && (myMergeTarget == null) && (!wasCanceled)) { Messages.showMessageDialog( SvnBundle.message("action.Subversion.integrate.changes.message.files.up.to.date.text"), myTitle, Messages.getInformationIcon()); } else { if (haveConflicts) { final VcsException exception = new VcsException( SvnBundle.message("svn.integrate.changelist.warning.unresolved.conflicts.text")); exception.setIsWarning(true); myExceptions.add(exception); } if (wasCanceled) { final List<String> details = new LinkedList<String>(); details.add("Integration was canceled"); myMerger.getSkipped(new Consumer<String>() { public void consume(String s) { if (!StringUtil.isEmptyOrSpaces(s)) { details.add(s); } } }); final VcsException exception = new VcsException(details); exception.setIsWarning(true); myExceptions.add(exception); } finishActions(wasCanceled); } myMerger.afterProcessing(); } else { stepToNextChangeList(); } }
From source file:org.moe.idea.actions.MOECreateClassTemplateDialog.java
License:Apache License
private void showMessage(String message) { Messages.showMessageDialog(message, "Multi-OS Engine Class Creation", MOEIcons.MOELogo); }
From source file:org.moe.idea.MOESdkPlugin.java
License:Apache License
public static String getSdkRootPath(Module module) { final Properties properties = ProjectUtil.retrievePropertiesFromGradle( new File(ModuleUtils.getModulePath(module)), ProjectUtil.SDK_PROPERTIES_TASK); String sdkPath = properties.getProperty(ProjectUtil.SDK_PATH_KEY); if (sdkPath == null || sdkPath.isEmpty()) { Messages.showMessageDialog(MOEText.get("Invalid.SDK.Path"), "Error", MOEIcons.MOELogo); }//from w w w. j a v a2s. c o m return sdkPath; }
From source file:org.moe.idea.runconfig.configuration.MOERunConfigurationEditor.java
License:Apache License
private void showMessage(String message) { Messages.showMessageDialog(message, MOEText.get("Configuration.Editor"), MOEIcons.MOELogo); }