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


Java SyntaxConstants类代码示例

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


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

示例1: DecompilePanel

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
public DecompilePanel(ClassNode cn, MethodNode mn) {
	this.classNode = cn;
	this.methodNode = mn;
	if (mn != null) {
		this.lookupHelper = new CFRResourceLookup(getIsolatedMethodClass());
	} else {
		this.lookupHelper = new CFRResourceLookup();
	}
	//
	textArea.setCaretPosition(0);
	textArea.requestFocusInWindow();
	textArea.setMarkOccurrences(true);
	textArea.setClearWhitespaceLinesEnabled(false);
	textArea.setEditable(false);
	textArea.setAntiAliasingEnabled(true);
	textArea.setCodeFoldingEnabled(true);
	textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
	textArea.setComponentPopupMenu(null);
	textArea.setPopupMenu(null);
	//
	setLayout(new BorderLayout());
	add(scrollText, BorderLayout.CENTER);
	//
	decompile();
}
 
开发者ID:Col-E,项目名称:Recaf,代码行数:26,代码来源:DecompilePanel.java

示例2: testParse_error_unclosedTag_nodtd

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
@Test
public void testParse_error_unclosedTag_nodtd() throws Exception {

	XmlParser parser = new XmlParser();

	// Include a DTD just for more code coverage
	RSyntaxDocument doc = new RSyntaxDocument(
			SyntaxConstants.SYNTAX_STYLE_XML);
	doc.insertString(0, "<?xml version='1.0'?>\n" +
			"<books>", null);

	ParseResult res = parser.parse(doc, doc.getSyntaxStyle());
	Assert.assertEquals(parser, res.getParser());
	Assert.assertEquals(0, res.getFirstLineParsed());
	Assert.assertEquals(1, res.getLastLineParsed());
	List<ParserNotice> notices = res.getNotices();
	Assert.assertEquals(1, notices.size());
	ParserNotice notice = notices.get(0);
	Assert.assertEquals(ParserNotice.Level.ERROR, notice.getLevel());

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:22,代码来源:XmlParserTest.java

示例3: testParse_error_unclosedTag_withDtd

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
@Test
public void testParse_error_unclosedTag_withDtd() throws Exception {

	XmlParser parser = new XmlParser();

	// Include a DTD just for more code coverage
	RSyntaxDocument doc = new RSyntaxDocument(
			SyntaxConstants.SYNTAX_STYLE_XML);
	doc.insertString(0, "<?xml version='1.0'?>\n" +
			"<!DOCTYPE RSyntaxTheme SYSTEM \"theme.dtd\">\n" +
			"<books>", null);

	ParseResult res = parser.parse(doc, doc.getSyntaxStyle());
	Assert.assertEquals(parser, res.getParser());
	Assert.assertEquals(0, res.getFirstLineParsed());
	Assert.assertEquals(2, res.getLastLineParsed());
	List<ParserNotice> notices = res.getNotices();
	Assert.assertEquals(1, notices.size());
	ParserNotice notice = notices.get(0);
	Assert.assertEquals(ParserNotice.Level.ERROR, notice.getLevel());

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:23,代码来源:XmlParserTest.java

示例4: testParse_happyPath

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
@Test
public void testParse_happyPath() throws Exception {

	TaskTagParser parser = new TaskTagParser();

	RSyntaxDocument doc = new RSyntaxDocument(
			SyntaxConstants.SYNTAX_STYLE_C);
	doc.insertString(0, "/* TODO: Fix this */", null);

	ParseResult res = parser.parse(doc, doc.getSyntaxStyle());
	Assert.assertEquals(parser, res.getParser());
	Assert.assertEquals(0, res.getFirstLineParsed());
	Assert.assertEquals(0, res.getLastLineParsed());
	List<ParserNotice> notices = res.getNotices();
	Assert.assertEquals(1, notices.size());
	// Note that the parser does not understand EOL vs. MLC comments, so
	// it just returns everything from the start of the task to the end of
	// the line.
	Assert.assertEquals("TODO: Fix this */", notices.get(0).getToolTipText());

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:22,代码来源:TaskTagParserTest.java

示例5: testParse_nullTaskPattern

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
@Test
public void testParse_nullTaskPattern() throws Exception {

	TaskTagParser parser = new TaskTagParser();
	parser.setTaskPattern(null);

	RSyntaxDocument doc = new RSyntaxDocument(
			SyntaxConstants.SYNTAX_STYLE_C);
	doc.insertString(0, "/* TODO: Fix this */ for", null);

	ParseResult res = parser.parse(doc, doc.getSyntaxStyle());
	Assert.assertEquals(parser, res.getParser());
	Assert.assertEquals(0, res.getFirstLineParsed());
	Assert.assertEquals(0, res.getLastLineParsed());
	List<ParserNotice> notices = res.getNotices();
	Assert.assertEquals(0, notices.size());

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:19,代码来源:TaskTagParserTest.java

示例6: testParse_noLanguage

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
@Test
public void testParse_noLanguage() throws Exception {

	TaskTagParser parser = new TaskTagParser();
	parser.setTaskPattern(null);

	RSyntaxDocument doc = new RSyntaxDocument(
			SyntaxConstants.SYNTAX_STYLE_NONE);
	doc.insertString(0, "/* TODO: Fix this */ for", null);

	ParseResult res = parser.parse(doc, doc.getSyntaxStyle());
	Assert.assertEquals(parser, res.getParser());
	Assert.assertEquals(0, res.getFirstLineParsed());
	Assert.assertEquals(0, res.getLastLineParsed());
	List<ParserNotice> notices = res.getNotices();
	Assert.assertEquals(0, notices.size());

	doc.setSyntaxStyle((String)null); // Not really valid, but whatever
	res = parser.parse(doc, doc.getSyntaxStyle());
	Assert.assertEquals(parser, res.getParser());
	Assert.assertEquals(0, res.getFirstLineParsed());
	Assert.assertEquals(0, res.getLastLineParsed());
	notices = res.getNotices();
	Assert.assertEquals(0, notices.size());

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:27,代码来源:TaskTagParserTest.java

示例7: JavaTextArea

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
public JavaTextArea(JRemapper jremap) {
	context = new Context(jremap);
	//
	textArea.setCaretPosition(0);
	textArea.requestFocusInWindow();
	textArea.setMarkOccurrences(true);
	textArea.setClearWhitespaceLinesEnabled(false);
	textArea.setEditable(false);
	textArea.setAntiAliasingEnabled(true);
	textArea.setCodeFoldingEnabled(true);
	textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
	textArea.setComponentPopupMenu(null);
	textArea.setPopupMenu(null);
	//
	caret = new JavaCaretListener(jremap, this);
	mouse = new JavaMouseListener(jremap, this);
	keys = new JavaKeyListener(jremap, this);
	textArea.addCaretListener(caret);
	textArea.addMouseListener(mouse);
	textArea.addKeyListener(keys);
	//
	setLayout(new BorderLayout());
	add(scrollText, BorderLayout.CENTER);
}
 
开发者ID:Col-E,项目名称:JRemapper,代码行数:25,代码来源:JavaTextArea.java

示例8: newTextArea

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
private RSyntaxTextArea newTextArea(){
//        JTextArea textArea = new JTextArea();
//        textArea.setAutoscrolls(true);
////      textArea.getDocument().addUndoableEditListener(undoMg);
//        textArea.addMouseListener(new TextAreaMouseListener());
        RSyntaxTextArea textArea = new RSyntaxTextArea();
        textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
        textArea.setCodeFoldingEnabled(true);
        textArea.setAntiAliasingEnabled(true);
        textArea.setAutoscrolls(true);

        SyntaxScheme scheme = textArea.getSyntaxScheme();
//        scheme.getStyle(Token.COMMENT_KEYWORD).foreground = Color.red;
//      scheme.getStyle(Token.DATA_TYPE).foreground = Color.blue;
        scheme.getStyle(Token.LITERAL_STRING_DOUBLE_QUOTE).foreground = Color.BLUE;
        scheme.getStyle(Token.LITERAL_NUMBER_DECIMAL_INT).foreground = new Color(164, 0, 0);
        scheme.getStyle(Token.LITERAL_NUMBER_FLOAT).foreground = new Color(164, 0, 0);
        scheme.getStyle(Token.LITERAL_BOOLEAN).foreground = Color.RED;
        scheme.getStyle(Token.OPERATOR).foreground = Color.BLACK;
        textArea.revalidate();
        textArea.addMouseListener(new TextAreaMouseListener());
       
        return textArea;
    }
 
开发者ID:nblookup,项目名称:HiJson,代码行数:25,代码来源:MainView.java

示例9: ConsoleTextField

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
public ConsoleTextField(CommandExecutor commandExecutor,
                        ConsoleTextArea textArea,
                        JLabel promptText)
{
    setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
    setAntiAliasingEnabled(true);
    setHighlightCurrentLine(false);
    discardAllEdits();
    setFont(EditorSettings.getCodeFont());

    this.history = new ArrayList<>();
    this.lineWas = "";
    this.commandExecutor = commandExecutor;
    this.promptText = promptText;
    this.textArea = textArea;
    addKeyListener(this);
    setFont(EditorSettings.getCodeFont());
    setInput("");
}
 
开发者ID:loadtestgo,项目名称:pizzascript,代码行数:20,代码来源:ConsoleTextField.java

示例10: createBottomPanel

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
/**
 * @param debuggerActions
 * @param loadChooser
 * @return
 */
static Component createBottomPanel(final AgentDebuggerFrame frame) {
    JPanel panel = new JPanel(new BorderLayout());

    RSyntaxTextArea loggerTA = new RSyntaxTextArea();
    frame.setLoggerTA(loggerTA);
    loggerTA.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE);
    loggerTA.setHyperlinksEnabled(false);
    loggerTA.setEditable(false);
    loggerTA.setHighlightCurrentLine(false);
    JPopupMenu popupMenu = new JPopupMenu();
    popupMenu.add(frame.getDebuggerActions().getSaveLogAction());
    popupMenu.add(frame.getDebuggerActions().getClearLogOutputAction());
    loggerTA.setPopupMenu(popupMenu);

    RTextScrollPane sp = new RTextScrollPane(loggerTA);
    sp.setIconRowHeaderEnabled(false);
    sp.getGutter().setBookmarkingEnabled(false);

    panel.add(sp, BorderLayout.CENTER);

    DebuggerAppender.addTextArea(loggerTA);

    return panel;
}
 
开发者ID:intuit,项目名称:Tank,代码行数:30,代码来源:PanelBuilder.java

示例11: addComponenets

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
protected void addComponenets() {
	this.codingArea = new RSyntaxTextArea(18, 60);
	codingArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PYTHON);
	codingArea.setCodeFoldingEnabled(true);
	codingArea.setText(standardScript());
	
	bodyPanel.setLayout(new BorderLayout());
	
	JPanel northPanel = addToNorth();
	if (northPanel != null) {
		bodyPanel.add(northPanel, BorderLayout.NORTH);
	}
	bodyPanel.add(new RTextScrollPane(codingArea), BorderLayout.CENTER);
	
	// insert footer button
	okButton = new JButton("OK");
	okButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			returnedValue = RETURNED_VALUES.SUCCESS;
			CodeDialog.this.dispose();
		}
	});
	addFooterButton(okButton, true);
}
 
