1 11 package org.eclipse.pde.internal.ui.refactoring; 12 13 import org.eclipse.core.resources.IFile; 14 import org.eclipse.ltk.core.refactoring.TextFileChange; 15 import org.eclipse.osgi.util.ManifestElement; 16 import org.eclipse.pde.internal.core.text.bundle.PDEManifestElement; 17 import org.osgi.framework.BundleException; 18 19 public class MoveFromChange extends TextFileChange { 20 21 PDEManifestElement[] fElements; 22 23 public MoveFromChange(String name, IFile file) { 24 super(name, file); 25 } 26 27 public ManifestElement[] getMovedElements() { 28 ManifestElement[] result = new ManifestElement[fElements.length]; 29 try { 30 for (int i = 0; i < fElements.length; i++) { 31 String value = fElements[i].write(); 32 String name = fElements[i].getHeader().getName(); 33 result[i] = ManifestElement.parseHeader(name, value)[0]; 34 } 35 } catch (BundleException e) { 36 } 37 return result; 38 } 39 40 public String getMovedText(int index) { 41 return fElements[index].write(); 42 } 43 44 public void setMovedElements(PDEManifestElement[] elements) { 45 fElements = elements; 46 } 47 48 public String getPackageName(int index) { 49 return fElements[index].getValue(); 50 } 51 52 } 53 | Popular Tags |