本文整理汇总了Java中org.fife.ui.rsyntaxtextarea.LinkGeneratorResult类的典型用法代码示例。如果您正苦于以下问题:Java LinkGeneratorResult类的具体用法?Java LinkGeneratorResult怎么用?Java LinkGeneratorResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinkGeneratorResult类属于org.fife.ui.rsyntaxtextarea包,在下文中一共展示了LinkGeneratorResult类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleDereferenceLink
import org.fife.ui.rsyntaxtextarea.LinkGeneratorResult; //导入依赖的package包/类
private LinkGeneratorResult handleDereferenceLink(Token parent, Token main,
RSyntaxTextArea textArea, int offs) {
// return new SelectRegionLinkGeneratorResult(textArea,
// main.offset, 1, 2);
// TODO: Implement me right! Need actual property definition to be able to
// look it up in the doc
String searchFor = null;//main.getLexeme();
if (isGlobalVariable(parent.getLexeme())) {
searchFor = "namespace " + parent.getLexeme();
}
else if ("lweapon".equalsIgnoreCase(searchFor) || "eweapon".equalsIgnoreCase(searchFor)) {
//searchFor = null;//"Weapon Functions and Variables";
}
return new OpenBuiltInStuffLinkGeneratorResult(textArea, main.getOffset(), searchFor);
}
示例2: isLinkAtOffset
import org.fife.ui.rsyntaxtextarea.LinkGeneratorResult; //导入依赖的package包/类
@Override
public LinkGeneratorResult isLinkAtOffset(RSyntaxTextArea textArea, int offset) {
try {
Token token = textArea.modelToToken(offset);
if (token == null) {
return null;
}
final int sourceOffset = token.getOffset();
final Position defPos = getDefPosition(jCls, textArea, sourceOffset);
if (defPos == null) {
return null;
}
return new LinkGeneratorResult() {
@Override
public HyperlinkEvent execute() {
return new HyperlinkEvent(defPos, HyperlinkEvent.EventType.ACTIVATED, null,
defPos.getNode().makeLongString());
}
@Override
public int getSourceOffset() {
return sourceOffset;
}
};
} catch (Exception e) {
LOG.error("isLinkAtOffset error", e);
return null;
}
}
示例3: createSelectedRegionResult
import org.fife.ui.rsyntaxtextarea.LinkGeneratorResult; //导入依赖的package包/类
/**
* @return LinkGeneratorResult based on the JavaScriptDeclaraton and the position
*/
protected LinkGeneratorResult createSelectedRegionResult(RSyntaxTextArea textArea, Token t, JavaScriptDeclaration dec) {
if(dec.getTypeDeclarationOptions() != null && !dec.getTypeDeclarationOptions().isSupportsLinks()) {
return null;
}
return new SelectRegionLinkGeneratorResult(textArea, t.getOffset(), dec.getStartOffSet(), dec.getEndOffset());
}
示例4: isLinkAtOffset
import org.fife.ui.rsyntaxtextarea.LinkGeneratorResult; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public LinkGeneratorResult isLinkAtOffset(RSyntaxTextArea textArea, int offs) {
JavaScriptDeclaration dec = null;
IsLinkableCheckResult result = checkForLinkableToken(textArea, offs);
if (result != null) {
//re-parse the document to resolve any variables local to the offs
Token t = result.token;
boolean function = result.function;
String name = t.getLexeme();
if(name != null && name.length() > 0)
{
//only re-parse the document if there is a character that could potentially be a variable or function
if(name.length() > 1 || (name.length() == 1 && Character.isJavaIdentifierPart(name.charAt(0))))
{
language.reparseDocument(offs);
}
}
JavaScriptParser parser = language.getJavaScriptParser();
VariableResolver variableResolver = parser.getVariablesAndFunctions();
if (variableResolver != null) {
if (!function) { // must be a variable
dec = variableResolver.findDeclaration(name, offs, findLocal, findPreprocessed, findSystem);
}
else {
String lookup = getLookupNameForFunction(textArea, offs, name);
// lookup Function based on the name
dec = variableResolver.findFunctionDeclaration(lookup, findLocal, findPreprocessed);
if(dec == null) {
dec = variableResolver.findFunctionDeclarationByFunctionName(name, findLocal, findPreprocessed);
}
}
}
if (dec != null) {
return createSelectedRegionResult(textArea, t, dec);
}
}
return null;
}