blob: 345480efee27a6c91ef846c53220edf9021476a1 (
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
|
/*******************************************************************************
* Copyright (c) 2003, 2007 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
*******************************************************************************/
/*
* Created on Jan 26, 2004
*
* To change the template for this generated file go to Window - Preferences - Java - Code
* Generation - Code and Comments
*/
package org.eclipse.jst.jee;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Preferences;
/**
* @author mdelder
*/
public class JEEPreferences {
public interface Keys {
}
private Plugin owner = null;
private Preferences preferences = null;
private boolean persistOnChange = false;
public JEEPreferences(Plugin owner) {
this.owner = owner;
}
protected void initializeDefaultPreferences() {
// placeholder
// we had to move generate_dd to jst.j2ee as jst.jee is not in the pre-req of many plug-ins
}
public void firePreferenceChanged() {
if (isPersistOnChange())
persist();
}
public void persist() {
getOwner().savePluginPreferences();
}
/**
* @return Returns the persistOnChange.
*/
public boolean isPersistOnChange() {
return this.persistOnChange;
}
/**
* @param persistOnChange
* The persistOnChange to set.
*/
public void setPersistOnChange(boolean persistOnChange) {
this.persistOnChange = persistOnChange;
}
public Preferences getPreferences() {
if (this.preferences == null)
this.preferences = getOwner().getPluginPreferences();
return this.preferences;
}
/**
* @return Returns the owner.
*/
private Plugin getOwner() {
return this.owner;
}
/**
* Returns the current value of the boolean-valued property with the
* given name.
* The given name must not be <code>null</code>.
*
* @param name the name of the property
* @return the boolean-valued property
*/
public boolean getBoolean(String name) {
return getPreferences().getBoolean(name);
}
/**
* Sets the current value of the boolean-valued property with the
* given name. The given name must not be <code>null</code>.
* @param name the name of the property
* @param value the new current value of the property
*/
public void setValue(String name, boolean value) {
getPreferences().setValue(name, value);
firePreferenceChanged();
}
}
|