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


Java LanguageSupportFactory类代码示例

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


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

示例1: execute

import org.fife.rsta.ac.LanguageSupportFactory; //导入依赖的package包/类
@Override
public HyperlinkEvent execute() {
	InputStream in = getClass().getResourceAsStream(res);
	BufferedReader r = new BufferedReader(new InputStreamReader(in));
	
	LanguageSupport ls = LanguageSupportFactory.get().getSupportFor("text/zscript");
	ZScriptLanguageSupport zsls = (ZScriptLanguageSupport)ls;
	DocDisplayer docDisplayer = zsls.getDocDisplayer();
	if (docDisplayer!=null) {
		String title = res.substring(res.lastIndexOf('/')+1);
		docDisplayer.display(title, r, searchFor);
	}
	else {
		UIManager.getLookAndFeel().provideErrorFeedback(textArea);
	}

	return null;
}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:19,代码来源:ZScriptLinkGenerator.java

示例2: refreshErrorTable

import org.fife.rsta.ac.LanguageSupportFactory; //导入依赖的package包/类
private void refreshErrorTable(List<ParserNotice> notices) {

		Gutter gutter = scrollPane.getGutter();
		gutter.removeAllTrackingIcons();
		errorTableModel.setRowCount(0);

		LanguageSupport ls = LanguageSupportFactory.get().getSupportFor("text/zscript");
		ZScriptLanguageSupport zsls = (ZScriptLanguageSupport)ls;
		ZScriptParser parser = zsls.getParser(textArea);
		for (ParserNotice notice : notices) {
			if (notice.getParser()==parser) {
				boolean error = notice.getLevel()==ParserNotice.Level.ERROR;
				String iconName = error ? IconFactory.ERROR_ICON : IconFactory.WARNING_ICON;
				Icon icon = IconFactory.get().getIcon(iconName);
				int line = notice.getLine();
				Object[] data = { icon, new Integer(line+1), notice };
				errorTableModel.addRow(data);
				try {
					gutter.addLineTrackingIcon(line, icon, notice.getToolTipText());
				} catch (BadLocationException ble) {
					ble.printStackTrace();
				}
			}
		}

	}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:27,代码来源:DemoRootPane.java

示例3: 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());

}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:21,代码来源:DemoRootPane.java

示例4: 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));

}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:30,代码来源:ZScriptOptionPanel.java

示例5: createTextArea

import org.fife.rsta.ac.LanguageSupportFactory; //导入依赖的package包/类
/**
	 * Creates the text area for this application.
	 *
	 * @return The text area.
	 */
	private RSyntaxTextArea createTextArea() {
		RSyntaxTextArea textArea = new RSyntaxTextArea(25, 80);
		LanguageSupportFactory.get().register(textArea);
		textArea.setCaretPosition(0);
		textArea.addHyperlinkListener(this);
		textArea.requestFocusInWindow();
		textArea.setMarkOccurrences(true);
		textArea.setCodeFoldingEnabled(true);
		textArea.setTabsEmulated(true);
		textArea.setTabSize(3);
//textArea.setBackground(new java.awt.Color(224, 255, 224));
//textArea.setUseSelectedTextColor(true);
//textArea.setLineWrap(true);
		ToolTipManager.sharedInstance().registerComponent(textArea);
		return textArea;
	}
 
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:22,代码来源:DemoRootPane.java

示例6: 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);
    }

}
 
开发者ID:pavloff-de,项目名称:spark4knime,代码行数:34,代码来源:JavaSnippetForRDDNodeDialog.java

示例7: 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
	}

}
 
开发者ID:pyros2097,项目名称:GdxStudio,代码行数:35,代码来源:JavaOutlineTree.java

示例8: 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
	}

}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:33,代码来源:ZScriptOutlineTree.java

示例9: 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));
}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:16,代码来源:Plugin.java

示例10: 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);

}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:38,代码来源:ZScriptOptionPanel.java

示例11: 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
	}

}
 
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:33,代码来源:XmlOutlineTree.java

示例12: 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
	}

}
 
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:35,代码来源:JavaScriptOutlineTree.java

示例13: 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);
}
 
开发者ID:cristian-henrique,项目名称:JCEditor,代码行数:59,代码来源:AreaDeTexto.java

示例14: actionPerformed

import org.fife.rsta.ac.LanguageSupportFactory; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
	LanguageSupport ls = LanguageSupportFactory.get().getSupportFor("text/zscript");
	ZScriptLanguageSupport zsls = (ZScriptLanguageSupport)ls;
	zsls.setAutoActivationEnabled(!zsls.isAutoActivationEnabled());
}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:7,代码来源:DemoRootPane.java

示例15: 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;

}
 
开发者ID:bobbylight,项目名称:ZScriptLanguageSupport,代码行数:43,代码来源:SourceParamChoicesProvider.java


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