本文整理汇总了Java中org.fife.rsta.ac.LanguageSupportFactory.get方法的典型用法代码示例。如果您正苦于以下问题:Java LanguageSupportFactory.get方法的具体用法?Java LanguageSupportFactory.get怎么用?Java LanguageSupportFactory.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fife.rsta.ac.LanguageSupportFactory
的用法示例。
在下文中一共展示了LanguageSupportFactory.get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerZScript
import org.fife.rsta.ac.LanguageSupportFactory; //导入方法依赖的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());
}
示例2: setValuesImpl
import org.fife.rsta.ac.LanguageSupportFactory; //导入方法依赖的package包/类
/**
* Sets values in this panel to reflect those being used by the plugin.
*
* @param owner The application window.
* @see #doApplyImpl(Frame)
*/
@Override
protected void setValuesImpl(Frame owner) {
LanguageSupportFactory lsf = LanguageSupportFactory.get();
LanguageSupport ls = lsf.getSupportFor(Plugin.SYNTAX_STYLE_ZSCRIPT);
ZScriptLanguageSupport zls = (ZScriptLanguageSupport)ls;
// Options dealing with code completion
setEnabledCBSelected(zls.isAutoCompleteEnabled());
paramAssistanceCB.setSelected(zls.isParameterAssistanceEnabled());
showDescWindowCB.setSelected(zls.getShowDescWindow());
// Options dealing with auto-activation
setAutoActivateCBSelected(zls.isAutoActivationEnabled());
aaDelayField.setText(Integer.toString(zls.getAutoActivationDelay()));
// Options dealing with code folding
RText rtext = (RText)owner;
AbstractMainView view = rtext.getMainView();
foldingCB.setSelected(view.isCodeFoldingEnabledFor(
Plugin.SYNTAX_STYLE_ZSCRIPT));
}
示例3: updateAutocompletion
import org.fife.rsta.ac.LanguageSupportFactory; //导入方法依赖的package包/类
private void updateAutocompletion() {
LanguageSupportFactory lsf = LanguageSupportFactory.get();
LanguageSupport support = lsf.getSupportFor(
org.fife.ui.rsyntaxtextarea.SyntaxConstants.SYNTAX_STYLE_JAVA);
JavaLanguageSupport jls = (JavaLanguageSupport)support;
JarManager jarManager = jls.getJarManager();
try {
boolean doUpdate = false;
if (filesExist(m_autoCompletionJars)) {
m_autoCompletionJars = m_snippet.getClassPath();
doUpdate = true;
} else {
if (!Arrays.equals(m_autoCompletionJars, m_snippet.getClassPath())) {
m_autoCompletionJars = m_snippet.getClassPath();
doUpdate = true;
}
}
if (doUpdate) {
jarManager.clearClassFileSources();
jarManager.addCurrentJreClassFileSource();
for (File jarFile : m_autoCompletionJars) {
jarManager.addClassFileSource(jarFile);
}
}
} catch (IOException ioe) {
LOGGER.error(ioe.getMessage(), ioe);
}
}
示例4: checkForJavaParsing
import org.fife.rsta.ac.LanguageSupportFactory; //导入方法依赖的package包/类
/**
* Refreshes listeners on the text area when its syntax style changes.
*/
private void checkForJavaParsing() {
// Remove possible listener on old Java parser (in case they're just
// changing syntax style AWAY from Java)
if (parser!=null) {
parser.removePropertyChangeListener(
JavaParser.PROPERTY_COMPILATION_UNIT, listener);
parser = null;
}
// Get the Java language support (shared by all RSTA instances editing
// Java that were registered with the LanguageSupportFactory).
LanguageSupportFactory lsf = LanguageSupportFactory.get();
LanguageSupport support = lsf.getSupportFor(SyntaxConstants.
SYNTAX_STYLE_JAVA);
JavaLanguageSupport jls = (JavaLanguageSupport)support;
// Listen for re-parsing of the editor, and update the tree accordingly
parser = jls.getParser(textArea);
if (parser!=null) { // Should always be true
parser.addPropertyChangeListener(
JavaParser.PROPERTY_COMPILATION_UNIT, listener);
// Populate with any already-existing CompilationUnit
CompilationUnit cu = parser.getCompilationUnit();
update(cu);
}
else {
update((CompilationUnit)null); // Clear the tree
}
}
示例5: checkForZScriptParsing
import org.fife.rsta.ac.LanguageSupportFactory; //导入方法依赖的package包/类
/**
* Refreshes listeners on the text area when its syntax style changes.
*/
private void checkForZScriptParsing() {
// Remove possible listener on old Java parser (in case they're just
// changing syntax style AWAY from Java)
if (parser!=null) {
parser.removePropertyChangeListener(
ZScriptParser.PROPERTY_AST, listener);
parser = null;
}
// Get the Java language support (shared by all RSTA instances editing
// Java that were registered with the LanguageSupportFactory).
LanguageSupportFactory lsf = LanguageSupportFactory.get();
LanguageSupport support = lsf.getSupportFor("text/zscript");
ZScriptLanguageSupport zls = (ZScriptLanguageSupport)support;
// Listen for re-parsing of the editor, and update the tree accordingly
parser = zls.getParser(textArea);
if (parser!=null) { // Should always be true
parser.addPropertyChangeListener(
ZScriptParser.PROPERTY_AST, listener);
// Populate with any already-existing AST.
update(parser.getAst());
}
else {
update((ZScriptAst)null); // Clear the tree
}
}
示例6: registerZScript
import org.fife.rsta.ac.LanguageSupportFactory; //导入方法依赖的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));
}
示例7: doApplyImpl
import org.fife.rsta.ac.LanguageSupportFactory; //导入方法依赖的package包/类
/**
* Applies the changes in this panel into the application.
*
* @see #setValuesImpl(Frame)
*/
@Override
protected void doApplyImpl(Frame owner) {
LanguageSupportFactory lsf = LanguageSupportFactory.get();
LanguageSupport ls = lsf.getSupportFor(Plugin.SYNTAX_STYLE_ZSCRIPT);
ZScriptLanguageSupport zls = (ZScriptLanguageSupport)ls;
// Options dealing with code completion.
zls.setAutoCompleteEnabled(enabledCB.isSelected());
zls.setParameterAssistanceEnabled(paramAssistanceCB.isSelected());
zls.setShowDescWindow(showDescWindowCB.isSelected());
// Options dealing with auto-activation.
zls.setAutoActivationEnabled(autoActivateCB.isSelected());
int delay = Integer.parseInt(AA_DELAY_DEFAULT);
String temp = aaDelayField.getText();
if (temp.length()>0) {
try {
delay = Integer.parseInt(aaDelayField.getText());
} catch (NumberFormatException nfe) { // Never happens
nfe.printStackTrace();
}
}
zls.setAutoActivationDelay(delay);
// Options dealing with code folding.
RText rtext = (RText)owner;
AbstractMainView view = rtext.getMainView();
boolean folding = foldingCB.isSelected();
view.setCodeFoldingEnabledFor(Plugin.SYNTAX_STYLE_ZSCRIPT, folding);
}
示例8: checkForXmlParsing
import org.fife.rsta.ac.LanguageSupportFactory; //导入方法依赖的package包/类
/**
* Refreshes listeners on the text area when its syntax style changes.
*/
private void checkForXmlParsing() {
// Remove possible listener on old Java parser (in case they're just
// changing syntax style AWAY from Java)
if (parser!=null) {
parser.removePropertyChangeListener(XmlParser.PROPERTY_AST, listener);
parser = null;
}
// Get the Java language support (shared by all RSTA instances editing
// Java that were registered with the LanguageSupportFactory).
LanguageSupportFactory lsf = LanguageSupportFactory.get();
LanguageSupport support = lsf.getSupportFor(SyntaxConstants.
SYNTAX_STYLE_XML);
XmlLanguageSupport xls = (XmlLanguageSupport)support;
// Listen for re-parsing of the editor, and update the tree accordingly
parser = xls.getParser(textArea);
if (parser!=null) { // Should always be true
parser.addPropertyChangeListener(XmlParser.PROPERTY_AST, listener);
// Populate with any already-existing AST.
XmlTreeNode root = parser.getAst();
update(root);
}
else {
update((XmlTreeNode)null); // Clear the tree
}
}
示例9: checkForJavaScriptParsing
import org.fife.rsta.ac.LanguageSupportFactory; //导入方法依赖的package包/类
/**
* Refreshes listeners on the text area when its syntax style changes.
*/
private void checkForJavaScriptParsing() {
// Remove possible listener on old Java parser (in case they're just
// changing syntax style AWAY from Java)
if (parser!=null) {
parser.removePropertyChangeListener(
JavaScriptParser.PROPERTY_AST, listener);
parser = null;
}
// Get the Java language support (shared by all RSTA instances editing
// Java that were registered with the LanguageSupportFactory).
LanguageSupportFactory lsf = LanguageSupportFactory.get();
LanguageSupport support = lsf.getSupportFor(SyntaxConstants.
SYNTAX_STYLE_JAVASCRIPT);
JavaScriptLanguageSupport jls = (JavaScriptLanguageSupport)support;
// Listen for re-parsing of the editor, and update the tree accordingly
parser = jls.getParser(textArea);
if (parser!=null) { // Should always be true
parser.addPropertyChangeListener(
JavaScriptParser.PROPERTY_AST, listener);
// Populate with any already-existing AST
AstRoot ast = parser.getAstRoot();
update(ast);
}
else {
update((AstRoot)null); // Clear the tree
}
}
示例10: AreaDeTexto
import org.fife.rsta.ac.LanguageSupportFactory; //导入方法依赖的package包/类
/**
* O construtor da classe define uma lista do tipo HashMap, esta lista
* armazena a extensão e sintaxe da linguagem. Também define o recurso
* de autocompletar o código.
*/
public AreaDeTexto() {
extensao.put("java", SyntaxConstants.SYNTAX_STYLE_JAVA);
extensao.put("cpp", SyntaxConstants.SYNTAX_STYLE_CPLUSPLUS);
extensao.put("py", SyntaxConstants.SYNTAX_STYLE_PYTHON);
extensao.put("xml", SyntaxConstants.SYNTAX_STYLE_XML);
extensao.put("html", SyntaxConstants.SYNTAX_STYLE_HTML);
extensao.put("js", SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
extensao.put("css", SyntaxConstants.SYNTAX_STYLE_CSS);
extensao.put("c", SyntaxConstants.SYNTAX_STYLE_C);
extensao.put("sh", SyntaxConstants.SYNTAX_STYLE_UNIX_SHELL);
extensao.put("properties", SyntaxConstants.SYNTAX_STYLE_PROPERTIES_FILE);
extensao.put("groovy", SyntaxConstants.SYNTAX_STYLE_GROOVY);
extensao.put("jsp", SyntaxConstants.SYNTAX_STYLE_JSP);
extensao.put("as", SyntaxConstants.SYNTAX_STYLE_ACTIONSCRIPT);
extensao.put("asm", SyntaxConstants.SYNTAX_STYLE_ASSEMBLER_X86);
extensao.put("clj", SyntaxConstants.SYNTAX_STYLE_CLOJURE);
extensao.put("d", SyntaxConstants.SYNTAX_STYLE_D);
extensao.put("dfm", SyntaxConstants.SYNTAX_STYLE_DELPHI);
extensao.put("pas", SyntaxConstants.SYNTAX_STYLE_DELPHI);
extensao.put("f", SyntaxConstants.SYNTAX_STYLE_FORTRAN);
extensao.put("json", SyntaxConstants.SYNTAX_STYLE_JSON);
extensao.put("lof", SyntaxConstants.SYNTAX_STYLE_LATEX);
extensao.put("lisp", SyntaxConstants.SYNTAX_STYLE_LISP);
extensao.put("lua", SyntaxConstants.SYNTAX_STYLE_LUA);
extensao.put("perl", SyntaxConstants.SYNTAX_STYLE_PERL);
extensao.put("php", SyntaxConstants.SYNTAX_STYLE_PHP);
extensao.put("rb", SyntaxConstants.SYNTAX_STYLE_RUBY);
extensao.put("scala", SyntaxConstants.SYNTAX_STYLE_SCALA);
extensao.put("cs", SyntaxConstants.SYNTAX_STYLE_CSHARP);
extensao.put("vb", SyntaxConstants.SYNTAX_STYLE_VISUAL_BASIC);
extensao.put("bat", SyntaxConstants.SYNTAX_STYLE_WINDOWS_BATCH);
extensao.put("alg", "text/portugol");
extensao.put("poti", "text/potigol");
this.setLayout(new BorderLayout());
this.setBorder(null);
this.add(barraDeRolagem());
LanguageSupportFactory lsf = LanguageSupportFactory.get();
LanguageSupport support = lsf.getSupportFor(SyntaxConstants.SYNTAX_STYLE_JAVA);
JavaLanguageSupport jls = (JavaLanguageSupport) support;
try {
jls.getJarManager().addCurrentJreClassFileSource();
} catch (IOException ex) { }
lsf.register(getRSyntax());
bPesquisa = new Pesquisar(getRSyntax());
bPesquisa.setVisible(false);
this.add(BorderLayout.SOUTH, bPesquisa);
}
示例11: getParameterChoices
import org.fife.rsta.ac.LanguageSupportFactory; //导入方法依赖的package包/类
@Override
public List<Completion> getParameterChoices(JTextComponent tc, Parameter param) {
String type = param.getType();
if (type==null) { // e.g. a template
return null;
}
LanguageSupportFactory lsf = LanguageSupportFactory.get();
LanguageSupport support = lsf.getSupportFor("text/zscript");
ZScriptLanguageSupport zsls = (ZScriptLanguageSupport)support;
RSyntaxTextArea textArea = (RSyntaxTextArea)tc;
ZScriptParser parser = zsls.getParser(textArea);
if (parser==null) {
return null;
}
ZScriptAst ast = parser.getAst();
if (ast==null) {
return null;
}
RootNode root = ast.getRootNode();
List<Completion> choices = new ArrayList<Completion>();
int dot = textArea.getCaretPosition();
VariablesInScopeGrabber grabber = new VariablesInScopeGrabber(dot);
root.accept(grabber);
List<VariableDecNode> vars = grabber.getVariableList();
for (VariableDecNode varDec : vars) {
if (type.equals(varDec.getType())) {
choices.add(new ZScriptVariableCompletion(provider, varDec));
}
}
List<Completion> constants = constantValueMap.get(type);
if (constants!=null) {
choices.addAll(constants);
}
return choices;
}
示例12: DemoRootPane
import org.fife.rsta.ac.LanguageSupportFactory; //导入方法依赖的package包/类
public DemoRootPane() {
LanguageSupportFactory lsf = LanguageSupportFactory.get();
LanguageSupport support = lsf.getSupportFor(SYNTAX_STYLE_JAVA);
JavaLanguageSupport jls = (JavaLanguageSupport)support;
// TODO: This API will change! It will be easier to do per-editor
// changes to the build path.
try {
jls.getJarManager().addCurrentJreClassFileSource();
//jsls.getJarManager().addClassFileSource(ji);
} catch (IOException ioe) {
ioe.printStackTrace();
}
// Dummy tree keeps JViewport's "background" looking right initially
JTree dummy = new JTree((TreeNode)null);
treeSP = new JScrollPane(dummy);
textArea = createTextArea();
setText("CExample.txt", SYNTAX_STYLE_C);
scrollPane = new RTextScrollPane(textArea, true);
scrollPane.setIconRowHeaderEnabled(true);
scrollPane.getGutter().setBookmarkingEnabled(true);
final JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
treeSP, scrollPane);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
sp.setDividerLocation(0.25);
}
});
sp.setContinuousLayout(true);
// setContentPane(sp);
setJMenuBar(createMenuBar());
ErrorStrip errorStrip = new ErrorStrip(textArea);
//errorStrip.setBackground(java.awt.Color.blue);
JPanel cp = new JPanel(new BorderLayout());
cp.add(sp);
cp.add(errorStrip, BorderLayout.LINE_END);
setContentPane(cp);
}