Source:
private void openExternalResource(final Location location, final AsyncCallback<VirtualFile> callback) { final NodeSettings nodeSettings = javaNodeManager.getJavaSettingsProvider().getSettings(); final JavaNodeFactory javaNodeFactory = javaNodeManager.getJavaNodeFactory(); String className = prepareFQN(location.getTarget()); final JarEntry jarEntry = dtoFactory.createDto(JarEntry.class); jarEntry.setPath(className); jarEntry.setName(className.substring(className.lastIndexOf(".") + 1) + ".class"); jarEntry.setType(CLASS_FILE); final String projectPath = location.getProjectPath(); projectServiceClient.getProject(appContext.getDevMachine(), projectPath) .then(new Function<ProjectConfigDto, JarFileNode>() { @Override public JarFileNode apply(ProjectConfigDto projectConfigDto) throws FunctionException { return javaNodeFactory.newJarFileNode(jarEntry, null, projectConfigDto, nodeSettings); } }) .then(new Operation<JarFileNode>() { @Override public void apply(final JarFileNode jarFileNode) throws OperationException { AsyncCallback<VirtualFile> downloadSourceCallBack = new AsyncCallback<VirtualFile>() { HandlerRegistration handler; @Override public void onSuccess(VirtualFile result) { if (jarFileNode.isContentGenerated()) { handler = eventBus.addHandler(TYPE, new FileContentUpdatedEventHandler() { @Override public void onFileSourceDownloaded(FileContentUpdatedEvent fileSourceDownloadedEvent) { handleActivateFile(jarFileNode, callback, location.getLineNumber()); handler.removeHandler(); } }); } else { handleActivateFile(jarFileNode, callback, location.getLineNumber()); } } @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } }; handleActivateFile(jarFileNode, downloadSourceCallBack, location.getLineNumber()); } }) .catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError arg) throws OperationException { callback.onFailure(arg.getCause()); } }); }

Target:
private void openExternalResource(final Location location, final AsyncCallback<VirtualFile> callback) { final NodeSettings nodeSettings = javaNodeManager.getJavaSettingsProvider().getSettings(); final JavaNodeFactory javaNodeFactory = javaNodeManager.getJavaNodeFactory(); String className = extractOuterClassFqn(location.getTarget()); final JarEntry jarEntry = dtoFactory.createDto(JarEntry.class); jarEntry.setPath(className); jarEntry.setName(className.substring(className.lastIndexOf(".") + 1) + ".class"); jarEntry.setType(CLASS_FILE); final String projectPath = location.getResourceProjectPath(); projectService.getProject(appContext.getDevMachine(), projectPath) .then(new Function<ProjectConfigDto, JarFileNode>() { @Override public JarFileNode apply(ProjectConfigDto projectConfigDto) throws FunctionException { return javaNodeFactory.newJarFileNode(jarEntry, null, projectConfigDto, nodeSettings); } }) .then(new Operation<JarFileNode>() { @Override public void apply(final JarFileNode jarFileNode) throws OperationException { AsyncCallback<VirtualFile> downloadSourceCallback = new AsyncCallback<VirtualFile>() { @Override public void onSuccess(final VirtualFile result) { if (jarFileNode.isContentGenerated()) { handleContentGeneratedResource(result, location, callback); } else { handleActivatedFile(jarFileNode, callback, location.getLineNumber()); } } @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } }; handleActivatedFile(jarFileNode, downloadSourceCallback, location.getLineNumber()); } }) .catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError arg) throws OperationException { callback.onFailure(arg.getCause()); } }); }