]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-after/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/nls/search/FileEntry.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-after / ui refactoring / org / eclipse / jdt / internal / ui / refactoring / nls / search / FileEntry.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11
12 package org.eclipse.jdt.internal.ui.refactoring.nls.search;
13
14 import java.util.Arrays;
15 import java.util.Iterator;
16 import java.util.Set;
17
18 import org.eclipse.core.runtime.IAdaptable;
19
20 import org.eclipse.core.resources.IFile;
21 import org.eclipse.core.resources.IResource;
22
23 import org.eclipse.search.ui.text.Match;
24
25 public class FileEntry implements IAdaptable {
26
27         private IFile fPropertiesFile;
28         private String fMessage;
29
30         public FileEntry(IFile propertiesFile, String message) {
31                 fPropertiesFile= propertiesFile;
32                 fMessage= message;
33         }
34
35         public IFile getPropertiesFile() {
36                 return fPropertiesFile;
37         }
38
39         public String getMessage() {
40                 return fMessage;
41         }
42
43         @Override
44         public String toString() {
45                 return fMessage;
46         }
47
48         public Object getAdapter(Class adapter) {
49                 if (IResource.class.equals(adapter))
50                         return fPropertiesFile;
51                 return null;
52         }
53
54         public void generated_6187658147420924307(IFile file, Set<Match> matches, NLSSearchResult nlssearchresult) {
55                 if (getPropertiesFile().equals(file)) {
56                         matches.addAll(Arrays.asList(nlssearchresult.getMatches(this)));
57                 }
58         }
59
60         public void generated_2140360628205478014(NLSSearchResultRequestor nlssearchresultrequestor, Iterator<Object> iter) {
61                 while (iter.hasNext()) {
62                         String propertyName= (String) iter.next();
63                         nlssearchresultrequestor.addMatch(this, propertyName);
64                 }
65                 nlssearchresultrequestor.fResult.addFileEntryGroup(this);
66         }
67 }