/** * Sets the token maker factory used by this document. * * @param tmf The <code>TokenMakerFactory</code> for this document. If * this is <code>null</code>, a default factory is used. */ public void setTokenMakerFactory(TokenMakerFactory tmf) { tokenMakerFactory = tmf!=null ? tmf : TokenMakerFactory.getDefaultInstance(); }
/** * Sets the syntax style being used for syntax highlighting in this * document. What styles are supported by a document is determined by its * {@link TokenMakerFactory}. By default, all <code>RSyntaxDocument</code>s * support all languages built into <code>RSyntaxTextArea</code>. * * @param styleKey The new style to use, such as * {@link SyntaxConstants#SYNTAX_STYLE_JAVA}. If this style is not * known or supported by this document, then * {@link SyntaxConstants#SYNTAX_STYLE_NONE} is used. * @see #setSyntaxStyle(TokenMaker) * @see #getSyntaxStyle() */ public void setSyntaxStyle(String styleKey) { tokenMaker = tokenMakerFactory.getTokenMaker(styleKey); updateSyntaxHighlightingInformation(); this.syntaxStyle = styleKey; }
/** * Returns a {@link TokenMaker} for the specified key. * * @param key The key. * @return The corresponding <code>TokenMaker</code>, or * {@link PlainTextTokenMaker} if none matches the specified key. */ public final TokenMaker getTokenMaker(String key) { TokenMaker tm = getTokenMakerImpl(key); if (tm==null) { tm = new PlainTextTokenMaker(); } return tm; }
/** * Sets the token maker factory used by this document. * * @param tmf The <code>TokenMakerFactory</code> for this document. If * this is <code>null</code>, a default factory is used. */ public void setTokenMakerFactory(TokenMakerFactory tmf) { tokenMakerFactory = tmf!=null ? tmf : TokenMakerFactory.getDefaultInstance(); }
/** * Returns a {@link TokenMaker} for the specified key. * * @param key The key. * @return The corresponding <code>TokenMaker</code>, or * {@link PlainTextTokenMaker} if none matches the specified key. */ public final TokenMaker getTokenMaker(String key) { TokenMaker tm = getTokenMakerImpl(key); if (tm==null) { tm = new PlainTextTokenMaker(); } return tm; }
/** * Sets the syntax style being used for syntax highlighting in this * document. What styles are supported by a document is determined by its * {@link TokenMakerFactory}. By default, all <code>RSyntaxDocument</code>s * support all languages built into <code>RSyntaxTextArea</code>. * * @param styleKey The new style to use, such as * {@link SyntaxConstants#SYNTAX_STYLE_JAVA}. If this style is not * known or supported by this document, then * {@link SyntaxConstants#SYNTAX_STYLE_NONE} is used. */ public void setSyntaxStyle(String styleKey) { tokenMaker = tokenMakerFactory.getTokenMaker(styleKey); updateSyntaxHighlightingInformation(); }
/** * Sets the token maker factory used by this document. * * @param tmf The <code>TokenMakerFactory</code> for this document. If * this is <code>null</code>, a default factory is used. */ public void setTokenMakerFactory(TokenMakerFactory tmf) { tokenMakerFactory = tmf!=null ? tmf : TokenMakerFactory.getDefaultInstance(); }
/** * Returns a {@link TokenMaker} for the specified key. * * @param key The key. * @return The corresponding <code>TokenMaker</code>, or * {@link PlainTextTokenMaker} if none matches the specified key. */ public final TokenMaker getTokenMaker(String key) { TokenMaker tm = getTokenMakerImpl(key); if (tm==null) { tm = new PlainTextTokenMaker(); } return tm; }
/** * Sets the syntax style being used for syntax highlighting in this * document. What styles are supported by a document is determined by its * {@link TokenMakerFactory}. By default, all <code>RSyntaxDocument</code>s * support all languages built into <code>RSyntaxTextArea</code>. * * @param styleKey The new style to use, such as * {@link SyntaxConstants#SYNTAX_STYLE_JAVA}. If this style is not * known or supported by this document, then * {@link SyntaxConstants#SYNTAX_STYLE_NONE} is used. * @see #setSyntaxStyle(TokenMaker) * @see #getSyntaxStyle() */ public void setSyntaxStyle(String styleKey) { tokenMaker = tokenMakerFactory.getTokenMaker(styleKey); updateSyntaxHighlightingInformation(); this.syntaxStyle = styleKey; }
/** * Sets the token maker factory used by this document. * * @param tmf The <code>TokenMakerFactory</code> for this document. If * this is <code>null</code>, a default factory is used. */ public void setTokenMakerFactory(TokenMakerFactory tmf) { tokenMakerFactory = tmf!=null ? tmf : TokenMakerFactory.getDefaultInstance(); }
/** * Returns a {@link TokenMaker} for the specified key. * * @param key The key. * @return The corresponding <code>TokenMaker</code>, or * {@link PlainTextTokenMaker} if none matches the specified key. */ public final TokenMaker getTokenMaker(String key) { TokenMaker tm = getTokenMakerImpl(key); if (tm==null) { tm = new PlainTextTokenMaker(); } return tm; }
/** * Sets the syntax style being used for syntax highlighting in this * document. What styles are supported by a document is determined by its * {@link TokenMakerFactory}. By default, all <code>RSyntaxDocument</code>s * support all languages built into <code>RSyntaxTextArea</code>. * * @param styleKey The new style to use, such as * {@link SyntaxConstants#SYNTAX_STYLE_JAVA}. If this style is not * known or supported by this document, then * {@link SyntaxConstants#SYNTAX_STYLE_NONE} is used. */ public void setSyntaxStyle(String styleKey) { tokenMaker = tokenMakerFactory.getTokenMaker(styleKey); updateSyntaxHighlightingInformation(); }
public TextEditorDemo() { JPanel cp = new JPanel(new BorderLayout()); AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory)TokenMakerFactory.getDefaultInstance(); atmf.putMapping("text/c3dg", "org.konte.ui.KonteRSTATokenMaker"); RSyntaxTextArea textArea = new RSyntaxTextArea(20, 60); textArea.setSyntaxEditingStyle("text/c3dg"); textArea.setCodeFoldingEnabled(true); RTextScrollPane sp = new RTextScrollPane(textArea); cp.add(sp); setContentPane(cp); setTitle("Text Editor Demo"); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); setLocationRelativeTo(null); }
this.editor.setPopupMenu(null); final AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance(); atmf.putMapping("text/plantuml", "com.igormaznitsa.sciareto.ui.editors.PlantUmlTokenMaker");