@Override public void performI18nization(final PsiFile psiFile, final Editor editor, PsiLiteralExpression literalExpression, Collection<PropertiesFile> propertiesFiles, String key, String value, String i18nizedText, PsiExpression[] parameters, final PropertyCreationHandler propertyCreationHandler) throws IncorrectOperationException { Project project = psiFile.getProject(); propertyCreationHandler.createProperty(project, propertiesFiles, key, value, parameters); try { final PsiElement newExpression = doReplacementInJava(psiFile, editor,literalExpression, i18nizedText); reformatAndCorrectReferences(newExpression); } catch (IncorrectOperationException e) { Messages.showErrorDialog(project, CodeInsightBundle.message("inspection.i18n.expression.is.invalid.error.message"), CodeInsightBundle.message("inspection.error.dialog.title")); } }
void performI18nization(final PsiFile psiFile, final Editor editor, PsiLiteralExpression literalExpression, Collection<PropertiesFile> propertiesFiles, String key, String value, String i18nizedText, PsiExpression[] parameters, PropertyCreationHandler propertyCreationHandler) throws IncorrectOperationException;
@Override public void performI18nization(final PsiFile psiFile, final Editor editor, PsiLiteralExpression literalExpression, Collection<PropertiesFile> propertiesFiles, String key, String value, String i18nizedText, PsiExpression[] parameters, final PropertyCreationHandler propertyCreationHandler) throws IncorrectOperationException { Project project = psiFile.getProject(); TextRange selectedText = JavaI18nUtil.getSelectedRange(editor, psiFile); if (selectedText == null) return; propertyCreationHandler.createProperty(project, propertiesFiles, key, value, parameters); editor.getDocument().replaceString(selectedText.getStartOffset(), selectedText.getEndOffset(), i18nizedText); }
public PropertyCreationHandler getPropertyCreationHandler() { PropertyCreationHandler handler = myResourceBundleManager.getPropertyCreationHandler(); return handler != null ? handler : JavaI18nUtil.DEFAULT_PROPERTY_CREATION_HANDLER; }