开发者ID:delas,项目名称:plg,代码行数:26,代码来源:CodeDialog.java

示例12: addNewTextEditor

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
private TextEditor addNewTextEditor(String title) {
    final TextEditor tab = new TextEditor(this.jTabbedPane1, title);
    this.jTabbedPane1.add(tab, title);
    this.jTabbedPane1.setSelectedComponent(tab);
    tab.setTextFont(_font);
    if (this._scriptLanguage.equals("Groovy")) {
        tab.getTextArea().setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_GROOVY);
    } else {
        tab.getTextArea().setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PYTHON);
    }
    tab.getTextArea().discardAllEdits();
    tab.getTextArea().setDirty(false);
    tab.setTitle(title);
    ButtonTabComponent btc = new ButtonTabComponent(this.jTabbedPane1);
    JButton button = btc.getTabButton();
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            FrmTextEditor.this.closeFile(tab);
        }
    });
    this.jTabbedPane1.setTabComponentAt(this.jTabbedPane1.indexOfComponent(tab), btc);

    return tab;
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoMap,代码行数:26,代码来源:FrmTextEditor.java

示例13: createSnippetPanel

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
/**
 * Create the panel with the snippet.
 */
private JComponent createSnippetPanel() {
    updateAutocompletion();

    m_snippetTextArea = new JSnippetTextArea(m_snippet);

    // reset style which causes a recreation of the folds
    // this code is also executed in "onOpen" but that is not called for the template viewer tab
    m_snippetTextArea.setSyntaxEditingStyle(
            SyntaxConstants.SYNTAX_STYLE_NONE);
    m_snippetTextArea.setSyntaxEditingStyle(
            SyntaxConstants.SYNTAX_STYLE_JAVA);
    // collapse all folds
    int foldCount = m_snippetTextArea.getFoldManager().getFoldCount();
    for (int i = 0; i < foldCount; i++) {
        Fold fold = m_snippetTextArea.getFoldManager().getFold(i);
        fold.setCollapsed(true);
    }
    JScrollPane snippetScroller = new RTextScrollPane(m_snippetTextArea);
    JPanel snippet = new JPanel(new BorderLayout());
    snippet.add(snippetScroller, BorderLayout.CENTER);
    ErrorStrip es = new ErrorStrip(m_snippetTextArea);
    snippet.add(es, BorderLayout.LINE_END);
    return snippet;
}
 
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:28,代码来源:JavaSnippetForRDDNodeDialog.java

