本文整理匯總了Java中org.fife.ui.rsyntaxtextarea.SyntaxConstants.SYNTAX_STYLE_XML屬性的典型用法代碼示例。如果您正苦於以下問題:Java SyntaxConstants.SYNTAX_STYLE_XML屬性的具體用法?Java SyntaxConstants.SYNTAX_STYLE_XML怎麽用?Java SyntaxConstants.SYNTAX_STYLE_XML使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.fife.ui.rsyntaxtextarea.SyntaxConstants
的用法示例。
在下文中一共展示了SyntaxConstants.SYNTAX_STYLE_XML屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testParse_error_unclosedTag_nodtd
@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());
}
示例2: testParse_error_unclosedTag_withDtd
@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());
}
示例3: getSyntaxName
@Override
public String getSyntaxName() {
if (resFile == null) {
return null;
}
switch (resFile.getType()) {
case CODE:
return super.getSyntaxName();
case MANIFEST:
case XML:
return SyntaxConstants.SYNTAX_STYLE_XML;
default:
String syntax = getSyntaxByExtension(resFile.getName());
if (syntax != null) {
return syntax;
}
return super.getSyntaxName();
}
}
示例4: XMLEditor
public XMLEditor(MainFrame mainFrame) {
super(new BorderLayout());
this.mainFrame = mainFrame;
// create text area
this.editor = new RSyntaxTextArea(new RSyntaxDocument(SyntaxConstants.SYNTAX_STYLE_XML));
this.editor.setAnimateBracketMatching(true);
this.editor.setAutoIndentEnabled(true);
this.editor.setSelectionColor(Colors.TEXT_HIGHLIGHT_BACKGROUND);
this.editor.setBorder(null);
JToolBar toolBar = new ExtendedJToolBar();
toolBar.setBorder(null);
toolBar.add(new ResourceAction(true, "xml_editor.apply_changes") {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
try {
validateProcess();
} catch (IOException | XMLException e1) {
LogService.getRoot().log(Level.WARNING,
"com.rapidminer.gui.processeditor.XMLEditor.failed_to_parse_process");
}
}
});
toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Colors.TEXTFIELD_BORDER));
add(toolBar, BorderLayout.NORTH);
RTextScrollPane rTextScrollPane = new RTextScrollPane(editor);
rTextScrollPane.setBorder(null);
add(rTextScrollPane, BorderLayout.CENTER);
}
示例5: XMLEditor
public XMLEditor(MainFrame mainFrame) {
super(new BorderLayout());
this.mainFrame = mainFrame;
// create text area
this.editor = new RSyntaxTextArea(new RSyntaxDocument(SyntaxConstants.SYNTAX_STYLE_XML));
this.editor.setAnimateBracketMatching(true);
this.editor.setAutoIndentEnabled(true);
this.editor.setSelectionColor(Colors.TEXT_HIGHLIGHT_BACKGROUND);
this.editor.setBorder(null);
JToolBar toolBar = new ExtendedJToolBar();
toolBar.setBorder(null);
toolBar.add(new ResourceAction(true, "xml_editor.apply_changes") {
private static final long serialVersionUID = 1L;
@Override
public void loggedActionPerformed(ActionEvent e) {
try {
validateProcess();
} catch (IOException | XMLException e1) {
LogService.getRoot().log(Level.WARNING,
"com.rapidminer.gui.processeditor.XMLEditor.failed_to_parse_process");
}
}
});
toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Colors.TEXTFIELD_BORDER));
add(toolBar, BorderLayout.NORTH);
RTextScrollPane rTextScrollPane = new RTextScrollPane(editor);
rTextScrollPane.setBorder(null);
add(rTextScrollPane, BorderLayout.CENTER);
}
示例6: getMimeFromLanguage
private String getMimeFromLanguage(Language language) {
String code = language.getCode();
String mimeType = "text/plain";
switch (code) {
case "java":
mimeType = SyntaxConstants.SYNTAX_STYLE_JAVA;
break;
case "php":
mimeType = SyntaxConstants.SYNTAX_STYLE_RUBY;
break;
case "bash":
mimeType = SyntaxConstants.SYNTAX_STYLE_UNIX_SHELL;
break;
case "ruby":
mimeType = SyntaxConstants.SYNTAX_STYLE_RUBY;
break;
case "javascript":
mimeType = SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT;
break;
case "css":
mimeType = SyntaxConstants.SYNTAX_STYLE_CSS;
break;
case "html":
mimeType = SyntaxConstants.SYNTAX_STYLE_HTML;
break;
case "csharp":
mimeType = SyntaxConstants.SYNTAX_STYLE_CSHARP;
break;
case "sql":
mimeType = SyntaxConstants.SYNTAX_STYLE_SQL;
break;
case "xml":
mimeType = SyntaxConstants.SYNTAX_STYLE_XML;
break;
case "c":
mimeType = SyntaxConstants.SYNTAX_STYLE_C;
break;
case "objc":
mimeType = SyntaxConstants.SYNTAX_STYLE_CPLUSPLUS;
break;
case "python":
mimeType = SyntaxConstants.SYNTAX_STYLE_PYTHON;
break;
case "perl":
mimeType = SyntaxConstants.SYNTAX_STYLE_PERL;
break;
}
return mimeType;
}
示例7: testParse_emptyDocument
@Test
public void testParse_emptyDocument() throws Exception {
XmlParser parser = new XmlParser();
RSyntaxDocument doc = new RSyntaxDocument(
SyntaxConstants.SYNTAX_STYLE_XML);
ParseResult res = parser.parse(doc, doc.getSyntaxStyle());
assertCleanParseResult_oneLineDocument(parser, res);
}
示例8: testParse_happyPath
@Test
public void testParse_happyPath() throws Exception {
XmlParser parser = new XmlParser();
RSyntaxDocument doc = new RSyntaxDocument(
SyntaxConstants.SYNTAX_STYLE_XML);
doc.insertString(0, "<?xml version='1.0'?><books></books>", null);
ParseResult res = parser.parse(doc, doc.getSyntaxStyle());
assertCleanParseResult_oneLineDocument(parser, res);
}