001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.uml.core.coreapplication;
043:
044: import org.netbeans.modules.uml.core.support.umlutils.IPropertyDefinition;
045: import org.netbeans.modules.uml.core.support.umlutils.IPropertyElement;
046: import java.util.Vector;
047:
048: public interface IPreferenceManager2 {
049: /**
050: * Returns whether the product is run in non-interactive testing mode.
051: * @return <code>true</code> if the product is in non-interactive testing
052: * mode.
053: */
054: public boolean isBatchTestMode();
055:
056: /**
057: * Sets whether the product is run in non-interactive testing mode.
058: * @param btm <code>true</code> if the product is in non-interactive testing
059: * mode.
060: */
061: public void setBatchTestMode(boolean btm);
062:
063: /**
064: * Register the passed-in file as the default preference file
065: */
066: public long registerFile(String fileName);
067:
068: /**
069: * Remove the passed in file as the default file
070: */
071: public long unregisterFile(String fileName);
072:
073: /**
074: * Validates the file for existence, read/write access, and validity against a preference DTD.
075: */
076: public boolean validateFile(String fileName);
077:
078: /**
079: * property PropertyDefinitions
080: */
081: public Vector<IPropertyDefinition> getPropertyDefinitions();
082:
083: /**
084: * property PropertyDefinitions
085: */
086: public void setPropertyDefinitions(IPropertyDefinition[] value);
087:
088: /**
089: * property PropertyElements
090: */
091: public IPropertyElement[] getPropertyElements();
092:
093: /**
094: * property PropertyElements
095: */
096: public void setPropertyElements(IPropertyElement[] value);
097:
098: /**
099: * Use the passed in file and build the preference definitions and preference elements to be used by the Describe application.
100: */
101: public long buildPreferences(String fileName);
102:
103: /**
104: * method ReloadPreferences
105: */
106: public long reloadPreferences();
107:
108: /**
109: * Shortcut method to add a boolean preference to both the definitions and the elements.
110: */
111: public long addBooleanPreference(IPreferenceObject prefObj);
112:
113: /**
114: * Remove the preference that represents the passed-in property element. This will remove it from the preference managers array as well as the XML file that it is in.
115: */
116: public long removePreference(IPropertyElement pEle);
117:
118: /**
119: * Register the passed-in file as an additional preference file using the passed-in key as its lookup value.
120: */
121: public long registerFile(String Key, String fileName);
122:
123: /**
124: * Remove the passed in file from the map by its key.
125: */
126: public long unregisterFile(String Key, String fileName);
127:
128: /**
129: * Shortcut method to add a list preference to both the definitions and the elements.
130: */
131: public long addListPreference(IPreferenceObject prefObj);
132:
133: /**
134: * Shortcut method to add a combo preference to both the definitions and the elements.
135: */
136: public long addComboPreference(IPreferenceObject prefObj);
137:
138: /**
139: * Shortcut method to add a edit preference to both the definitions and the elements.
140: */
141: public long addEditPreference(IPreferenceObject prefObj);
142:
143: /**
144: * Get the value of the preference with the given fully-qualified path.
145: */
146: public String getPreferenceValue(String path);
147:
148: /**
149: * Get the value of the passed-in preference name. This routine searches in the default preference structure. For example, DefaultFilter will return PSK_DATA.
150: */
151: public String getPreferenceValue(String path, String prefName);
152:
153: /**
154: * method GetPreferenceValue2
155: */
156: public String getPreferenceValue(String Key, String path,
157: String prefName);
158:
159: /**
160: * The preference manager has been told to save its information. It will loop through its definitions and its elements, saving them if necessary.
161: */
162: public long save();
163:
164: /**
165: * Set the value of the passed in preference name. This routine searches in the default preference structure.
166: */
167: public long setPreferenceValue(String path, String prefName,
168: String pVal);
169:
170: /**
171: * Set the value of the passed in preference name. This routine searches in the key preference structure.
172: */
173: public long setPreferenceValue(String Key, String path,
174: String prefName, String pVal);
175:
176: /**
177: * Set the value of the passed in preference.
178: */
179: public long setPreferenceValue(IPropertyElement pEle, String pVal);
180:
181: /**
182: * Retrieve the actual preference element that is found under the default top level element and is at the proper sub level that matches the passed in path and pref name.
183: */
184: public IPropertyElement getPreferenceElement(String path,
185: String prefName);
186:
187: /**
188: * Retrieve the actual preference element that is found under the key top level element and is at the proper sub level that matches the passed in path and pref name.
189: */
190: public IPropertyElement getPreferenceElement(String Key,
191: String path, String prefName);
192:
193: /**
194: * Retrieve the actual preference def that is found under the default top level def and is at the proper sub level that matches the passed in path and pref name.
195: */
196: public IPropertyDefinition getPreferenceDefinition(String path,
197: String prefName);
198:
199: /**
200: * Retrieve the actual preference def that is found under the key top level def and is at the proper sub level that matches the passed in path and pref name.
201: */
202: public IPropertyDefinition getPreferenceDefinition(String Key,
203: String path, String prefName);
204:
205: /**
206: * Get the translated value of the passed in preference name.
207: */
208: public String getTranslatedPreferenceValue(String path,
209: String prefName);
210:
211: /**
212: * Get the translated value of the passed in preference name.
213: */
214: public String getTranslatedPreferenceValue(String Key, String path,
215: String prefName);
216:
217: /**
218: * Determines if a particular preference has a particular value, looking in Defaults
219: */
220: public boolean matches(String path, String prefName,
221: String prefValue);
222:
223: /**
224: * Determines if a particular preference has a particular value
225: */
226: public boolean matches(String Key, String path, String prefName,
227: String prefValue);
228:
229: /**
230: * Restore the preferences to their default values
231: */
232: public long restore();
233:
234: /**
235: * This method is used to determine what the default font of the grid should be for the application
236: */
237: public String getDefaultFont();
238:
239: /**
240: * This method is used to determine what the default font of the grid should be for the application
241: */
242: public String getDefaultDocFont();
243:
244: /**
245: * Restore the preferences to their default values upon install
246: */
247: public long restoreForInstall();
248:
249: /**
250: * Finds a preference of name sName under pEle. The found element returned is the first sName found in that hive - at any child level, not just immediate children
251: */
252: public IPropertyElement findElement(IPropertyElement pEle,
253: String sName);
254:
255: public boolean isEditable(IPropertyElement pEle);
256:
257: public String getPreferenceValueWithFullPath(
258: String fullPathToPreference);
259: }
|