List of usage examples for com.intellij.openapi.ui Messages getInformationIcon
@NotNull public static Icon getInformationIcon()
From source file:org.sonarlint.intellij.config.global.SonarQubeServerEditor.java
License:Open Source License
private void testConnection() { SonarQubeServer tmpServer = new SonarQubeServer(); setServer(tmpServer);/*from w w w . j a v a2s . co m*/ ConnectionTestTask test = new ConnectionTestTask(tmpServer); ProgressManager.getInstance().run(test); ValidationResult r = test.result(); if (test.getException() != null) { String msg = "Error testing connection"; if (test.getException().getMessage() != null) { msg = msg + ": " + test.getException().getMessage(); } Messages.showErrorDialog(testButton, msg, "Error"); } else if (r.success()) { Messages.showMessageDialog(testButton, r.message(), "Connection", Messages.getInformationIcon()); } else { Messages.showErrorDialog(testButton, r.message(), "Connection failed"); } }
From source file:org.stepik.plugin.collective.ui.StepikSettingsPanel.java
License:Apache License
public StepikSettingsPanel() { initProjectOfSettings();//from www .j a v a 2s .c o m // myEmailTextField.setText(StudyTaskManager.getInstance(settingsProject).getUser().getEmail()); mySignupTextField.addHyperlinkListener(new HyperlinkAdapter() { @Override protected void hyperlinkActivated(final HyperlinkEvent e) { BrowserUtil.browse(e.getURL()); } }); magicButton.setText("Magic auth"); mySignupTextField .setText("<html>Do not have an account at stepik.org? <a href=\"https://stepik.org/registration\">" + "Sign up" + "</a></html>"); mySignupTextField.setBackground(myPane.getBackground()); mySignupTextField.setCursor(new Cursor(Cursor.HAND_CURSOR)); myAuthTypeLabel.setBorder(JBUI.Borders.emptyLeft(10)); myAuthTypeComboBox.addItem(AUTH_PASSWORD); // TODO later // myAuthTypeComboBox.addItem(AUTH_TOKEN); // final Project project = ProjectManager.getInstance().getDefaultProject(); myTestButton.addActionListener(e -> { StudyTaskManager manager = StudyTaskManager.getInstance(settingsProject); StepikUser oldUser = manager.getUser(); StepikUser testUser = new StepikUser(getEmail(), getPassword()); manager.setUser(testUser); if (StepikConnectorLogin.loginFromSettings(settingsProject, testUser)) { String message = "Hello, " + manager.getUser().getName() + "!\n I am glad to see you."; Messages.showMessageDialog(message, "Check credentials", Messages.getInformationIcon()); } else { Messages.showWarningDialog("Can't sign in.", "Check credentials"); } manager.setUser(oldUser); }); myPasswordField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { myCredentialsModified = true; } }); DocumentListener passwordEraser = new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { if (!myCredentialsModified) { erasePassword(); } } }; myEmailTextField.getDocument().addDocumentListener(passwordEraser); myPasswordField.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { if (!myCredentialsModified && !getPassword().isEmpty()) { erasePassword(); } } @Override public void focusLost(FocusEvent e) { } }); myAuthTypeComboBox.addItemListener(e -> { if (e.getStateChange() == ItemEvent.SELECTED) { String item = e.getItem().toString(); if (AUTH_PASSWORD.equals(item)) { ((CardLayout) myCardPanel.getLayout()).show(myCardPanel, AUTH_PASSWORD); } else if (AUTH_TOKEN.equals(item)) { ((CardLayout) myCardPanel.getLayout()).show(myCardPanel, AUTH_TOKEN); } erasePassword(); } }); }
From source file:org.trzcinka.intellitrac.view.configuration.ConfigurationForm.java
License:Apache License
public ConfigurationForm() { testConnectionButton.addActionListener(new ActionListener() { /**//ww w . j av a 2 s. c o m * Invoked when an action occurs. */ public void actionPerformed(ActionEvent e) { Container parent = ((Component) e.getSource()).getParent(); Cursor oldCursor = parent.getCursor(); parent.setCursor(MouseCursors.WAIT_CURSOR); ResourceBundle bundle = BundleLocator.getBundle(); TracGateway gateway = TracGatewayLocator.retrieveTracGateway(); try { ConnectionSettings settings = new ConnectionSettings(); settings.setLogin(login.getText()); settings.setPassword(password.getText()); settings.setTracUrl(tracUrl.getText()); gateway.testConnection(settings); Messages.showMessageDialog( bundle.getString("configuration.connection.dialogs.connection_success"), bundle.getString("dialogs.success"), Messages.getInformationIcon()); } catch (ConnectionFailedException exception) { Messages.showMessageDialog( bundle.getString("configuration.connection.dialogs.connection_failed"), bundle.getString("dialogs.error"), Messages.getErrorIcon()); } catch (MalformedURLException e1) { Messages.showMessageDialog(bundle.getString("configuration.connection.dialogs.malformed_url"), bundle.getString("dialogs.error"), Messages.getErrorIcon()); } finally { parent.setCursor(oldCursor); } } }); ticketTemplatesList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { ListSelectionModel model = (ListSelectionModel) e.getSource(); if (model.isSelectionEmpty()) { ticketTemplateNameTextField.setEnabled(false); ticketTemplateContentEditorPane.setEnabled(false); ticketTemplateNameTextField.setText(null); ticketTemplateContentEditorPane.setText(null); removeButton.setEnabled(false); } else { Template selected = (Template) ticketTemplatesList.getSelectedValue(); ticketTemplateNameTextField.setEnabled(true); ticketTemplateContentEditorPane.setEnabled(true); ticketTemplateNameTextField.setText(selected.getName()); ticketTemplateContentEditorPane.setText(selected.getContent()); removeButton.setEnabled(true); } } }); ticketTemplateNameTextField.getDocument().addDocumentListener(new DocumentAdapter() { protected void textChanged(DocumentEvent e) { Template selected = (Template) ticketTemplatesList.getSelectedValue(); if (selected != null) { selected.setName(ticketTemplateNameTextField.getText()); } } }); ticketTemplateContentEditorPane.getDocument().addDocumentListener(new DocumentAdapter() { protected void textChanged(DocumentEvent e) { Template selected = (Template) ticketTemplatesList.getSelectedValue(); if (selected != null) { selected.setContent(ticketTemplateContentEditorPane.getText()); } } }); newButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Template template = new Template(); template.setName( BundleLocator.getBundle().getString("configuration.ticket_templates.new_template_name")); ticketTemplatesListModel.add(template); } }); removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ticketTemplatesListModel.remove(ticketTemplatesList.getSelectedIndex()); } }); rootComponent.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (defaultValuesPanel == rootComponent.getSelectedComponent()) { ConnectionSettings connectionSettings = new ConnectionSettings(); connectionSettings.setLogin(login.getText()); connectionSettings.setPassword(password.getText()); connectionSettings.setTracUrl(tracUrl.getText()); try { gateway.setConfiguration(connectionSettings); fillComboBox(componentComboBoxModel, gateway.retrieveComponents(), componentComboBox.getSelectedItem(), false); fillComboBox(priorityComboBoxModel, gateway.retrievePriorities(), priorityComboBox.getSelectedItem(), false); fillComboBox(typeComboBoxModel, gateway.retrieveTypes(), typeComboBox.getSelectedItem(), false); fillComboBox(milestoneComboBoxModel, gateway.retrieveMilestones(), milestoneComboBox.getSelectedItem(), false); fillComboBox(versionComboBoxModel, gateway.retrieveVersions(), versionComboBox.getSelectedItem(), false); } catch (Exception e1) { if (logger.isDebugEnabled()) { logger.debug(e1); } } } } }); }
From source file:org.wso2.wsf.idea.ws.plugin.WSASApplicationComponent.java
License:Apache License
public void showInstallationPath() { Messages.showMessageDialog(WSASConfigurationBean.getWsasInstallationPath(), "WSAS Installation Path", Messages.getInformationIcon()); }
From source file:org.wso2.wsf.idea.ws.util.PopupMessageUtil.java
License:Apache License
public static void popupInformationMessageBox(String infoMessage) { Messages.showMessageDialog(infoMessage, WSASMessageConstant.WARNING_WSAS_HEADING, Messages.getInformationIcon()); }
From source file:ru.salerman.bitrixstorm.config.MarkDirectoryAsBitrixSiteTemplate.java
License:Apache License
public void actionPerformed(AnActionEvent e) { DataContext dataContext = e.getDataContext(); PsiElement path = LangDataKeys.PSI_ELEMENT.getData(dataContext); String siteTemplate = BitrixSiteTemplate.getInstance(e.getProject()).getSiteTemplate(path); BitrixSiteTemplate.getInstance(e.getProject()).setName(siteTemplate); BitrixComponentManager.getInstance(e.getProject()).refresh(); Messages.showMessageDialog("\"" + siteTemplate + "\" was marked as Bitrix Site Template ", "Information", Messages.getInformationIcon()); }
From source file:ui.GoogleAlertDialog.java
License:Apache License
@Nullable @Override//from ww w . j av a 2 s.c o m protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout(15, 0)); // icon JLabel iconLabel = new JLabel(Messages.getInformationIcon()); Container container = new Container(); container.setLayout(new BorderLayout()); container.add(iconLabel, BorderLayout.NORTH); panel.add(container, BorderLayout.WEST); if (mMessage != null) { final JTextPane messageComponent = MultiSelectDialog.createMessageComponent(mMessage); final Dimension screenSize = messageComponent.getToolkit().getScreenSize(); final Dimension textSize = messageComponent.getPreferredSize(); if (mMessage.length() > 100) { final JScrollPane pane = ScrollPaneFactory.createScrollPane(messageComponent); pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); final int scrollSize = (int) new JScrollBar(Adjustable.VERTICAL).getPreferredSize().getWidth(); final Dimension preferredSize = new Dimension( Math.min(textSize.width, screenSize.width / 2) + scrollSize, Math.min(textSize.height, screenSize.height / 3) + scrollSize); pane.setPreferredSize(preferredSize); panel.add(pane, BorderLayout.CENTER); } else { panel.add(messageComponent, BorderLayout.CENTER); } } return panel; }
From source file:view.PluginViewFactory.java
License:Apache License
private void viewComponentInit() { TableCellEditor editor = new DefaultCellEditor(mPropNameComboBox); mPropTable.setRowHeight(30);/*from w ww. jav a2s. c o m*/ mPropTable.setModel(new PropertyTableModel()); mPropTable.setAutoscrolls(true); mPropTable.getColumnModel().getColumn(COLUMN_PROPERTY_NAME).setCellEditor(editor); mPropTable.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent tableModelEvent) { if (mIsUpdateDone == false) return; int row = tableModelEvent.getFirstRow(); int col = tableModelEvent.getColumn(); String name = mPropTable.getValueAt(row, COLUMN_PROPERTY_NAME).toString(); if (col == COLUMN_PROPERTY_NAME) { cellChangeToCurrentValueAtRow(row); } else if (col == COLUMN_PROPERTY_VALUE) { Property property = mDeviceManager.getProperty(name); Object valueObject = mPropTable.getValueAt(row, COLUMN_PROPERTY_VALUE); if (valueObject == null) { return; } else if ("".equals(name)) { mPropTable.setValueAt(null, row, COLUMN_PROPERTY_VALUE); return; } String value = valueObject.toString(); if (property != null) { if (!value.equals(mDeviceManager.getProperty(name))) { try { mDeviceManager.setPropertyValue(name, value); saveTable(); } catch (NullValueException e) { cellChangeToCurrentValueAtRow(row); e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } } else if (value != null) { mDeviceManager.putProperty(name, new Property(name, value)); } } else { System.out.println("Error : Col Number Over"); } } }); mDeviceListComboBox.setPrototypeDisplayValue("XXXXXXXXXXXXX"); mDeviceListComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent itemEvent) { if (ItemEvent.SELECTED == itemEvent.getStateChange()) { SelectedDeviceChanged(); } } }); mTableViewListComboBox.setPrototypeDisplayValue("XXXXXXXXXXXXX"); mTableViewListComboBox.setEditable(true); mTableViewListComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent itemEvent) { if (itemEvent.getStateChange() == ItemEvent.DESELECTED) return; String tableView = itemEvent.getItem().toString(); if (TABLE_VIEW_LIST_PROPERTY_NAME.equals(tableView)) { showMessage("Cannot use that table view name", "Error"); return; } updateTable(tableView); } }); mRefreshButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { mDeviceManager.updatePropFromDevice(); } }); final JFileChooser jFileChooser = new JFileChooser(); jFileChooser.setCurrentDirectory(new File(mProject.getBasePath())); jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); jFileChooser.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { File selectedFile = jFileChooser.getSelectedFile(); if (selectedFile == null) return; mIsChosenFileExist = selectedFile.exists(); mIsChosenFileWritable = selectedFile.getParentFile().canWrite(); } }); mSavePropFileButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (jFileChooser.showSaveDialog(mPluginViewContent) == JFileChooser.CANCEL_OPTION) return; if (!mIsChosenFileWritable) { showMessage("Please choose writable path.", "Android Property Manager"); return; } else if (mIsChosenFileExist) { if (Messages.showOkCancelDialog("Overwrite file?", "Android Property Manager", Messages.getInformationIcon()) != Messages.OK) { return; } } String[] values = mPropertiesComponent .getValues(mTableViewListComboBox.getSelectedItem().toString()); ArrayList<String> propertyNames; if (ALL_TABLE_VIEW_PROPERTY_NAME == mTableViewListComboBox.getSelectedItem().toString()) { propertyNames = mDeviceManager.getPropertyNames(); } else { propertyNames = new ArrayList<>(Arrays.asList(values)); } mDeviceManager.savePropFile(jFileChooser.getSelectedFile().getPath(), propertyNames); } }); mLoadPropFileButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (jFileChooser.showDialog(mPluginViewContent, "Choose") == JFileChooser.CANCEL_OPTION) return; if (mIsChosenFileExist) { mDeviceManager.loadPropFile(jFileChooser.getSelectedFile().getPath()); mDeviceManager.updatePropFromDevice(); } else { showMessage("Please select exist file.", "Android Property Manager"); } } }); mPushPropFileButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (jFileChooser.showDialog(mPluginViewContent, "Choose") == JFileChooser.CANCEL_OPTION) return; if (mIsChosenFileExist) { String oldPropDirPath = mProject.getBasePath(); mDeviceManager.pushPropFile(jFileChooser.getSelectedFile().getPath(), oldPropDirPath); PluginViewFactory.getInstance() .setHint("Property file is saved at system/build.prop of device file system"); } else { showMessage("Please select exist file.", "Android Property Manager"); } } }); mRestartRuntimeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { try { PluginViewFactory.getInstance().setHint("Device is restarting runtime..."); mDeviceManager.restartRuntime(); } catch (TimeoutException e) { e.printStackTrace(); } catch (AdbCommandRejectedException e) { e.printStackTrace(); } catch (ShellCommandUnresponsiveException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }); mRebootDeviceButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { try { PluginViewFactory.getInstance().setHint("Device is rebooting..., so now it is offline state"); mDeviceManager.rebootDevice(); } catch (TimeoutException e) { e.printStackTrace(); } catch (AdbCommandRejectedException e) { e.printStackTrace(); } catch (ShellCommandUnresponsiveException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }); }
From source file:view.PluginViewFactory.java
License:Apache License
public void showMessage(String message, String type) { Messages.showMessageDialog(mProject, message, type, Messages.getInformationIcon()); }