本文整理汇总了Java中org.netbeans.modules.csl.api.ElementKind类的典型用法代码示例。如果您正苦于以下问题:Java ElementKind类的具体用法?Java ElementKind怎么用?Java ElementKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ElementKind类属于org.netbeans.modules.csl.api包,在下文中一共展示了ElementKind类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: k2i
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
int k2i( ElementKind kind ) {
switch( kind ) {
case CONSTRUCTOR:
return 1;
case METHOD:
case DB:
return 2;
case FIELD:
return 3;
case CLASS:
case INTERFACE:
// case ENUM:
// case ANNOTATION_TYPE:
// return 4;
// TODO - what about other types?
default:
return 100;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ElementNode.java
示例2: instantSubstitution
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
@Override
public boolean instantSubstitution(JTextComponent component) {
ElementKind kind = item.getKind();
if (kind == ElementKind.PARAMETER || kind == ElementKind.CLASS || kind == ElementKind.MODULE) {
// These types of elements aren't ever instant substituted in Java - use same behavior here
return false;
}
if (component != null) {
try {
int caretOffset = component.getSelectionEnd();
if (caretOffset > substitutionOffset) {
String text = component.getDocument().getText(substitutionOffset, caretOffset - substitutionOffset);
if (!getInsertPrefix().toString().startsWith(text)) {
return false;
}
}
}
catch (BadLocationException ble) {}
}
defaultAction(component);
return true;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:GsfCompletionItem.java
示例3: IsInMethodTree
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
private boolean IsInMethodTree(MethodTreeImpl method, String className) {
if (method.getName() != null && method.getReturnType() != null) {
MethodItem methodItem = new MethodItem(method.getName().toString(), method.getReturnType().toString(), offset, modifiersAdapter(method.getModifiers()), ElementKind.METHOD);
if (method.getParameters() != null) {
methodItem.variablesMethod = method.getParameters();
}
this.collectionOfDeclarations.get(className).item_methods.add(methodItem);
}
List<? extends VariableTree> parameters = method.getParameters();
for (VariableTree variable : parameters) {
IsInVariableDeclaration((VariableTreeImpl) variable, method, className);
}
boolean result = SearchInMethodBlock((BlockTreeImpl) method.getBody(), method.getBody(), className);
if (IsInRange((CompoundTree) method.getBody()) && !this.foundCursor) {
this.classNameForCursor = className;
this.parentForCursor = method.getBody();
this.foundCursor = true;
result = true;
}
return result;
}
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:22,代码来源:RecoverDeclarations.java
示例4: IsInConstructor
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
private boolean IsInConstructor(ConstructorTreeImpl constructor, String className) {
if (constructor.getName() != null) {
MethodItem methodItem = new MethodItem(constructor.getName().toString(), "", offset, modifiersAdapter(constructor.getModifiers()), ElementKind.CONSTRUCTOR);
if (constructor.getParameters() != null) {
methodItem.variablesMethod = constructor.getParameters();
}
this.collectionOfDeclarations.get(className).item_methods.add(methodItem);
}
List<? extends VariableTree> parameters = constructor.getParameters();
for (VariableTree variable : parameters) {
IsInVariableDeclaration((VariableTreeImpl) variable, constructor, className);
}
boolean result = SearchInMethodBlock((BlockTreeImpl) constructor.getBody(), constructor.getBody(), className);
if (IsInRange((CompoundTree) constructor.getBody()) && !this.foundCursor) {
this.classNameForCursor = className;
this.parentForCursor = constructor.getBody();
this.foundCursor = true;
result = true;
}
return result;
}
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:22,代码来源:RecoverDeclarations.java
示例5: complete
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
void complete(List<CompletionProposal> proposals, CompletionContext context, int anchor) {
String filter = context.getPrefix();
GoloClassLoader classLoader = context.getGoloClassLoader();
if (classLoader == null) {
return;
}
Map<Class<?>, FileObject> goloSources = null;
try {
goloSources = context.loadGoloFiles(context.getSourceFile(), classLoader);
} catch (Throwable t) {
}
if (goloSources != null) {
for (Class<?> moduleName : goloSources.keySet()) {
FileObject goloFile = goloSources.get(moduleName);
if (goloFile != context.getSourceFile()) {
if (moduleName.getSimpleName().toLowerCase().startsWith(filter.toLowerCase())) {
proposals.add(new CompletionItem.ModuleItem(new SimpleGoloElementHandle(goloFile, goloFile.getNameExt(), moduleName.getSimpleName(), ElementKind.MODULE, null), moduleName, anchor));
}
}
}
}
}
开发者ID:golo-lang,项目名称:golo-netbeans,代码行数:26,代码来源:ModuleCompletion.java
示例6: FanTypeProposal
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
public FanTypeProposal(FanType type, int anchor, String forcedName)
{
Boolean isJava=false;
this.pod = type.getPod();
this.name = type.getSimpleName();
if (forcedName != null)
{
this.name = forcedName;
}
this.anchor = anchor;
this.modifiers = Collections.emptySet();
this.kind = ElementKind.CLASS;
icon = ImageUtilities.loadImageIcon("net/colar/netbeans/fan/fan.png", false);
if (isJava)
{
icon = ImageUtilities.loadImageIcon("net/colar/netbeans/fan/project/resources/java.png", false);
}
FanBasicElementHandle handle = new FanBasicElementHandle(name, kind);
handle.setDoc(FanIndexer.getDoc(type));
element = handle;
}
开发者ID:tcolar,项目名称:fantomidemodule,代码行数:23,代码来源:FanTypeProposal.java
示例7: CmdCompletionProposal
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
CmdCompletionProposal(
@NonNull final Command cmd,
final boolean upcase,
final int anchor) {
this.cmd = cmd;
this.upperCase = upcase;
setKind(ElementKind.KEYWORD);
setAnchorOffset(anchor);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:DockerfileCompletion.java
示例8: getLhsHtml
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
public String getLhsHtml(HtmlFormatter formatter) {
ElementKind kind = getKind();
formatter.name(kind, true);
formatter.appendText(getName());
formatter.name(kind, false);
return formatter.getText();
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DefaultCompletionProposal.java
示例9: name
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
public void name(ElementKind kind, boolean start) {
assert start != isName;
isName = start;
if (isName) {
sb.append("<b>");
} else {
sb.append("</b>");
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:GsfHtmlFormatter.java
示例10: getLhsHtml
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
@Override
public String getLhsHtml(HtmlFormatter formatter) {
formatter.name(ElementKind.KEYWORD, true);
formatter.appendText(getName());
formatter.name(ElementKind.KEYWORD, false);
return formatter.getText();
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:YamlCompletion.java
示例11: getMediaFeatures
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
private static List<CompletionProposal> getMediaFeatures(final CompletionContext context) {
final List<CompletionProposal> proposals = new ArrayList<>();
for(String mtype : getMediaFeatures()) {
proposals.add(CssCompletionItem.createRAWCompletionItem(null, mtype, ElementKind.FIELD, context.getAnchorOffset(), true));
}
return proposals;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:MediaQueriesModule.java
示例12: getMediaTypes
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
private static List<CompletionProposal> getMediaTypes(final CompletionContext context) {
final List<CompletionProposal> proposals = new ArrayList<>();
for(String mtype : MEDIA_TYPES) {
proposals.add(CssCompletionItem.createRAWCompletionItem(null, mtype, ElementKind.OTHER, context.getAnchorOffset(), true));
}
return proposals;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:MediaQueriesModule.java
示例13: createRAWCompletionItem
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
public static CssCompletionItem createRAWCompletionItem(CssElement element,
String value,
ElementKind kind,
int anchorOffset,
boolean addSemicolon) {
return new RAWCompletionItem(element, kind, value, anchorOffset, addSemicolon);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CssCompletionItem.java
示例14: createRAWCompletionProposals
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
public static List<CompletionProposal> createRAWCompletionProposals(Collection<String> props, ElementKind kind, int anchor, String addPrefix) {
List<CompletionProposal> proposals = new ArrayList<>(props.size());
for (String value : props) {
if(addPrefix != null) {
value = addPrefix + value;
}
CssElement handle = new CssElement(value);
CompletionProposal proposal = CssCompletionItem.createRAWCompletionItem(handle, value, kind, anchor, false);
proposals.add(proposal);
}
return proposals;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:Utilities.java
示例15: refactorFile
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
private void refactorFile(FileObject base, RefactoringElementsBag elements) {
CssProjectSupport sup = CssProjectSupport.findFor(base);
if (sup == null) {
return;
}
CssIndex index = sup.getIndex();
DependenciesGraph deps = index.getDependencies(base);
//find only files directly importing the base file
String baseFileName = base.getNameExt();
for (org.netbeans.modules.web.common.api.DependenciesGraph.Node referingNode : deps.getSourceNode().getReferingNodes()) {
try {
FileObject file = referingNode.getFile();
CssFileModel model = CssFileModel.create(Source.create(file));
Collection<Entry> imports = model.getImports();
//find the import of the base file
for (Entry e : imports) {
if (e.isValidInSourceDocument() && e.getName().indexOf(baseFileName) != -1) {
//found
WhereUsedElement elem = WhereUsedElement.create(file, e, ElementKind.FILE);
elements.add(refactoring, elem);
}
}
} catch (ParseException ex) {
Exceptions.printStackTrace(ex);
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:CssWhereUsedQueryPlugin.java
示例16: getKind
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
@Override
public ElementKind getKind() {
switch(type) {
case MIXIN_DECLARATION:
return ElementKind.METHOD;
case VARIABLE_GLOBAL_DECLARATION:
case VARIABLE_LOCAL_DECLARATION:
case VARIABLE_DECLARATION_IN_BLOCK_CONTROL:
return ElementKind.VARIABLE;
default:
return null;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:CPCslElementHandle.java
示例17: getLhsHtml
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
@Override
public String getLhsHtml(HtmlFormatter formatter) {
if (this.elementeKind.equals(ElementKind.METHOD) || this.elementeKind.equals(ElementKind.CONSTRUCTOR)) {
formatter.appendText(name + "(" + getParameters() + ")");
return formatter.getText();
} else {
formatter.appendText(name);
return formatter.getText();
}
}
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:11,代码来源:ProposalItem.java
示例18: Block
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
public Block(CharSequence function, int offset, int length, CharSequence extra, ElementKind kind) {
this.function = function;
this.offset = offset;
this.length = length;
this.extra = extra;
this.kind = kind;
}
开发者ID:shannah,项目名称:mirah-nbm,代码行数:8,代码来源:MirahParser.java
示例19: SimpleGoloElementHandle
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
public SimpleGoloElementHandle(FileObject fileObject, String fromClassName, String elementName, ElementKind elementKind, Set<Modifier> modifiers) {
this.fileObject = fileObject;
this.elementName = elementName;
this.modifiers = modifiers;
this.elementKind = elementKind;
this.fromClassName = fromClassName;
}
开发者ID:golo-lang,项目名称:golo-netbeans,代码行数:8,代码来源:SimpleGoloElementHandle.java
示例20: FanStructureItem
import org.netbeans.modules.csl.api.ElementKind; //导入依赖的package包/类
public FanStructureItem(AstNode node, ElementKind kind, ParserResult result)
{
this.node = node;
this.kind = kind;
this.result = result;
//TODO: modifiers
this.name = node.getNodeText(true);
// node gives up index of 1st and last token part of this struct. item
// then we find those tokens by index in tokenStream (from lexer)
// from that we can find start and end location of struct. text in source file.
OffsetRange range = node.getRelevantTextRange();
start = range.getStart();
stop = range.getEnd();
this.handle = new FanElementHandle(kind, node, result, range);
}
开发者ID:tcolar,项目名称:fantomidemodule,代码行数:16,代码来源:FanStructureItem.java
注:本文中的org.netbeans.modules.csl.api.ElementKind类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论