Skip to content

Commit

Permalink
Revert "CHE-5174 Improving search results (eclipse-che#5874)" (eclips…
Browse files Browse the repository at this point in the history
…e-che#5988)

This reverts commit 83150f4.
  • Loading branch information
vparfonov authored and Dmytro Nochevnov committed Aug 16, 2017
1 parent 2a756ec commit a8c164d
Show file tree
Hide file tree
Showing 39 changed files with 211 additions and 1,296 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.eclipse.che.api.workspace.shared.dto.NewProjectConfigDto;
import org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto;
import org.eclipse.che.api.workspace.shared.dto.SourceStorageDto;
import org.eclipse.che.ide.api.resources.SearchResult;
import org.eclipse.che.ide.resource.Path;

import java.util.List;
Expand Down Expand Up @@ -258,7 +257,7 @@ public interface ProjectServiceClient {
* @see ItemReference
* @since 4.4.0
*/
Promise<List<SearchResult>> search(QueryExpression expression);
Promise<List<ItemReference>> search(QueryExpression expression);

/**
* Gets list of {@link SourceEstimation} for all supposed project types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,39 @@
import org.eclipse.che.api.project.shared.dto.CopyOptions;
import org.eclipse.che.api.project.shared.dto.ItemReference;
import org.eclipse.che.api.project.shared.dto.MoveOptions;
import org.eclipse.che.api.project.shared.dto.SearchResultDto;
import org.eclipse.che.api.project.shared.dto.SourceEstimation;
import org.eclipse.che.api.project.shared.dto.TreeElement;
import org.eclipse.che.api.promises.client.Function;
import org.eclipse.che.api.promises.client.Promise;
import org.eclipse.che.api.workspace.shared.dto.NewProjectConfigDto;
import org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto;
import org.eclipse.che.api.workspace.shared.dto.SourceStorageDto;
import org.eclipse.che.ide.MimeType;
import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.api.machine.WsAgentStateController;
import org.eclipse.che.ide.api.resources.SearchResult;
import org.eclipse.che.ide.dto.DtoFactory;
import org.eclipse.che.ide.resource.Path;
import org.eclipse.che.ide.rest.AsyncRequestFactory;
import org.eclipse.che.ide.rest.DtoUnmarshallerFactory;
import org.eclipse.che.ide.rest.StringUnmarshaller;
import org.eclipse.che.ide.rest.UrlBuilder;
import org.eclipse.che.ide.ui.loaders.request.LoaderFactory;
import org.eclipse.che.ide.websocket.Message;
import org.eclipse.che.ide.websocket.MessageBuilder;
import org.eclipse.che.ide.websocket.WebSocketException;
import org.eclipse.che.ide.websocket.rest.RequestCallback;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static com.google.common.base.Strings.isNullOrEmpty;
import static com.google.gwt.http.client.RequestBuilder.DELETE;
import static com.google.gwt.http.client.RequestBuilder.POST;
import static com.google.gwt.http.client.RequestBuilder.PUT;
import static com.google.gwt.safehtml.shared.UriUtils.encodeAllowEscapes;
import static org.eclipse.che.api.promises.client.callback.AsyncPromiseHelper.createFromAsyncRequest;
import static org.eclipse.che.ide.MimeType.APPLICATION_JSON;
import static org.eclipse.che.ide.rest.HTTPHeader.ACCEPT;
import static org.eclipse.che.ide.rest.HTTPHeader.CONTENTTYPE;
import static org.eclipse.che.ide.rest.HTTPHeader.CONTENT_TYPE;

/**
Expand Down Expand Up @@ -141,7 +143,7 @@ public Promise<Void> importProject(Path path, SourceStorageDto source) {

/** {@inheritDoc} */
@Override
public Promise<List<SearchResult>> search(QueryExpression expression) {
public Promise<List<ItemReference>> search(QueryExpression expression) {
final String url =
encodeAllowEscapes(getBaseUrl() + SEARCH + (isNullOrEmpty(expression.getPath()) ? Path.ROOT : path(expression.getPath())));

Expand All @@ -162,13 +164,7 @@ public Promise<List<SearchResult>> search(QueryExpression expression) {
return reqFactory.createGetRequest(url + queryParameters.toString().replaceFirst("&", "?"))
.header(ACCEPT, MimeType.APPLICATION_JSON)
.loader(loaderFactory.newLoader("Searching..."))
.send(unmarshaller.newListUnmarshaller(SearchResultDto.class)).then(
(Function<List<SearchResultDto>, List<SearchResult>>)arg -> {
if (arg.isEmpty()) {
return Collections.emptyList();
}
return arg.stream().map(SearchResult::new).collect(Collectors.toList());
});
.send(unmarshaller.newListUnmarshaller(ItemReference.class));
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import org.eclipse.che.ide.resource.Path;
import org.eclipse.che.ide.util.NameUtils;

import java.util.List;

/**
* Interface for resource which may contain other resources (termed its members).
* <p/>
Expand Down Expand Up @@ -438,7 +436,7 @@ public interface Container extends Resource {
* @return the {@link Promise} with array of found results
* @since 4.4.0
*/
Promise<List<SearchResult>> search(String fileMask, String contentMask);
Promise<Resource[]> search(String fileMask, String contentMask);

/**
* Returns the plain list of file tree with given {@code depth}.
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,6 @@ public interface Resources extends Tree.Resources,
@Source("part/che-logo.svg")
SVGResource cheLogo();

@Source("searchMatch.svg")
SVGResource searchMatch();

/** Interface for css resources. */
interface CoreCss extends CssResource {
String editorPaneMenuDelimiter();
Expand Down Expand Up @@ -216,10 +213,7 @@ interface CoreCss extends CssResource {

String tagsPanel();

@ClassName("found-highlight")
String foundPhraseHighlight();

@ClassName("search-match")
String searchMatch();
@ClassName("codeassistant-highlight")
String codeassistantHighlight();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private void appendPlain(SafeHtmlBuilder builder, String text) {
}

private void appendHighlighted(SafeHtmlBuilder builder, String text) {
builder.appendHtmlConstant("<span class=\"" + resources.coreCss().foundPhraseHighlight() + "\">");
builder.appendHtmlConstant("<span class=\"" + resources.coreCss().codeassistantHighlight() + "\">");
builder.appendEscaped(text);
builder.appendHtmlConstant("</span>");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import com.google.inject.ImplementedBy;

import org.eclipse.che.api.project.shared.dto.SearchResultDto;
import org.eclipse.che.api.project.shared.dto.ItemReference;
import org.eclipse.che.ide.api.mvp.View;
import org.eclipse.che.ide.resource.Path;

Expand Down Expand Up @@ -67,6 +67,6 @@ interface ActionDelegate {
* @param items
* items of suggestions
*/
void showItems(List<SearchResultDto> items);
void showItems(List<ItemReference> items);

}
Loading

0 comments on commit a8c164d

Please sign in to comment.