• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AttributesUtilities类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getColoring

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
private Coloring getColoring() {
    if (attribs == null) {
        if (fcsLookupResult == null) {
            fcsLookupResult = MimeLookup.getLookup(org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(component))
                    .lookupResult(FontColorSettings.class);
            fcsLookupResult.addLookupListener(WeakListeners.create(LookupListener.class, fcsTracker, fcsLookupResult));
        }
        
        FontColorSettings fcs = fcsLookupResult.allInstances().iterator().next();
        AttributeSet attr = fcs.getFontColors(FontColorNames.CODE_FOLDING_BAR_COLORING);
        specificAttrs = attr;
        if (attr == null) {
            attr = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
        } else {
            attr = AttributesUtilities.createComposite(
                    attr, 
                    fcs.getFontColors(FontColorNames.DEFAULT_COLORING));
        }
        attribs = attr;
    }        
    return Coloring.fromAttributeSet(attribs);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:CodeFoldingSideBar.java


示例2: getColoring

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
private Coloring getColoring() {
    if (attribs == null) {
        if (fcsLookupResult == null) {
            fcsLookupResult = MimeLookup.getLookup(org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(getComponent()))
                    .lookupResult(FontColorSettings.class);
            fcsLookupResult.addLookupListener(WeakListeners.create(LookupListener.class, fcsTracker, fcsLookupResult));
        }
        
        FontColorSettings fcs = fcsLookupResult.allInstances().iterator().next();
        AttributeSet attr = fcs.getFontColors(FontColorNames.CODE_FOLDING_COLORING);
        if (attr == null) {
            attr = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
        } else {
            attr = AttributesUtilities.createComposite(attr, fcs.getFontColors(FontColorNames.DEFAULT_COLORING));
        }
        
        attribs = attr;
    }        
    return Coloring.fromAttributeSet(attribs);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:CollapsedView.java


示例3: getColoring

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
private Coloring getColoring() {
    if (attribs == null) {
        if (fcsLookupResult == null) {
            fcsLookupResult = MimeLookup.getLookup(org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(component))
                    .lookupResult(FontColorSettings.class);
            fcsLookupResult.addLookupListener(WeakListeners.create(LookupListener.class, fcsTracker, fcsLookupResult));
        }
        
        FontColorSettings fcs = fcsLookupResult.allInstances().iterator().next();
        AttributeSet attr = fcs.getFontColors(FontColorNames.CODE_FOLDING_BAR_COLORING);
        if (attr == null) {
            attr = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
        } else {
            attr = AttributesUtilities.createComposite(attr, fcs.getFontColors(FontColorNames.DEFAULT_COLORING));
        }
        attribs = attr;
    }        
    return Coloring.fromAttributeSet(attribs);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:CodeFoldingSideBar.java


示例4: setAttrs

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
void setAttrs(Lookup.Result<FontColorSettings> result) {
    if (Boolean.TRUE.equals(component.getClientProperty("AsTextField"))) {
        if (UIManager.get("TextField.selectionBackground") != null) {
            attribs = AttributesUtilities.createImmutable(
                    StyleConstants.Background, (Color) UIManager.get("TextField.selectionBackground"),
                    StyleConstants.Foreground, (Color) UIManager.get("TextField.selectionForeground"));
        } else {
            final JTextField referenceTextField = (JTextField) new JComboBox<String>().getEditor().getEditorComponent();
            attribs = AttributesUtilities.createImmutable(
                    StyleConstants.Background, referenceTextField.getSelectionColor(),
                    StyleConstants.Foreground, referenceTextField.getSelectedTextColor());
        }
        return;
    }
    FontColorSettings fcs = result.allInstances().iterator().next();
    attribs = fcs.getFontColors(coloringName);
    if (attribs == null) {
        attribs = SimpleAttributeSet.EMPTY;
    } else if (extendsEOL || extendsEmptyLine) {
        attribs = AttributesUtilities.createImmutable(
                attribs,
                AttributesUtilities.createImmutable(
                ATTR_EXTENDS_EOL, Boolean.valueOf(extendsEOL),
                ATTR_EXTENDS_EMPTY_LINE, Boolean.valueOf(extendsEmptyLine)));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:CaretBasedBlockHighlighting.java


示例5: getAttribs

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
private AttributeSet getAttribs(String coloringName, boolean extendsEol, boolean extendsEmptyLine) {
    FontColorSettings fcs = MimeLookup.getLookup(getMimeType(component)).lookup(FontColorSettings.class);
    AttributeSet attribs = fcs.getFontColors(coloringName);
    
    if (attribs == null) {
        attribs = SimpleAttributeSet.EMPTY;
    } else if (extendsEol || extendsEmptyLine) {
        attribs = AttributesUtilities.createImmutable(
            attribs, 
            AttributesUtilities.createImmutable(
                ATTR_EXTENDS_EOL, Boolean.valueOf(extendsEol),
                ATTR_EXTENDS_EMPTY_LINE, Boolean.valueOf(extendsEmptyLine))
        );
    }
    
    return attribs;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:BlockHighlighting.java


示例6: ReadOnlyFilesHighlighting

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
public ReadOnlyFilesHighlighting(Document doc) {
    this.document = doc;
    FontColorSettings fcs = MimeLookup.getLookup(MimePath.EMPTY).lookup(FontColorSettings.class);
    if (fcs != null) {
        AttributeSet readOnlyFilesColoring = fcs.getFontColors("readonly-files"); //NOI18N
        if (readOnlyFilesColoring != null) {
            this.attribs = AttributesUtilities.createImmutable(
                    readOnlyFilesColoring,
                    EXTENDS_EOL_OR_EMPTY_ATTR_SET);
        } else {
            this.attribs = null;
        }
    } else {
        this.attribs = null;
    }
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("~~~ this=" + s2s(this) + ", doc=" + s2s(doc) + ", file=" + fileFromDoc(doc) //NOI18N
                + ", attribs=" + attribs + (attribs != null ? ", bg=" + attribs.getAttribute(StyleConstants.Background) : "")); //NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ReadOnlyFilesHighlighting.java


示例7: updateColors

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
private void updateColors(final FontColorSettings fcs) {
    if (getParent() == null) {
        return;
    }
    AttributeSet as = fcs.getFontColors(BRACES_COLORING);
    if (as == null) {
        as = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
        this.backColor = (Color)as.getAttribute(StyleConstants.ColorConstants.Background);
    } else {
        this.backColor = (Color)as.getAttribute(StyleConstants.ColorConstants.Background);
        as = AttributesUtilities.createComposite(
                as, 
                fcs.getFontColors(FontColorNames.DEFAULT_COLORING));
    }
    this.coloring = Coloring.fromAttributeSet(as);
    int w = 0;
    
    if (coloring.getFont() != null) {
        w = coloring.getFont().getSize();
    } else if (baseUI != null) {
        w = baseUI.getEditorUI().getLineNumberDigitWidth();
    }
    this.barWidth = Math.max(4, w / 2);
    updatePreferredSize();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:BraceMatchingSidebarComponent.java


示例8: getAttribs

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
private AttributeSet getAttribs(String coloringName, boolean extendsEol, boolean extendsEmptyLine) {
    FontColorSettings fcs = MimeLookup.getLookup(mimeType).lookup(FontColorSettings.class);
    AttributeSet attribs = fcs.getFontColors(coloringName);
    
    if (attribs == null) {
        attribs = SimpleAttributeSet.EMPTY;
    } else if (extendsEol || extendsEmptyLine) {
        attribs = AttributesUtilities.createImmutable(
            attribs, 
            AttributesUtilities.createImmutable(
                ATTR_EXTENDS_EOL, Boolean.valueOf(extendsEol),
                ATTR_EXTENDS_EMPTY_LINE, Boolean.valueOf(extendsEmptyLine))
        );
    }
    
    return attribs;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:GuardedBlockSuppressLayer.java


示例9: EmbeddedSectionsHighlighting

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
EmbeddedSectionsHighlighting(Document document) {
    this.document = document;

    // load the background color for the embedding token
    AttributeSet attribs = null;
    String mimeType = (String) document.getProperty("mimeType"); //NOI18N
    FontColorSettings fcs = MimeLookup.getLookup(mimeType).lookup(FontColorSettings.class);
    if (fcs != null) {
        Color jsBC = getColoring(fcs, YamlTokenId.RUBY.primaryCategory());
        if (jsBC != null) {
            attribs = AttributesUtilities.createImmutable(
                    StyleConstants.Background, jsBC,
                    ATTR_EXTENDS_EOL, Boolean.TRUE);
        }
    }
    rubyBackground = attribs;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:EmbeddedSectionsHighlighting.java


示例10: Highlighting

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
/** Creates a new instance of Highlighting */
public Highlighting(Document doc) {
    AttributeSet firstLineFontColor = MimeLookup.getLookup(MimePath.get("text/x-java")).lookup(FontColorSettings.class).getTokenFontColors("javadoc-first-sentence"); //NOI18N
    AttributeSet commentFontColor = MimeLookup.getLookup(MimePath.get("text/x-java")).lookup(FontColorSettings.class).getTokenFontColors("comment"); //NOI18N
    if(firstLineFontColor != null && commentFontColor != null) {
        Collection<Object> attrs = new LinkedList<Object>();
        for (Enumeration<?> e = firstLineFontColor.getAttributeNames(); e.hasMoreElements(); ) {
            Object key = e.nextElement();
            Object value = firstLineFontColor.getAttribute(key);

            if (!commentFontColor.containsAttribute(key, value)) {
                attrs.add(key);
                attrs.add(value);
            }
        }
        fontColor = AttributesUtilities.createImmutable(attrs.toArray());
    } else {
        fontColor = AttributesUtilities.createImmutable();
        LOG.warning("FontColorSettings for javadoc-first-sentence or comment are not available."); //NOI18N
    }
    this.document = doc;
    hierarchy = TokenHierarchy.get(document);
    if (hierarchy != null) {
        hierarchy.addTokenHierarchyListener(WeakListeners.create(TokenHierarchyListener.class, this, hierarchy));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:Highlighting.java


示例11: XhtmlElHighlighting

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
XhtmlElHighlighting(Document document) {
    this.document = document;
    
    // load the background color for the embedding token
    AttributeSet elAttribs = null;
    String mimeType = (String) document.getProperty("mimeType"); //NOI18N
    FontColorSettings fcs = MimeLookup.getLookup(mimeType).lookup(FontColorSettings.class);
    if (fcs != null) {
        Color elBC = getColoring(fcs, XhtmlElTokenId.EL.primaryCategory());
        if (elBC != null) {
            elAttribs = AttributesUtilities.createImmutable(
                StyleConstants.Background, elBC, 
                ATTR_EXTENDS_EOL, Boolean.TRUE);
        }
    }
    expressionLanguageBackground = elAttribs;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:XhtmlElHighlighting.java


示例12: ComposedTextHighlighting

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
public ComposedTextHighlighting(JTextComponent component, Document document, String mimeType) {
    // Prepare the highlight
    FontColorSettings fcs = MimeLookup.getLookup(MimePath.parse(mimeType)).lookup(FontColorSettings.class);
    AttributeSet dc = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
    Color background = (Color) dc.getAttribute(StyleConstants.Background);
    Color foreground = (Color) dc.getAttribute(StyleConstants.Foreground);
    highlightInverse = AttributesUtilities.createImmutable(StyleConstants.Background, foreground, StyleConstants.Foreground, background);
    highlightUnderlined = AttributesUtilities.createImmutable(StyleConstants.Underline, foreground);
    
    // Create the highlights container
    this.bag = new OffsetsBag(document);
    this.bag.addHighlightsChangeListener(this);

    // Start listening on the document
    this.document = document;
    this.document.addDocumentListener(WeakListeners.document(this, this.document));
    
    this.component = component;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ComposedTextHighlighting.java


示例13: FanHighlightsContainer

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
public FanHighlightsContainer(Document document)
{
    this.document = document;

    //try load the background from html settings
    FontColorSettings fcs = MimeLookup.getLookup(FanLanguage.FAN_MIME_TYPE).lookup(FontColorSettings.class);
    Color jsBC = null;
    Color sqlBC = null;
    AttributeSet as = fcs.getTokenFontColors(FantomConstants.COLORING_JAVASCRIPT);
    if (as != null)
    {
        jsBC = (Color) as.getAttribute(StyleConstants.Background);
    }
    AttributeSet asSql = fcs.getTokenFontColors(FantomConstants.COLORING_SQL);
    if (asSql != null)
    {
        sqlBC = (Color) asSql.getAttribute(StyleConstants.Background);
    }

    javascriptBackground = jsBC == null ? SimpleAttributeSet.EMPTY : AttributesUtilities.createImmutable(
            StyleConstants.Background, jsBC,
            ATTR_EXTENDS_EOL, Boolean.TRUE);
    sqlBackground = sqlBC == null ? SimpleAttributeSet.EMPTY : AttributesUtilities.createImmutable(
            StyleConstants.Background, sqlBC,
            ATTR_EXTENDS_EOL, Boolean.TRUE);
}
 
开发者ID:tcolar,项目名称:fantomidemodule,代码行数:27,代码来源:FanHighlightsContainer.java


示例14: makeHyperlink

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
private synchronized void makeHyperlink(HyperlinkType type, HyperlinkProviderExt provider, final int start, final int end, final int offset) {
    boolean makeCursorSnapshot = true;
    
    if (hyperlinkUp) {
        unHyperlink(false);
        makeCursorSnapshot = false;
    }
    
    OffsetsBag prepare = new OffsetsBag(component.getDocument());

    FontColorSettings fcs = MimeLookup.getLookup(MimePath.EMPTY).lookup(FontColorSettings.class);
    AttributeSet hyperlinksHighlight = fcs.getFontColors("hyperlinks"); //NOI18N
    prepare.addHighlight(start, end, AttributesUtilities.createComposite(
        hyperlinksHighlight != null ? hyperlinksHighlight : defaultHyperlinksHighlight,
        AttributesUtilities.createImmutable(EditorStyleConstants.Tooltip, new TooltipResolver(provider, offset, type))));

    getBag(currentDocument).setHighlights(prepare);

    hyperlinkUp = true;

    if (makeCursorSnapshot) {
        if (component.isCursorSet()) {
            oldComponentsMouseCursor = component.getCursor();
        } else {
            oldComponentsMouseCursor = null;
        }
        component.setCursor(getMouseCursor(type));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:HyperlinkOperation.java


示例15: findAttributes

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
private AttributeSet findAttributes() {
    ArrayList<AttributeSet> list = new ArrayList<AttributeSet>();

    for(int i = 0; i < marks.length; i++) {
        if (marks[i].getPreviousMarkAttributes() != null) {
            list.add(marks[i].getPreviousMarkAttributes());
        }
    }

    if (!list.isEmpty()) {
        return AttributesUtilities.createComposite(list.toArray(new AttributeSet[list.size()]));
    } else {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ProxyHighlightsContainer.java


示例16: adjustAttributes

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
private static AttributeSet adjustAttributes(AttributeSet as) {
    Collection<Object> attrs = new LinkedList<Object>();
    
    for (Enumeration<?> e = as.getAttributeNames(); e.hasMoreElements(); ) {
        Object key = e.nextElement();
        Object value = as.getAttribute(key);
        
        if (value != Boolean.FALSE) {
            attrs.add(key);
            attrs.add(value);
        }
    }
    
    return AttributesUtilities.createImmutable(attrs.toArray());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ColoringManager.java


示例17: createAttribs

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
private AttributeSet createAttribs(Object... keyValuePairs) {
    List<Object> list = new ArrayList<Object>();
    for (int i = keyValuePairs.length / 2 - 1; i >= 0; i--) {
        Object attrKey = keyValuePairs[2 * i];
        Object attrValue = keyValuePairs[2 * i + 1];

        if (attrKey != null && attrValue != null) {
            list.add(attrKey);
            list.add(attrValue);
        }
    }
    return AttributesUtilities.createImmutable(list.toArray());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:MethodChooser.java


示例18: getHyperlinkHighlight

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
private AttributeSet getHyperlinkHighlight() {
    synchronized(this) {
        if (defaultHyperlinkHighlight == null) {
            defaultHyperlinkHighlight = AttributesUtilities.createImmutable(
                    StyleConstants.Foreground, Color.BLUE, StyleConstants.Underline, Color.BLUE);
        }
    }
    return defaultHyperlinkHighlight;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:MethodChooser.java


示例19: findColoringForToken

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
private AttributeSet findColoringForToken(String tokenName) {
    ArrayList<AttributeSet> colorings = new ArrayList<AttributeSet>();
    String name = tokenName;

    for (FontColorSettingsImpl fcsi : allFcsi) {
        name = processLayer(fcsi, name, colorings);
    }

    if (colorings.size() > 0) {
        return AttributesUtilities.createImmutable(colorings.toArray(new AttributeSet[colorings.size()]));
    } else {
        return NULL;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:CompositeFCS.java


示例20: immutize

import org.netbeans.api.editor.settings.AttributesUtilities; //导入依赖的package包/类
/**
 * Creates unmodifiable copy of the original map converting <code>AttributeSet</code>s
 * to their immutable versions.
 */
public static Map<String, AttributeSet> immutize(Map<String, ? extends AttributeSet> map, Object... filterOutKeys) {
    Map<String, AttributeSet> immutizedMap = new HashMap<String, AttributeSet>();
    
    for(String name : map.keySet()) {
        AttributeSet attribs = map.get(name);
        
        if (filterOutKeys.length == 0) {
            immutizedMap.put(name, AttributesUtilities.createImmutable(attribs));
        } else {
            List<Object> pairs = new ArrayList<Object>();

            // filter out attributes specified by filterOutKeys
            first:
            for(Enumeration<? extends Object> keys = attribs.getAttributeNames(); keys.hasMoreElements(); ) {
                Object key = keys.nextElement();
                
                for(Object filterOutKey : filterOutKeys) {
                    if (Utilities.compareObjects(key, filterOutKey)) {
                        continue first;
                    }
                }
                
                pairs.add(key);
                pairs.add(attribs.getAttribute(key));
            }

            immutizedMap.put(name, AttributesUtilities.createImmutable(pairs.toArray()));
        }
    }
    
    return Collections.unmodifiableMap(immutizedMap);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:NbUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SmaliHelpFormatter类代码示例发布时间:2022-05-23
下一篇:
Java AbstractNode类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap