]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-after/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/nls/search/NLSSearchEditorOpener.java
a4c63572944c581414aebb6d9a5d005b9d134b92
[ifi-stolz-refaktor.git] / case-study / jdt-after / ui refactoring / org / eclipse / jdt / internal / ui / refactoring / nls / search / NLSSearchEditorOpener.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 org.eclipse.search.ui.text.Match;
15
16 import org.eclipse.jdt.core.IJavaElement;
17
18 import org.eclipse.jdt.internal.ui.search.JavaSearchEditorOpener;
19
20 /**
21  */
22 public class NLSSearchEditorOpener extends JavaSearchEditorOpener {
23         @Override
24         protected Object getElementToOpen(Match match) {
25                 Object element= match.getElement();
26                 if (element instanceof IJavaElement) {
27                         return element;
28                 } else if (element instanceof FileEntry) {
29                         FileEntry fileEntry= (FileEntry) element;
30                         return fileEntry.getPropertiesFile();
31                 } else if (element instanceof CompilationUnitEntry) {
32                         return ((CompilationUnitEntry)element).getCompilationUnit();
33                 }
34                 // this should not happen
35                 return null;
36         }
37 }