Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Vitalii Parfonov <vparfonov@redhat.com>
  • Loading branch information
vparfonov committed Dec 22, 2017
1 parent a8f6104 commit 4546a1f
Showing 1 changed file with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,16 @@
import static org.eclipse.che.ide.api.jsonrpc.Constants.WS_AGENT_JSON_RPC_ENDPOINT_ID;
import static org.eclipse.che.ide.util.NameUtils.getFileExtension;

import com.google.common.base.Optional;
import com.google.gwt.http.client.URL;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.util.List;
import org.eclipse.che.api.core.jsonrpc.commons.RequestTransmitter;
import org.eclipse.che.api.project.shared.dto.ProjectSearchRequestDto;
import org.eclipse.che.api.project.shared.dto.ProjectSearchResponseDto;
import org.eclipse.che.api.promises.client.Operation;
import org.eclipse.che.api.promises.client.OperationException;
import org.eclipse.che.api.project.shared.dto.SearchResultDto;
import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.api.editor.EditorAgent;
import org.eclipse.che.ide.api.resources.File;
import org.eclipse.che.ide.dto.DtoFactory;
import org.eclipse.che.ide.resource.Path;
import org.eclipse.che.ide.util.loging.Log;
Expand Down Expand Up @@ -76,12 +74,9 @@ public void onFileSelected(Path path) {
.getWorkspaceRoot()
.getFile(path)
.then(
new Operation<Optional<File>>() {
@Override
public void apply(Optional<File> optFile) throws OperationException {
if (optFile.isPresent()) {
editorAgent.openEditor(optFile.get());
}
optFile -> {
if (optFile.isPresent()) {
editorAgent.openEditor(optFile.get());
}
});
}
Expand Down Expand Up @@ -111,13 +106,14 @@ public void onFileNameChanged(String fileName) {
}

private void prepareResults(ProjectSearchResponseDto response) {
List<SearchResultDto> results = response.getItemReferences();
sort(
response.getItemReferences(),
results,
(o1, o2) -> {
String ext1 = getFileExtension(o1.getItemReference().getName());
String ext2 = getFileExtension(o2.getItemReference().getName());
return ext1.compareToIgnoreCase(ext2);
});
view.showItems(response.getItemReferences());
view.showItems(results);
}
}

0 comments on commit 4546a1f

Please sign in to comment.