private static AttributeSet getHighlightAS () { FontColorSettings fcs = MimeLookup.getLookup(MimePath.EMPTY).lookup(FontColorSettings.class); AttributeSet as = fcs.getFontColors("synchronized-text-blocks"); //NOI18N return as == null ? defaultSyncedTextBlocksHighlight : as; }
private static AttributeSet getSyncedTextBlocksHighlight(String name) { FontColorSettings fcs = MimeLookup.getLookup(MimePath.EMPTY).lookup(FontColorSettings.class); AttributeSet as = fcs != null ? fcs.getFontColors(name) : null; return as == null ? defaultSyncedTextBlocksHighlight : as; }
public FoldView(JTextComponent textComponent, Fold fold, FontColorSettings colorSettings, int options) { super(null); int offset = fold.getStartOffset(); int len = fold.getEndOffset() - offset; assert (len > 0) : "length=" + len + " <= 0"; // NOI18N this.length = len; this.textComponent = textComponent; this.fold = fold; this.foldingColors = colorSettings.getFontColors(FontColorNames.CODE_FOLDING_COLORING); this.selectedColors = colorSettings.getFontColors(FontColorNames.SELECTION_COLORING); this.options = options; }
private static Color getHighlight(String name, int defaultRGB) { FontColorSettings fcs = MimeLookup.getLookup(MimePath.EMPTY).lookup(FontColorSettings.class); AttributeSet as = (fcs != null) ? fcs.getFontColors(name) : null; if (as != null) { return (Color) as.getAttribute(StyleConstants.Background); } else { return new Color(defaultRGB); } }
private Map<?, ?> getRenderingHints() { Map<?, ?> renderingHints = null; // init hints if any Lookup lookup = MimeLookup.getLookup("text/plain"); // NOI18N if (lookup != null) { FontColorSettings fcs = lookup.lookup(FontColorSettings.class); if (fcs != null) { AttributeSet attributes = fcs.getFontColors(FontColorNames.DEFAULT_COLORING); if (attributes != null) { renderingHints = (Map<?, ?>) attributes.getAttribute(EditorStyleConstants.RenderingHints); } } } return renderingHints; }
/** * Get the colour for drawing text. */ public static Color getTextColor(JTextComponent jtc) { String mimeType = NbEditorUtilities.getMimeType(jtc); FontColorSettings fcs = MimeLookup.getLookup(mimeType).lookup(FontColorSettings.class); AttributeSet fontColors = fcs.getFontColors("default"); Color fg = (Color) fontColors.getAttribute(StyleConstants.Foreground); return fg; // JTextComponent host = (JTextComponent) getContainer(); // return (host.isEnabled()) ? host.getForeground() : host.getDisabledTextColor(); }
public static Font getFont(JTextComponent jtc) { String defaultFontName = "Monospaced"; String mimeType = NbEditorUtilities.getMimeType(jtc); FontColorSettings fcs = MimeLookup.getLookup(mimeType).lookup(FontColorSettings.class); String fontName = (String) fcs.getFontColors("default").getAttribute(StyleConstants.FontFamily); Font smallFont = new Font(fontName != null ? fontName : defaultFontName, Font.PLAIN, Options.getFontSize()); return smallFont; } }
public static Color getBackgroundColor(JTextComponent jtc) { String mimeType = NbEditorUtilities.getMimeType(jtc); FontColorSettings fcs = MimeLookup.getLookup(mimeType).lookup(FontColorSettings.class); AttributeSet fontColors = fcs.getFontColors("default"); Color bg = (Color) fontColors.getAttribute(StyleConstants.Background); return bg; }
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); }
/** * Creates new instance initializing final fields. */ public AnnotationBar(JTextComponent target) { this.textComponent = target; this.editorUI = Utilities.getEditorUI(target); this.foldHierarchy = FoldHierarchy.get(editorUI.getComponent()); this.doc = editorUI.getDocument(); this.caret = textComponent.getCaret(); setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); elementAnnotationsSubstitute = ""; //NOI18N if (textComponent instanceof JEditorPane) { String mimeType = org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(textComponent); FontColorSettings fcs = MimeLookup.getLookup(mimeType).lookup(FontColorSettings.class); renderingHints = (Map) fcs.getFontColors(FontColorNames.DEFAULT_COLORING).getAttribute(EditorStyleConstants.RenderingHints); } else { renderingHints = null; } }
private void initProperties() { AttributeSet searchHiliteAttrs = ((FontColorSettings) MimeLookup.getLookup(MimePath.get("text/x-java")).lookup(FontColorSettings.class)).getFontColors("highlight-search"); //NOI18N Color c = (Color) searchHiliteAttrs.getAttribute(StyleConstants.Background); if (c != null) { bgColor = getColorString(c); } c = (Color) searchHiliteAttrs.getAttribute(StyleConstants.Foreground); if (c != null) { fgColor = getColorString(c); } Sheet sheet = Sheet.createDefault(); Sheet.Set ps = Sheet.createPropertiesSet(); ps.put(new PathProperty()); ps.put(new DateProperty()); ps.put(new UsernameProperty()); ps.put(new MessageProperty()); sheet.put(ps); setSheet(sheet); }