Skip to main content
summaryrefslogtreecommitdiffstats
blob: 83145aa7bc38e1be56a0da07ede76e0a6a913a2a (plain) (blame)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*******************************************************************************
 * Copyright (c) 2004, 2016 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.ui.internal.intro.impl.model;

import org.osgi.framework.Bundle;
import org.w3c.dom.Element;

/**
 * An intro content provider element. This element allows intro page to
 * dynamically pull data from various sources (e.g., the web, eclipse, etc) and
 * provide content based on this dynamic data. The element's class must
 * implement the IIntroContentProvider interface. The pluginId attribute can be
 * used if the class doesn't come from the plugin that defined the markup. The
 * text content should be used only if we fail to load the class. <br>
 *
 * INTRO: model class has access to style-id attribute but it is not used in the
 * schema.
 */
public class IntroContentProvider extends AbstractTextElement {
    public static final String TAG_CONTENT_PROVIDER = "contentProvider"; //$NON-NLS-1$

    private static final String ATT_PLUGIN_ID = "pluginId"; //$NON-NLS-1$
    private static final String ATT_CLASS = "class"; //$NON-NLS-1$

    private String contentProvider;
    private String pluginId;


    public IntroContentProvider(Element element, Bundle bundle) {
        super(element, bundle);
        contentProvider = getAttribute(element, ATT_CLASS);
        pluginId = getAttribute(element, ATT_PLUGIN_ID);
    }

    /**
     * Returns the content provider, which should implement
     * IIntroContentProvider
     *
     * @return Returns the contentProvider.
     */
    public String getClassName() {
        return contentProvider;
    }

    /**
     * Returns the id of the plugin that contains the content provider class
     *
     * @return Returns the pluginId.
     */
    public String getPluginId() {
        return pluginId;
    }

    @Override
	public int getType() {
        return AbstractIntroElement.CONTENT_PROVIDER;
    }
}

Back to the top