Skip to content

Commit

Permalink
Fixing tests (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
machaval authored Aug 2, 2024
1 parent b6274c4 commit 05fac88
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static WeaveHeader createHeader(Project project) {


public static WeaveDocument createFile(Project project, String text) {
String name = "dummy.wev";
String name = "dummy.dwl";
return (WeaveDocument) PsiFileFactory.getInstance(project).
createFileFromText(name, WeaveFileType.getInstance(), text).getChildren()[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.intellij.navigation.ItemPresentation;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiReference;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.PlatformIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -115,8 +116,9 @@ public static WeaveDocument setName(WeaveDocument document, String name) {
return document;
}

@Nullable
public static WeaveExpression getExpression(WeaveBody body) {
return body.getAnnotatedExpression().getExpression();
return PsiTreeUtil.findChildOfType(body, WeaveExpression.class);
}

public static ItemPresentation getPresentation(WeaveObjectExpression document) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import com.intellij.codeInsight.hint.HintManagerImpl;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiNamedElement;
import com.intellij.refactoring.RefactoringActionHandler;
import com.intellij.testFramework.LoggedErrorProcessor;
import com.intellij.testFramework.TestLoggerFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.mule.tooling.lang.dw.parser.psi.WeaveBody;
Expand All @@ -30,6 +33,8 @@
import static org.mule.tooling.lang.dw.util.ListUtils.last;

public abstract class AbstractIntroduceDirectiveHandler implements RefactoringActionHandler {


@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile psiFile, DataContext dataContext) {
PsiElement valueToReplace = getValueToReplace(psiFile, editor);
Expand Down

0 comments on commit 05fac88

Please sign in to comment.