org.fife.rsta.ac.c.CLanguageSupport Maven / Gradle / Ivy
/*
* 03/21/2010
*
* Copyright (C) 2010 Robert Futrell
* robert_futrell at users.sourceforge.net
* http://fifesoft.com/rsyntaxtextarea
*
* This code is licensed under the LGPL. See the "license.txt" file included
* with this project.
*/
package org.fife.rsta.ac.c;
import javax.swing.ListCellRenderer;
import org.fife.rsta.ac.AbstractLanguageSupport;
import org.fife.ui.autocomplete.AutoCompletion;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
/**
* Language support for C.
*
* @author Robert Futrell
* @version 1.0
*/
public class CLanguageSupport extends AbstractLanguageSupport {
/**
* The completion provider, shared amongst all text areas editing C.
*/
private CCompletionProvider provider;
/**
* Constructor.
*/
public CLanguageSupport() {
setParameterAssistanceEnabled(true);
setShowDescWindow(true);
}
/**
* {@inheritDoc}
*/
protected ListCellRenderer createDefaultCompletionCellRenderer() {
return new CCellRenderer();
}
private CCompletionProvider getProvider() {
if (provider==null) {
provider = new CCompletionProvider();
}
return provider;
}
/**
* {@inheritDoc}
*/
public void install(RSyntaxTextArea textArea) {
CCompletionProvider provider = getProvider();
AutoCompletion ac = createAutoCompletion(provider);
ac.install(textArea);
installImpl(textArea, ac);
textArea.setToolTipSupplier(provider);
}
/**
* {@inheritDoc}
*/
public void uninstall(RSyntaxTextArea textArea) {
uninstallImpl(textArea);
}
}