1 11 package org.eclipse.jdt.internal.ui.refactoring; 12 13 import org.eclipse.core.runtime.CoreException; 14 15 import org.eclipse.jface.util.Assert; 16 17 import org.eclipse.jface.text.IRegion; 18 import org.eclipse.jface.text.Region; 19 20 import org.eclipse.ltk.internal.ui.refactoring.ChangeElement; 21 import org.eclipse.ltk.internal.ui.refactoring.PseudoLanguageChangeElement; 22 23 import org.eclipse.jdt.core.IJavaElement; 24 import org.eclipse.jdt.core.ISourceRange; 25 import org.eclipse.jdt.core.ISourceReference; 26 27 31 public class PseudoJavaChangeElement extends PseudoLanguageChangeElement { 32 33 private IJavaElement fJavaElement; 34 35 public PseudoJavaChangeElement(ChangeElement parent, IJavaElement element) { 36 super(parent); 37 fJavaElement= element; 38 Assert.isNotNull(fJavaElement); 39 } 40 41 46 public IJavaElement getJavaElement() { 47 return fJavaElement; 48 } 49 50 public Object getModifiedElement() { 51 return fJavaElement; 52 } 53 54 public IRegion getTextRange() throws CoreException { 55 ISourceRange range= ((ISourceReference)fJavaElement).getSourceRange(); 56 return new Region(range.getOffset(), range.getLength()); 57 } 58 } | Popular Tags |