KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > refactoring > MoveFromChange


1 /*******************************************************************************
2  * Copyright (c) 2005 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 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 JavaDoc 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 JavaDoc value = fElements[i].write();
32                 String JavaDoc 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 JavaDoc getMovedText(int index) {
41         return fElements[index].write();
42     }
43     
44     public void setMovedElements(PDEManifestElement[] elements) {
45         fElements = elements;
46     }
47     
48     public String JavaDoc getPackageName(int index) {
49         return fElements[index].getValue();
50     }
51
52 }
53
Popular Tags