01: /*******************************************************************************
02: * Copyright (c) 2004, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.intro.impl.model;
11:
12: import org.osgi.framework.Bundle;
13: import org.w3c.dom.Element;
14:
15: /**
16: * An intro content provider element. This element allows intro page to
17: * dynamically pull data from various sources (e.g., the web, eclipse, etc) and
18: * provide content based on this dynamic data. The element's class must
19: * implement the IIntroContentProvider interface. The pluginId attribute can be
20: * used if the class doesn't come from the plugin that defined the markup. The
21: * text content should be used only if we fail to load the class. <br>
22: *
23: * INTRO: model class has access to style-id attribute but it is not used in the
24: * schema.
25: */
26: public class IntroContentProvider extends AbstractTextElement {
27: public static final String TAG_CONTENT_PROVIDER = "contentProvider"; //$NON-NLS-1$
28:
29: private static final String ATT_PLUGIN_ID = "pluginId"; //$NON-NLS-1$
30: private static final String ATT_CLASS = "class"; //$NON-NLS-1$
31:
32: private String contentProvider;
33: private String pluginId;
34:
35: public IntroContentProvider(Element element, Bundle bundle) {
36: super (element, bundle);
37: contentProvider = getAttribute(element, ATT_CLASS);
38: pluginId = getAttribute(element, ATT_PLUGIN_ID);
39: }
40:
41: /**
42: * Returns the content provider, which should implement
43: * IIntroContentProvider
44: *
45: * @return Returns the contentProvider.
46: */
47: public String getClassName() {
48: return contentProvider;
49: }
50:
51: /**
52: * Returns the id of the plugin that contains the content provider class
53: *
54: * @return Returns the pluginId.
55: */
56: public String getPluginId() {
57: return pluginId;
58: }
59:
60: /*
61: * (non-Javadoc)
62: *
63: * @see org.eclipse.ui.internal.intro.impl.model.AbstractIntroElement#getType()
64: */
65: public int getType() {
66: return AbstractIntroElement.CONTENT_PROVIDER;
67: }
68: }
|