@Test(dependsOnMethods = "testOpenFile", expectedExceptions = WorkspaceDocumentException.class) public void testOpenFileOnAlreadyOpenFile() throws IOException, WorkspaceDocumentException { documentManager.openFile(filePath, readAll(filePath.toFile())); }
@Override public void openFile(Path filePath, String content) throws WorkspaceDocumentException { if (isFileOpen(filePath)) { throw new WorkspaceDocumentException( "File " + filePath.toString() + " is already opened in document manager." ); } documentList.put(filePath, new DocumentPair(new WorkspaceDocument(filePath, content))); LSDocumentIdentifier document = new LSDocumentIdentifierImpl(filePath.toUri().toString()); if (document.isWithinProject()) { rescanProjectRoot(filePath); } }
WorkspaceDocumentManagerImpl implements WorkspaceDocumentManager { @Override public void openFile(Path filePath, String content) throws WorkspaceDocumentException { if (isFileOpen(filePath)) { throw new WorkspaceDocumentException( "File " + filePath.toString() + " is already opened in document manager." ); } documentList.put(filePath, new DocumentPair(new WorkspaceDocument(filePath, content))); LSDocumentIdentifier document = new LSDocumentIdentifierImpl(filePath.toUri().toString()); if (document.isWithinProject()) { rescanProjectRoot(filePath); } } }
WorkspaceDocumentManagerImpl implements WorkspaceDocumentManager { @Override public void openFile(Path filePath, String content) throws WorkspaceDocumentException { if (isFileOpen(filePath)) { throw new WorkspaceDocumentException( "File " + filePath.toString() + " is already opened in document manager." ); } documentList.put(filePath, new DocumentPair(new WorkspaceDocument(filePath, content))); LSDocumentIdentifier document = new LSDocumentIdentifierImpl(filePath.toUri().toString()); if (document.isWithinProject()) { rescanProjectRoot(filePath); } } protected  WorkspaceDocumentManagerImpl(); }
WorkspaceDocumentManagerImpl implements WorkspaceDocumentManager { @Override public void openFile(Path filePath, String content) throws WorkspaceDocumentException { if (isFileOpen(filePath)) { throw new WorkspaceDocumentException( "File " + filePath.toString() + " is already opened in document manager." ); } documentList.put(filePath, new DocumentPair(new WorkspaceDocument(filePath, content))); LSDocumentIdentifier document = new LSDocumentIdentifierImpl(filePath.toUri().toString()); if (document.isWithinProject()) { rescanProjectRoot(filePath); } } protected  WorkspaceDocumentManagerImpl(); static WorkspaceDocumentManagerImpl getInstance(); @Override boolean isFileOpen(Path filePath); @Override void openFile(Path filePath, String content); @Override void updateFile(Path filePath, List<TextDocumentContentChangeEvent> changeEvent); @Override void setCodeLenses(Path filePath, List<CodeLens> codeLens); @Override void closeFile(Path filePath); @Override List<CodeLens> getCodeLenses(Path filePath); @Override LSDocumentIdentifier getLSDocument(Path filePath); @Override String getFileContent(Path filePath); @Override Optional<Lock> lockFile(Path filePath); @Override Set<Path> getAllFilePaths(); @Override void clearAllFilePaths(); @Override SyntaxTree getTree(Path filePath); @Override void setTree(Path filePath, SyntaxTree newTree); }
WorkspaceDocumentManagerImpl implements WorkspaceDocumentManager { @Override public void openFile(Path filePath, String content) throws WorkspaceDocumentException { if (isFileOpen(filePath)) { throw new WorkspaceDocumentException( "File " + filePath.toString() + " is already opened in document manager." ); } documentList.put(filePath, new DocumentPair(new WorkspaceDocument(filePath, content))); LSDocumentIdentifier document = new LSDocumentIdentifierImpl(filePath.toUri().toString()); if (document.isWithinProject()) { rescanProjectRoot(filePath); } } protected  WorkspaceDocumentManagerImpl(); static WorkspaceDocumentManagerImpl getInstance(); @Override boolean isFileOpen(Path filePath); @Override void openFile(Path filePath, String content); @Override void updateFile(Path filePath, List<TextDocumentContentChangeEvent> changeEvent); @Override void setCodeLenses(Path filePath, List<CodeLens> codeLens); @Override void closeFile(Path filePath); @Override List<CodeLens> getCodeLenses(Path filePath); @Override LSDocumentIdentifier getLSDocument(Path filePath); @Override String getFileContent(Path filePath); @Override Optional<Lock> lockFile(Path filePath); @Override Set<Path> getAllFilePaths(); @Override void clearAllFilePaths(); @Override SyntaxTree getTree(Path filePath); @Override void setTree(Path filePath, SyntaxTree newTree);  }