示例14: onOpen

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onOpen() {
    m_snippetTextArea.requestFocus();
    m_snippetTextArea.requestFocusInWindow();
    // reset style which causes a recreation of the popup window with
    // the side effect, that all folds are recreated, so that we must collapse
    // them next (bug 4061)
    m_snippetTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE);
    m_snippetTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
    // collapse all folds
    FoldManager foldManager = m_snippetTextArea.getFoldManager();
    int foldCount = foldManager.getFoldCount();
    for (int i = 0; i < foldCount; i++) {
        Fold fold = foldManager.getFold(i);
        fold.setCollapsed(true);
    }
}
 
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:21,代码来源:JavaSnippetForRDDNodeDialog.java

示例15: JavaSnippetDocument

import org.fife.ui.rsyntaxtextarea.SyntaxConstants; //导入依赖的package包/类
/**
 * Create a new instance.
 */
public JavaSnippetDocument() {
    super(SyntaxConstants.SYNTAX_STYLE_NONE);
    try {
        addGuardedSection(
                GUARDED_IMPORTS, getLength());
        insertString(getLength(), " \n", null);
        addGuardedSection(
                GUARDED_FIELDS, getLength());
        insertString(getLength(), " \n", null);
        GuardedSection bodyStart = addGuardedSection(
                GUARDED_BODY_START, getLength());
        bodyStart.setText("// expression start\n"
                + "  public void snippet() "
                + "throws TypeException, ColumnException, Abort {\n");
        insertString(getLength(), " \n", null);

        GuardedSection bodyEnd = addGuardedFooterSection(
                GUARDED_BODY_END, getLength());
        bodyEnd.setText("// expression end\n"
                + "    }\n"
                + "}");
    } catch (BadLocationException e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
}
 
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:29,代码来源:JavaSnippetDocument.java


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