Skip to content

Commit

Permalink
#2088 fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgen Vidolob committed Aug 11, 2016
1 parent 965c474 commit 47e18b6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import com.google.inject.Singleton;

import org.eclipse.che.api.promises.client.Function;
import org.eclipse.che.api.promises.client.Operation;
import org.eclipse.che.api.promises.client.OperationException;
import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.api.data.tree.Node;
import org.eclipse.che.ide.api.editor.EditorAgent;
Expand Down Expand Up @@ -64,33 +62,35 @@ public void openFile(final String filePath, final TextRange selectionRange) {
return;
}

appContext.getWorkspaceRoot().getFile(filePath).then(new Operation<Optional<File>>() {
@Override
public void apply(Optional<File> file) throws OperationException {
if (file.isPresent()) {
selectNode();
}
}
}).then(new Operation<Optional<File>>() {
@Override
public void apply(Optional<File> file) throws OperationException {
if (file.isPresent()) {
openNode(selectionRange);
}
}
});
appContext.getWorkspaceRoot().getFile(filePath).then(openNode(selectionRange));

// .then(new Operation<Optional<File>>() {
// @Override
// public void apply(Optional<File> file) throws OperationException {
// if (file.isPresent()) {
// selectNode();
// }
// }
// }).then(new Operation<Optional<File>>() {
// @Override
// public void apply(Optional<File> file) throws OperationException {
// if (file.isPresent()) {
// openNode(selectionRange);
// }
// }
// });
}

public void openFile(String filePath) {
openFile(filePath, null);
}

private Function<Node, Node> openNode(final TextRange selectionRange) {
return new Function<Node, Node>() {
private Function<Optional<File>, Optional<File>> openNode(final TextRange selectionRange) {
return new Function<Optional<File>, Optional<File>>() {
@Override
public Node apply(Node node) {
if (node instanceof VirtualFile) {
openFile((VirtualFile)node, selectionRange);
public Optional<File> apply(Optional<File> node) {
if(node.isPresent()){
openFile(node.get(), selectionRange);
}
return node;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public WorkspaceService(LanguageServerRegistry registry) {
public List<? extends SymbolInformation> documentSymbol(WorkspaceSymbolParamsDTO workspaceSymbolParams) throws ExecutionException,
InterruptedException,
LanguageServerException {
LanguageServer server = getServer(workspaceSymbolParams.getFileUri());
LanguageServer server = getServer(TextDocumentService.prefixURI(workspaceSymbolParams.getFileUri()));
if (server == null) {
return emptyList();
}
Expand Down

0 comments on commit 47e18b6

Please sign in to comment.