1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*******************************************************************************
 *  Copyright (c) 2000, 2008 IBM Corporation and others.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 * 
 *  Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.pde.internal.ui.wizards;

import java.util.StringTokenizer;
import org.eclipse.core.runtime.IConfigurationElement;

public class Category {
    private IConfigurationElement config;
    private String[] parentCategoryPath;
    public static final String ATT_ID = "id"; //$NON-NLS-1$
    public static final String ATT_CATEGORY = "parentCategory"; //$NON-NLS-1$
    public static final String ATT_NAME = "name"; //$NON-NLS-1$

    public Category(IConfigurationElement aConfig) {
        config = aConfig;
    }

    public String getID() {
        return config.getAttribute(ATT_ID);
    }

    public String getLabel() {
        return config.getAttribute(ATT_NAME);
    }

    public String[] getParentCategoryPath() {
        if (parentCategoryPath != null)
            return parentCategoryPath;
        String category = config.getAttribute(ATT_CATEGORY);
        if (category == null)
            return null;
        StringTokenizer stok = new StringTokenizer(category, "/"); //$NON-NLS-1$
        parentCategoryPath = new String[stok.countTokens()];
        for (int i = 0; stok.hasMoreTokens(); i++) {
            parentCategoryPath[i] = stok.nextToken();
        }
        return parentCategoryPath;

    }
}
			
			

Browsed Source: [clear]