本文整理汇总了Java中org.fife.ui.rsyntaxtextarea.TokenMakerFactory.getDefaultInstance方法的典型用法代码示例。如果您正苦于以下问题:Java TokenMakerFactory.getDefaultInstance方法的具体用法?Java TokenMakerFactory.getDefaultInstance怎么用?Java TokenMakerFactory.getDefaultInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fife.ui.rsyntaxtextarea.TokenMakerFactory
的用法示例。
在下文中一共展示了TokenMakerFactory.getDefaultInstance方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent ev) {
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
atmf.putMapping("text/portugol", "com.cristian.PortugolTokenMaker");
lista.get(arquivos.getSelectedIndex()).getRSyntax().setSyntaxEditingStyle("text/portugol");
updateLanguage("Portugol");
if (lista.get(arquivos.getSelectedIndex()).getArquivo() == null && gerarEstrutura.isSelected()) {
new GerarEstrutura(lista.get(arquivos.getSelectedIndex()).getRSyntax(), "Portugol");
}
bExecutarPotigol.setEnabled(false);
}
示例2: TextEditorDemo
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; //导入方法依赖的package包/类
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);
}
示例3: updateCompletionProvider
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; //导入方法依赖的package包/类
/**
* para o editor do jifi usar:
*
* updateCompletionProvider("s3f.jifi.functions.*","tokenInfo");
* updateCompletionProvider("s3f.jifi.functions.*","tokenInfo");
*
*
* @param em
* @param path
* @param property
*/
public final void updateCompletionProvider(EntityManager em, String path, String property) {
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
TokenMaker tokenMaker = atmf.getTokenMaker(textArea.getSyntaxEditingStyle());
TokenMap tokenMap = null;
if (tokenMaker instanceof ExtensibleTokenMaker) {
tokenMap = ((ExtensibleTokenMaker) tokenMaker).getTokenMap();
}
for (Object o : em.getAllProperties(path, property, Object.class)) {
if (o instanceof Completion) {
completionProvider.addCompletion((Completion) o);
if (tokenMap != null) {
//TODO: verificar!
tokenMap.put(((Completion) o).getReplacementText(), Token.FUNCTION);
}
} else {
completionProvider.addCompletion(
new BasicCompletion(completionProvider, o.toString())
);
if (tokenMap != null) {
//TODO: verificar!
tokenMap.put(o.toString(), Token.DATA_TYPE);
}
}
}
}
示例4: registerZScript
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; //导入方法依赖的package包/类
/**
* Set up general stuff for our new language. This doesn't really belong
* here, but was put here anywhere to share between the applet and
* stand-alone demos.
*/
static void registerZScript() {
// Set up general stuff for our new language.
LanguageSupportFactory lsf = LanguageSupportFactory.get();
lsf.addLanguageSupport("text/zscript", "org.fife.rsta.zscript.ZScriptLanguageSupport");
TokenMakerFactory tmf = TokenMakerFactory.getDefaultInstance();
((AbstractTokenMakerFactory)tmf).putMapping("text/zscript", "org.fife.rsta.zscript.ZScriptTokenMaker");
FoldParserManager fpm = FoldParserManager.get();
fpm.addFoldParserMapping("text/zscript", new CurlyFoldParser(false, false));
LanguageSupport ls = LanguageSupportFactory.get().getSupportFor("text/zscript");
ZScriptLanguageSupport zsls = (ZScriptLanguageSupport)ls;
zsls.setDocDisplayer(new DemoDocDisplayer());
}
示例5: setSyntaxHighlightingForRelationalAlgebra
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; //导入方法依赖的package包/类
/**
* Tells the RSyntaxTextArea instance what TokerMaker it has
* to use in order to recognize the Relational Algebra language.
*/
private void setSyntaxHighlightingForRelationalAlgebra() {
AbstractTokenMakerFactory atmf =
(AbstractTokenMakerFactory)TokenMakerFactory.getDefaultInstance();
atmf.putMapping(RA_SYNTAX_STYLE_ID, TOKEN_MAKER_LOCATION);
getRelationalAlgebraCodeEditor().setSyntaxEditingStyle(RA_SYNTAX_STYLE_ID);
}
示例6: SparqlTextArea
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; //导入方法依赖的package包/类
public SparqlTextArea() {
// Whether templates are enabled is a global property affecting all
// RSyntaxTextAreas, so this method is static.
RSyntaxTextArea.setTemplatesEnabled( true );
// Code templates are shared among all RSyntaxTextAreas. You add and
// remove templates through the shared CodeTemplateManager instance.
ctm = RSyntaxTextArea.getCodeTemplateManager();
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
atmf.putMapping( "text/sparql", SPARQLTokenMaker.class.getCanonicalName() );
setSyntaxEditingStyle( "text/sparql" );
changeStyleViaThemeXml();
setCodeFoldingEnabled( false );
setAntiAliasingEnabled( true );
setLineWrap( true );
setWrapStyleWord( true );
Font f = getFont();
// use a mono-spaced font so indentation works well
setFont( new Font( Font.MONOSPACED, f.getStyle(), f.getSize() ) );
CompletionProvider provider = createCompletionProvider();
AutoCompletion ac = new AutoCompletion( provider );
ac.install( this );
setBracketMatchingEnabled( true );
// Remove the code-folding component and it's separator from the popup menu:
JPopupMenu popup = getPopupMenu();
popup.remove( popup.getComponent( 9 ) ); // the separator
popup.remove( popup.getComponent( 9 ) ); // the item
popup.addSeparator();
popup.add( saver );
}
示例7: Editor
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; //导入方法依赖的package包/类
public Editor() throws IOException {
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory)TokenMakerFactory.getDefaultInstance();
// Class generated by jflex
atmf.putMapping("sat", "gui.editionView.editor.TouistlTokenMaker");
atmf.putMapping("smt", "gui.editionView.editor.TouistlTokenMaker");
atmf.putMapping("qbf", "gui.editionView.editor.TouistlTokenMaker");
this.setSyntaxEditingStyle("sat");
// Defines the color, font police and style of the different tokens
Theme t = Theme.load(this.getClass().getResourceAsStream("/touistTheme.xml"));
t.apply(this);
snipetsBegin = new ArrayList<Integer>();
snipetsEnd = new ArrayList<Integer>();
// Note: I disabled ctrl+left and ctrl+right for moving through snippet tokens
// because it was disabling the possibilty of moving through the text word by word on
// Windows.
/*
this.getDocument().addDocumentListener(new SnippetListener());
String rightKeyStrokeAndKey = "control RIGHT";
KeyStroke rightKeyStroke = KeyStroke.getKeyStroke(rightKeyStrokeAndKey);
this.getInputMap().put(rightKeyStroke, rightKeyStrokeAndKey);
this.getActionMap().put(rightKeyStrokeAndKey, new SnippetRightAction(this));
String leftKeyStrokeAndKey = "control LEFT";
KeyStroke leftKeyStroke = KeyStroke.getKeyStroke(leftKeyStrokeAndKey);
this.getInputMap().put(leftKeyStroke, leftKeyStrokeAndKey);
this.getActionMap().put(leftKeyStrokeAndKey, new SnippetLeftAction(this));
*/
}
示例8: createGui
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; //导入方法依赖的package包/类
private void createGui()
{
setLayout(new BorderLayout());
sectionPanel = new CollapsibleSectionPanel();
editor = new TextEditorPane();
editor.setBracketMatchingEnabled(true);
Font font = new Font("Monospaced", Font.PLAIN, editor.getFont().getSize() + 2);
editor.setFont(font);
SyntaxScheme syntax = editor.getSyntaxScheme();
syntax.getStyle(Token.LITERAL_STRING_DOUBLE_QUOTE).foreground = Color.BLUE;
syntax.getStyle(Token.LITERAL_CHAR).foreground = Color.BLUE;
syntax.getStyle(Token.SEPARATOR).foreground = Color.DARK_GRAY;
syntax.getStyle(Token.RESERVED_WORD).font = font;
RTextScrollPane scrollPane = new RTextScrollPane(editor);
sectionPanel.add(scrollPane);
add(sectionPanel, BorderLayout.CENTER);
CompletionProvider provider = createCompletionProvider();
AutoCompletion ac = new AutoCompletion(provider);
ac.install(editor);
AbstractTokenMakerFactory tokenMakerFactory =
(AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
tokenMakerFactory.putMapping("text/conf",
"de.muenchen.allg.itd51.wollmux.former.ConfigTokenMaker");
editor.setSyntaxEditingStyle("text/conf");
setJMenuBar(createMenu());
initDialogs();
editor.setCaretPosition(0);
}
示例9: registerZScript
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; //导入方法依赖的package包/类
/**
* Set up general stuff for our new language.
*/
private void registerZScript() {
LanguageSupportFactory lsf = LanguageSupportFactory.get();
lsf.addLanguageSupport(SYNTAX_STYLE_ZSCRIPT,
"org.fife.rsta.zscript.ZScriptLanguageSupport");
TokenMakerFactory tmf = TokenMakerFactory.getDefaultInstance();
((AbstractTokenMakerFactory)tmf).putMapping(SYNTAX_STYLE_ZSCRIPT,
"org.fife.rsta.zscript.ZScriptTokenMaker",
getClass().getClassLoader());
FoldParserManager fpm = FoldParserManager.get();
fpm.addFoldParserMapping(SYNTAX_STYLE_ZSCRIPT,
new CurlyFoldParser(false, false));
}
示例10: setTokenMaker
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; //导入方法依赖的package包/类
private void setTokenMaker() {
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
atmf.putMapping(Const.languageId, Const.tokenizerClassId);
}
示例11: OwnSyntaxPane
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; //导入方法依赖的package包/类
public OwnSyntaxPane() {
panel = new JPanel(new FlowLayout());
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
textArea = new RSyntaxTextArea() {
private static final long serialVersionUID = 7431070002967577129L;
@Override
public void undoLastAction() {
CurrentDiagram.getInstance().getDiagramHandler().getController().undo();
}
@Override
public void redoLastAction() {
CurrentDiagram.getInstance().getDiagramHandler().getController().redo();
}
};
// Setup highlighting
createHightLightMap();
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
atmf.putMapping(OwnTokenMaker.ID, OwnTokenMaker.class.getName());
textArea.setSyntaxEditingStyle(OwnTokenMaker.ID);
textArea.getSyntaxScheme().getStyle(TokenTypes.RESERVED_WORD).foreground = Converter.convert(ColorOwn.SYNTAX_HIGHLIGHTING);
// Setup autocompletion
createAutocompletionCompletionProvider();
AutoCompletion ac = new AutoCompletion(provider);
// ac.setShowDescWindow(true);
ac.install(textArea);
JLabel propertyLabel = new JLabel(" Properties");
propertyLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
propertyLabel.setFont(DerivedConfig.getPanelHeaderFont());
panel.add(propertyLabel);
textArea.setAntiAliasingEnabled(true);
textArea.setFont(DerivedConfig.getPanelContentFont());
scrollPane = new RTextScrollPane(textArea, false);
scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
panel.add(scrollPane);
textArea.getDocument().putProperty(PlainDocument.tabSizeAttribute, 3); // Reduce tab size
}
示例12: addNewLanguage
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; //导入方法依赖的package包/类
/**
*
* @param name ex: "function"
* @param classpath ex:
* "robotinterface.gui.panels.editor.syntaxtextarea.FunctionTokenMaker"
*/
public static void addNewLanguage(String name, String classpath) {
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
atmf.putMapping("text/" + name, classpath);
}