Lines 10-16
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.jdt.core.search; |
11 |
package org.eclipse.jdt.core.search; |
12 |
|
12 |
|
13 |
import org.eclipse.jdt.internal.core.search.indexing.InternalSearchDocument; |
13 |
import org.eclipse.jdt.internal.compiler.SourceElementParser; |
|
|
14 |
import org.eclipse.jdt.internal.core.index.Index; |
14 |
|
15 |
|
15 |
/** |
16 |
/** |
16 |
* A search document encapsulates a content to be either indexed or searched in. |
17 |
* A search document encapsulates a content to be either indexed or searched in. |
Lines 21-27
Link Here
|
21 |
* |
22 |
* |
22 |
* @since 3.0 |
23 |
* @since 3.0 |
23 |
*/ |
24 |
*/ |
24 |
public abstract class SearchDocument extends InternalSearchDocument { |
25 |
public abstract class SearchDocument { |
|
|
26 |
private Index index; |
27 |
private String containerRelativePath; |
28 |
private SourceElementParser parser; |
25 |
private String documentPath; |
29 |
private String documentPath; |
26 |
private SearchParticipant participant; |
30 |
private SearchParticipant participant; |
27 |
|
31 |
|
Lines 47-53
Link Here
|
47 |
* @param key the key of the index entry |
51 |
* @param key the key of the index entry |
48 |
*/ |
52 |
*/ |
49 |
public void addIndexEntry(char[] category, char[] key) { |
53 |
public void addIndexEntry(char[] category, char[] key) { |
50 |
super.addIndexEntry(category, key); |
54 |
if (this.index != null) |
|
|
55 |
this.index.addIndexEntry(category, key, getContainerRelativePath()); |
51 |
} |
56 |
} |
52 |
|
57 |
|
53 |
/** |
58 |
/** |
Lines 88-93
Link Here
|
88 |
*/ |
93 |
*/ |
89 |
public abstract char[] getCharContents(); |
94 |
public abstract char[] getCharContents(); |
90 |
|
95 |
|
|
|
96 |
private String getContainerRelativePath() { |
97 |
if (this.containerRelativePath == null) |
98 |
this.containerRelativePath = this.index.containerRelativePath(getPath()); |
99 |
return this.containerRelativePath; |
100 |
} |
101 |
|
91 |
/** |
102 |
/** |
92 |
* Returns the encoding for this document. |
103 |
* Returns the encoding for this document. |
93 |
* <p> |
104 |
* <p> |
Lines 100-105
Link Here
|
100 |
public abstract String getEncoding(); |
111 |
public abstract String getEncoding(); |
101 |
|
112 |
|
102 |
/** |
113 |
/** |
|
|
114 |
* @nooverride This method is not intended to be re-implemented or extended by clients. |
115 |
* @noreference This method is not intended to be referenced by clients. |
116 |
*/ |
117 |
public SourceElementParser getParser() { |
118 |
return this.parser; |
119 |
} |
120 |
|
121 |
/** |
103 |
* Returns the participant that created this document. |
122 |
* Returns the participant that created this document. |
104 |
* |
123 |
* |
105 |
* @return the participant that created this document |
124 |
* @return the participant that created this document |
Lines 125-130
Link Here
|
125 |
* {@link SearchParticipant#indexDocument(SearchDocument document, org.eclipse.core.runtime.IPath indexPath)}. |
144 |
* {@link SearchParticipant#indexDocument(SearchDocument document, org.eclipse.core.runtime.IPath indexPath)}. |
126 |
*/ |
145 |
*/ |
127 |
public void removeAllIndexEntries() { |
146 |
public void removeAllIndexEntries() { |
128 |
super.removeAllIndexEntries(); |
147 |
if (this.index != null) |
|
|
148 |
this.index.remove(getContainerRelativePath()); |
149 |
} |
150 |
|
151 |
/** |
152 |
* @nooverride This method is not intended to be re-implemented or extended by clients. |
153 |
* @noreference This method is not intended to be referenced by clients. |
154 |
*/ |
155 |
public void setIndex(Index indexToSet) { |
156 |
this.index = indexToSet; |
157 |
} |
158 |
|
159 |
/** |
160 |
* @nooverride This method is not intended to be re-implemented or extended by clients. |
161 |
* @noreference This method is not intended to be referenced by clients. |
162 |
*/ |
163 |
public void setParser(SourceElementParser sourceElementParser) { |
164 |
this.parser = sourceElementParser; |
129 |
} |
165 |
} |
130 |
} |
166 |
} |