01: /*******************************************************************************
02: * Copyright (c) 2005, 2007 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.core.text.bundle;
11:
12: import org.eclipse.osgi.util.ManifestElement;
13: import org.eclipse.pde.internal.core.ibundle.IBundle;
14:
15: public class ImportPackageHeader extends BasePackageHeader {
16:
17: private static final long serialVersionUID = 1L;
18:
19: public ImportPackageHeader(String name, String value,
20: IBundle bundle, String lineDelimiter) {
21: super (name, value, bundle, lineDelimiter);
22: }
23:
24: protected PDEManifestElement createElement(ManifestElement element) {
25: return new ImportPackageObject(this , element,
26: getVersionAttribute());
27: }
28:
29: public ImportPackageObject getPackage(String packageName) {
30: return (fElementMap == null) ? null
31: : (ImportPackageObject) fElementMap.get(packageName);
32: }
33:
34: public ImportPackageObject[] getPackages() {
35: PDEManifestElement[] elements = getElements();
36: ImportPackageObject[] result = new ImportPackageObject[elements.length];
37: System.arraycopy(elements, 0, result, 0, elements.length);
38: return result;
39: }
40:
41: public ImportPackageObject addPackage(String id) {
42: ImportPackageObject obj = new ImportPackageObject(this, id,
43: null, getVersionAttribute());
44: addManifestElement(obj);
45: return obj;
46: }
47:
48: }
|