List of usage examples for com.intellij.openapi.ui Messages getWarningIcon
@NotNull public static Icon getWarningIcon()
From source file:com.intellij.application.options.SchemesToImportPopup.java
License:Apache License
public void show(Collection<T> schemes) { if (schemes.isEmpty()) { Messages.showMessageDialog("There are no available schemes to import", "Import", Messages.getWarningIcon()); return;//from ww w. j a v a 2 s . com } final JList list = new JBList(new CollectionListModel<T>(schemes)); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setCellRenderer(new SchemesToImportListCellRenderer()); Runnable selectAction = new Runnable() { @Override public void run() { onSchemeSelected((T) list.getSelectedValue()); } }; showList(list, selectAction); }
From source file:com.intellij.codeInsight.daemon.impl.quickfix.AddModuleDependencyFix.java
License:Apache License
private static void showCircularWarningAndContinue(final Project project, final Pair<Module, Module> circularModules, final Module classModule, final Runnable doit) { final String message = QuickFixBundle.message("orderEntry.fix.circular.dependency.warning", classModule.getName(), circularModules.getFirst().getName(), circularModules.getSecond().getName()); if (ApplicationManager.getApplication().isUnitTestMode()) throw new RuntimeException(message); ApplicationManager.getApplication().invokeLater(new Runnable() { @Override//w ww . j a v a 2 s.co m public void run() { if (!project.isOpen()) return; int ret = Messages.showOkCancelDialog(project, message, QuickFixBundle.message("orderEntry.fix.title.circular.dependency.warning"), Messages.getWarningIcon()); if (ret == 0) { ApplicationManager.getApplication().runWriteAction(doit); } } }); }
From source file:com.intellij.codeInsight.daemon.impl.quickfix.SideEffectWarningDialog.java
License:Apache License
@Override protected JComponent createCenterPanel() { final JPanel panel = new JPanel(new BorderLayout()); final String text = sideEffectsDescription(); final JLabel label = new JLabel(text); label.setIcon(Messages.getWarningIcon()); panel.add(label, BorderLayout.NORTH); return panel; }
From source file:com.intellij.compiler.impl.CompilerUtil.java
License:Apache License
public static boolean askUserToContinueWithNoClearing(Project project, Collection<VirtualFile> affectedOutputPaths) { final StringBuilder paths = new StringBuilder(); for (final VirtualFile affectedOutputPath : affectedOutputPaths) { if (paths.length() > 0) { paths.append(",\n"); }//from w w w . j ava 2 s . com paths.append(affectedOutputPath.getPath().replace('/', File.separatorChar)); } final int answer = Messages.showOkCancelDialog(project, CompilerBundle.message("warning.sources.under.output.paths", paths.toString()), CommonBundle.getErrorTitle(), Messages.getWarningIcon()); if (answer == Messages.OK) { // ok return true; } else { return false; } }
From source file:com.intellij.debugger.engine.DebugProcessImpl.java
License:Apache License
private void checkVirtualMachineVersion(VirtualMachine vm) { final String version = vm.version(); if ("1.4.0".equals(version)) { SwingUtilities.invokeLater(new Runnable() { @Override//from w w w. j ava 2 s . co m public void run() { Messages.showMessageDialog(getProject(), DebuggerBundle.message("warning.jdk140.unstable"), DebuggerBundle.message("title.jdk140.unstable"), Messages.getWarningIcon()); } }); } }
From source file:com.intellij.debugger.settings.ArrayRendererConfigurable.java
License:Apache License
private void applyTo(ArrayRenderer renderer, boolean showBigRangeWarning) { int newStartIndex = getInt(myStartIndex); int newEndIndex = getInt(myEndIndex); int newLimit = getInt(myEntriesLimit); if (newStartIndex >= 0 && newEndIndex >= 0) { if (newStartIndex >= newEndIndex) { int currentStartIndex = renderer.START_INDEX; int currentEndIndex = renderer.END_INDEX; newEndIndex = newStartIndex + (currentEndIndex - currentStartIndex); }/*w w w . j a va 2s . c o m*/ if (newLimit <= 0) { newLimit = 1; } if (showBigRangeWarning && (newEndIndex - newStartIndex > 10000)) { final int answer = Messages.showOkCancelDialog(myPanel.getRootPane(), DebuggerBundle.message("warning.range.too.big", ApplicationNamesInfo.getInstance().getProductName()), DebuggerBundle.message("title.range.too.big"), Messages.getWarningIcon()); if (answer != DialogWrapper.OK_EXIT_CODE) { return; } } } renderer.START_INDEX = newStartIndex; renderer.END_INDEX = newEndIndex; renderer.ENTRIES_LIMIT = newLimit; }
From source file:com.intellij.debugger.ui.HotSwapUIImpl.java
License:Apache License
private void hotSwapSessions(final List<DebuggerSession> sessions, @Nullable final Map<String, List<String>> generatedPaths) { final boolean shouldAskBeforeHotswap = myAskBeforeHotswap; myAskBeforeHotswap = true;/*from w ww. j a v a2s.com*/ // need this because search with PSI is perormed during hotswap PsiDocumentManager.getInstance(myProject).commitAllDocuments(); final DebuggerSettings settings = DebuggerSettings.getInstance(); final String runHotswap = settings.RUN_HOTSWAP_AFTER_COMPILE; final boolean shouldDisplayHangWarning = shouldDisplayHangWarning(settings, sessions); if (shouldAskBeforeHotswap && DebuggerSettings.RUN_HOTSWAP_NEVER.equals(runHotswap)) { return; } final boolean shouldPerformScan = true; final HotSwapProgressImpl findClassesProgress; if (shouldPerformScan) { findClassesProgress = new HotSwapProgressImpl(myProject); } else { boolean createProgress = false; for (DebuggerSession session : sessions) { if (session.isModifiedClassesScanRequired()) { createProgress = true; break; } } findClassesProgress = createProgress ? new HotSwapProgressImpl(myProject) : null; } ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { public void run() { final Map<DebuggerSession, Map<String, HotSwapFile>> modifiedClasses; if (shouldPerformScan) { modifiedClasses = scanForModifiedClassesWithProgress(sessions, findClassesProgress, true); } else { final List<DebuggerSession> toScan = new ArrayList<DebuggerSession>(); final List<DebuggerSession> toUseGenerated = new ArrayList<DebuggerSession>(); for (DebuggerSession session : sessions) { (session.isModifiedClassesScanRequired() ? toScan : toUseGenerated).add(session); session.setModifiedClassesScanRequired(false); } modifiedClasses = new HashMap<DebuggerSession, Map<String, HotSwapFile>>(); if (!toUseGenerated.isEmpty()) { modifiedClasses.putAll(HotSwapManager.findModifiedClasses(toUseGenerated, generatedPaths)); } if (!toScan.isEmpty()) { modifiedClasses .putAll(scanForModifiedClassesWithProgress(toScan, findClassesProgress, true)); } } final Application application = ApplicationManager.getApplication(); if (modifiedClasses.isEmpty()) { final String message = DebuggerBundle.message("status.hotswap.uptodate"); HotSwapProgressImpl.NOTIFICATION_GROUP.createNotification(message, NotificationType.INFORMATION) .notify(myProject); return; } application.invokeLater(new Runnable() { public void run() { if (shouldAskBeforeHotswap && !DebuggerSettings.RUN_HOTSWAP_ALWAYS.equals(runHotswap)) { final RunHotswapDialog dialog = new RunHotswapDialog(myProject, sessions, shouldDisplayHangWarning); dialog.show(); if (!dialog.isOK()) { for (DebuggerSession session : modifiedClasses.keySet()) { session.setModifiedClassesScanRequired(true); } return; } final Set<DebuggerSession> toReload = new HashSet<DebuggerSession>( dialog.getSessionsToReload()); for (DebuggerSession session : modifiedClasses.keySet()) { if (!toReload.contains(session)) { session.setModifiedClassesScanRequired(true); } } modifiedClasses.keySet().retainAll(toReload); } else { if (shouldDisplayHangWarning) { final int answer = Messages.showCheckboxMessageDialog( DebuggerBundle.message("hotswap.dialog.hang.warning"), DebuggerBundle.message("hotswap.dialog.title"), new String[] { "Perform &Reload Classes", "&Skip Reload Classes" }, CommonBundle.message("dialog.options.do.not.show"), false, 1, 1, Messages.getWarningIcon(), new PairFunction<Integer, JCheckBox, Integer>() { @Override public Integer fun(Integer exitCode, JCheckBox cb) { settings.HOTSWAP_HANG_WARNING_ENABLED = !cb.isSelected(); return exitCode == DialogWrapper.OK_EXIT_CODE ? exitCode : DialogWrapper.CANCEL_EXIT_CODE; } }); if (answer == DialogWrapper.CANCEL_EXIT_CODE) { for (DebuggerSession session : modifiedClasses.keySet()) { session.setModifiedClassesScanRequired(true); } return; } } } if (!modifiedClasses.isEmpty()) { final HotSwapProgressImpl progress = new HotSwapProgressImpl(myProject); application.executeOnPooledThread(new Runnable() { public void run() { reloadModifiedClasses(modifiedClasses, progress); } }); } } }, ModalityState.NON_MODAL); } }); }
From source file:com.intellij.diagnostic.ITNReporter2.java
License:Apache License
private static boolean doSubmit(final IdeaLoggingEvent event, final Component parentComponent, final Consumer<SubmittedReportInfo> callback, final ErrorBean errorBean, final String description) { final DataContext dataContext = DataManager.getInstance().getDataContext(parentComponent); final Project project = CommonDataKeys.PROJECT.getData(dataContext); final ErrorReportConfigurable errorReportConfigurable = ErrorReportConfigurable.getInstance(); if (!errorReportConfigurable.KEEP_ITN_PASSWORD && !StringUtil.isEmpty(errorReportConfigurable.ITN_LOGIN) && StringUtil.isEmpty(errorReportConfigurable.getPlainItnPassword())) { final JetBrainsAccountDialog dlg = new JetBrainsAccountDialog(parentComponent); dlg.show();// www .j a v a 2 s. c o m if (!dlg.isOK()) { return false; } } errorBean.setDescription(description); errorBean.setMessage(event.getMessage()); if (previousExceptionThreadId != 0) { errorBean.setPreviousException(previousExceptionThreadId); } Throwable t = event.getThrowable(); if (t != null) { final PluginId pluginId = IdeErrorsDialog.findPluginId(t); if (pluginId != null) { final IdeaPluginDescriptor ideaPluginDescriptor = PluginManager.getPlugin(pluginId); if (ideaPluginDescriptor != null && !ideaPluginDescriptor.isBundled()) { errorBean.setPluginName(ideaPluginDescriptor.getName()); errorBean.setPluginVersion(ideaPluginDescriptor.getVersion()); } } } Object data = event.getData(); if (data instanceof AbstractMessage) { errorBean.setAssigneeId(((AbstractMessage) data).getAssigneeId()); } if (data instanceof LogMessageEx) { errorBean.setAttachments(((LogMessageEx) data).getAttachments()); } @NonNls String login = errorReportConfigurable.ITN_LOGIN; @NonNls String password = errorReportConfigurable.getPlainItnPassword(); if (login.trim().length() == 0 && password.trim().length() == 0) { login = "idea_anonymous"; password = "guest"; } ErrorReportSender.sendError(project, login, password, errorBean, new Consumer<Integer>() { @SuppressWarnings({ "AssignmentToStaticFieldFromInstanceMethod" }) @Override public void consume(Integer threadId) { previousExceptionThreadId = threadId; wasException = true; final SubmittedReportInfo reportInfo = new SubmittedReportInfo(URL_HEADER + threadId, String.valueOf(threadId), SubmittedReportInfo.SubmissionStatus.NEW_ISSUE); callback.consume(reportInfo); ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { StringBuilder text = new StringBuilder(); final String url = IdeErrorsDialog.getUrl(reportInfo, true); IdeErrorsDialog.appendSubmissionInformation(reportInfo, text, url); text.append("."); if (reportInfo.getStatus() != SubmittedReportInfo.SubmissionStatus.FAILED) { text.append("<br/>").append(DiagnosticBundle.message("error.report.gratitude")); } NotificationType type = reportInfo .getStatus() == SubmittedReportInfo.SubmissionStatus.FAILED ? NotificationType.ERROR : NotificationType.INFORMATION; NotificationListener listener = url != null ? new NotificationListener.UrlOpeningListener(true) : null; ReportMessages.GROUP.createNotification(ReportMessages.ERROR_REPORT, XmlStringUtil.wrapInHtml(text), type, listener).setImportant(false).notify(project); } }); } }, new Consumer<Exception>() { @Override public void consume(final Exception e) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { String msg; if (e instanceof NoSuchEAPUserException) { msg = DiagnosticBundle.message("error.report.authentication.failed"); } else if (e instanceof InternalEAPException) { msg = DiagnosticBundle.message("error.report.posting.failed", e.getMessage()); } else { msg = DiagnosticBundle.message("error.report.sending.failure"); } if (e instanceof UpdateAvailableException) { String message = DiagnosticBundle.message("error.report.new.eap.build.message", e.getMessage()); showMessageDialog(parentComponent, project, message, CommonBundle.getWarningTitle(), Messages.getWarningIcon()); callback.consume(new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED)); } else if (showYesNoDialog(parentComponent, project, msg, ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) { callback.consume(new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED)); } else { if (e instanceof NoSuchEAPUserException) { final JetBrainsAccountDialog dialog; if (parentComponent.isShowing()) { dialog = new JetBrainsAccountDialog(parentComponent); } else { dialog = new JetBrainsAccountDialog(project); } dialog.show(); } ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { doSubmit(event, parentComponent, callback, errorBean, description); } }); } } }); } }); return true; }
From source file:com.intellij.dvcs.branch.DvcsTaskHandler.java
License:Apache License
@Override public TaskInfo startNewTask(@NotNull final String taskName) { List<R> repositories = myRepositoryManager.getRepositories(); List<R> problems = ContainerUtil.filter(repositories, new Condition<R>() { @Override//ww w .j a v a2 s .c o m public boolean value(R repository) { return hasBranch(repository, taskName); } }); MultiMap<String, String> map = new MultiMap<String, String>(); if (!problems.isEmpty()) { if (ApplicationManager.getApplication().isUnitTestMode() || Messages.showDialog(myProject, "<html>The following repositories already have specified " + myBranchType + "<b>" + taskName + "</b>:<br>" + StringUtil.join(problems, "<br>") + ".<br>" + "Do you want to checkout existing " + myBranchType + "?", myBranchType + " Already Exists", new String[] { Messages.YES_BUTTON, Messages.NO_BUTTON }, 0, Messages.getWarningIcon(), new DialogWrapper.PropertyDoNotAskOption("git.checkout.existing.branch")) == 0) { checkout(taskName, problems, null); fillMap(taskName, problems, map); } } repositories.removeAll(problems); if (!repositories.isEmpty()) { checkoutAsNewBranch(taskName, repositories); } fillMap(taskName, repositories, map); return new TaskInfo(map); }
From source file:com.intellij.dvcs.push.PushController.java
License:Apache License
public boolean ensureForcePushIsNeeded() { Collection<MyRepoModel<?, ?, ?>> selectedNodes = getSelectedRepoNode(); MyRepoModel<?, ?, ?> selectedModel = ObjectUtils.assertNotNull(ContainerUtil.getFirstItem(selectedNodes)); final PushSupport activePushSupport = selectedModel.getSupport(); final PushTarget commonTarget = getCommonTarget(selectedNodes); if (commonTarget != null && activePushSupport.isSilentForcePushAllowed(commonTarget)) return true; return Messages.showOkCancelDialog(myProject, XmlStringUtil.wrapInHtml(DvcsBundle.message("push.force.confirmation.text", commonTarget != null ? " to <b>" + commonTarget.getPresentation() + "</b>" : "")), "Force Push", "&Force Push", CommonBundle.getCancelButtonText(), Messages.getWarningIcon(), commonTarget != null ? new MyDoNotAskOptionForPush(activePushSupport, commonTarget) : null) == OK; }