-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
line numbers are shown for matches multiple matches in the same file are shown individually when you click on a search result, the editor loads the file AND jumps straight to the matching line with all instances of the search term already highlighted Signed-off-by: Vitalii Parfonov <vparfonov@redhat.com>
- Loading branch information
Showing
40 changed files
with
1,304 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...he-core-ide-api/src/main/java/org/eclipse/che/ide/api/resources/SearchOccurrenceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2017 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.che.ide.api.resources; | ||
|
||
import org.eclipse.che.api.project.shared.SearchOccurrence; | ||
|
||
/** | ||
* @author Vitalii Parfonov | ||
*/ | ||
|
||
public class SearchOccurrenceImpl implements SearchOccurrence { | ||
|
||
private float score; | ||
private int endOffset; | ||
private int startOffset; | ||
private String phrase; | ||
private String lineContent; | ||
private int lineNumber; | ||
|
||
public SearchOccurrenceImpl(SearchOccurrence searchOccurrence) { | ||
score = searchOccurrence.getScore(); | ||
endOffset = searchOccurrence.getEndOffset(); | ||
startOffset = searchOccurrence.getStartOffset(); | ||
phrase = searchOccurrence.getPhrase(); | ||
lineContent = searchOccurrence.getLineContent(); | ||
lineNumber = searchOccurrence.getLineNumber(); | ||
} | ||
|
||
@Override | ||
public float getScore() { | ||
return score; | ||
} | ||
|
||
@Override | ||
public void setScore(float score) { | ||
this.score = score; | ||
} | ||
|
||
@Override | ||
public String getPhrase() { | ||
return phrase; | ||
} | ||
|
||
@Override | ||
public void setPhrase(String phrase) { | ||
this.phrase = phrase; | ||
} | ||
|
||
@Override | ||
public int getEndOffset() { | ||
return endOffset; | ||
} | ||
|
||
@Override | ||
public void setEndOffset(int endOffset) { | ||
this.endOffset = endOffset; | ||
} | ||
|
||
@Override | ||
public int getStartOffset() { | ||
return startOffset; | ||
} | ||
|
||
@Override | ||
public void setStartOffset(int startOffset) { | ||
this.startOffset = startOffset; | ||
} | ||
|
||
@Override | ||
public void setLineNumber(int lineNumber) { | ||
this.lineNumber = lineNumber; | ||
} | ||
|
||
@Override | ||
public int getLineNumber() { | ||
return lineNumber; | ||
} | ||
|
||
@Override | ||
public void setLineContent(String lineContent) { | ||
this.lineContent = lineContent; | ||
} | ||
|
||
@Override | ||
public String getLineContent() { | ||
return lineContent; | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/resources/SearchResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2017 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.che.ide.api.resources; | ||
|
||
import org.eclipse.che.api.project.shared.Constants; | ||
import org.eclipse.che.api.project.shared.SearchOccurrence; | ||
import org.eclipse.che.api.project.shared.dto.SearchOccurrenceDto; | ||
import org.eclipse.che.api.project.shared.dto.SearchResultDto; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Vitalii Parfonov | ||
*/ | ||
|
||
public class SearchResult { | ||
|
||
private String name; | ||
private String path; | ||
private String project; | ||
private String contentUrl; | ||
private List<SearchOccurrence> occurrences; | ||
|
||
public SearchResult(SearchResultDto searchResultDto) { | ||
name = searchResultDto.getItemReference().getName(); | ||
path = searchResultDto.getItemReference().getPath(); | ||
project = searchResultDto.getItemReference().getProject(); | ||
if (searchResultDto.getItemReference().getLink(Constants.LINK_REL_GET_CONTENT) != null) { | ||
contentUrl = searchResultDto.getItemReference().getLink(Constants.LINK_REL_GET_CONTENT).getHref(); | ||
} | ||
final List<SearchOccurrenceDto> dtos = searchResultDto.getSearchOccurrences(); | ||
occurrences = new ArrayList<>(dtos.size()); | ||
for (SearchOccurrence dto : dtos) { | ||
occurrences.add(new SearchOccurrenceImpl(dto)); | ||
} | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getPath() { | ||
return path; | ||
} | ||
|
||
public void setPath(String path) { | ||
this.path = path; | ||
} | ||
|
||
public String getProject() { | ||
return project; | ||
} | ||
|
||
public void setProject(String project) { | ||
this.project = project; | ||
} | ||
|
||
public List<SearchOccurrence> getOccurrences() { | ||
return occurrences; | ||
} | ||
|
||
public void setOccurrences(List<SearchOccurrence> occurrences) { | ||
this.occurrences = occurrences; | ||
} | ||
|
||
public String getContentUrl() { | ||
return contentUrl; | ||
} | ||
|
||
public void setContentUrl(String contentUrl) { | ||
this.contentUrl = contentUrl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.