List of usage examples for com.intellij.openapi.ui Messages getQuestionIcon
@NotNull public static Icon getQuestionIcon()
From source file:org.jetbrains.plugins.ruby.settings.GeneralSettingsTab.java
License:Apache License
@Override public void apply() throws ConfigurationException { final RApplicationSettings settings = RApplicationSettings.getInstance(); settings.useConsoleOutputOtherFilters = otherFiltersCheckBox.isSelected(); settings.useConsoleOutputRubyStacktraceFilter = rubyStacktraceFilterCheckBox.isSelected(); settings.useConsoleColorMode = colorModeCheckBox.isSelected(); settings.additionalEnvPATH = myTFAdditioanlPath.getText().trim(); final boolean isProjectViewStyleChanged = isProjectViewStyleChanged(); settings.useRubySpecificProjectView = useRubyProjectViewBox.isSelected(); if (isProjectViewStyleChanged) { final int result = Messages.showYesNoDialog(myContentPane.getParent(), RBundle.message("settings.plugin.general.tab.use.ruby.project.view.changed.message"), RBundle.message("settings.plugin.general.tab.use.ruby.project.view.changed.title"), Messages.getQuestionIcon()); if (result == DialogWrapper.OK_EXIT_CODE) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override/*ww w. ja v a2s . c o m*/ public void run() { // reload all projects for (Project project : ProjectManager.getInstance().getOpenProjects()) { ProjectManager.getInstance().reloadProject(project); } } }, ModalityState.NON_MODAL); } } }
From source file:org.jetbrains.tfsIntegration.core.tfs.operations.ApplyGetOperations.java
License:Apache License
private boolean canOverrideLocalConflictingItem(final GetOperation operation, boolean sourceNotTarget) throws TfsException { if (myDownloadMode == DownloadMode.FORCE || myDownloadMode == DownloadMode.MERGE) { return true; }//from w w w. j a va 2 s . c o m LocalConflictHandlingType conflictHandlingType = getLocalConflictHandlingType(); if (conflictHandlingType == LocalConflictHandlingType.ERROR) { throw new OperationFailedException( "Local conflict detected for " + VersionControlPath.localPathFromTfsRepresentation( sourceNotTarget ? operation.getSlocal() : operation.getTlocal())); } else if (conflictHandlingType == LocalConflictHandlingType.SHOW_MESSAGE) { String path = VersionControlPath.localPathFromTfsRepresentation( sourceNotTarget ? operation.getSlocal() : operation.getTlocal()); final String message = MessageFormat.format("Local conflict detected. Override local item?\n {0}", path); // TODO: more detailed message needed final String title = "Modify Files"; final Ref<Integer> result = new Ref<Integer>(); WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(new Runnable() { public void run() { result.set(Messages.showYesNoDialog(message, title, Messages.getQuestionIcon())); } }); if (result.get() == Messages.YES) { return true; } else { reportLocalConflict(operation, sourceNotTarget); return false; } } else { throw new IllegalArgumentException("Unknown conflict handling type: " + conflictHandlingType); } }
From source file:org.jetbrains.tfsIntegration.ui.ApplyLabelDialog.java
License:Apache License
protected void doOKAction() { try {/*from w w w . j av a 2 s . co m*/ List<VersionControlLabel> labels = myWorkspace.getServer().getVCS().queryLabels(getLabelName(), null, null, false, null, null, false, myApplyLabelForm.getContentPane(), TFSBundle.message("checking.existing.labels")); if (!labels.isEmpty()) { String message = MessageFormat.format("Label ''{0}'' already exists.\nDo you want to update it?", getLabelName()); if (Messages.showOkCancelDialog(myProject, message, getTitle(), "Update Label", "Cancel", Messages.getQuestionIcon()) != Messages.OK) { return; } } } catch (TfsException e) { Messages.showErrorDialog(myProject, e.getMessage(), getTitle()); return; } super.doOKAction(); }
From source file:org.jetbrains.tfsIntegration.ui.CheckInPoliciesForm.java
License:Apache License
public CheckInPoliciesForm(Project project, Map<String, ManageWorkspacesForm.ProjectEntry> projectToDescriptors) { myProject = project;//from w w w . j a va2s .c o m myProjectToDescriptors = new HashMap<String, ModifyableProjectEntry>(projectToDescriptors.size()); for (Map.Entry<String, ManageWorkspacesForm.ProjectEntry> e : projectToDescriptors.entrySet()) { myProjectToDescriptors.put(e.getKey(), new ModifyableProjectEntry(new ModifyableProjectEntry(e.getValue()))); } myProjectCombo.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { updateTable(); updateCheckboxes(); } }); myPoliciesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { updateButtons(); } }); List<String> projects = new ArrayList<String>(myProjectToDescriptors.keySet()); Collections.sort(projects, new Comparator<String>() { public int compare(String s1, String s2) { return s1.compareTo(s2); } }); myProjectCombo.setModel(new DefaultComboBoxModel(ArrayUtil.toStringArray(projects))); myProjectCombo.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel component = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); String path = (String) value; component.setText(VersionControlPath.getTeamProject(path)); return component; } }); myPoliciesTable .setModelAndUpdateColumns(new ListTableModel<Pair<StatefulPolicyDescriptor, Boolean>>(COLUMNS)); myEditButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final StatefulPolicyDescriptor descriptor = getSelectedDescriptor(); editPolicy(descriptor); } }); myRemoveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final StatefulPolicyDescriptor descriptor = getSelectedDescriptor(); final String message = MessageFormat.format("Are you sure to remove checkin policy ''{0}''?", descriptor.getType().getName()); if (Messages.showOkCancelDialog(myProject, message, "Remove Checkin Policy", Messages.getQuestionIcon()) == Messages.OK) { final ModifyableProjectEntry projectEntry = myProjectToDescriptors.get(getSelectedProject()); projectEntry.descriptors.remove(descriptor); projectEntry.isModified = true; updateTable(); updateButtons(); } } }); myAddButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final ModifyableProjectEntry projectEntry = myProjectToDescriptors.get(getSelectedProject()); List<PolicyBase> policies = new ArrayList<PolicyBase>(); try { // do not allow to add the same unconfigurable policy several times main_loop: for (PolicyBase installed : CheckinPoliciesManager.getInstalledPolicies()) { if (!installed.canEdit()) { for (StatefulPolicyDescriptor descriptor : projectEntry.descriptors) { if (descriptor.getType().equals(installed.getPolicyType())) { continue main_loop; } } } policies.add(installed); } } catch (DuplicatePolicyIdException ex) { final String message = MessageFormat.format( "Several checkin policies with the same id found: ''{0}''.\nPlease review your extensions.", ex.getDuplicateId()); Messages.showErrorDialog(myProject, message, "Add Checkin Policy"); return; } ChooseCheckinPolicyDialog d = new ChooseCheckinPolicyDialog(myProject, policies); if (!d.showAndGet()) { return; } PolicyBase policy = d.getSelectedPolicy(); StatefulPolicyDescriptor newDescriptor = new StatefulPolicyDescriptor(policy.getPolicyType(), true, StatefulPolicyParser.createEmptyConfiguration(), Collections.<String>emptyList(), StatefulPolicyDescriptor.DEFAULT_PRIORITY, null); if (!editPolicy(newDescriptor)) { return; } projectEntry.descriptors.add(newDescriptor); projectEntry.isModified = true; updateTable(); int index = projectEntry.descriptors.size() - 1; myPoliciesTable.getSelectionModel().setSelectionInterval(index, index); updateButtons(); } }); new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { final StatefulPolicyDescriptor descriptor = getSelectedDescriptor(); if (descriptor != null) { editPolicy(descriptor); } return true; } }.installOn(myPoliciesTable); myTeampriseCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ModifyableProjectEntry entry = myProjectToDescriptors.get(getSelectedProject()); entry.policiesCompatibilityOverride.teamprise = myTeampriseCheckBox.isSelected(); entry.isModified = true; } }); myTeamExplorerCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ModifyableProjectEntry entry = myProjectToDescriptors.get(getSelectedProject()); entry.policiesCompatibilityOverride.teamExplorer = myTeamExplorerCheckBox.isSelected(); entry.isModified = true; } }); myNonInstalledPoliciesCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ModifyableProjectEntry entry = myProjectToDescriptors.get(getSelectedProject()); entry.policiesCompatibilityOverride.nonInstalled = myNonInstalledPoliciesCheckBox.isSelected(); entry.isModified = true; } }); myOverrideCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ModifyableProjectEntry entry = myProjectToDescriptors.get(getSelectedProject()); if (myOverrideCheckBox.isSelected()) { entry.policiesCompatibilityOverride = new TfsCheckinPoliciesCompatibility(false, false, false); } else { entry.policiesCompatibilityOverride = null; } updateCheckboxes(); entry.isModified = true; } }); ActionListener l = new ActionListener() { public void actionPerformed(ActionEvent e) { boolean b = myTeamExplorerCheckBox.isSelected() || myTeampriseCheckBox.isSelected(); myNonInstalledPoliciesCheckBox.setEnabled(b); if (!b) { myNonInstalledPoliciesCheckBox.setSelected(false); myProjectToDescriptors .get(getSelectedProject()).policiesCompatibilityOverride.nonInstalled = false; } } }; myTeamExplorerCheckBox.addActionListener(l); myTeampriseCheckBox.addActionListener(l); updateTable(); updateCheckboxes(); updateButtons(); }
From source file:org.jetbrains.tfsIntegration.ui.ProjectConfigurableForm.java
License:Apache License
public ProjectConfigurableForm(final Project project) { myProject = project;// w ww. ja v a 2s .co m 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:org.metaborg.intellij.idea.sdks.MetaborgSdkType.java
License:Apache License
/** * {@inheritDoc}/*from w w w. j a va 2 s . c om*/ */ @Override public boolean setupSdkPaths(final Sdk metaborgSdk, final SdkModel sdkModel) { final SdkModificator sdkModificator = metaborgSdk.getSdkModificator(); boolean success = setupSdkPaths(metaborgSdk, sdkModificator, sdkModel); if (success && sdkModificator.getSdkAdditionalData() == null) { @Nullable final JavaSdkVersion minimumJdkVersion = getMinimumJdkVersion(metaborgSdk); final List<String> jdkCandidates = new ArrayList<>(); for (final Sdk sdk : sdkModel.getSdks()) { if (isAcceptableJdk(sdk, minimumJdkVersion)) { jdkCandidates.add(sdk.getName()); } } if (jdkCandidates.isEmpty()) { Messages.showErrorDialog("No JDK found" + (minimumJdkVersion != null ? " of at least version " + minimumJdkVersion.getDescription() : "") + ". Please configure one.", "JDK Not Found"); return false; } String jdkName = jdkCandidates.get(0); if (jdkCandidates.size() > 1) { @SuppressWarnings("deprecation") final int choice = Messages.showChooseDialog("Select the JDK to use with Metaborg.", "Select JDK", ArrayUtil.toStringArray(jdkCandidates), jdkName, Messages.getQuestionIcon()); if (choice == -1) { // User cancelled. success = false; } jdkName = jdkCandidates.get(choice); } @Nullable final Sdk jdk = sdkModel.findSdk(jdkName); assert jdk != null; setJdk(metaborgSdk, sdkModificator, jdk); } sdkModificator.commitChanges(); return success; }
From source file:org.mustbe.consulo.roots.impl.ExcludedContentFolderTypeProvider.java
License:Apache License
@NotNull @Override/*from w ww . ja va 2 s . c o m*/ public AnAction createMarkAction() { return new MarkRootAction(getName(), getMarkActionDescription(), getIcon(), this) { @Override public void actionPerformed(AnActionEvent e) { VirtualFile[] vFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY); String message = vFiles.length == 1 ? FileUtil.toSystemDependentName(vFiles[0].getPath()) : vFiles.length + " selected files"; final int rc = Messages.showOkCancelDialog(e.getData(CommonDataKeys.PROJECT), ActionsBundle.message("action.mark.as.excluded.confirm.message", message), getMarkActionDescription(), Messages.getQuestionIcon()); if (rc != 0) { return; } super.actionPerformed(e); } }; }
From source file:org.napile.idea.thermit.config.execution.AntBuildMessageView.java
License:Apache License
/** * @return can be null if user cancelled operation *//*from w w w . j a v a 2 s .c o m*/ @Nullable public static AntBuildMessageView openBuildMessageView(Project project, AntBuildFileBase buildFile, String[] targets) { final VirtualFile antFile = buildFile.getVirtualFile(); if (!LOG.assertTrue(antFile != null)) { return null; } // check if there are running instances of the same build file MessageView ijMessageView = MessageView.SERVICE.getInstance(project); Content[] contents = ijMessageView.getContentManager().getContents(); for (Content content : contents) { if (content.isPinned()) { continue; } AntBuildMessageView buildMessageView = content.getUserData(KEY); if (buildMessageView == null) { continue; } if (!antFile.equals(buildMessageView.getBuildFile().getVirtualFile())) { continue; } if (buildMessageView.isStopped()) { ijMessageView.getContentManager().removeContent(content, true); continue; } int result = Messages.showYesNoCancelDialog( ThermitBundle.message("ant.is.active.terminate.confirmation.text"), ThermitBundle.message("starting.ant.build.dialog.title"), Messages.getQuestionIcon()); switch (result) { case 0: // yes buildMessageView.stopProcess(); ijMessageView.getContentManager().removeContent(content, true); continue; case 1: // no continue; default: // cancel return null; } } final AntBuildMessageView messageView = new AntBuildMessageView(project, buildFile, targets); String contentName = buildFile.getPresentableName(); contentName = BUILD_CONTENT_NAME + " (" + contentName + ")"; final Content content = PeerFactory.getInstance().getContentFactory() .createContent(messageView.getComponent(), contentName, true); content.putUserData(KEY, messageView); ijMessageView.getContentManager().addContent(content); ijMessageView.getContentManager().setSelectedContent(content); content.setDisposer(new Disposable() { @Override public void dispose() { Disposer.dispose(messageView.myAlarm); } }); new CloseListener(content, ijMessageView.getContentManager(), project); // Do not inline next two variabled. Seeking for NPE. ToolWindow messageToolWindow = ToolWindowManager.getInstance(project) .getToolWindow(ToolWindowId.MESSAGES_WINDOW); messageToolWindow.activate(null); return messageView; }
From source file:org.napile.idea.thermit.config.execution.InputRequestHandler.java
License:Apache License
private static String askUser(SegmentReader reader, Project project) { String prompt = reader.readLimitedString(); String defaultValue = reader.readLimitedString(); String[] choices = reader.readStringArray(); MessagesEx.BaseInputInfo question;/* w ww. ja v a2 s . co m*/ if (choices.length == 0) { final MessagesEx.InputInfo info = new MessagesEx.InputInfo(project); info.setDefaultValue(defaultValue); question = info; } else { MessagesEx.ChoiceInfo choiceInfo = new MessagesEx.ChoiceInfo(project); choiceInfo.setChoices(choices, defaultValue); question = choiceInfo; } question.setIcon(Messages.getQuestionIcon()); question.setTitle(ThermitBundle.message("user.inout.request.ant.build.input.dialog.title")); question.setMessage(prompt); question.setIcon(Messages.getQuestionIcon()); return question.forceUserInput(); }
From source file:org.napile.idea.thermit.config.explorer.AntExplorer.java
License:Apache License
public void removeBuildFile() { final AntBuildFile buildFile = getCurrentBuildFile(); if (buildFile == null) { return;//from ww w . j av a 2 s .com } final String fileName = buildFile.getPresentableUrl(); final int result = Messages.showYesNoDialog(myProject, ThermitBundle.message("remove.the.reference.to.file.confirmation.text", fileName), ThermitBundle.message("confirm.remove.dialog.title"), Messages.getQuestionIcon()); if (result != 0) { return; } myConfig.removeBuildFile(buildFile); }