KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > intro > impl > model > IntroHead


1 /*******************************************************************************
2  * Copyright (c) 2004, 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
12 package org.eclipse.ui.internal.intro.impl.model;
13
14 import org.eclipse.core.runtime.IConfigurationElement;
15 import org.eclipse.ui.internal.intro.impl.model.util.BundleUtil;
16 import org.osgi.framework.Bundle;
17 import org.w3c.dom.Element JavaDoc;
18
19 /**
20  * An intro Head element. Head elements are only interpreted for HTML case. They
21  * are always inlined. Ignored in UI Forms case.
22  */

23 public class IntroHead extends AbstractIntroElement {
24
25     protected static final String JavaDoc TAG_HEAD = "head"; //$NON-NLS-1$
26

27     private static final String JavaDoc ATT_SRC = "src"; //$NON-NLS-1$
28
// default encoding is UTF-8
29
private static final String JavaDoc ATT_ENCODING = "encoding"; //$NON-NLS-1$
30

31     private String JavaDoc src;
32     private String JavaDoc encoding;
33
34     IntroHead(IConfigurationElement element) {
35         super(element);
36         src = element.getAttribute(ATT_SRC);
37         encoding = element.getAttribute(ATT_ENCODING);
38         if (encoding == null)
39             encoding = "UTF-8"; //$NON-NLS-1$
40

41         // Resolve.
42
src = BundleUtil.getResourceLocation(src, element);
43     }
44
45
46     IntroHead(Element element, Bundle bundle, String JavaDoc base) {
47         super(element, bundle);
48         src = getAttribute(element, ATT_SRC);
49         encoding = getAttribute(element, ATT_ENCODING);
50         if (encoding == null)
51             encoding = "UTF-8"; //$NON-NLS-1$
52

53         // Resolve.
54
src = BundleUtil.getResolvedResourceLocation(base, src, bundle);
55     }
56
57
58     /**
59      * @return Returns the src.
60      */

61     public String JavaDoc getSrc() {
62         return src;
63     }
64
65     /**
66      * @return Returns the encoding of the inlined file. Default is UTF-8.
67      */

68     public String JavaDoc getInlineEncoding() {
69         return encoding;
70     }
71
72
73     /*
74      * (non-Javadoc)
75      *
76      * @see org.eclipse.ui.internal.intro.impl.model.IntroElement#getType()
77      */

78     public int getType() {
79         return AbstractIntroElement.HEAD;
80     }
81
82 }
83
Popular Tags