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.intellij.util.ui.RegExInputVerifier.java
License:Apache License
public boolean shouldYieldFocus(JComponent input) { if (input instanceof JFormattedTextField) { final JFormattedTextField ftf = (JFormattedTextField) input; final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter(); if (formatter != null) { try { formatter.stringToValue(ftf.getText()); } catch (final ParseException e) { SwingUtilities.invokeLater(new Runnable() { public void run() { Messages.showErrorDialog(e.getMessage(), "Malformed Naming Pattern"); }/* www. ja v a2s .c o m*/ }); } } } return true; }
From source file:com.intellij.vcs.starteam.StarteamChangeProvider.java
private void processFailedConnection(final String msg) { if (!warnShown) { Runnable action = new Runnable() { public void run() { String title = StarteamBundle.message("message.title.configuration.error"); String reconnectText = StarteamBundle.message("text.reconnect"); String cancelText = StarteamBundle.message("text.cancel"); int result = Messages.showChooseDialog(project, msg, title, Messages.getQuestionIcon(), new String[] { reconnectText, cancelText }, reconnectText); if (result == 0) { try { host.doShutdown(); host.doStart();//from www. j a va 2 s. com warnShown = false; } catch (VcsException e) { Messages.showErrorDialog(msg, StarteamBundle.message("message.title.configuration.error")); } } } }; ApplicationManager.getApplication().invokeLater(action); warnShown = true; } }
From source file:com.intellij.xdebugger.impl.ui.tree.SetValueInplaceEditor.java
License:Apache License
@Override public void doOKAction() { if (myModifier == null) return;//w w w . j a v a 2 s . c om myExpressionEditor.saveTextInHistory(); final XDebuggerTreeState treeState = XDebuggerTreeState.saveState(myTree); myValueNode.setValueModificationStarted(); myModifier.setValue(myExpressionEditor.getExpression().getExpression(), new XValueModifier.XModificationCallback() { @Override public void valueModified() { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { myTree.rebuildAndRestore(treeState); } }); } @Override public void errorOccurred(@NotNull final String errorMessage) { AppUIUtil.invokeOnEdt(new Runnable() { @Override public void run() { myTree.rebuildAndRestore(treeState); Editor editor = myExpressionEditor.getEditor(); if (editor != null) { HintManager.getInstance().showErrorHint(editor, errorMessage); } else { Messages.showErrorDialog(myTree, errorMessage); } } }); } }); super.doOKAction(); }
From source file:com.jetbrains.edu.learning.newproject.CourseProjectGenerator.java
License:Apache License
/** * Create new project in given location. * To create course structure: modules, folders, files, etc. use {@link CourseProjectGenerator#createCourseStructure(Project, VirtualFile, Object)} * * @param locationString location of new project * @param projectSettings new project settings * @return project of new course or null if new project can't be created *//*from ww w. j av a 2s. c o m*/ @Nullable protected Project createProject(@NotNull String locationString, @NotNull Object projectSettings) { final File location = new File(FileUtil.toSystemDependentName(locationString)); if (!location.exists() && !location.mkdirs()) { String message = ActionsBundle.message("action.NewDirectoryProject.cannot.create.dir", location.getAbsolutePath()); Messages.showErrorDialog(message, ActionsBundle.message("action.NewDirectoryProject.title")); return null; } final VirtualFile baseDir = WriteAction .compute(() -> LocalFileSystem.getInstance().refreshAndFindFileByIoFile(location)); if (baseDir == null) { LOG.error("Couldn't find '" + location + "' in VFS"); return null; } VfsUtil.markDirtyAndRefresh(false, true, true, baseDir); RecentProjectsManager.getInstance() .setLastProjectCreationLocation(PathUtil.toSystemIndependentName(location.getParent())); @SuppressWarnings("unchecked") ProjectOpenedCallback callback = (p, module) -> createCourseStructure(p, baseDir, (S) projectSettings); EnumSet<PlatformProjectOpenProcessor.Option> options = EnumSet .of(PlatformProjectOpenProcessor.Option.FORCE_NEW_FRAME); baseDir.putUserData(COURSE_MODE_TO_CREATE, myCourse.getCourseMode()); Project project = PlatformProjectOpenProcessor.doOpenProject(baseDir, null, -1, callback, options); if (project != null) { project.putUserData(EDU_PROJECT_CREATED, true); } return project; }
From source file:com.jetbrains.edu.learning.stepik.builtInServer.EduBuiltInServerUtils.java
License:Apache License
private static void showDialog(@Nullable Course course, int stepId) { ApplicationManager.getApplication().invokeLater(() -> { if (course != null) { PropertiesComponent.getInstance().setValue(StepikNames.STEP_ID, stepId, 0); new JoinCourseDialog(course).show(); } else {/* www .jav a 2 s . c om*/ Messages.showErrorDialog("Can not get course info from Stepik", "Failed to Create Course"); } }); }
From source file:com.liferay.ide.idea.ui.modules.NewLiferayModuleAction.java
License:Open Source License
@Override public void actionPerformed(AnActionEvent event) { Project project = getEventProject(event); if (!_isValidWorkspaceLocation(project)) { Messages.showErrorDialog("Unable to detect current project as a Liferay workspace", "No Liferay workspace"); return;//from w w w. j a va2 s. c o m } String defaultPath = null; VirtualFile virtualFile = event.getData(CommonDataKeys.VIRTUAL_FILE); if ((virtualFile != null) && virtualFile.isDirectory()) { defaultPath = virtualFile.getPath(); } NewLiferayModuleWizard wizard = new NewLiferayModuleWizard(project, new DefaultModulesProvider(project), defaultPath); if (wizard.showAndGet()) { createModuleFromWizard(project, wizard); } }
From source file:com.maddyhome.idea.copyright.options.ExternalOptionHelper.java
License:Apache License
@Nullable public static List<CopyrightProfile> loadOptions(File file) { try {/*from w ww .ja v a 2s .c o m*/ List<CopyrightProfile> profiles = new ArrayList<CopyrightProfile>(); Document doc = JDOMUtil.loadDocument(file); Element root = doc.getRootElement(); if (root.getName().equals("component")) { final Element copyrightElement = root.getChild("copyright"); if (copyrightElement != null) extractNewNoticeAndKeyword(copyrightElement, profiles); } else { List list = root.getChildren("component"); for (Object element : list) { Element component = (Element) element; String name = component.getAttributeValue("name"); if (name.equals("CopyrightManager")) { for (Object o : component.getChildren("copyright")) { extractNewNoticeAndKeyword((Element) o, profiles); } } else if (name.equals("copyright")) { extractNoticeAndKeyword(component, profiles); } } } return profiles; } catch (Exception e) { logger.info(e); Messages.showErrorDialog(e.getMessage(), "Import Failure"); return null; } }
From source file:com.magnet.plugin.r2m.helpers.UIHelper.java
License:Open Source License
public static void showErrorMessageEventuallyAndEnable(final String message, final JComponent component) { SwingUtilities.invokeLater(new Runnable() { @Override//ww w . j av a 2 s . c o m public void run() { Messages.showErrorDialog(message, R2MMessages.getMessage("WINDOW_TITLE")); component.setEnabled(true); } }); }
From source file:com.microsoft.intellij.actions.AzureDockerHostDeployAction.java
License:Open Source License
public void onActionPerformed(AnActionEvent actionEvent) { try {/*from w w w. j a v a2 s . c o m*/ Project project = getCurrentProject(); if (!AzureSignInAction.doSignIn(AuthMethodManager.getInstance(), project)) return; AzureDockerUIResources.CANCELED = false; Module module = PluginUtil.getSelectedModule(); List<Module> modules = Arrays.asList(ModuleManager.getInstance(project).getModules()); if (module == null && modules.isEmpty()) { Messages.showErrorDialog(message("noModule"), message("error")); } else if (module == null) { module = modules.iterator().next(); } AzureManager azureAuthManager = AuthMethodManager.getInstance().getAzureManager(); // not signed in if (azureAuthManager == null) { System.out.println("ERROR! Not signed in!"); return; } AzureDockerHostsManager dockerManager = AzureDockerHostsManager .getAzureDockerHostsManagerEmpty(azureAuthManager); if (!dockerManager.isInitialized()) { AzureDockerUIResources.updateAzureResourcesWithProgressDialog(project); if (AzureDockerUIResources.CANCELED) { return; } } if (dockerManager.getSubscriptionsMap().isEmpty()) { PluginUtil.displayErrorDialog("Publish Docker Container", "Please select a subscription first"); return; } DockerHost dockerHost = (dockerManager.getDockerPreferredSettings() != null) ? dockerManager.getDockerHostForURL(dockerManager.getDockerPreferredSettings().dockerApiName) : null; AzureDockerImageInstance dockerImageDescription = dockerManager .getDefaultDockerImageDescription(project.getName(), dockerHost); AzureSelectDockerWizardModel model = new AzureSelectDockerWizardModel(project, dockerManager, dockerImageDescription); AzureSelectDockerWizardDialog wizard = new AzureSelectDockerWizardDialog(model); if (dockerHost != null) { model.selectDefaultDockerHost(dockerHost, true); } wizard.show(); if (wizard.getExitCode() == DialogWrapper.OK_EXIT_CODE) { try { String url = wizard.deploy(); System.out.println("Web app published at: " + url); } catch (Exception ex) { PluginUtil.displayErrorDialogAndLog(message("webAppDplyErr"), ex.getMessage(), ex); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.microsoft.intellij.ui.debug.AzureRemoteConfigurable.java
License:Apache License
private Action createLinkAction() { return new AbstractAction("Azure Web App") { @Override//from ww w. ja v a2 s . co m public void actionPerformed(ActionEvent e) { String prevSelection = (String) webAppCombo.getSelectedItem(); Module module = PluginUtil.getSelectedModule(); if (module == null && !modules.isEmpty()) { module = modules.iterator().next(); WebSiteDeployForm form = new WebSiteDeployForm(module); form.show(); if (form.getExitCode() == DialogWrapper.OK_EXIT_CODE) { try { String url = form.deploy(); WebSiteDeployTask task = new WebSiteDeployTask(project, form.getSelectedWebSite(), url); task.queue(); } catch (AzureCmdException ex) { PluginUtil.displayErrorDialogAndLog(message("webAppDplyErr"), ex.getMessage(), ex); } } List<String> listToDisplay = loadWebApps(); if (!listToDisplay.isEmpty()) { if (!prevSelection.isEmpty() && listToDisplay.contains(prevSelection)) { webAppCombo.setSelectedItem(prevSelection); } else { webAppCombo.setSelectedItem(listToDisplay.get(0)); } } } else { Messages.showErrorDialog(message("noModule"), message("error")); } } }; }