KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 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.ui.internal.intro.impl.model;
12
13 import java.util.Hashtable JavaDoc;
14 import java.util.Map JavaDoc;
15
16 import org.eclipse.core.runtime.IConfigurationElement;
17 import org.eclipse.ui.internal.intro.impl.model.util.BundleUtil;
18 import org.osgi.framework.Bundle;
19 import org.w3c.dom.Element JavaDoc;
20
21
22 public class IntroTheme extends AbstractIntroIdElement {
23     private static final String JavaDoc ATT_PATH = "path"; //$NON-NLS-1$
24
private String JavaDoc name;
25     private String JavaDoc path;
26     private Hashtable JavaDoc properties;
27     
28     public IntroTheme(IConfigurationElement element) {
29         super(element);
30         name = element.getAttribute(name);
31         path = element.getAttribute(ATT_PATH);
32         path = BundleUtil.getResolvedResourceLocation(path, getBundle());
33         loadProperties(element);
34     }
35
36     public IntroTheme(Element element, Bundle bundle) {
37         super(element, bundle);
38     }
39
40     public IntroTheme(Element element, Bundle bundle, String JavaDoc base) {
41         super(element, bundle, base);
42     }
43     
44     public String JavaDoc getName() {
45         return name;
46     }
47     
48     public String JavaDoc getPath() {
49         return path;
50     }
51
52     public int getType() {
53         return THEME;
54     }
55     
56     public Map JavaDoc getProperties() {
57         return properties;
58     }
59     
60     private void loadProperties(IConfigurationElement element) {
61         IConfigurationElement [] children = element.getChildren("property"); //$NON-NLS-1$
62
if (children.length==0)
63             return;
64         properties = new Hashtable JavaDoc();
65         for (int i=0; i<children.length; i++) {
66             IConfigurationElement property = children[i];
67             String JavaDoc name = property.getAttribute("name"); //$NON-NLS-1$
68
String JavaDoc value = property.getAttribute("value"); //$NON-NLS-1$
69
if (name!=null && value!=null)
70                 properties.put(name, value);
71         }
72     }
73 }
74
Popular Tags