SSR: remove unnecessary parameter

GitOrigin-RevId: bfdf3f9c0bbb7814c31ef4e614907957a478a709
This commit is contained in:
Bas Leijdekkers
2019-05-24 19:10:42 +03:00
committed by intellij-monorepo-bot
parent 189d82b146
commit ddf98bc3d8
6 changed files with 10 additions and 13 deletions
@@ -416,9 +416,8 @@ public class JavaStructuralSearchProfile extends StructuralSearchProfile {
@NotNull
@Override
public PsiCodeFragment createCodeFragment(Project project, String text, PsiElement context) {
final JavaCodeFragmentFactory factory = JavaCodeFragmentFactory.getInstance(project);
return factory.createCodeBlockCodeFragment(text, context, true);
public PsiCodeFragment createCodeFragment(Project project, String text) {
return JavaCodeFragmentFactory.getInstance(project).createCodeBlockCodeFragment(text, null, true);
}
@Override
@@ -90,7 +90,7 @@ public abstract class StructuralSearchProfile {
}
@Nullable
public PsiCodeFragment createCodeFragment(Project project, String text, @Nullable PsiElement context) {
public PsiCodeFragment createCodeFragment(Project project, String text) {
return null;
}
@@ -99,7 +99,7 @@ public final class ReplacementPreviewDialog extends DialogWrapper {
PsiFile file = null;
final StructuralSearchProfile profile = StructuralSearchUtil.getProfileByFileType(myFileType);
if (profile != null) {
file = profile.createCodeFragment(project, "", null);
file = profile.createCodeFragment(project, "");
}
if (file != null) {
@@ -567,14 +567,14 @@ class EditVarConstraintsDialog extends DialogWrapper {
}
Editor createEditor(final Project project, final String text, final String fileName) {
Language groovy = Language.findLanguageByID("Groovy");
final Language groovy = Language.findLanguageByID("Groovy");
Document doc = null;
final FileType fileType = getFileType(fileName);
if (groovy != null) {
// there is no right way to create a code fragment for generic language, so we use this hole since we need extend resolve scope
for (StructuralSearchProfile profile : StructuralSearchProfile.EP_NAME.getExtensions()) {
if (profile.isMyLanguage(groovy)) {
PsiCodeFragment fragment = Objects.requireNonNull(profile.createCodeFragment(project, text, null));
final PsiCodeFragment fragment = Objects.requireNonNull(profile.createCodeFragment(project, text));
fragment.forceResolveScope(new StructuralSearchScriptScope(myProject));
doc = PsiDocumentManager.getInstance(project).getDocument(fragment);
break;
@@ -285,7 +285,7 @@ public class UIUtil {
@NotNull
public static Document createDocument(@NotNull Project project, @NotNull LanguageFileType fileType, Language dialect, @NotNull String text,
@NotNull StructuralSearchProfile profile) {
PsiFile codeFragment = profile.createCodeFragment(project, text, null);
PsiFile codeFragment = profile.createCodeFragment(project, text);
if (codeFragment == null) {
codeFragment = createFileFragment(project, fileType, dialect, text);
}
@@ -302,7 +302,7 @@ public class UIUtil {
@NotNull
public static Editor createEditor(@NotNull Project project, @NotNull LanguageFileType fileType, Language dialect, @NotNull String text,
@NotNull StructuralSearchProfile profile) {
PsiFile codeFragment = profile.createCodeFragment(project, text, null);
PsiFile codeFragment = profile.createCodeFragment(project, text);
if (codeFragment == null) {
codeFragment = createFileFragment(project, fileType, dialect, text);
}
@@ -48,10 +48,8 @@ public class GroovyStructuralSearchProfile extends StructuralSearchProfileBase {
}
@Override
public PsiCodeFragment createCodeFragment(Project project, String text, @Nullable PsiElement context) {
final GroovyCodeFragment result = new GroovyCodeFragment(project, text);
result.setContext(context);
return result;
public PsiCodeFragment createCodeFragment(Project project, String text) {
return new GroovyCodeFragment(project, text);
}
@NotNull