Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b82121903e1a2349a23df8eb16d752b19b8881c7 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*******************************************************************************
 * Copyright (c) 2007 Symbian Software Limited 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:
 * Bala Torati (Symbian) - Initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.core.templateengine;

import java.util.Set;



/**
 * TemplateInfo class contains the template information like wizard ID, pattern, path and project type.
 */
public class TemplateInfo {
	private String projectTypeId;
	private String filterPattern;
	private String usageDescription;
	private String templatePath;
	private String pluginId;
	private Set toolChainIdSet;
	private String pagesProvider;
	private boolean isCategory;
	private String icon;
	private String templateId;
	
	public TemplateInfo(String templateId, String projectTypeId, String filterPattern, String templatePath, 
			String pluginId, Set toolChainIdSet, String usageDescription, 
			String pagesProvider, boolean isCategory) {
		this.templateId = templateId;
		this.filterPattern = filterPattern;
		this.templatePath = templatePath;
		this.pluginId = pluginId;
		this.projectTypeId = projectTypeId;
		this.toolChainIdSet = toolChainIdSet;
		this.usageDescription = usageDescription != null ? usageDescription : ""; //$NON-NLS-1$
		this.pagesProvider = pagesProvider;
		this.isCategory = isCategory;
	}

	/**
	 * Returns the Plugin ID
	 * @return   String contains the plugin id.
	 */
	public String getPluginId() {
		return pluginId;
	}

	/**
	 * Returns the Template ID
	 * @return   String contains the template id.
	 */
	public String getTemplateId() {
		return templateId;
	}

	/**
	 * Returns the Template path as String.
	 * @return   String containing the path.
	 */
	public String getTemplatePath() {
		return templatePath;
	}

	/**
	 * Returns the Filter Pattern.
	 * @return   String containing the Filter Pattern.
	 */
	public String getFilterPattern() {
		return filterPattern;
	}

	/**
	 * @return   the usageDescription
	 */
	public String getUsageDescription() {
		return usageDescription;
	}
	
	public String getExtraPagesProvider() {
		return pagesProvider;
	}
	
	/**
	 * @return the projectTypeIds
	 */
	public String getProjectType() {
		return projectTypeId;
	}

	/**
	 * @return the toolChainIds
	 */
	public String[] getToolChainIds() {
		return (String[]) toolChainIdSet.toArray(new String[toolChainIdSet.size()]);
	}

	public void setToolChainSet(Set toolChainIdSet) {
		this.toolChainIdSet = toolChainIdSet;
	}
	
	/**
	 * @return the isCategory
	 */
	public boolean isCategory() {
		return isCategory;
	}

	/**
	 * @return the icon image file name
	 */
	public String getIcon() {
		return icon;
	}

	/**
	 * Checks whether two TemplateInfo object are equal. 
	 */
	public boolean equals(Object obj) {
		if (obj instanceof TemplateInfo) {
			TemplateInfo info = (TemplateInfo) obj;
			return projectTypeId.equals(info.projectTypeId) && templatePath.equals(info.templatePath) && pluginId.equals(info.pluginId)
				&& (((filterPattern == null || info.filterPattern == null) && filterPattern == info.filterPattern)
						|| filterPattern.equals(info.filterPattern))
				&& ((toolChainIdSet.equals(info.toolChainIdSet)))
				&& ((isCategory == info.isCategory));
		}
		return false;
	}

	/**
	 * Return the hashcode of the object.
	 */
	public int hashCode() {
		return projectTypeId.hashCode() | templatePath.hashCode() | pluginId.hashCode();
	}

}

Back to the top