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


Java AttributesUtilities类代码示例

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


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


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