use of com.intellij.testFramework.MapDataContext in project intellij-community by JetBrains.
the class CCTaskFileActionTest method getActionEvent.
@NotNull
private TestActionEvent getActionEvent(VirtualFile virtualFile, AnAction action) {
MapDataContext context = new MapDataContext();
context.put(CommonDataKeys.VIRTUAL_FILE, virtualFile);
context.put(CommonDataKeys.PROJECT, getProject());
return new TestActionEvent(context, action);
}
use of com.intellij.testFramework.MapDataContext in project intellij-community by JetBrains.
the class JavaFXRenameTest method doTestPropertyRenameHandler.
public void doTestPropertyRenameHandler(String... files) throws Exception {
myFixture.configureByFiles(files);
final MapDataContext dataContext = new MapDataContext();
dataContext.put(CommonDataKeys.EDITOR, getEditor());
final RenameHandler renameHandler = RenameHandlerRegistry.getInstance().getRenameHandler(dataContext);
assertTrue(renameHandler instanceof JavaFxPropertyRenameHandler);
}
use of com.intellij.testFramework.MapDataContext in project intellij-community by JetBrains.
the class JavaFXRenameTest method doTestStaticProperty.
public void doTestStaticProperty(@NonNls String newName, String className) throws Exception {
myFixture.configureByFiles(getTestName(true) + ".fxml", className.replace('.', '/') + ".java");
final MapDataContext dataContext = new MapDataContext();
dataContext.put(CommonDataKeys.EDITOR, getEditor());
dataContext.put(PsiElementRenameHandler.DEFAULT_NAME, newName);
final JavaFxPropertyRenameHandler renameHandler = new JavaFxPropertyRenameHandler();
assertTrue(renameHandler.isAvailableOnDataContext(dataContext));
renameHandler.invoke(getProject(), getEditor(), null, dataContext);
myFixture.checkResultByFile(getTestName(true) + "_after.fxml");
final PsiClass psiClass = myFixture.findClass(className);
assertNotNull(psiClass);
final String propName = newName.substring(0, 1).toUpperCase() + newName.substring(1);
assertMethodExists(psiClass, "set" + propName);
}
use of com.intellij.testFramework.MapDataContext in project intellij-community by JetBrains.
the class JavaFXRenameTest method doTestHandler.
@NotNull
public PsiClass doTestHandler(String newName, String className) throws Exception {
if (className == null) {
className = getTestName(false);
myFixture.configureByFiles(getTestName(true) + ".fxml", getTestName(false) + ".java");
} else {
myFixture.configureByFiles(getTestName(true) + ".fxml", getTestName(false) + ".java", className.replace('.', '/') + ".java");
}
final MapDataContext dataContext = new MapDataContext();
dataContext.put(CommonDataKeys.EDITOR, getEditor());
dataContext.put(PsiElementRenameHandler.DEFAULT_NAME, newName);
final JavaFxPropertyRenameHandler renameHandler = new JavaFxPropertyRenameHandler();
assertTrue(renameHandler.isAvailableOnDataContext(dataContext));
renameHandler.invoke(getProject(), getEditor(), null, dataContext);
myFixture.checkResultByFile(getTestName(true) + "_after.fxml");
final PsiClass psiClass = myFixture.findClass(className);
assertNotNull(psiClass);
return psiClass;
}
use of com.intellij.testFramework.MapDataContext in project kotlin by JetBrains.
the class AbstractHierarchyTest method getDataContext.
private DataContext getDataContext() {
Editor editor = getEditor();
PsiFile psiFile = getFile();
MapDataContext context = new MapDataContext();
context.put(CommonDataKeys.PROJECT, getProject());
context.put(CommonDataKeys.EDITOR, editor);
context.put(CommonDataKeys.PSI_ELEMENT, psiFile.findElementAt(editor.getCaretModel().getOffset()));
return context;
}
Aggregations