List of usage examples for com.intellij.openapi.ui Messages showInfoMessage
public static void showInfoMessage(@Nullable Project project, @Nls String message, @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title)
From source file:com.microsoft.alm.plugin.idea.tfvc.ui.settings.ProjectConfigurableForm.java
License:Open Source License
public ProjectConfigurableForm(final Project project) { myProject = project;// w w w .jav a2s . c o m // TODO: set these visible once we start using them myResetPasswordsButton.setVisible(false); myUseIdeaHttpProxyCheckBox.setVisible(false); myTFSCheckBox.setVisible(false); myStatefulCheckBox.setVisible(false); myReportNotInstalledPoliciesCheckBox.setVisible(false); myResetPasswordsButton.setVisible(false); serverLabel.setVisible(false); passwordLabel.setVisible(false); checkinPolicyLabel.setVisible(false); noteLabel.setVisible(false); pathLabel.setText(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_SETTINGS_DESCRIPTION)); tfExeField.addBrowseFolderListener(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_SETTINGS_TITLE), TfPluginBundle.message(TfPluginBundle.KEY_TFVC_SETTINGS_DESCRIPTION), project, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()); testExeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { PluginServiceProvider.getInstance().getPropertyService().setProperty(PropertyService.PROP_TF_HOME, getCurrentExecutablePath()); try { TfTool.checkVersion(); Messages.showInfoMessage(myContentPane, TfPluginBundle.message(TfPluginBundle.KEY_TFVC_SETTINGS_FOUND_EXE), TfPluginBundle.message(TfPluginBundle.KEY_TFVC_TF_VERSION_WARNING_TITLE)); } catch (ToolVersionException e) { Messages.showWarningDialog(myContentPane, LocalizationServiceImpl.getInstance().getExceptionMessage(e), TfPluginBundle.message(TfPluginBundle.KEY_TFVC_TF_VERSION_WARNING_TITLE)); } catch (ToolException e) { Messages.showErrorDialog(myContentPane, LocalizationServiceImpl.getInstance().getExceptionMessage(e), TfPluginBundle.message(TfPluginBundle.KEY_TFVC_TF_VERSION_WARNING_TITLE)); } } }); // load settings load(); // TODO: comment back in when ready to use // myManageButton.addActionListener(new ActionListener() { // public void actionPerformed(final ActionEvent e) { // ManageWorkspacesDialog d = new ManageWorkspacesDialog(myProject); // d.show(); // } // }); // // myUseIdeaHttpProxyCheckBox.setSelected(TFSConfigurationManager.getInstance().useIdeaHttpProxy()); // // myResetPasswordsButton.addActionListener(new ActionListener() { // public void actionPerformed(final ActionEvent e) { // final String title = "Reset Stored Passwords"; // if (Messages.showYesNoDialog(myProject, "Do you want to reset all stored passwords?", title, Messages.getQuestionIcon()) == Messages.YES) { // TFSConfigurationManager.getInstance().resetStoredPasswords(); // Messages.showInfoMessage(myProject, "Passwords reset successfully.", title); // } // } // }); // // ActionListener l = new ActionListener() { // public void actionPerformed(ActionEvent e) { // updateNonInstalledCheckbox(); // } // }; // myStatefulCheckBox.addActionListener(l); // myTFSCheckBox.addActionListener(l); }
From source file:com.ritesh.idea.plugin.state.SettingsPage.java
License:Apache License
private void testConnection() { final MutableObject connException = new MutableObject(); if (StringUtils.isEmpty(loginPanel.getUrl()) || StringUtils.isEmpty(loginPanel.getUsername()) || StringUtils.isEmpty(loginPanel.getPassword())) { Messages.showErrorDialog(project, "Connection information provided is invalid.", "Invalid Settings"); return;//from w w w . ja v a2s . c o m } TaskUtil.queueTask(project, PluginBundle.message(PluginBundle.CONNECTION_TEST_TITLE), true, new ThrowableFunction<ProgressIndicator, Void>() { @Override public Void throwableCall(ProgressIndicator params) throws Exception { try { params.setIndeterminate(true); ReviewDataProvider.getInstance(project).testConnection(loginPanel.getUrl(), loginPanel.getUsername(), loginPanel.getPassword()); // The task was not cancelled and is successful connException.setValue(Boolean.TRUE); } catch (InvalidConfigurationException a) { } catch (final Exception exception) { connException.setValue(exception); } return null; } }, null, null); if (connException.getValue() == Boolean.TRUE) { Messages.showInfoMessage(project, PluginBundle.message(PluginBundle.LOGIN_SUCCESS_MESSAGE), PluginBundle.message(PluginBundle.CONNECTION_STATUS_TITLE)); } else if (connException.getValue() instanceof Exception) { final ExceptionHandler.Message message = ExceptionHandler .getMessage((Exception) connException.getValue()); Messages.showErrorDialog(message.message, PluginBundle.message(PluginBundle.CONNECTION_STATUS_TITLE)); } }
From source file:com.twitter.intellij.pants.util.PantsUtil.java
License:Apache License
/** * Determine whether a project is trigger by Pants `idea-plugin` goal by * looking at the "pants_idea_plugin_version" property. *///from www . j a v a2 s . co m public static boolean isSeedPantsProject(@NotNull Project project) { class SeedPantsProjectKeys { private static final String PANTS_IDEA_PLUGIN_VERSION = "pants_idea_plugin_version"; } if (isPantsProject(project)) { return false; } String version = PropertiesComponent.getInstance(project) .getValue(SeedPantsProjectKeys.PANTS_IDEA_PLUGIN_VERSION); if (version == null) { return false; } if (versionCompare(version, PANTS_IDEA_PLUGIN_VERESION_MIN) < 0 || versionCompare(version, PANTS_IDEA_PLUGIN_VERESION_MAX) > 0) { Messages.showInfoMessage(project, PantsBundle.message("pants.idea.plugin.goal.version.unsupported"), "Version Error"); return false; } return true; }
From source file:com.urswolfer.intellij.plugin.gerrit.ui.diff.CustomizableFrameDiffTool.java
License:Apache License
private static boolean askForceOpenDiff(DiffRequest data) { byte[] bytes1; byte[] bytes2; try {/*from w w w. j a va2 s. c o m*/ bytes1 = data.getContents()[0].getBytes(); bytes2 = data.getContents()[1].getBytes(); } catch (IOException e) { MessagesEx.error(data.getProject(), e.getMessage()).showNow(); return false; } String message = Arrays.equals(bytes1, bytes2) ? DiffBundle.message("diff.contents.are.identical.message.text") : DiffBundle.message("diff.contents.have.differences.only.in.line.separators.message.text"); Messages.showInfoMessage(data.getProject(), message, DiffBundle.message("no.differences.dialog.title")); return false; }
From source file:com.urswolfer.intellij.plugin.gerrit.ui.SettingsPanel.java
License:Apache License
public SettingsPanel() { gerritLoginInfoTextField.setText(LoginPanel.LOGIN_CREDENTIALS_INFO); gerritLoginInfoTextField.setBackground(pane.getBackground()); testButton.addActionListener(new ActionListener() { @Override//from w w w . j a va 2 s . com public void actionPerformed(ActionEvent e) { String password = isPasswordModified() ? getPassword() : gerritSettings.getPassword(); try { GerritAuthData.Basic gerritAuthData = new GerritAuthData.Basic(getHost(), getLogin(), password); if (gerritUtil.checkCredentials(ProjectManager.getInstance().getDefaultProject(), gerritAuthData)) { Messages.showInfoMessage(pane, "Connection successful", "Success"); } else { Messages.showErrorDialog(pane, "Can't login to " + getHost() + " using given credentials", "Login Failure"); } } catch (Exception ex) { log.info(ex); Messages.showErrorDialog(pane, String.format("Can't login to %s: %s", getHost(), gerritUtil.getErrorTextFromException(ex)), "Login Failure"); } setPassword(password); } }); hostTextField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { String text = hostTextField.getText(); if (text.endsWith("/")) { hostTextField.setText(text.substring(0, text.length() - 1)); } } }); passwordField.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { passwordModified = true; } @Override public void removeUpdate(DocumentEvent e) { passwordModified = true; } @Override public void changedUpdate(DocumentEvent e) { passwordModified = true; } }); automaticRefreshCheckbox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { updateAutomaticRefresh(); } }); }
From source file:de.bewalt.intellij.plugin.psl.UpdateModulesFromPsfAction.java
License:Apache License
/** * Implement this method to provide your action handler. * * @param event Carries information on the invocation place *//* w w w . j ava2 s .c o m*/ @Override public void actionPerformed(AnActionEvent event) { boolean isAModuleCheckedOut = false; CompositeOperation operation = new CompositeOperation(); XmlFile xmlFile = (XmlFile) LangDataKeys.PSI_FILE.getData(event.getDataContext()); Project project = event.getProject(); if (project == null || xmlFile == null) { // this should not happen return; } XmlDocument document = xmlFile.getDocument(); if (document == null) { Messages.showErrorDialog(project, "Invalid project set file", "Can't Update Modules"); return; } XmlTag rootTag = document.getRootTag(); if (rootTag == null) { Messages.showErrorDialog(project, "Invalid project set file", "Can't Update Modules"); return; } for (XmlTag xmlTag : rootTag.getSubTags()) { if (xmlTag.getLocalName().equals("provider")) { String idAttributeValue = xmlTag.getAttributeValue("id", null); if (idAttributeValue != null && !idAttributeValue.equals("org.eclipse.team.cvs.core.cvsnature")) { Messages.showErrorDialog(project, "Unsupported provider in project set file", "Can't Update Modules"); return; } else { for (XmlTag projectTag : xmlTag.getSubTags()) { if (projectTag.getLocalName().equals("project")) { String projectReference = projectTag.getAttributeValue("reference", null); ProjectReference reference = new ProjectReference(projectReference); UpdateSettings settings = createSettings(reference); Module module = getModule(project, reference); if (module != null) { ModuleRootManager rootManager = ModuleRootManager.getInstance(module); VirtualFile[] roots = rootManager.getContentRoots(); FilePath[] files = new FilePath[roots.length]; for (int i = 0; i < roots.length; i++) { VirtualFile root = roots[i]; files[i] = FilePathImpl.create(root); } operation.addOperation(new UpdateOperation(files, settings, project)); } else { if (reference.connection.indexOf('@') < 0) { Messages.showErrorDialog(project, "For initial check out of modules you need to define a user in the project set file CVS root configurations", "Can't check out module " + reference.remoteModuleName); } else { VirtualFile baseDir = project.getBaseDir(); final CvsApplicationLevelConfiguration config = CvsApplicationLevelConfiguration .getInstance(); final KeywordSubstitutionWrapper substitution = KeywordSubstitutionWrapper .getValue(config.CHECKOUT_KEYWORD_SUBSTITUTION); CvsRootConfiguration environment = config .getConfigurationForCvsRoot(reference.connection); CheckoutProjectOperation checkoutProjectOperation = new CheckoutProjectOperation( new String[] { reference.remoteModuleName }, new ModifiedCvsEnvironmentProxy(environment, new SimpleRevision(reference.stickyTag)), false, new File(baseDir.getCanonicalPath()), reference.localModuleName, true, substitution == null ? null : substitution.getSubstitution()); operation.addOperation(checkoutProjectOperation); isAModuleCheckedOut = true; } } } } } } } try { CvsVcs2.executeOperation("Update from project set file", operation, project); if (isAModuleCheckedOut) { Messages.showInfoMessage(project, "Please run import module action to recognize the newly checked out modules.", "New Modules Were Checked Out"); } } catch (VcsException e) { Messages.showErrorDialog(project, "Error while updating: " + e.getMessage(), "Update Error"); } }
From source file:git4idea.actions.GitCurrentBranch.java
License:Apache License
@Override protected void perform(@NotNull Project project, GitVcs vcs, @NotNull List<VcsException> exceptions, @NotNull VirtualFile[] files) throws VcsException { GitCommand cmd = new GitCommand(project, vcs.getSettings(), GitUtil.getVcsRoot(project, files[0])); Messages.showInfoMessage(project, "Checked out branch: " + cmd.currentBranch(), "Current Branch"); }
From source file:git4idea.GitVcsPanel.java
License:Apache License
private void testConnection() { final GitVcsSettings settings = new GitVcsSettings(); settings.GIT_EXECUTABLE = gitField.getText(); final VirtualFile baseDir = project.getBaseDir(); assert baseDir != null; final GitCommand command = new GitCommand(project, settings, baseDir); final String s; try {/*from w w w. ja v a2 s .c o m*/ s = command.version(); } catch (VcsException e) { Messages.showErrorDialog(project, e.getMessage(), "Error Running git"); return; } Messages.showInfoMessage(project, s, "Git Executed Successfully"); }
From source file:intellijeval.git.GitCloneDialog.java
License:Apache License
private void test() { myTestURL = getCurrentUrlText();//from ww w . j a v a 2 s .c om boolean testResult = test(myTestURL); if (testResult) { Messages.showInfoMessage(myTestButton, GitBundle.message("clone.test.success.message", myTestURL), GitBundle.getString("clone.test.connection.title")); myTestResult = Boolean.TRUE; } else { myTestResult = Boolean.FALSE; } updateButtons(); }
From source file:limitedwip.ui.QuickCommitAction.java
License:Apache License
@Override public void actionPerformed(@NotNull final AnActionEvent event) { final Project project = getEventProject(event); if (project == null) return;/* w ww. j ava2 s .co m*/ if (anySystemCheckinHandlerCancelsCommit(project)) return; Runnable runnable = new Runnable() { @Override public void run() { RefreshAction.doRefresh(project); String lastCommitMessage = VcsConfiguration.getInstance(project).LAST_COMMIT_MESSAGE; String commitMessage = nextCommitMessage(lastCommitMessage); LocalChangeList defaultChangeList = ChangeListManager.getInstance(project).getDefaultChangeList(); if (defaultChangeList.getChanges().isEmpty()) { Messages.showInfoMessage(project, VcsBundle.message("commit.dialog.no.changes.detected.text"), VcsBundle.message("commit.dialog.no.changes.detected.title")); return; } ArrayList<CheckinHandler> noCheckinHandlers = new ArrayList<CheckinHandler>(); CommitHelper commitHelper = new CommitHelper(project, defaultChangeList, new ArrayList<Change>(defaultChangeList.getChanges()), "", commitMessage, noCheckinHandlers, true, true, FunctionUtil.nullConstant(), new CommitResultHandler() { @Override public void onSuccess(@NotNull String commitMessage) { } @Override public void onFailure() { } }); boolean committed = commitHelper.doCommit(); if (committed) { VcsConfiguration.getInstance(project).saveCommitMessage(commitMessage); LimitedWIPProjectComponent projectComponent = project .getComponent(LimitedWIPProjectComponent.class); projectComponent.onQuickCommit(); } } }; ChangeListManager.getInstance(project).invokeAfterUpdate(runnable, InvokeAfterUpdateMode.SYNCHRONOUS_CANCELLABLE, "Refreshing changelists...", ModalityState.current()); }