com.intellij.openapi.ui.Messages Java Examples
The following examples show how to use
com.intellij.openapi.ui.Messages.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AttachDebuggerAction.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 7 votes |
SelectConfigDialog() { super(null, false, false); setTitle("Run Configuration"); myPanel = new JPanel(); myTextPane = new JTextPane(); Messages.installHyperlinkSupport(myTextPane); String selectConfig = "<html><body>" + "<p>The run configuration for the Flutter module must be selected." + "<p>Please change the run configuration to the one created when the<br>" + "module was created. See <a href=\"" + FlutterConstants.URL_RUN_AND_DEBUG + "\">the Flutter documentation</a> for more information.</body></html>"; myTextPane.setText(selectConfig); myPanel.add(myTextPane); init(); //noinspection ConstantConditions getButton(getCancelAction()).setVisible(false); }
Example #2
Source File: FlutterProjectCreator.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
private VirtualFile getLocationFromModel(@Nullable Project projectToClose, boolean saveLocation) { final File location = new File(FileUtil.toSystemDependentName(myModel.projectLocation().get())); if (!location.exists() && !location.mkdirs()) { String message = ActionsBundle.message("action.NewDirectoryProject.cannot.create.dir", location.getAbsolutePath()); Messages.showErrorDialog(projectToClose, message, ActionsBundle.message("action.NewDirectoryProject.title")); return null; } final File baseFile = new File(location, myModel.projectName().get()); //noinspection ResultOfMethodCallIgnored baseFile.mkdirs(); final VirtualFile baseDir = ApplicationManager.getApplication().runWriteAction( (Computable<VirtualFile>)() -> LocalFileSystem.getInstance().refreshAndFindFileByIoFile(baseFile)); if (baseDir == null) { FlutterUtils.warn(LOG, "Couldn't find '" + location + "' in VFS"); return null; } if (saveLocation) { RecentProjectsManager.getInstance().setLastProjectCreationLocation(location.getPath()); } return baseDir; }
Example #3
Source File: PushController.java From consulo with Apache License 2.0 | 6 votes |
public boolean ensureForcePushIsNeeded() { Collection<MyRepoModel<?, ?, ?>> selectedNodes = getSelectedRepoNode(); MyRepoModel<?, ?, ?> selectedModel = ContainerUtil.getFirstItem(selectedNodes); if (selectedModel == null) return false; final PushSupport activePushSupport = selectedModel.getSupport(); final PushTarget commonTarget = getCommonTarget(selectedNodes); if (commonTarget != null && activePushSupport.isSilentForcePushAllowed(commonTarget)) return true; return Messages.showOkCancelDialog(myProject, XmlStringUtil.wrapInHtml(DvcsBundle.message("push.force.confirmation.text", commonTarget != null ? " to <b>" + commonTarget.getPresentation() + "</b>" : "")), "Force Push", "&Force Push", CommonBundle.getCancelButtonText(), Messages.getWarningIcon(), commonTarget != null ? new MyDoNotAskOptionForPush(activePushSupport, commonTarget) : null) == OK; }
Example #4
Source File: ToolWindowFactory.java From adc with Apache License 2.0 | 6 votes |
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) { ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); JPanel framePanel = createPanel(project); disableAll(); AndroidDebugBridge adb = AndroidSdkUtils.getDebugBridge(project); if (adb == null) { return; } if(adb.isConnected()){ ToolWindowFactory.this.adBridge = adb; Logger.getInstance(ToolWindowFactory.class).info("Successfully obtained debug bridge"); AndroidDebugBridge.addDeviceChangeListener(deviceChangeListener); updateDeviceComboBox(); } else { Logger.getInstance(ToolWindowFactory.class).info("Unable to obtain debug bridge"); String msg = MessageFormat.format(resourceBundle.getString("error.message.adb"), ""); Messages.showErrorDialog(msg, resourceBundle.getString("error.title.adb")); } Content content = contentFactory.createContent(framePanel, "", false); toolWindow.getContentManager().addContent(content); }
Example #5
Source File: ProjectViewDropTarget.java From consulo with Apache License 2.0 | 6 votes |
private void doDrop(@Nonnull TreePath target, PsiElement[] sources) { final PsiElement targetElement = getPsiElement(target); if (targetElement == null) return; if (DumbService.isDumb(myProject)) { Messages.showMessageDialog(myProject, "Copy refactoring is not available while indexing is in progress", "Indexing", null); return; } final PsiDirectory psiDirectory; if (targetElement instanceof PsiDirectoryContainer) { final PsiDirectoryContainer directoryContainer = (PsiDirectoryContainer)targetElement; final PsiDirectory[] psiDirectories = directoryContainer.getDirectories(); psiDirectory = psiDirectories.length != 0 ? psiDirectories[0] : null; } else if (targetElement instanceof PsiDirectory) { psiDirectory = (PsiDirectory)targetElement; } else { final PsiFile containingFile = targetElement.getContainingFile(); LOG.assertTrue(containingFile != null, targetElement); psiDirectory = containingFile.getContainingDirectory(); } TransactionGuard.getInstance().submitTransactionAndWait(() -> CopyHandler.doCopy(sources, psiDirectory)); }
Example #6
Source File: SchemesToImportPopup.java From consulo with Apache License 2.0 | 6 votes |
public void show(Collection<T> schemes) { if (schemes.isEmpty()) { Messages.showMessageDialog("There are no available schemes to import", "Import", Messages.getWarningIcon()); return; } final JList list = new JBList(new CollectionListModel<T>(schemes)); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setCellRenderer(new SchemesToImportListCellRenderer()); Runnable selectAction = new Runnable() { @Override public void run() { onSchemeSelected((T)list.getSelectedValue()); } }; showList(list, selectAction); }
Example #7
Source File: AsyncHelper.java From r2m-plugin-android with Apache License 2.0 | 6 votes |
private void showOverrideConfirmationDialog(final List<String> list) { this.result = false; StringBuilder sb = new StringBuilder("\n"); for (String e : list) { sb.append(e).append("\n"); } int option = Messages.showOkCancelDialog( R2MMessages.getMessage("CONFIRM_OVERRIDE_FILES", sb.toString()), R2MMessages.getMessage("CONFIRM_OVERRIDE_FILES_TITLE"), R2MMessages.getMessage("CONFIRM_OVERRIDE_FILES_BUTTON_TEXT"), Messages.CANCEL_BUTTON, Messages.getWarningIcon()); if (option == 0) { onActionSuccess(GenerateActions.START_FILE_OPERATIONS); } else { this.result = true; onActionSuccess(GenerateActions.FILE_OPERATION_SUCCESS); } }
Example #8
Source File: ProjectFileIndexSampleAction.java From intellij-sdk-docs with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(@NotNull final AnActionEvent event) { Project project = event.getProject(); final Editor editor = event.getData(CommonDataKeys.EDITOR); if (project == null || editor == null) return; Document document = editor.getDocument(); FileDocumentManager fileDocumentManager = FileDocumentManager.getInstance(); VirtualFile virtualFile = fileDocumentManager.getFile(document); ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex(); if (virtualFile != null) { Module module = projectFileIndex.getModuleForFile(virtualFile); String moduleName; moduleName = module != null ? module.getName() : "No module defined for file"; VirtualFile moduleContentRoot = projectFileIndex.getContentRootForFile(virtualFile); boolean isLibraryFile = projectFileIndex.isLibraryClassFile(virtualFile); boolean isInLibraryClasses = projectFileIndex.isInLibraryClasses(virtualFile); boolean isInLibrarySource = projectFileIndex.isInLibrarySource(virtualFile); Messages.showInfoMessage("Module: " + moduleName + "\n" + "Module content root: " + moduleContentRoot + "\n" + "Is library file: " + isLibraryFile + "\n" + "Is in library classes: " + isInLibraryClasses + ", Is in library source: " + isInLibrarySource, "Main File Info for" + virtualFile.getName()); } }
Example #9
Source File: SlackPost.java From SlackStorm with GNU General Public License v2.0 | 6 votes |
private void pushMessage(String message, String details) throws IOException { String input = "payload=" + URLEncoder.encode(channel.getPayloadMessage(details, message), "UTF-8"); try { URL url = new URL(channel.getUrl()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setDoInput(true); conn.setDoOutput(true); DataOutputStream wr = new DataOutputStream (conn.getOutputStream ()); wr.writeBytes (input); wr.flush (); wr.close (); if (conn.getResponseCode() == 200 && readInputStreamToString(conn).equals("ok")) { Messages.showMessageDialog(project, "Message Sent.", "Information", SlackStorage.getSlackIcon()); } else { Messages.showMessageDialog(project, "Message not sent, check your configuration.", "Error", Messages.getErrorIcon()); } } catch (MalformedURLException e) { e.printStackTrace(); } }
Example #10
Source File: BaseToolsPanel.java From consulo with Apache License 2.0 | 6 votes |
private void removeSelected() { CheckedTreeNode node = getSelectedToolNode(); if (node != null) { int result = Messages.showYesNoDialog(this, ToolsBundle.message("tools.delete.confirmation"), CommonBundle.getWarningTitle(), Messages.getWarningIcon()); if (result != 0) { return; } myIsModified = true; if (node.getUserObject() instanceof Tool) { Tool tool = (Tool)node.getUserObject(); CheckedTreeNode parentNode = (CheckedTreeNode)node.getParent(); ((ToolsGroup)parentNode.getUserObject()).removeElement(tool); removeNodeFromParent(node); if (parentNode.getChildCount() == 0) { removeNodeFromParent(parentNode); } } else if (node.getUserObject() instanceof ToolsGroup) { removeNodeFromParent(node); } update(); IdeFocusManager.getGlobalInstance().doForceFocusWhenFocusSettlesDown(myTree); } }
Example #11
Source File: HttpUtils.java From EasyCode with MIT License | 6 votes |
/** * post json请求 * * @param uri 地址 * @param param 参数 * @return 请求返回结果 */ public static String postJson(String uri, Map<String, Object> param) { HttpPost httpPost = new HttpPost(HOST_URL + uri); httpPost.setHeader(HttpHeaders.USER_AGENT, USER_AGENT); httpPost.setHeader(HttpHeaders.CONTENT_TYPE, CONTENT_TYPE); httpPost.setConfig(getDefaultConfig()); ObjectMapper objectMapper = new ObjectMapper(); try { if (!CollectionUtil.isEmpty(param)) { httpPost.setEntity(new StringEntity(objectMapper.writeValueAsString(param), "utf-8")); } return handlerRequest(httpPost); } catch (JsonProcessingException e) { Messages.showWarningDialog("JSON解析出错!", MsgValue.TITLE_INFO); ExceptionUtil.rethrow(e); } return null; }
Example #12
Source File: IdeaHelper.java From azure-devops-intellij with MIT License | 6 votes |
/** * Verifies if TF is configured, show notification and warning message if not * * @param project Idea project * @return true if TF is configured, false if TF is not correctly configured */ public static boolean isTFConfigured(@NotNull final Project project) { String tfLocation = TfTool.getLocation(); if (StringUtils.isEmpty(tfLocation)) { tfLocation = TfTool.tryDetectTf(); if (!StringUtils.isEmpty(tfLocation)) { PluginServiceProvider.getInstance().getPropertyService().setProperty(PropertyService.PROP_TF_HOME, tfLocation); return true; } //TF is not configured, show warning message int result = Messages.showDialog(project, TfPluginBundle.message(TfPluginBundle.KEY_TFVC_NOT_CONFIGURED), TfPluginBundle.message(TfPluginBundle.KEY_TFVC), new String[] { TfPluginBundle.message(TfPluginBundle.KEY_TFVC_NOT_CONFIGURED_DIALOG_OPEN_SETTINGS), TfPluginBundle.message(TfPluginBundle.KEY_TFVC_NOT_CONFIGURED_DIALOG_CANCEL)}, 0, getWarningIcon()); if (result == 0) { ShowSettingsUtil.getInstance().showSettingsDialog(project, TFSVcs.TFVC_NAME); } return false; } return true; }
Example #13
Source File: CustomRenameHandler.java From Intellij-Plugin with Apache License 2.0 | 6 votes |
public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) { PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext); if (element == null) element = psiElement; psiElement = element; String text = element.toString(); //Finding text from annotation if (isMethod(element)) { List<String> values = StepUtil.getGaugeStepAnnotationValues((PsiMethod) element); if (values.size() == 0) { return; } else if (values.size() == 1) text = values.get(0); else if (values.size() > 1) { Messages.showWarningDialog("Refactoring for steps having aliases are not supported", "Warning"); return; } } else if (isStep(element)) { text = ((SpecStepImpl) element).getStepValue().getStepAnnotationText(); } else if (isConcept(element)) { text = removeIdentifiers(((ConceptStepImpl) element).getStepValue().getStepAnnotationText()); } final RefactoringDialog form = new RefactoringDialog(this.editor.getProject(), file, this.editor, text); form.show(); }
Example #14
Source File: ReopenProjectAction.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess @Override public void actionPerformed(@Nonnull AnActionEvent e) { //Force move focus to IdeFrame IdeEventQueue.getInstance().getPopupManager().closeAllPopups(); final int modifiers = e.getModifiers(); final boolean forceOpenInNewFrame = BitUtil.isSet(modifiers, InputEvent.CTRL_MASK) || BitUtil.isSet(modifiers, InputEvent.SHIFT_MASK) || e.getPlace() == ActionPlaces.WELCOME_SCREEN; Project project = e.getData(CommonDataKeys.PROJECT); if (!new File(myProjectPath).exists()) { if (Messages.showDialog(project, "The path " + FileUtil.toSystemDependentName(myProjectPath) + " does not exist.\n" + "If it is on a removable or network drive, please make sure that the drive is connected.", "Reopen Project", new String[]{"OK", "&Remove From List"}, 0, Messages.getErrorIcon()) == 1) { myIsRemoved = true; RecentProjectsManager.getInstance().removePath(myProjectPath); } return; } ProjectUtil.openAsync(myProjectPath, project, forceOpenInNewFrame, UIAccess.current()); }
Example #15
Source File: DojoSettingsConfigurable.java From needsmoredojo with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(ActionEvent e) { autoDetectDojoSources.setEnabled(false); VirtualFile directory = SourcesLocator.getDojoSourcesDirectory(project, false); if(directory == null) { Messages.showInfoMessage("Could not find any dojo sources via auto-detection", "Auto-detect Dojo Sources"); autoDetectDojoSources.setEnabled(true); return; } dojoSourcesText.setText(directory.getCanonicalPath()); dojoSourceString = directory.getCanonicalPath(); autoDetectDojoSources.setEnabled(true); updateModifiedState(); }
Example #16
Source File: PasswordPromptComponent.java From consulo with Apache License 2.0 | 6 votes |
public PasswordPromptComponent(PasswordSafeSettings.ProviderType type, String message, boolean showUserName, String passwordPrompt, String rememberPrompt) { myIconLabel.setText(""); myIconLabel.setIcon(Messages.getWarningIcon()); myMessageLabel.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL)); myMessageLabel.setText(message); setTargetProviderType(type); setUserInputVisible(showUserName); if (passwordPrompt != null) myPasswordLabel.setText(passwordPrompt); if (rememberPrompt != null) { myRememberCheckBox.setText(rememberPrompt); DialogUtil.registerMnemonic(myRememberCheckBox); } }
Example #17
Source File: FastpassUpdater.java From intellij-pants-plugin with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(@NotNull AnActionEvent e) { Project project = e.getProject(); if (fastpassBinaryExists()) { systemVersion(FASTPASS_PATH) .ifPresent(systemVersion -> extractFastpassData(project) .ifPresent(data -> { if (!data.version.equals(systemVersion)) { String message = "Do you want to update fastpass to version: " + systemVersion + "?"; int answer = Messages.showYesNoDialog(project, message, DIALOG_TITLE, null); if (answer == Messages.YES) { updateFastpassVersion(project, data); } } else { Messages.showInfoMessage(project, "Fastpass is already up to date", DIALOG_TITLE); } })); } }
Example #18
Source File: ExampleChooserHelper.java From r2m-plugin-android with Apache License 2.0 | 6 votes |
public static String showExamplesDialog() { EXAMPLES_DIALOG_UP = true; try { List<String> examples = getManifest().getExamplesList(); String response = Messages.showEditableChooseDialog( R2MMessages.getMessage("CHOOSE_EXAMPLE_LABEL"), R2MMessages.getMessage("CHOOSE_EXAMPLE_TITLE"), Messages.getQuestionIcon(), examples.toArray(new String[examples.size()]), R2MMessages.getMessage("CHOOSE_EXAMPLE_DEFAULT_VALUE"), null); return response == null ? null : response.split(ExamplesManifest.DESCRIPTION_SEPARATOR_KEY)[0]; } finally { EXAMPLES_DIALOG_UP = false; } }
Example #19
Source File: AlwaysPresentGoSyncPlugin.java From intellij with Apache License 2.0 | 6 votes |
private static void fixLanguageSupport(Project project) { ProjectViewEdit edit = ProjectViewEdit.editLocalProjectView( project, builder -> { removeGoWorkspaceType(builder); addToAdditionalLanguages(builder); return true; }); if (edit == null) { Messages.showErrorDialog( "Could not modify project view. Check for errors in your project view and try again", "Error"); return; } edit.apply(); BlazeSyncManager.getInstance(project) .incrementalProjectSync(/* reason= */ "enabled-go-support"); }
Example #20
Source File: SdkListConfigurable.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess @Override public void actionPerformed(final AnActionEvent e) { final Object o = getSelectedObject(); if (o instanceof SdkImpl) { final SdkImpl selected = (SdkImpl)o; String defaultNewName = SdkConfigurationUtil.createUniqueSdkName(selected.getName(), mySdksModel.getSdks()); final String newName = Messages.showInputDialog("Enter bundle name:", "Copy Bundle", null, defaultNewName, new NonEmptyInputValidator() { @Override public boolean checkInput(String inputString) { return super.checkInput(inputString) && mySdksModel.findSdk(inputString) == null; } }); if (newName == null) return; SdkImpl sdk = selected.clone(); sdk.setName(newName); sdk.setPredefined(false); mySdksModel.doAdd(sdk, sdk1 -> addSdkNode(sdk1, true)); } }
Example #21
Source File: RemoteServerConfigurable.java From consulo with Apache License 2.0 | 6 votes |
@Override public JComponent createOptionsPanel() { mySettingsPanel.add(BorderLayout.CENTER, ConfigurableUIMigrationUtil.createComponent(myConfigurable)); myTestConnectionButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { myConfigurable.apply(); } catch (ConfigurationException exc) { Messages.showErrorDialog(myMainPanel, "Cannot test connection: " + exc.getMessage(), exc.getTitle()); return; } testConnection(); } }); myMainPanel.setBorder(JBUI.Borders.empty(0, 10, 0, 10)); return myMainPanel; }
Example #22
Source File: FilterDialog.java From consulo with Apache License 2.0 | 6 votes |
@Override protected void doOKAction() { String errorMessage = null; if (noText(myNameField.getText())) { errorMessage = ToolsBundle.message("tools.filters.add.name.required.error"); } else if (noText(myRegexpField.getText())) { errorMessage = ToolsBundle.message("tools.filters.add.regex.required.error"); } if (errorMessage != null) { Messages.showMessageDialog(getContentPane(), errorMessage, CommonBundle.getErrorTitle(), Messages.getErrorIcon()); return; } try { checkRegexp(myRegexpField.getText()); } catch (InvalidExpressionException e) { Messages.showMessageDialog(getContentPane(), e.getMessage(), ToolsBundle.message("tools.filters.add.regex.invalid.title"), Messages.getErrorIcon()); return; } super.doOKAction(); }
Example #23
Source File: AbstractNavigationHandler.java From NutzCodeInsight with Apache License 2.0 | 6 votes |
@Override public final void navigate(MouseEvent mouseEvent, PsiElement psiElement) { if (canNavigate(psiElement)) { final Project project = psiElement.getProject(); final List<VirtualFile> fileList = findTemplteFileList(psiElement); if (fileList.size() == 1) { FileEditorManager.getInstance(project).openFile(fileList.get(0), true); } else if (fileList.size() > 1) { final List<VirtualFile> infos = new ArrayList<>(fileList); List<PsiElement> elements = new ArrayList<>(); PsiManager psiManager = PsiManager.getInstance(psiElement.getProject()); infos.forEach(virtualFile -> elements.add(psiManager.findFile(virtualFile).getNavigationElement())); NavigationUtil.getPsiElementPopup(elements.toArray(new PsiElement[0]), title).show(new RelativePoint(mouseEvent)); } else { if (fileList == null || fileList.size() <= 0) { Messages.showErrorDialog("没有找到这个资源文件,请检查!", "错误提示"); } } } }
Example #24
Source File: AnnotateActionTest.java From azure-devops-intellij with MIT License | 6 votes |
@Test public void testExecute_Success() { ArgumentCaptor<URI> argCapture = ArgumentCaptor.forClass(URI.class); when(mockTeamProjectReference.getName()).thenReturn("TeamName"); when(mockItemInfo.getServerItem()).thenReturn("$/path/to/file.txt"); when(mockServerContext.getTeamProjectReference()).thenReturn(mockTeamProjectReference); when(mockActionContext.getServerContext()).thenReturn(mockServerContext); when(mockActionContext.getItem()).thenReturn(mockItemInfo); annotateAction.execute(mockActionContext); verifyStatic(times(0)); Messages.showErrorDialog(any(Project.class), anyString(), anyString()); verifyStatic(times(1)); BrowserUtil.browse(argCapture.capture()); assertEquals(serverURI.toString() + "TeamName/_versionControl/?path=%24%2Fpath%2Fto%2Ffile.txt&_a=contents&annotate=true&hideComments=true", argCapture.getValue().toString()); }
Example #25
Source File: HaxeDebugRunner.java From intellij-haxe with Apache License 2.0 | 6 votes |
private static void showInfoMessage(final Project project, final String message, final String title) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { if (false /* TODO: Get display behavior from the plugin configuration. */) { // Put up a modal dialog. Folks don't like this much, so this should not be the default. Messages.showInfoMessage(project, message, title); } else { // Show the error on the status bar. StatusBarUtil.setStatusBarInfo(project, message); // XXX: Should we log this, too?? } // Add the output to the "Problems" pane. ProblemsView.SERVICE.getInstance(project).addMessage(MessageCategory.INFORMATION, new String[]{message}, null, null, null, null, UUID.randomUUID()); } }); }
Example #26
Source File: IncompatibleEncodingDialog.java From consulo with Apache License 2.0 | 6 votes |
@Nullable @Override protected JComponent createCenterPanel() { JLabel label = new JLabel(XmlStringUtil.wrapInHtml("The encoding you've chosen ('" + charset.displayName() + "') may change the contents of '" + virtualFile.getName() + "'.<br>" + "Do you want to<br>" + "1. <b>Reload</b> the file from disk in the new encoding '" + charset.displayName() + "' and overwrite editor contents or<br>" + "2. <b>Convert</b> the text and overwrite file in the new encoding" + "?")); label.setIcon(Messages.getQuestionIcon()); label.setIconTextGap(10); return label; }
Example #27
Source File: FlutterProjectCreator.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
private VirtualFile getLocationFromModel(@Nullable Project projectToClose, boolean saveLocation) { final File location = new File(FileUtil.toSystemDependentName(myModel.projectLocation().get())); if (!location.exists() && !location.mkdirs()) { String message = ActionsBundle.message("action.NewDirectoryProject.cannot.create.dir", location.getAbsolutePath()); Messages.showErrorDialog(projectToClose, message, ActionsBundle.message("action.NewDirectoryProject.title")); return null; } final File baseFile = new File(location, myModel.projectName().get()); //noinspection ResultOfMethodCallIgnored baseFile.mkdirs(); final VirtualFile baseDir = ApplicationManager.getApplication().runWriteAction( (Computable<VirtualFile>)() -> LocalFileSystem.getInstance().refreshAndFindFileByIoFile(baseFile)); if (baseDir == null) { FlutterUtils.warn(LOG, "Couldn't find '" + location + "' in VFS"); return null; } if (saveLocation) { RecentProjectsManager.getInstance().setLastProjectCreationLocation(location.getPath()); } return baseDir; }
Example #28
Source File: TextMergeViewer.java From consulo with Apache License 2.0 | 5 votes |
@javax.annotation.Nullable public Action getResolveAction(@Nonnull final MergeResult result) { String caption = MergeUtil.getResolveActionTitle(result, myMergeRequest, myMergeContext); return new AbstractAction(caption) { @Override public void actionPerformed(ActionEvent e) { if ((result == MergeResult.LEFT || result == MergeResult.RIGHT) && myContentModified && Messages.showYesNoDialog(myPanel.getRootPane(), DiffBundle.message("merge.dialog.resolve.side.with.discard.message", result == MergeResult.LEFT ? 0 : 1), DiffBundle.message("merge.dialog.resolve.side.with.discard.title"), Messages.getQuestionIcon()) != Messages.YES) { return; } if (result == MergeResult.RESOLVED) { if ((getChangesCount() != 0 || getConflictsCount() != 0) && Messages.showYesNoDialog(myPanel.getRootPane(), DiffBundle.message("merge.dialog.apply.partially.resolved.changes.confirmation.message", getChangesCount(), getConflictsCount()), DiffBundle.message("apply.partially.resolved.merge.dialog.title"), Messages.getQuestionIcon()) != Messages.YES) { return; } } if (result == MergeResult.CANCEL && !MergeUtil.showExitWithoutApplyingChangesDialog(TextMergeViewer.this, myMergeRequest, myMergeContext)) { return; } destroyChangedBlocks(); myMergeContext.finishMerge(result); } }; }
Example #29
Source File: LSPRenameHandler.java From lsp4intellij with Apache License 2.0 | 5 votes |
private void performDialogRename(Editor editor) { EditorEventManager manager = EditorEventManagerBase.forEditor(editor); if (manager != null) { String renameTo = Messages.showInputDialog( editor.getProject(), "Enter new name: ", "Rename", Messages.getQuestionIcon(), "", new NonEmptyInputValidator()); if (renameTo != null && !renameTo.equals("")) { manager.rename(renameTo); } } }
Example #30
Source File: JSONEditDialog.java From JSONToKotlinClass with MIT License | 5 votes |
private void onOK() { String text = jsonTestPanel.getText(); if (text.isEmpty()) { Messages.showErrorDialog(textResources.getEmptyJSONMessage(), textResources.getEmptyJSONTitle()); return; } String className = classNameTextField.getText(); if (className.isEmpty()) { Messages.showErrorDialog(textResources.getEmptyClassMessage(), textResources.getEmptyClassNameTitle()); return; } processJSON(text, className); }