remove unneeded code

This commit is contained in:
Dmitry Jemerov
2011-05-24 21:12:28 +04:00
parent 75bbd0ead8
commit 093ea5c106
2 changed files with 2 additions and 36 deletions
@@ -1,35 +0,0 @@
package com.jetbrains.python.refactoring;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
/**
* @author oleg
*/
public class FileDataContext implements DataContext {
private final PsiFile myFile;
public FileDataContext(final PsiFile file) {
myFile = file;
}
@Override
@Nullable
public Object getData(@NonNls String dataId) {
if (LangDataKeys.LANGUAGE.is(dataId)) {
return myFile.getLanguage();
}
if (PlatformDataKeys.PROJECT.is(dataId)) {
return myFile.getProject();
}
if (LangDataKeys.PSI_FILE.is(dataId)) {
return myFile;
}
throw new IllegalArgumentException("Data not supported: " + dataId);
}
}
@@ -1,6 +1,7 @@
package com.jetbrains.python.refactoring;
import com.intellij.lang.LanguageRefactoringSupport;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.refactoring.RefactoringActionHandler;
import com.jetbrains.python.PythonLanguage;
import com.jetbrains.python.fixtures.LightMarkedTestCase;
@@ -19,7 +20,7 @@ public class PyExtractMethodTest extends LightMarkedTestCase {
try {
System.setProperty(PyExtractMethodUtil.NAME, name);
try {
handler.invoke(myFixture.getProject(), myFixture.getEditor(), myFixture.getFile(), new FileDataContext(myFixture.getFile()));
handler.invoke(myFixture.getProject(), myFixture.getEditor(), myFixture.getFile(), ((EditorEx) myFixture.getEditor()).getDataContext());
}
catch (Exception e) {
if (result.endsWith(".py")) { // expected output file, not an exception