protected void findInProject(final Location location, final AsyncCallback<VirtualFile> callback) { Resource resource = appContext.getResource(); if (resource == null) { callback.onFailure(new IllegalStateException("Resource is undefined")); return; } Optional<Project> project = resource.getRelatedProject(); if (!project.isPresent()) { callback.onFailure(new IllegalStateException("Project is undefined")); return; } project .get() .getFile(location.getTarget()) .then( file -> { if (file.isPresent()) { callback.onSuccess(file.get()); } else { callback.onFailure(new IllegalArgumentException(location + " not found.")); } }) .catchError( error -> { callback.onFailure(new IllegalArgumentException(location + " not found.")); }); }
.getFile(alteredFiles.getFileByIndex(currentFileIndex)) .then( file -> {