01: /*******************************************************************************
02: * Copyright (c) 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.refactoring;
11:
12: import org.eclipse.core.resources.IFile;
13: import org.eclipse.ltk.core.refactoring.TextFileChange;
14: import org.eclipse.osgi.util.ManifestElement;
15: import org.eclipse.pde.internal.core.text.bundle.PDEManifestElement;
16: import org.osgi.framework.BundleException;
17:
18: public class MoveFromChange extends TextFileChange {
19:
20: PDEManifestElement[] fElements;
21:
22: public MoveFromChange(String name, IFile file) {
23: super (name, file);
24: }
25:
26: public ManifestElement[] getMovedElements() {
27: ManifestElement[] result = new ManifestElement[fElements.length];
28: try {
29: for (int i = 0; i < fElements.length; i++) {
30: String value = fElements[i].write();
31: String name = fElements[i].getHeader().getName();
32: result[i] = ManifestElement.parseHeader(name, value)[0];
33: }
34: } catch (BundleException e) {
35: }
36: return result;
37: }
38:
39: public String getMovedText(int index) {
40: return fElements[index].write();
41: }
42:
43: public void setMovedElements(PDEManifestElement[] elements) {
44: fElements = elements;
45: }
46:
47: public String getPackageName(int index) {
48: return fElements[index].getValue();
49: }
50:
51: }
|