@Nullable public static I18nQuickFixHandler getHandler(final AnActionEvent e) { final Editor editor = getEditor(e); if (editor == null) return null; PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE); if (psiFile == null) return null; TextRange range = JavaI18nUtil.getSelectedRange(editor, psiFile); if (range == null) return null; final PsiLiteralExpression literalExpression = getEnclosingStringLiteral(psiFile, editor); PsiElement element = psiFile.findElementAt(editor.getCaretModel().getOffset()); if (element == null) return null; if (I18nizeConcatenationQuickFix.getEnclosingLiteralConcatenation(element) != null) { return new I18nizeConcatenationQuickFix(); } else if (literalExpression != null && literalExpression.getTextRange().contains(range)) { return new I18nizeQuickFix(); } for (I18nizeHandlerProvider handlerProvider : I18nizeHandlerProvider.EP_NAME.getExtensions()) { I18nQuickFixHandler handler = handlerProvider.getHandler(psiFile, editor, range); if (handler != null) { return handler; } } return null; }
@Override public void createProperty( final Project project, final Collection<PropertiesFile> propertiesFiles, final String key, final String value, final PsiExpression[] parameters) throws IncorrectOperationException { JavaI18nUtil.createProperty(project, propertiesFiles, key, value); }