本文整理汇总了Java中org.fife.ui.autocomplete.Completion类的典型用法代码示例。如果您正苦于以下问题:Java Completion类的具体用法?Java Completion怎么用?Java Completion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Completion类属于org.fife.ui.autocomplete包,在下文中一共展示了Completion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateCompletionProvider
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* para o editor do jifi usar:
*
* updateCompletionProvider("s3f.jifi.functions.*","tokenInfo");
* updateCompletionProvider("s3f.jifi.functions.*","tokenInfo");
*
*
* @param em
* @param path
* @param property
*/
public final void updateCompletionProvider(EntityManager em, String path, String property) {
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
TokenMaker tokenMaker = atmf.getTokenMaker(textArea.getSyntaxEditingStyle());
TokenMap tokenMap = null;
if (tokenMaker instanceof ExtensibleTokenMaker) {
tokenMap = ((ExtensibleTokenMaker) tokenMaker).getTokenMap();
}
for (Object o : em.getAllProperties(path, property, Object.class)) {
if (o instanceof Completion) {
completionProvider.addCompletion((Completion) o);
if (tokenMap != null) {
//TODO: verificar!
tokenMap.put(((Completion) o).getReplacementText(), Token.FUNCTION);
}
} else {
completionProvider.addCompletion(
new BasicCompletion(completionProvider, o.toString())
);
if (tokenMap != null) {
//TODO: verificar!
tokenMap.put(o.toString(), Token.DATA_TYPE);
}
}
}
}
开发者ID:anderson-,项目名称:S3F,代码行数:39,代码来源:CodeEditorTab.java
示例2: getClass
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* Returns the class for a completion (class completions return the class
* itself, member completions return the enclosing class).
*/
private String getClass(Completion c, String desc) {
String clazz = null;
if (c instanceof ClassCompletion) {
clazz = ((ClassCompletion)c).getClassName(true);
}
else if (c instanceof MemberCompletion) {
MemberCompletion mc = (MemberCompletion)c;
clazz = mc.getEnclosingClassName(true);
}
else {
System.err.println("Can't determine class from completion type: " +
c.getClass() + " (" + c.toString() + ") - href: " + desc);
}
return clazz;
}
开发者ID:pyros2097,项目名称:GdxStudio,代码行数:24,代码来源:JavadocUrlHandler.java
示例3: getPackage
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* Returns the package of the specified completion.
*
* @param c The completion.
* @param desc The description text being parsed. Used for errors if we
* cannot determine the package.
* @return The package.
*/
private String getPackage(Completion c, String desc) {
String pkg = null;
if (c instanceof ClassCompletion) {
pkg = ((ClassCompletion)c).getPackageName();
}
else if (c instanceof MemberCompletion) {
String definedIn = ((MemberCompletion)c).getEnclosingClassName(true);
if (definedIn!=null) {
int lastDot = definedIn.lastIndexOf('.');
if (lastDot>-1) {
pkg = definedIn.substring(0, lastDot);
}
}
}
else {
System.err.println("Can't determine package from completion type: " +
c.getClass() + " (" + c.toString() + ") - href: " + desc);
}
return pkg;
}
开发者ID:pyros2097,项目名称:GdxStudio,代码行数:33,代码来源:JavadocUrlHandler.java
示例4: compareTo
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* Overridden to ensure that two completions don't just have the same
* text value (ignoring case), but that they're of the same "type" of
* <code>Completion</code> as well, so, for example, a completion for the
* "String" class won't clash with a completion for a "string" LocalVar.
*
* @param o Another completion instance.
* @return How this completion compares to the other one.
*/
@Override
public int compareTo(Completion o) {
int rc = -1;
if (o==this) {
rc = 0;
}
else if (o instanceof Completion) {
Completion c2 = (Completion)o;
rc = toString().compareToIgnoreCase(c2.toString());
if (rc==0) { // Same text value
String clazz1 = getClass().getName();
clazz1 = clazz1.substring(clazz1.lastIndexOf('.'));
String clazz2 = c2.getClass().getName();
clazz2 = clazz2.substring(clazz2.lastIndexOf('.'));
rc = clazz1.compareTo(clazz2);
}
}
return rc;
}
开发者ID:pyros2097,项目名称:GdxStudio,代码行数:34,代码来源:AbstractJavaSourceCompletion.java
示例5: compareTo
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* Overridden to ensure that two completions don't just have the same
* text value (ignoring case), but that they're of the same "type" of
* <code>Completion</code> as well, so, for example, a completion for the
* "String" class won't clash with a completion for a "string" LocalVar.
*
* @param c2 Another completion instance.
* @return How this completion compares to the other one.
*/
@Override
public int compareTo(Completion c2) {
int rc = -1;
if (c2==this) {
rc = 0;
}
else if (c2!=null) {
rc = toString().compareToIgnoreCase(c2.toString());
if (rc==0) { // Same text value
String clazz1 = getClass().getName();
clazz1 = clazz1.substring(clazz1.lastIndexOf('.'));
String clazz2 = c2.getClass().getName();
clazz2 = clazz2.substring(clazz2.lastIndexOf('.'));
rc = clazz1.compareTo(clazz2);
}
}
return rc;
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:33,代码来源:AbstractJavaSourceCompletion.java
示例6: generate
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public List<Completion> generate(CompletionProvider provider, String input){
List<Completion> completions = new ArrayList<Completion>();
completions.add(new FontFamilyCompletion(provider, "Georgia"));
completions.add(new FontFamilyCompletion(provider, "\"Times New Roman\""));
completions.add(new FontFamilyCompletion(provider, "Arial"));
completions.add(new FontFamilyCompletion(provider, "Helvetica"));
completions.add(new FontFamilyCompletion(provider, "Impact"));
completions.add(new FontFamilyCompletion(provider, "\"Lucida Sans Unicode\""));
completions.add(new FontFamilyCompletion(provider, "Tahoma"));
completions.add(new FontFamilyCompletion(provider, "Verdana"));
completions.add(new FontFamilyCompletion(provider, "Geneva"));
completions.add(new FontFamilyCompletion(provider, "\"Courier New\""));
completions.add(new FontFamilyCompletion(provider, "Courier"));
completions.add(new FontFamilyCompletion(provider, "\"Lucida Console\""));
completions.add(new FontFamilyCompletion(provider, "Menlo"));
completions.add(new FontFamilyCompletion(provider, "Monaco"));
completions.add(new FontFamilyCompletion(provider, "Consolas"));
return completions;
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:27,代码来源:CommonFontCompletionGenerator.java
示例7: generate
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public List<Completion> generate(CompletionProvider provider, String input){
List<Completion> completions = new ArrayList<Completion>();
completions.add(new BorderStyleCompletion(provider, "none"));
completions.add(new BorderStyleCompletion(provider, "hidden"));
completions.add(new BorderStyleCompletion(provider, "dotted"));
completions.add(new BorderStyleCompletion(provider, "dashed"));
completions.add(new BorderStyleCompletion(provider, "solid"));
completions.add(new BorderStyleCompletion(provider, "double"));
completions.add(new BorderStyleCompletion(provider, "groove"));
completions.add(new BorderStyleCompletion(provider, "ridge"));
completions.add(new BorderStyleCompletion(provider, "inset"));
completions.add(new BorderStyleCompletion(provider, "outset"));
return completions;
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:22,代码来源:BorderStyleCompletionGenerator.java
示例8: PropertyValueCompletionProvider
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
public PropertyValueCompletionProvider(boolean isLess) {
setAutoActivationRules(true, "@: ");
// While we don't have functions per-se in CSS, we do in Less
setParameterizedCompletionParams('(', ", ", ')');
this.isLess = isLess;
try {
this.valueCompletions = new HashMap<String, List<Completion>>();
this.valueCompletionGenerators =
new HashMap<String, List<CompletionGenerator>>();
loadPropertyCompletions();
this.htmlTagCompletions = loadHtmlTagCompletions();
} catch (IOException ioe) { // Never happens
throw new RuntimeException(ioe);
}
comparator = new AbstractCompletionProvider.CaseInsensitiveComparator();
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:21,代码来源:PropertyValueCompletionProvider.java
示例9: loadFromXML
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* Loads completions from an XML file. The XML should validate against
* <code>CompletionXml.dtd</code>.
*
* @param resource A resource the current ClassLoader can get to.
* @throws IOException If an IO error occurs.
*/
protected List<Completion> loadFromXML(String resource) throws IOException {
ClassLoader cl = getClass().getClassLoader();
InputStream in = cl.getResourceAsStream(resource);
if (in==null) {
File file = new File(resource);
if (file.isFile()) {
in = new FileInputStream(file);
}
else {
throw new IOException("No such resource: " + resource);
}
}
BufferedInputStream bin = new BufferedInputStream(in);
try {
return loadFromXML(bin, null);
} finally {
bin.close();
}
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:27,代码来源:PropertyValueCompletionProvider.java
示例10: getTagCompletions
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* Overridden to include JSP-specific tags in addition to the standard
* HTML tags.
*
* @return The list of tags.
*/
@Override
protected List<Completion> getTagCompletions() {
List<Completion> completions = new ArrayList<Completion>(
super.getTagCompletions());
for (Map.Entry<String, TldFile> entry : prefixToTld.entrySet()) {
String prefix = entry.getKey();
TldFile tld = entry.getValue();
for (int j=0; j<tld.getElementCount(); j++) {
TldElement elem = tld.getElement(j);
MarkupTagCompletion mtc = new MarkupTagCompletion(this,
prefix + ":" + elem.getName());
mtc.setDescription(elem.getDescription());
completions.add(mtc);
}
}
Collections.sort(completions);
return completions;
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:29,代码来源:JspCompletionProvider.java
示例11: addLessCompletions
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* Overridden to handle Less properly.
*/
@Override
protected boolean addLessCompletions(List<Completion> completions,
LexerState state, JTextComponent comp, String alreadyEntered) {
boolean modified = false;
if (alreadyEntered != null && alreadyEntered.length() > 0 &&
alreadyEntered.charAt(0) == '@') {
addLessVariableCompletions(completions, comp, alreadyEntered);
modified = true;
}
if (state == LexerState.VALUE) {
addLessBuiltinFunctionCompletions(completions, alreadyEntered);
modified = true;
}
return modified;
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:24,代码来源:LessCodeCompletionProvider.java
示例12: compareTo
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public int compareTo(Completion other) {
int rc = -1;
if (other==this) {
rc = 0;
}
else if (other instanceof JSCompletion) {
JSCompletion c2 = (JSCompletion)other;
rc = getLookupName().compareTo(c2.getLookupName());
}
else if (other!=null) {
rc = toString().compareTo(other.toString());
if (rc == 0) { // Same text value
String clazz1 = getClass().getName();
clazz1 = clazz1.substring(clazz1.lastIndexOf('.'));
String clazz2 = other.getClass().getName();
clazz2 = clazz2.substring(clazz2.lastIndexOf('.'));
rc = clazz1.compareTo(clazz2);
}
}
return rc;
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:27,代码来源:JSFunctionCompletion.java
示例13: addCodeBlock
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* for each child of parent AstNode add a new code block and add completions
* for each block of code
*
* @param parent AstNode to iterate children
* @param set completions set to add to
* @param entered Text entered
* @param codeBlock parent CodeBlock
* @param offset codeblock offset
*/
private void addCodeBlock(Node parent, Set<Completion> set,
String entered, CodeBlock codeBlock, int offset) {
if(parent == null)
return;
Node child = parent.getFirstChild();
while (child != null) {
CodeBlock childBlock = codeBlock;
if (child instanceof AstNode) {
AstNode node = (AstNode) child;
int start = node.getAbsolutePosition();
childBlock = codeBlock.addChildCodeBlock(start);
childBlock.setEndOffset(offset);
}
iterateNode((AstNode) child, set, entered, childBlock, offset);
child = child.getNext();
}
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:33,代码来源:JavaScriptAstParser.java
示例14: processCaseNode
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
private void processCaseNode(Node child, CodeBlock block,
Set<Completion> set, String entered, int offset) {
SwitchCase switchCase = (SwitchCase) child;
List<AstNode> statements = switchCase.getStatements();
int start = switchCase.getAbsolutePosition();
offset = start + switchCase.getLength();
if (canProcessNode(switchCase)) {
block = block.addChildCodeBlock(start);
block.setEndOffset(offset);
if(statements != null) {
for (AstNode node : statements) {
iterateNode(node, set, entered, block, offset);
}
}
}
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:17,代码来源:JavaScriptAstParser.java
示例15: iterateNode
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* Overridden iterateNode to intercept Token.EXPR_RESULT and check for importPackage and importClass named nodes
* If found, then process them and extract the imports and add them to RhinoJavaScriptTypesFactory then return
* otherwise call super.iterateNode()
*/
@Override
protected void iterateNode(AstNode child, Set <Completion>set,
String entered, CodeBlock block, int offset) {
//look for importPackage and importClass
switch (child.getType()) {
case Token.EXPR_RESULT:
boolean importFound = processImportNode(child, set, entered, block, offset);
if(importFound)
return; //already processed node
break;
}
super.iterateNode(child, set, entered, block, offset);
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:21,代码来源:RhinoJavaScriptAstParser.java
示例16: processImportNode
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* Look for text importPackage and importClass and add to cache
* @param child AstNode to check. This will always be Token.EXPR_RESULT AstNode
* @param set Set to add completions
* @param entered text entered by user if applicable
* @param block CodeBlock
* @param offset position of AstNode within document
* @return true if either importPackage or importClass is found
*/
private boolean processImportNode(AstNode child,
Set<Completion> set, String entered, CodeBlock block,
int offset) {
String src = JavaScriptHelper.convertNodeToSource(child);
if(src != null) {
if(src.startsWith("importPackage")) {
processImportPackage(src);
return true;
}
else if(src.startsWith("importClass")) {
processImportClass(src);
return true;
}
}
return false;
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:29,代码来源:RhinoJavaScriptAstParser.java
示例17: populateCompletionsForType
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* Populate Completions for types... included extended classes. TODO
* optimise this.
*
* @param completionsMap
* @param completions
* @param type
* @param manager
*/
public void populateCompletionsForType(JavaScriptType cachedType,
Set<Completion> completions) {
if (cachedType != null) {
Map<String, JSCompletion> completionsForType = cachedType.getMethodFieldCompletions();
for (JSCompletion completion : completionsForType.values()) {
completions.add(completion);
}
// get any extended classes and recursively populate
List<JavaScriptType> extendedClasses = cachedType.getExtendedClasses();
for (JavaScriptType extendedType : extendedClasses) {
populateCompletionsForType(extendedType, completions);
}
}
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:26,代码来源:JavaScriptTypesFactory.java
示例18: getClass
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* Returns the class for a completion (class completions return the class
* itself, member completions return the enclosing class).
*/
private String getClass(Completion c, String desc) {
String clazz = null;
if (c instanceof JSClassCompletion) {
clazz = ((JSClassCompletion)c).getClassName(true);
}
else if (c instanceof JSCompletion) {
JSCompletion jsc = (JSCompletion)c;
clazz = jsc.getEnclosingClassName(true);
}
else {
Logger.logError("Can't determine class from completion type: " +
c.getClass() + " (" + c.toString() + ") - href: " + desc);
}
return clazz;
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:24,代码来源:JavaScriptDocUrlhandler.java
示例19: getPackage
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
/**
* Returns the package of the specified completion.
*
* @param c The completion.
* @param desc The description text being parsed. Used for errors if we
* cannot determine the package.
* @return The package.
*/
private String getPackage(Completion c, String desc) {
String pkg = null;
if (c instanceof JSClassCompletion) {
pkg = ((JSClassCompletion)c).getPackageName();
}
if (c instanceof JSCompletion) {
String definedIn = ((JSCompletion)c).getEnclosingClassName(true);
if (definedIn!=null) {
int lastDot = definedIn.lastIndexOf('.');
if (lastDot>-1) {
pkg = definedIn.substring(0, lastDot);
}
}
}
else {
Logger.logError("Can't determine package from completion type: " +
c.getClass() + " (" + c.toString() + ") - href: " + desc);
}
return pkg;
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:33,代码来源:JavaScriptDocUrlhandler.java
示例20: getReplacementText
import org.fife.ui.autocomplete.Completion; //导入依赖的package包/类
@Override
protected String getReplacementText(Completion c, Document doc,
int start, int len) {
String replacement = super.getReplacementText(c, doc, start, len);
if(c instanceof JavaScriptShorthandCompletion)
{
try
{
int caret = textArea.getCaretPosition();
String leadingWS = RSyntaxUtilities.getLeadingWhitespace(doc, caret);
if (replacement.indexOf('\n')>-1) {
replacement = replacement.replaceAll("\n", "\n" + leadingWS);
}
}
catch(BadLocationException ble){}
}
return replacement;
}
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:21,代码来源:JavaScriptLanguageSupport.java
注:本文中的org.fife.ui.autocomplete.Completion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论