Skip to main content
summaryrefslogtreecommitdiffstats
blob: 41f12e27978a417ea7c1d91524ccba5ad4acacb8 (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
/*******************************************************************************
 * Copyright (c) 2006 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.cheatsheets.data;

import java.net.MalformedURLException;
import java.net.URL;

/**
 * The input to the parser which can be the URL of a file
 * or a string of XML
 */

public class ParserInput {
	private URL url;
	private String xml;
	private String pluginId;
	
	public ParserInput() {
		url = null;
		xml = null;
	}
	
	public ParserInput(String xml, String basePath) {
		this.xml = xml;
		this.url = null;
		if (basePath != null) {
			try {
				this.url = new URL(basePath);
			} catch (MalformedURLException e) {
				// leave the url null
			}
		}
	}
	
	public ParserInput(URL url, String pluginId) {
		this.url = url;
		this.xml = null;
		this.pluginId = pluginId;
	}
	
	public URL getUrl() {
		return url;
	}
	
	public String getXml() {
		return xml;
	}

	public String getPluginId() {
		return pluginId;
	}

}

Back to the top