1 11 package org.eclipse.search.ui.text; 12 import org.eclipse.search.ui.ISearchResult; 13 import org.eclipse.search.ui.SearchResultEvent; 14 23 public class MatchEvent extends SearchResultEvent { 24 private static final long serialVersionUID = 6009335074727417445L; 25 private int fKind; 26 private Match[] fMatches; 27 private Match[] fMatchContainer = new Match[1]; 28 33 public static final int ADDED = 1; 34 39 public static final int REMOVED = 2; 40 41 private static final Match[] fgEmtpyMatches = new Match[0]; 42 43 48 public MatchEvent(ISearchResult searchResult) { 49 super(searchResult); 50 } 51 52 57 public int getKind() { 58 return fKind; 59 } 60 65 public Match[] getMatches() { 66 if (fMatches != null) 67 return fMatches; 68 else if (fMatchContainer[0] != null) 69 return fMatchContainer; 70 else 71 return fgEmtpyMatches; 72 } 73 74 79 protected void setKind(int kind) { 80 fKind = kind; 81 } 82 87 protected void setMatch(Match match) { 88 fMatchContainer[0] = match; 89 fMatches = null; 90 } 91 92 97 protected void setMatches(Match[] matches) { 98 fMatchContainer[0] = null; 99 fMatches = matches; 100 } 101 } 102 | Popular Tags |