blob: 835543ebd82434fe1ea61e75977556622505e2ea (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/*******************************************************************************
* Copyright (c) 2007-2012 Wind River Systems, Inc. and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
*******************************************************************************/
package org.eclipse.cdt.debug.ui.memory.search;
import java.util.Enumeration;
import java.util.Vector;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.ISearchResult;
import org.eclipse.search.ui.ISearchResultListener;
import org.eclipse.search.ui.SearchResultEvent;
public class MemorySearchResult implements ISearchResult {
private ISearchQuery fQuery;
private String fLabel;
private Vector<ISearchResultListener> listeners = new Vector<ISearchResultListener>();
private Vector<MemoryMatch> fMatches = new Vector<MemoryMatch>();
public MemorySearchResult(ISearchQuery query, String label) {
fQuery = query;
fLabel = label;
}
public ImageDescriptor getImageDescriptor() {
return null;
}
public String getLabel() {
return fLabel;
}
public ISearchQuery getQuery() {
return fQuery;
}
public String getTooltip() {
return fLabel;
}
public MemoryMatch[] getMatches() {
MemoryMatch matches[] = new MemoryMatch[fMatches.size()];
for (int i = 0; i < matches.length; i++)
matches[i] = fMatches.elementAt(i);
return matches;
}
public void addMatch(MemoryMatch address) {
fMatches.addElement(address);
fireChange();
}
private void fireChange() {
Enumeration<ISearchResultListener> en = listeners.elements();
while (en.hasMoreElements()) {
en.nextElement().searchResultChanged(new SearchResultEvent(this) {
private static final long serialVersionUID = -1435449002760145835L;
});
}
}
public void addListener(ISearchResultListener l) {
listeners.addElement(l);
}
public void removeListener(ISearchResultListener l) {
listeners.removeElement(l);
}
}
|