当前位置: 首页>>代码示例>>Java>>正文


Java SimpleValueNames类代码示例

本文整理汇总了Java中org.netbeans.api.editor.settings.SimpleValueNames的典型用法代码示例。如果您正苦于以下问题:Java SimpleValueNames类的具体用法?Java SimpleValueNames怎么用?Java SimpleValueNames使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SimpleValueNames类属于org.netbeans.api.editor.settings包,在下文中一共展示了SimpleValueNames类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateCheckers

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
private String updateCheckers(PreferenceChangeEvent evt) {
    String pk = evt.getKey();
    if (pk != null) {
        if (pk.equals(SimpleValueNames.CODE_FOLDING_ENABLE)) {
            updateEnabledState();
            return pk;
        }
        if (pk.equals(PREF_OVERRIDE_DEFAULTS)) {
            updateOverrideChanged();
        } else if (!pk.startsWith(COLLAPSE_PREFIX)) {
            return pk;
        }
    } else {
        updateEnabledState();
    }
    String c = pk == null ? null : pk.substring(COLLAPSE_PREFIX.length());
    for (JCheckBox cb : controls) {
        FoldType ft = (FoldType)cb.getClientProperty("type"); // NOI18N
        FoldType ftp = ft.parent();
        if (c == null || ft.code().equals(c) || (ftp != null && ftp.code().equals(c))) {
            updateChecker(pk, cb, ft);
            return pk;
        }
    }
    return pk;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:DefaultFoldingOptions.java

示例2: getTabInsertString

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
/** @deprecated
 * @see Formatter.insertTabString()
 */
public static String getTabInsertString(BaseDocument doc, int offset)
throws BadLocationException {
    int col = getVisualColumn(doc, offset);
    Preferences prefs = CodeStylePreferences.get(doc).getPreferences();
    boolean expandTabs = prefs.getBoolean(SimpleValueNames.EXPAND_TABS, EditorPreferencesDefaults.defaultExpandTabs);
    if (expandTabs) {
        int spacesPerTab = prefs.getInt(SimpleValueNames.SPACES_PER_TAB, EditorPreferencesDefaults.defaultSpacesPerTab);
        if (spacesPerTab <= 0) {
            return ""; //NOI18N
        }
        int len = (col + spacesPerTab) / spacesPerTab * spacesPerTab - col;
        return new String(Analyzer.getSpacesBuffer(len), 0, len);
    } else { // insert pure tab
        return "\t"; // NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:Utilities.java

示例3: updateLineWrapType

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
private void updateLineWrapType() {
    // Should be able to run without mutex
    String lwt = null;
    JTextComponent textComponent = docView.getTextComponent();
    if (textComponent != null) {
        lwt = (String) textComponent.getClientProperty(SimpleValueNames.TEXT_LINE_WRAP);
    }
    if (lwt == null) {
        Document doc = docView.getDocument();
        lwt = (String) doc.getProperty(SimpleValueNames.TEXT_LINE_WRAP);
    }
    if (lwt != null) {
        lineWrapType = LineWrapType.fromSettingValue(lwt);
    }
    if (asTextField || lineWrapType == null) {
        lineWrapType = LineWrapType.NONE;
    }
    clearStatusBits(AVAILABLE_WIDTH_VALID);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:DocumentViewOp.java

示例4: checkSetIndentation

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
private void checkSetIndentation(String before, int indent, String after, boolean indentWithTabs) throws Exception {
    int offset = before.indexOf('^');
    // Must indicate caret pos!
    assertTrue(offset != -1);
    before = before.substring(0, offset) + before.substring(offset + 1);

    BaseDocument doc = getDocument(before);

    if (indentWithTabs) {
        CodeStylePreferences.get(doc).getPreferences().putBoolean(SimpleValueNames.EXPAND_TABS, false);
        CodeStylePreferences.get(doc).getPreferences().putInt(SimpleValueNames.TAB_SIZE, 8);
    }

    GsfUtilities.setLineIndentation(doc, offset, indent);
    assertEquals(after, doc.getText(0, doc.getLength()));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:GsfUtilitiesTest.java

示例5: setSpacesPerTab

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
public void setSpacesPerTab(int spacesPerTab) {
    if (spacesPerTab <= 0) {
        IllegalArgumentException iae = new IllegalArgumentException("Invalid argument"); //NOI18N
        ErrorManager errMan = Lookup.getDefault().lookup(ErrorManager.class);

        if (errMan != null) {
            Toolkit.getDefaultToolkit().beep();
            errMan.annotate(iae, ErrorManager.USER, iae.getMessage(), NbBundle.getMessage(FormatterIndentEngine.class, "MSG_NegativeValue"), null, null); //NOI18N
        } else {
            throw iae;
        }
    }

    int old = getFormatter().getSpacesPerTab();
    getFormatter().setSpacesPerTab(spacesPerTab);
    if (old != spacesPerTab) {
        setValue(SimpleValueNames.SPACES_PER_TAB,
            new Integer(spacesPerTab), SPACES_PER_TAB_PROP);
        
        firePropertyChange(SPACES_PER_TAB_PROP,
            new Integer(old),
            new Integer(spacesPerTab)
        );
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:FormatterIndentEngine.java

示例6: runLocked

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
@Override
public void runLocked(Runnable run) {
    Preferences prefs = MimeLookup.getLookup(DocumentUtilities.getMimeType(doc)).lookup(Preferences.class);
    if (prefs.getBoolean(SimpleValueNames.ON_SAVE_USE_GLOBAL_SETTINGS, Boolean.TRUE)) {
        prefs = MimeLookup.getLookup(MimePath.EMPTY).lookup(Preferences.class);
    }
    String policy = prefs.get(SimpleValueNames.ON_SAVE_REFORMAT, "never"); //NOI18N
    if (!"never".equals(policy)) { //NOI18N
        modifiedLinesOnly = "modified-lines".equals(policy);
        reformat = Reformat.get(doc);
        reformat.lock();
        try {
            run.run();
        } finally {
            reformat.unlock();
        }
    } else {
        run.run();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ReformatBeforeSaveTask.java

示例7: setFoldingOptions

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
void setFoldingOptions (
    boolean showCodeFolding,
    boolean foldImports,
    boolean foldInitialComent,
    boolean foldInnerClasses,
    boolean foldJavaDoc,
    boolean foldMethods,
    boolean foldTags
) {
    Collection<String> mimeTypes = new ArrayList<String>(EditorSettings.getDefault().getAllMimeTypes());
    mimeTypes.add("");
    for(String mimeType : mimeTypes) {
        Preferences prefs = MimeLookup.getLookup(mimeType).lookup(Preferences.class);
        
        prefs.putBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, Boolean.valueOf(showCodeFolding));
        prefs.putBoolean("code-folding-collapse-import", foldImports); //NOI18N
        prefs.putBoolean("code-folding-collapse-initial-comment", foldInitialComent); //NOI18N
        prefs.putBoolean("code-folding-collapse-innerclass", foldInnerClasses); //NOI18N
        prefs.putBoolean("code-folding-collapse-javadoc", foldJavaDoc); //NOI18N
        prefs.putBoolean("code-folding-collapse-method", foldMethods); //NOI18N
        prefs.putBoolean("code-folding-collapse-tags", foldTags); //NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:Model.java

示例8: update

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
void update(Preferences preferences, Preferences globalPreferences) {
    this.allLanguages = (preferences == globalPreferences);
    this.preferences = preferences;

    boolean useGlobalSettings = !allLanguages && preferences.getBoolean(SimpleValueNames.ON_SAVE_USE_GLOBAL_SETTINGS, Boolean.TRUE);
    if (useGlobalSettings) {
        preferences = globalPreferences;
    }
    cbUseGlobalSettings.setSelected(useGlobalSettings);
    cbUseGlobalSettings.setVisible(!allLanguages);
    String rtw = preferences.get(SimpleValueNames.ON_SAVE_REMOVE_TRAILING_WHITESPACE, "never");
    cboRemoveTrailingWhitespace.setSelectedItem(rtw);
    String reformat = preferences.get(SimpleValueNames.ON_SAVE_REFORMAT, "never");
    cboReformat.setSelectedItem(reformat);
    updateEnabled();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:OnSaveCommonPanel.java

示例9: enableFoldsActionPerformed

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
private void enableFoldsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableFoldsActionPerformed
    if (ignoreEnableTrigger) {
        return;
    }
    boolean enable = enableFolds.isSelected();
    currentPreferences.putBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, enable);
    // visual feedback handled by listener.
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:FoldOptionsPanel.java

示例10: preferenceChange

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
public void preferenceChange(PreferenceChangeEvent evt) {
    String key = evt == null ? null : evt.getKey();
    if (key == null || SimpleValueNames.CODE_FOLDING_ENABLE.equals(key)) {
        updateColors();
        
        boolean newEnabled = prefs.getBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, EditorPreferencesDefaults.defaultCodeFoldingEnable);
        PREF_LOG.log(Level.FINE, "Sidebar folding-enable pref change: " + newEnabled);
        if (enabled != newEnabled) {
            enabled = newEnabled;
            updatePreferredSize();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:CodeFoldingSideBar.java

示例11: globalEnableFolding

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
void globalEnableFolding(boolean enable) {
    PREF_LOG.log(Level.FINE, "Globally set folding-enable: " + enable);
    prefs("").putBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, enable); // NOI18N
    for (String mime : EditorSettings.getDefault().getAllMimeTypes()) {
        prefs(mime).remove(SimpleValueNames.CODE_FOLDING_ENABLE);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:FoldOptionsController.java

示例12: updateEnabledState

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
private void updateEnabledState() {
    boolean foldEnable = preferences.getBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, true);
    boolean useDefaults = preferences.getBoolean(FoldUtilitiesImpl.PREF_OVERRIDE_DEFAULTS, true);
    
    for (JComponent c : controls) {
        FoldType ft = (FoldType)c.getClientProperty("type"); // NOI18N
        boolean enable = true;
        if (defaultPrefs != null && useDefaults) {
            enable = !isDefinedDefault(ft);
        }
        enable &= foldEnable;
        c.setEnabled(enable);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:DefaultFoldingOptions.java

示例13: fireChanged

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
private void fireChanged(String pk) {
    if (pk == null) {
        isChanged = false;
        return;
    }
    Preferences prefs = MimeLookup.getLookup(mimeType).lookup(Preferences.class);
    boolean changed = preferences.getBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, true) != prefs.getBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, true)
            || preferences.getBoolean(FoldUtilitiesImpl.PREF_OVERRIDE_DEFAULTS, true) != prefs.getBoolean(FoldUtilitiesImpl.PREF_OVERRIDE_DEFAULTS, true)
            || preferences.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_PREVIEW, true) != prefs.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_PREVIEW, true)
            || preferences.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_SUMMARY, true) != prefs.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_SUMMARY, true);
    for (JCheckBox cb : controls) {
        changed |= isFoldTypeChanged((FoldType) cb.getClientProperty("type"), prefs); // NOI18N
    }
    isChanged = changed;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:DefaultFoldingOptions.java

示例14: updateComponentProperties

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
/**
 * Update various properties of the component in AWT thread.
 */
void updateComponentProperties() {

    // Refresh rendering hints
    String mimeType = org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(component);
    FontColorSettings fcs = MimeLookup.getLookup(mimeType).lookup(FontColorSettings.class);
    renderingHints = (Map<?, ?>) fcs.getFontColors(FontColorNames.DEFAULT_COLORING).getAttribute(EditorStyleConstants.RenderingHints);
    
    // Set the margin
    String value = prefs.get(SimpleValueNames.MARGIN, null);
    Insets margin = value != null ? SettingsConversions.parseInsets(value) : null;
    component.setMargin(margin != null ? margin : NULL_INSETS);

    lineNumberDigitWidth = computeLineNumberDigitWidth();

    // Update line height
    updateLineHeight(getComponent());

    // Update space width of the default coloring's font
    FontMetricsCache.Info fmcInfo = FontMetricsCache.getInfo(getDefaultColoring().getFont());
    defaultSpaceWidth = fmcInfo.getSpaceWidth(component);

    updateLineNumberWidth(0);

    // update glyph gutter colors and fonts
    if (isGlyphGutterVisible()) {
        glyphGutter.update();
        updateScrollPaneCornerColor();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:EditorUI.java

示例15: insertTabString

import org.netbeans.api.editor.settings.SimpleValueNames; //导入依赖的package包/类
/** Modify the line to move the text starting at dotPos one tab
 * column to the right.  Whitespace preceeding dotPos may be
 * replaced by a TAB character if tabs expanding is on.
 * @param doc document to operate on
 * @param dotPos insertion point
 */
static void insertTabString (final BaseDocument doc, final int dotPos) throws BadLocationException {
    final BadLocationException[] badLocationExceptions = new BadLocationException [1];
    doc.runAtomic (new Runnable () {
        public void run () {
            try {
                // Determine first white char before dotPos
                int rsPos = Utilities.getRowStart(doc, dotPos);
                int startPos = Utilities.getFirstNonWhiteBwd(doc, dotPos, rsPos);
                startPos = (startPos >= 0) ? (startPos + 1) : rsPos;

                int startCol = Utilities.getVisualColumn(doc, startPos);
                int endCol = Utilities.getNextTabColumn(doc, dotPos);
                Preferences prefs = CodeStylePreferences.get(doc).getPreferences();
                String tabStr = Analyzer.getWhitespaceString(
                        startCol, endCol,
                        prefs.getBoolean(SimpleValueNames.EXPAND_TABS, EditorPreferencesDefaults.defaultExpandTabs),
                        prefs.getInt(SimpleValueNames.TAB_SIZE, EditorPreferencesDefaults.defaultTabSize));

                // Search for the first non-common char
                char[] removeChars = doc.getChars(startPos, dotPos - startPos);
                int ind = 0;
                while (ind < removeChars.length && removeChars[ind] == tabStr.charAt(ind)) {
                    ind++;
                }

                startPos += ind;
                doc.remove(startPos, dotPos - startPos);
                doc.insertString(startPos, tabStr.substring(ind), null);
            } catch (BadLocationException ex) {
                badLocationExceptions [0] = ex;
            }
        }
    });
    if (badLocationExceptions[0] != null)
        throw badLocationExceptions [0];
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:43,代码来源:BaseKit.java


注:本文中的org.netbeans.api.editor.settings.SimpleValueNames类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。