Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: dcfeff12b7b6e8245181018e3c11fd73b1e65c06 (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
/*******************************************************************************
 * Copyright (c) 2000, 2018 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.text.templates.persistence;

import java.util.UUID;

import org.eclipse.jface.text.templates.Template;


/**
 * TemplatePersistenceData stores information about a template. It uniquely
 * references contributed templates via their id. Contributed templates may be
 * deleted or modified. All template may be enabled or not.
 * <p>
 * Clients may use this class, although this is not usually needed except when
 * implementing a custom template preference page or template store. This class
 * is not intended to be subclassed.
 * </p>
 *
 * @since 3.0
 * @noextend This class is not intended to be subclassed by clients.
 * @deprecated See {@link org.eclipse.text.templates.TemplatePersistenceData}
 */
@Deprecated
public class TemplatePersistenceData extends org.eclipse.text.templates.TemplatePersistenceData {

	private final org.eclipse.text.templates.TemplatePersistenceData ref;

	/**
	 * In some cases, we must continue to respect the deprecated TemplatePresistenceData
	 * even though we are given {@link org.eclipse.text.templates.TemplatePersistenceData}.
	 *
	 * @param data The {@link org.eclipse.text.templates.TemplatePersistenceData} that will
	 * underlie this object.
	 * @since 3.14
	 */
	public TemplatePersistenceData(org.eclipse.text.templates.TemplatePersistenceData data) {
		super(data.getTemplate(), data.isEnabled(), data.getId()); // these are ignored
		this.ref= data instanceof TemplatePersistenceData ? ((TemplatePersistenceData) data).ref : data; // no double wrapping
	}

	public TemplatePersistenceData(Template template, boolean enabled) {
		this(new org.eclipse.text.templates.TemplatePersistenceData(template, enabled));
	}

	public TemplatePersistenceData(Template template, boolean enabled, String id) {
		this(new org.eclipse.text.templates.TemplatePersistenceData(template, enabled, id));
	}

	@Override
	public String getId() {
		return ref.getId();
	}

	@Override
	public boolean isDeleted() {
		return ref.isDeleted();
	}

	@Override
	public void setDeleted(boolean isDeleted) {
		ref.setDeleted(isDeleted);
	}

	@Override
	public Template getTemplate() {
		return ref.getTemplate();
	}

	@Override
	public void setTemplate(Template template) {
		ref.setTemplate(template);
	}

	@Override
	public boolean isCustom() {
		return ref.isCustom();
	}

	@Override
	public boolean isModified() {
		return ref.isModified();
	}

	@Override
	public boolean isUserAdded() {
		return ref.isUserAdded();
	}

	@Override
	public void revert() {
		ref.revert();
	}

	@Override
	public boolean isEnabled() {
		return ref.isEnabled();
	}

	@Override
	public void setEnabled(boolean isEnabled) {
		ref.setEnabled(isEnabled);
	}

	@Override
	public boolean equals(Object other) {
		return ref.equals(other);
	}

	@Override
	public int hashCode() {
		return ref.hashCode();
	}

	@Override
	protected UUID getUniqueIdForEquals() {
		return getUniqueIdForEquals(ref);
	}

}

Back to the top