KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > wizards > Category


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.pde.internal.ui.wizards;
12
13 import java.util.StringTokenizer JavaDoc;
14
15 import org.eclipse.core.runtime.IConfigurationElement;
16
17 public class Category {
18     private IConfigurationElement config;
19     private String JavaDoc [] parentCategoryPath;
20     public static final String JavaDoc ATT_ID="id"; //$NON-NLS-1$
21
public static final String JavaDoc ATT_CATEGORY="parentCategory"; //$NON-NLS-1$
22
public static final String JavaDoc ATT_NAME="name"; //$NON-NLS-1$
23

24 public Category(IConfigurationElement aConfig) {
25     config = aConfig;
26 }
27 public String JavaDoc getID() {
28     return config.getAttribute(ATT_ID);
29 }
30 public String JavaDoc getLabel() {
31     return config.getAttribute(ATT_NAME);
32 }
33 public String JavaDoc[] getParentCategoryPath() {
34     if (parentCategoryPath!=null) return parentCategoryPath;
35     String JavaDoc category = config.getAttribute(ATT_CATEGORY);
36     if (category==null) return null;
37     StringTokenizer JavaDoc stok = new StringTokenizer JavaDoc(category, "/"); //$NON-NLS-1$
38
parentCategoryPath = new String JavaDoc [stok.countTokens()];
39     for (int i=0; stok.hasMoreTokens(); i++) {
40         parentCategoryPath[i]=stok.nextToken();
41     }
42     return parentCategoryPath;
43     
44
45 }
46 }
47
Popular Tags