List of usage examples for com.intellij.openapi.ui Messages getInformationIcon
@NotNull public static Icon getInformationIcon()
From source file:com.intellij.usages.impl.SearchForUsagesRunnable.java
License:Apache License
private void endSearchForUsages(@NotNull final AtomicBoolean findStartedBalloonShown) { assert !ApplicationManager.getApplication().isDispatchThread() : Thread.currentThread(); int usageCount = myUsageCountWithoutDefinition.get(); if (usageCount == 0 && myProcessPresentation.isShowNotFoundMessage()) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override//from w w w .j a v a2 s. c o m public void run() { if (myProcessPresentation.isCanceled()) { notifyByFindBalloon(null, MessageType.WARNING, myProcessPresentation, myProject, Arrays.asList("Usage search was canceled")); findStartedBalloonShown.set(false); return; } final List<Action> notFoundActions = myProcessPresentation.getNotFoundActions(); final String message = UsageViewBundle.message("dialog.no.usages.found.in", StringUtil.decapitalize(myPresentation.getUsagesString()), myPresentation.getScopeText()); if (notFoundActions.isEmpty()) { List<String> lines = new ArrayList<String>(); lines.add(StringUtil.escapeXml(message)); if (myOutOfScopeUsages.get() != 0) { lines.add(UsageViewManagerImpl.outOfScopeMessage(myOutOfScopeUsages.get(), mySearchScopeToWarnOfFallingOutOf)); } if (myProcessPresentation.isShowFindOptionsPrompt()) { lines.add(createOptionsHtml(mySearchFor)); } MessageType type = myOutOfScopeUsages.get() == 0 ? MessageType.INFO : MessageType.WARNING; notifyByFindBalloon(createGotToOptionsListener(mySearchFor), type, myProcessPresentation, myProject, lines); findStartedBalloonShown.set(false); } else { List<String> titles = new ArrayList<String>(notFoundActions.size() + 1); titles.add(UsageViewBundle.message("dialog.button.ok")); for (Action action : notFoundActions) { Object value = action.getValue(FindUsagesProcessPresentation.NAME_WITH_MNEMONIC_KEY); if (value == null) value = action.getValue(Action.NAME); titles.add((String) value); } int option = Messages.showDialog(myProject, message, UsageViewBundle.message("dialog.title.information"), ArrayUtil.toStringArray(titles), 0, Messages.getInformationIcon()); if (option > 0) { notFoundActions.get(option - 1) .actionPerformed(new ActionEvent(this, 0, titles.get(option))); } } } }, ModalityState.NON_MODAL, myProject.getDisposed()); } else if (usageCount == 1 && !myProcessPresentation.isShowPanelIfOnlyOneUsage()) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { Usage usage = myFirstUsage.get(); if (usage.canNavigate()) { usage.navigate(true); flashUsageScriptaculously(usage); } List<String> lines = new ArrayList<String>(); lines.add("Only one usage found."); if (myOutOfScopeUsages.get() != 0) { lines.add(UsageViewManagerImpl.outOfScopeMessage(myOutOfScopeUsages.get(), mySearchScopeToWarnOfFallingOutOf)); } lines.add(createOptionsHtml(mySearchFor)); MessageType type = myOutOfScopeUsages.get() == 0 ? MessageType.INFO : MessageType.WARNING; notifyByFindBalloon(createGotToOptionsListener(mySearchFor), type, myProcessPresentation, myProject, lines); } }, ModalityState.NON_MODAL, myProject.getDisposed()); } else { final UsageViewImpl usageView = myUsageViewRef.get(); if (usageView != null) { usageView.drainQueuedUsageNodes(); usageView.setSearchInProgress(false); } final List<String> lines; final HyperlinkListener hyperlinkListener; if (myOutOfScopeUsages.get() == 0 || getPsiElement(mySearchFor) == null) { lines = Collections.emptyList(); hyperlinkListener = null; } else { lines = Arrays.asList(UsageViewManagerImpl.outOfScopeMessage(myOutOfScopeUsages.get(), mySearchScopeToWarnOfFallingOutOf), createSearchInProjectHtml()); hyperlinkListener = createSearchInProjectListener(); } if (!myProcessPresentation.getLargeFiles().isEmpty() || myOutOfScopeUsages.get() != 0 || myProcessPresentation.searchIncludingProjectFileUsages() != null) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { MessageType type = myOutOfScopeUsages.get() == 0 ? MessageType.INFO : MessageType.WARNING; notifyByFindBalloon(hyperlinkListener, type, myProcessPresentation, myProject, lines); } }, ModalityState.NON_MODAL, myProject.getDisposed()); } } if (myListener != null) { myListener.findingUsagesFinished(myUsageViewRef.get()); } }
From source file:com.intellij.util.net.HTTPProxySettingsPanel.java
License:Apache License
public HTTPProxySettingsPanel(final HttpConfigurable httpConfigurable) { final ButtonGroup group = new ButtonGroup(); group.add(myUseHTTPProxyRb);/*from ww w . j av a 2 s. c o m*/ group.add(myAutoDetectProxyRb); group.add(myNoProxyRb); myNoProxyRb.setSelected(true); final ButtonGroup proxyTypeGroup = new ButtonGroup(); proxyTypeGroup.add(myHTTP); proxyTypeGroup.add(mySocks); myHTTP.setSelected(true); myProxyExceptions.setBorder(UIUtil.getTextFieldBorder()); final Boolean property = Boolean.getBoolean(JavaProxyProperty.USE_SYSTEM_PROXY); mySystemProxyDefined.setVisible(Boolean.TRUE.equals(property)); if (Boolean.TRUE.equals(property)) { mySystemProxyDefined.setIcon(Messages.getWarningIcon()); mySystemProxyDefined.setFont(mySystemProxyDefined.getFont().deriveFont(Font.BOLD)); mySystemProxyDefined.setUI(new MultiLineLabelUI()); } myProxyAuthCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { enableProxyAuthentication(myProxyAuthCheckBox.isSelected()); } }); final ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { enableProxy(myUseHTTPProxyRb.isSelected()); } }; myUseHTTPProxyRb.addActionListener(listener); myAutoDetectProxyRb.addActionListener(listener); myNoProxyRb.addActionListener(listener); myHttpConfigurable = httpConfigurable; myClearPasswordsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { myHttpConfigurable.clearGenericPasswords(); Messages.showMessageDialog(myMainPanel, "Proxy passwords were cleared.", "Auto-detected proxy", Messages.getInformationIcon()); } }); if (HttpConfigurable.getInstance() != null) { myCheckButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final String title = "Check Proxy Settings"; final String answer = Messages.showInputDialog(myMainPanel, "Warning: your settings will be saved.\n\nEnter any URL to check connection to:", title, Messages.getQuestionIcon(), "http://", null); if (!StringUtil.isEmptyOrSpaces(answer)) { apply(); final HttpConfigurable instance = HttpConfigurable.getInstance(); final AtomicReference<IOException> exc = new AtomicReference<IOException>(); myCheckButton.setEnabled(false); myCheckButton.setText("Check connection (in progress...)"); myConnectionCheckInProgress = true; final Application application = ApplicationManager.getApplication(); application.executeOnPooledThread(new Runnable() { @Override public void run() { HttpURLConnection connection = null; try { //already checked for null above //noinspection ConstantConditions connection = instance.openHttpConnection(answer); connection.setReadTimeout(3 * 1000); connection.setConnectTimeout(3 * 1000); connection.connect(); final int code = connection.getResponseCode(); if (HttpURLConnection.HTTP_OK != code) { exc.set(new IOException("Error code: " + code)); } } catch (IOException e1) { exc.set(e1); } finally { if (connection != null) { connection.disconnect(); } } //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override public void run() { myConnectionCheckInProgress = false; reset(); // since password might have been set Component parent = null; if (myMainPanel.isShowing()) { parent = myMainPanel; myCheckButton.setText("Check connection"); myCheckButton.setEnabled(canEnableConnectionCheck()); } else { final IdeFrame frame = IdeFocusManager.findInstance() .getLastFocusedFrame(); if (frame == null) { return; } parent = frame.getComponent(); } //noinspection ThrowableResultOfMethodCallIgnored final IOException exception = exc.get(); if (exception == null) { Messages.showMessageDialog(parent, "Connection successful", title, Messages.getInformationIcon()); } else { final String message = exception.getMessage(); if (instance.USE_HTTP_PROXY) { instance.LAST_ERROR = message; } Messages.showErrorDialog(parent, errorText(message)); } } }); } }); } } }); } else { myCheckButton.setVisible(false); } }
From source file:com.intellij.util.net.HttpProxySettingsUi.java
License:Apache License
public HttpProxySettingsUi(@NotNull final HttpConfigurable settings) { ButtonGroup group = new ButtonGroup(); group.add(myUseHTTPProxyRb);/*w ww . j a va2 s.c o m*/ group.add(myAutoDetectProxyRb); group.add(myNoProxyRb); myNoProxyRb.setSelected(true); ButtonGroup proxyTypeGroup = new ButtonGroup(); proxyTypeGroup.add(myHTTP); proxyTypeGroup.add(mySocks); myHTTP.setSelected(true); Boolean property = Boolean.getBoolean(JavaProxyProperty.USE_SYSTEM_PROXY); mySystemProxyDefined.setVisible(Boolean.TRUE.equals(property)); if (Boolean.TRUE.equals(property)) { mySystemProxyDefined.setIcon(Messages.getWarningIcon()); RelativeFont.BOLD.install(mySystemProxyDefined); } myProxyAuthCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(@NotNull ActionEvent e) { enableProxyAuthentication(myProxyAuthCheckBox.isSelected()); } }); myPacUrlCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(@NotNull ActionEvent e) { myPacUrlTextField.setEnabled(myPacUrlCheckBox.isSelected()); } }); ActionListener listener = new ActionListener() { @Override public void actionPerformed(@NotNull ActionEvent e) { enableProxy(myUseHTTPProxyRb.isSelected()); } }; myUseHTTPProxyRb.addActionListener(listener); myAutoDetectProxyRb.addActionListener(listener); myNoProxyRb.addActionListener(listener); myClearPasswordsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(@NotNull ActionEvent e) { settings.clearGenericPasswords(); //noinspection DialogTitleCapitalization Messages.showMessageDialog(myMainPanel, "Proxy passwords were cleared.", "Auto-detected Proxy", Messages.getInformationIcon()); } }); configureCheckButton(); }
From source file:com.intellij.util.net.HttpProxySettingsUi.java
License:Apache License
private void configureCheckButton() { if (HttpConfigurable.getInstance() == null) { myCheckButton.setVisible(false); return;/*from ww w . j a v a2 s.com*/ } myCheckButton.addActionListener(new ActionListener() { @Override public void actionPerformed(@NotNull ActionEvent e) { final String title = "Check Proxy Settings"; final String answer = Messages.showInputDialog(myMainPanel, "Warning: your settings will be saved.\n\nEnter any URL to check connection to:", title, Messages.getQuestionIcon(), "http://", null); if (StringUtil.isEmptyOrSpaces(answer)) { return; } final HttpConfigurable settings = HttpConfigurable.getInstance(); apply(settings); final AtomicReference<IOException> exceptionReference = new AtomicReference<IOException>(); myCheckButton.setEnabled(false); myCheckButton.setText("Check connection (in progress...)"); myConnectionCheckInProgress = true; ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { @Override public void run() { HttpURLConnection connection = null; try { //already checked for null above //noinspection ConstantConditions connection = settings.openHttpConnection(answer); connection.setReadTimeout(3 * 1000); connection.setConnectTimeout(3 * 1000); connection.connect(); final int code = connection.getResponseCode(); if (HttpURLConnection.HTTP_OK != code) { exceptionReference.set(new IOException("Error code: " + code)); } } catch (IOException e) { exceptionReference.set(e); } finally { if (connection != null) { connection.disconnect(); } } //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { @Override public void run() { myConnectionCheckInProgress = false; reset(settings); // since password might have been set Component parent; if (myMainPanel.isShowing()) { parent = myMainPanel; myCheckButton.setText("Check connection"); myCheckButton.setEnabled(canEnableConnectionCheck()); } else { IdeFrame frame = IdeFocusManager.findInstance().getLastFocusedFrame(); if (frame == null) { return; } parent = frame.getComponent(); } //noinspection ThrowableResultOfMethodCallIgnored final IOException exception = exceptionReference.get(); if (exception == null) { Messages.showMessageDialog(parent, "Connection successful", title, Messages.getInformationIcon()); } else { final String message = exception.getMessage(); if (settings.USE_HTTP_PROXY) { settings.LAST_ERROR = message; } Messages.showErrorDialog(parent, errorText(message)); } } }); } }); } }); }
From source file:com.mediaworx.intellij.opencmsplugin.sync.OpenCmsSyncer.java
License:Open Source License
/** * Analyzes the given file list using the {@link SyncFileAnalyzer} and triggers the sync to/from OpenCms using * the {@link SyncJob}//from ww w . j a v a2 s. c o m * @param syncFiles list of local files (and folders) that are used as starting point for the sync */ public void syncFiles(List<File> syncFiles) { SyncFileAnalyzer analyzer; try { analyzer = new SyncFileAnalyzer(plugin, syncFiles, pullMetaDataOnly); } catch (CmsConnectionException e) { Messages.showDialog(e.getMessage(), "Error", new String[] { "Ok" }, 0, Messages.getErrorIcon()); return; } ProgressManager.getInstance().runProcessWithProgressSynchronously(analyzer, "Analyzing local and VFS syncFiles and folders ...", true, plugin.getProject()); if (!analyzer.isExecuteSync()) { return; } int numSyncEntities = analyzer.getSyncList().size(); boolean proceed = numSyncEntities > 0; LOG.info("proceed? " + proceed); StringBuilder message = new StringBuilder(); if (analyzer.hasWarnings()) { message.append("Infos/Warnings during file analysis:\n").append(analyzer.getWarnings().append("\n")); } if (proceed) { SyncJob syncJob = new SyncJob(plugin, analyzer.getSyncList()); if (showConfirmDialog && !pullMetaDataOnly && ((numSyncEntities == 1 && message.length() > 0) || numSyncEntities > 1)) { assembleConfirmMessage(message, syncJob.getSyncList()); int dlgStatus = Messages.showOkCancelDialog(plugin.getProject(), message.toString(), "Start OpenCms VFS Sync?", Messages.getQuestionIcon()); proceed = dlgStatus == 0; } if (proceed) { plugin.showConsole(); new Thread(syncJob).start(); } } else { message.append("Nothing to sync"); Messages.showMessageDialog(message.toString(), "OpenCms VFS Sync", Messages.getInformationIcon()); } }
From source file:com.perl5.lang.perl.idea.configuration.module.PerlModuleSdkConfigurable.java
License:Apache License
private void init() { myJdkPanel = new JPanel(new GridBagLayout()); myCbModuleJdk = new JdkComboBox(myJdksModel, new Condition<SdkTypeId>() { @Override// w w w .ja v a 2 s .c o m public boolean value(SdkTypeId sdkTypeId) { return sdkTypeId == PerlSdkType.getInstance(); } }); myCbModuleJdk.insertItemAt(new JdkComboBox.ProjectJdkComboBoxItem(), 0); myCbModuleJdk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (myFreeze) { return; } final Sdk newJdk = myCbModuleJdk.getSelectedJdk(); setSdk(newJdk); clearCaches(); } }); myJdkPanel.add(new JLabel(ProjectBundle.message("module.libraries.target.jdk.module.radio")), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(12, 6, 12, 0), 0, 0)); myJdkPanel.add(myCbModuleJdk, new GridBagConstraints(1, 0, 1, 1, 0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(6, 6, 12, 0), 0, 0)); final Project project = getRootModel().getModule().getProject(); final JButton setUpButton = new JButton(ApplicationBundle.message("button.new")); myCbModuleJdk.setSetupButton(setUpButton, project, myJdksModel, new JdkComboBox.ProjectJdkComboBoxItem(), new Condition<Sdk>() { @Override public boolean value(Sdk jdk) { final Sdk projectJdk = myJdksModel.getProjectSdk(); if (projectJdk == null) { final int res = Messages.showYesNoDialog(myJdkPanel, ProjectBundle.message("project.roots.no.jdk.on.project.message"), ProjectBundle.message("project.roots.no.jdk.on.project.title"), Messages.getInformationIcon()); if (res == Messages.YES) { myJdksModel.setProjectSdk(jdk); return true; } } return false; } }, true); myJdkPanel.add(setUpButton, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 7, 0), 0, 0)); final JButton editButton = new JButton(ApplicationBundle.message("button.edit")); myCbModuleJdk.setEditButton(editButton, getRootModel().getModule().getProject(), new Computable<Sdk>() { @Override @Nullable public Sdk compute() { return getRootModel().getSdk(); } }); myJdkPanel.add(editButton, new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 7, 0), 0, 0)); }
From source file:com.perl5.lang.perl.idea.configuration.paths.PerlModuleSdkConfigurable.java
License:Apache License
private void init() { myJdkPanel = new JPanel(new GridBagLayout()); myCbModuleJdk = new JdkComboBox(myJdksModel, new Condition<SdkTypeId>() { @Override/*from ww w.j a v a2 s. c o m*/ public boolean value(SdkTypeId sdkTypeId) { return sdkTypeId == PerlSdkType.getInstance(); } }); myCbModuleJdk.insertItemAt(new JdkComboBox.ProjectJdkComboBoxItem(), 0); myCbModuleJdk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (myFreeze) return; final Sdk newJdk = myCbModuleJdk.getSelectedJdk(); setSdk(newJdk); clearCaches(); } }); myJdkPanel.add(new JLabel(ProjectBundle.message("module.libraries.target.jdk.module.radio")), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(12, 6, 12, 0), 0, 0)); myJdkPanel.add(myCbModuleJdk, new GridBagConstraints(1, 0, 1, 1, 0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(6, 6, 12, 0), 0, 0)); final Project project = getRootModel().getModule().getProject(); final JButton setUpButton = new JButton(ApplicationBundle.message("button.new")); myCbModuleJdk.setSetupButton(setUpButton, project, myJdksModel, new JdkComboBox.ProjectJdkComboBoxItem(), new Condition<Sdk>() { @Override public boolean value(Sdk jdk) { final Sdk projectJdk = myJdksModel.getProjectSdk(); if (projectJdk == null) { final int res = Messages.showYesNoDialog(myJdkPanel, ProjectBundle.message("project.roots.no.jdk.on.project.message"), ProjectBundle.message("project.roots.no.jdk.on.project.title"), Messages.getInformationIcon()); if (res == Messages.YES) { myJdksModel.setProjectSdk(jdk); return true; } } return false; } }, true); myJdkPanel.add(setUpButton, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 7, 0), 0, 0)); final JButton editButton = new JButton(ApplicationBundle.message("button.edit")); myCbModuleJdk.setEditButton(editButton, getRootModel().getModule().getProject(), new Computable<Sdk>() { @Override @Nullable public Sdk compute() { return getRootModel().getSdk(); } }); myJdkPanel.add(editButton, new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 4, 7, 0), 0, 0)); }
From source file:com.photon.ui.Json2JavaDialog.java
private void okButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed doClose(RET_OK);//from ww w. j a va 2 s . c o m Messages.showMessageDialog(mProject, "JSON to Java conversion successful.\nOut put path : ", "Alert", Messages.getInformationIcon()); }
From source file:com.photon.ui.Plist2JsonDialog.java
private void okButtonActionPerformed(ActionEvent evt) { PlistToJsonConverter lConvertor = new PlistToJsonConverter(); String lSourceFile = jFileChooser1.getSelectedFile().getAbsolutePath(); String lDesFile = lSourceFile.substring(0, lSourceFile.lastIndexOf(".")); lDesFile = lDesFile.concat(".json"); lConvertor.convert(lSourceFile, lDesFile); doClose(RET_OK);// w w w . ja v a2 s . c om Messages.showMessageDialog(mProject, "Plist to JSON conversion successful.\nOut put path : " + lDesFile, "Alert", Messages.getInformationIcon()); }
From source file:com.theoryinpractice.testng.configuration.browser.GroupBrowser.java
License:Apache License
@Nullable @Override/* w w w . j ava 2s .co m*/ protected String showDialog() { TestClassFilter filter; Module module = editor.getModuleSelector().getModule(); if (module == null) { filter = new TestClassFilter(GlobalSearchScope.projectScope(getProject()), getProject(), false); } else { filter = new TestClassFilter(GlobalSearchScope.moduleScope(module), getProject(), false); } PsiClass[] classes = TestNGUtil.getAllTestClasses(filter, true); if (classes == null || classes.length == 0) { Messages.showMessageDialog(getField(), "No tests found in project", "Cannot Browse Groups", Messages.getInformationIcon()); return null; } else { return GroupList.showDialog(classes, getField()); } }