use of com.intellij.testFramework.LightVirtualFile in project intellij-community by JetBrains.
the class PythonRunConfigurationProducer method isConfigurationFromContext.
@Override
public boolean isConfigurationFromContext(PythonRunConfiguration configuration, ConfigurationContext context) {
final Location location = context.getLocation();
if (location == null)
return false;
final PsiFile script = location.getPsiElement().getContainingFile();
if (!isAvailable(location, script))
return false;
final VirtualFile virtualFile = script.getVirtualFile();
if (virtualFile == null)
return false;
if (virtualFile instanceof LightVirtualFile)
return false;
final String workingDirectory = configuration.getWorkingDirectory();
final String scriptName = configuration.getScriptName();
final String path = virtualFile.getPath();
return scriptName.equals(path) || path.equals(new File(workingDirectory, scriptName).getAbsolutePath());
}
use of com.intellij.testFramework.LightVirtualFile in project intellij-community by JetBrains.
the class PythonConsoleParsingTest method createFile.
@Override
protected PsiFile createFile(String name, String text) {
LightVirtualFile originalFile = new LightVirtualFile(name, myLanguage, text);
LightVirtualFile virtualFile = new LightVirtualFile(name, myLanguage, text);
virtualFile.setOriginalFile(originalFile);
originalFile.setCharset(CharsetToolkit.UTF8_CHARSET);
originalFile.putUserData(LanguageLevel.KEY, myLanguageLevel);
PyConsoleUtil.markIPython(originalFile);
return createFile(virtualFile);
}
use of com.intellij.testFramework.LightVirtualFile in project intellij-plugins by JetBrains.
the class LibraryUtil method getTestGlobalLibrary.
@TestOnly
static // we cannot use LocalFileSystem, because our test can run outside the idea
VirtualFile getTestGlobalLibrary(boolean isPlayer) {
String name = (isPlayer ? "player" : "air") + "-catalog.xml";
File file = new File(DebugPathManager.getTestDataPath() + "/lib/playerglobal", name);
assert file.exists();
try {
return new LightVirtualFile(name, XmlFileType.INSTANCE, IOUtil.getCharSequence(file), StandardCharsets.UTF_8, 0);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of com.intellij.testFramework.LightVirtualFile in project intellij-plugins by JetBrains.
the class LiveObjectsNode method getNavigatable.
@Override
public Navigatable getNavigatable() {
if (navigatableCache == null) {
final VirtualFile virtualFile = new LightVirtualFile(runConfigurationName, new LiveObjectsFileType(), "") {
@NotNull
@Override
public String getPath() {
return getName();
}
};
virtualFile.putUserData(ProfileData.CONTROLLER, liveModelController);
virtualFile.putUserData(ProfileData.PROFILING_MANAGER, profilingManager);
navigatableCache = new OpenFileDescriptor(module.getProject(), virtualFile);
}
return navigatableCache;
}
Aggregations