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:org.moe.idea.sdk.MOESdkType.java
License:Apache License
public static Sdk getMOESdk(Module module) { if (module == null) { return null; }/*w w w .j a v a2s .c o m*/ String modulePath = ModuleUtils.getModulePath(module); if (modulePath == null) { return null; } final Properties properties = ProjectUtil.retrievePropertiesFromGradle(new File(modulePath), ProjectUtil.SDK_PROPERTIES_TASK); String moeRootPath = properties.getProperty(ProjectUtil.SDK_PATH_KEY); if (moeRootPath == null) { return null; } String name = new File(moeRootPath).getName(); ProjectJdkTable jdkTable = ProjectJdkTable.getInstance(); for (Sdk sdk : jdkTable.getAllJdks()) { if (sdk != null && sdk.getHomePath() != null && sdk.getHomePath().equals(moeRootPath)) { return sdk; } } Sdk jdk = getJDK(); if (jdk == null) { jdk = findValidJdk(); } if (jdk == null) { Messages.showMessageDialog(MOEText.get("JDK.Not.Found"), "Error", MOEIcons.MOELogo); return null; } MOESdkType sdkType = new MOESdkType(name, moeRootPath); final Sdk sdk = ProjectJdkTable.getInstance().createSdk(sdkType.suggestSdkName(null, null), sdkType); sdkType.setupSdkRoots(sdk, jdk); ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { ProjectJdkTable.getInstance().addJdk(sdk); } }); return sdk; }
From source file:org.stepik.plugin.collective.ui.StepikSettingsPanel.java
License:Apache License
public StepikSettingsPanel() { initProjectOfSettings();// w w w . j ava 2 s. 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.gateway.TracGatewayLocator.java
License:Apache License
public static void handleConnectionProblem() { if (SwingUtilities.isEventDispatchThread()) { Messages.showMessageDialog(bundle.getString("configuration.connection.dialogs.connection_failed"), bundle.getString("dialogs.error"), Messages.getErrorIcon()); }// w w w . j av a 2 s . c o m }
From source file:org.trzcinka.intellitrac.view.configuration.ConfigurationForm.java
License:Apache License
public ConfigurationForm() { testConnectionButton.addActionListener(new ActionListener() { /**/*from w w w . j a v a 2s.co 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.trzcinka.intellitrac.view.toolwindow.tickets.report_editor.ReportEditorForm.java
License:Apache License
public ReportEditorForm() { ticketsModel.getCurrentReportModel().addListener(this); okButton.addActionListener(new ActionListener() { /**// w ww .jav a 2 s . co m * Invoked when an action occurs. */ public void actionPerformed(ActionEvent e) { Report report = new Report(); getData(report); try { TracGatewayLocator.retrieveTracGateway().retrieveTickets(report.getProperQuery()); } catch (TracError er) { Messages.showMessageDialog(MessageFormat.format( bundle.getString("tool_window.tickets.report_editor.validation.custom.query"), er.getMessage()), bundle.getString("dialogs.error"), Messages.getErrorIcon()); return; } catch (ConnectionFailedException e1) { TracGatewayLocator.handleConnectionProblem(); return; } ticketsModel.getReportsListModel().saveReport(report); reportsListRedirect(); } }); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { reportsListRedirect(); } }); }
From source file:org.trzcinka.intellitrac.view.TracSyntaxEditor.java
License:Apache License
public TracSyntaxEditor() { editRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setEditMode();/*w w w .j a v a 2 s. c om*/ } }); previewRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setPreviewMode(); } }); editor.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (BrowserUtil.canStartDefaultBrowser()) { BrowserUtil.launchBrowser(e.getURL().toString()); } else { ResourceBundle bundle = BundleLocator.getBundle(); Messages.showMessageDialog(bundle.getString("dialogs.cannot_start_browser"), bundle.getString("dialogs.warning"), Messages.getWarningIcon()); } } } }); }
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 popupWarningMessageBox(String warningMessage) { Messages.showMessageDialog(warningMessage, WSASMessageConstant.WARNING_WSAS_HEADING, Messages.getWarningIcon());/* ww w . j a va 2 s. c om*/ }
From source file:org.wso2.wsf.idea.ws.util.PopupMessageUtil.java
License:Apache License
public static void popupErrorMessageBox(String errorMessage) { Messages.showMessageDialog(errorMessage, WSASMessageConstant.WARNING_WSAS_HEADING, Messages.getErrorIcon()); }
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()); }