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.cnd.editor.cplusplus;
043:
044: import org.openide.util.HelpCtx;
045: import org.openide.util.NbBundle;
046: import org.netbeans.editor.ext.ExtSettingsNames;
047: import org.netbeans.modules.editor.options.BaseOptions;
048: import org.netbeans.modules.editor.options.OptionSupport;
049:
050: /** Options for the CC editor kit */
051: public class CCOptions extends BaseOptions {
052:
053: static final long serialVersionUID = 6972381723748170674L;
054:
055: private static final String CC = "CPLUSPLUS"; //NOI18N
056: private static final String HELP_ID = "Welcome_opt_editor_cpp"; // !!! NOI18N
057:
058: public static final String COMPLETION_AUTO_POPUP_PROP = "completionAutoPopup"; // NOI18N
059: public static final String JAVADOC_AUTO_POPUP_PROP = "javaDocAutoPopup"; //NOI18N
060:
061: static final String[] CC_PROP_NAMES = OptionSupport
062: .mergeStringArrays(BaseOptions.BASE_PROP_NAMES,
063: new String[] { COMPLETION_AUTO_POPUP_PROP,
064: JAVADOC_AUTO_POPUP_PROP });
065:
066: public CCOptions() {
067: super (CCKit.class, CC);
068: }
069:
070: public CCOptions(Class kitClass, String typeName) {
071: super (kitClass, typeName);
072: }
073:
074: /** Return the C++ Indent Engine class */
075: protected @Override
076: Class getDefaultIndentEngineClass() {
077: return CCIndentEngine.class;
078: }
079:
080: public boolean getCompletionAutoPopup() {
081: return getSettingBoolean(ExtSettingsNames.COMPLETION_AUTO_POPUP);
082: }
083:
084: public void setCompletionAutoPopup(boolean v) {
085: setSettingBoolean(ExtSettingsNames.COMPLETION_AUTO_POPUP, v,
086: COMPLETION_AUTO_POPUP_PROP);
087: }
088:
089: public boolean getJavaDocAutoPopup() {
090: return getSettingBoolean(ExtSettingsNames.JAVADOC_AUTO_POPUP);
091: }
092:
093: public void setJavaDocAutoPopup(boolean auto) {
094: setSettingBoolean(ExtSettingsNames.JAVADOC_AUTO_POPUP, auto,
095: JAVADOC_AUTO_POPUP_PROP);
096: }
097:
098: public @Override
099: HelpCtx getHelpCtx() {
100: return new HelpCtx(HELP_ID);
101: }
102:
103: /**
104: * Get the localized string from the argument. This method is called up the stack.
105: * So even though its not called inside this class, its definately needed!
106: */
107: protected @Override
108: String getString(String s) {
109: try {
110: String res = NbBundle.getBundle(CCOptions.class).getString(
111: s);
112: return (res == null) ? super .getString(s) : res;
113: } catch (Exception e) {
114: return super.getString(s);
115: }
116: }
117: }
|