use of org.eclipse.n4js.workspace.locations.FileURI in project n4js by eclipse.
the class AbstractIdeTest method createFile.
/**
* Same as {@link #createFile(FileURI, CharSequence)}, using the {@link #DEFAULT_SOURCE_FOLDER}.
*/
protected void createFile(String projectName, String modulePathAndName, CharSequence content) {
FileURI projectRoot = toFileURI(getProjectRoot(projectName));
NameAndExtension nameAndExt = testWorkspaceManager.getN4JSNameAndExtension(modulePathAndName);
String filePathAndName = nameAndExt.extension == null ? modulePathAndName + "." + TestWorkspaceManager.DEFAULT_EXTENSION : modulePathAndName;
FileURI fileURI = projectRoot.resolve(DEFAULT_SOURCE_FOLDER).resolve(filePathAndName);
createFile(fileURI, content);
}
use of org.eclipse.n4js.workspace.locations.FileURI in project n4js by eclipse.
the class AbstractIdeTest method renameFile.
/**
* Same as {@link #renameFileOnDiskWithoutNotification(FileURI, String)}, but also notifies the server.
*/
protected void renameFile(FileURI fileURI, String newFileNameIncludingExtension) {
FileURI fileURIRenamed = fileURI.getParent().appendSegment(newFileNameIncludingExtension);
internalMoveFile(fileURI, fileURIRenamed, true);
}
use of org.eclipse.n4js.workspace.locations.FileURI in project n4js by eclipse.
the class AbstractIdeTest method changeNonOpenedFile.
/**
* Change a non-opened file <em>on disk</em> and notify the LSP server.
* <p>
* Use method {@link #changeOpenedFile(String, Pair...)} instead if the file was previously opened with one of the
* {@link #openFile(FileURI) #openFile()} methods.
*
* @param modification
* a function returning the desired new content when given the file's current content on disk.
*/
protected void changeNonOpenedFile(String moduleName, Function<String, ? extends CharSequence> modification) {
FileURI fileURI = getFileURIFromModuleName(moduleName);
changeNonOpenedFile(fileURI, modification);
}
use of org.eclipse.n4js.workspace.locations.FileURI in project n4js by eclipse.
the class AbstractIdeTest method openFile.
/**
* Same as {@link #openFile(FileURI)}, accepting a module name instead of a file URI.
*/
protected void openFile(String moduleName) {
FileURI fileURI = getFileURIFromModuleName(moduleName);
openFile(fileURI);
}
use of org.eclipse.n4js.workspace.locations.FileURI in project n4js by eclipse.
the class AbstractIdeTest method assertOutputFileContains.
/**
* Asserts the output file of the given module located in the given project contains the given sub-string.
*/
protected void assertOutputFileContains(String projectName, String moduleName, CharSequence expectedSubString) {
FileURI outputFileURI = toFileURI(getOutputFile(projectName, moduleName));
String outputCode = getContentOfFileOnDisk(outputFileURI);
Assert.assertTrue("output code did not contain the expected sub-string:\n" + "EXPECTED SUB-STRING: " + expectedSubString + "\n" + "ACTUAL OUTPUT CODE:\n" + outputCode, outputCode.contains(expectedSubString));
}
Aggregations