1 /******************************************************************************* 2 * Copyright (c) 2000, 2006 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.jdt.core.IJavaElement; 15 import org.eclipse.jdt.internal.ui.search.JavaSearchEditorOpener; 16 import org.eclipse.search.ui.text.Match; 17 18 /** 19 */ 20 public class NLSSearchEditorOpener extends JavaSearchEditorOpener { 21 protected Object getElementToOpen(Match match) { 22 Object element= match.getElement(); 23 if (element instanceof IJavaElement) { 24 return element; 25 } else if (element instanceof FileEntry) { 26 FileEntry fileEntry= (FileEntry) element; 27 return fileEntry.getPropertiesFile(); 28 } else if (element instanceof CompilationUnitEntry) { 29 return ((CompilationUnitEntry)element).getCompilationUnit(); 30 } 31 // this should not happen 32 return null; 33 } 34 } 35