void (@NotNull final Project project, final Editor editor, PsiFile file, DataContext dataContext) { MavenActionsUsagesCollector.trigger(project, MavenActionsUsagesCollector.INTRODUCE_PROPERTY); PsiDocumentManager.getInstance(project).commitAllDocuments(); Pair<XmlElement, TextRange> elementAndRange = getSelectedElementAndTextRange(editor, file); if (elementAndRange == null) return; XmlElement selectedElement = elementAndRange.first; final TextRange range = elementAndRange.second; String stringValue = selectedElement.getText(); if (stringValue == null) return; final MavenDomProjectModel model = MavenDomUtil.getMavenDomModel(file, MavenDomProjectModel.class); final String selectedString = editor.getDocument().getText(range); List<TextRange> ranges = getPropertiesTextRanges(stringValue); int offsetInElement = range.getStartOffset() - selectedElement.getTextOffset(); if (model == null || StringUtil.isEmptyOrSpaces(selectedString) || isIntersectWithRanges(ranges, offsetInElement, offsetInElement + selectedString.length())) { return; } editor.getSelectionModel().setSelection(range.getStartOffset(), range.getEndOffset()); IntroducePropertyDialog dialog = new IntroducePropertyDialog(project, selectedElement, model, selectedString); dialog.show(); if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) return; final String propertyName = dialog.getEnteredName(); final MavenDomProjectModel selectedProject = dialog.getSelectedProject(); if (ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(getFiles(file, selectedProject)).hasReadonlyFiles()) { return; } final String replaceWith = PREFIX + propertyName + SUFFIX; WriteCommandAction.runWriteCommandAction(project, () -> { editor.getDocument().replaceString(range.getStartOffset(), range.getEndOffset(), replaceWith); PsiDocumentManager.getInstance(project).commitAllDocuments(); createMavenProperty(selectedProject, propertyName, selectedString); PsiDocumentManager.getInstance(project).commitAllDocuments(); }); showFindUsages(project, propertyName, selectedString, replaceWith, selectedProject); }