本文整理了Java中org.netbeans.modules.parsing.api.Source.getFileObject()
方法的一些代码示例,展示了Source.getFileObject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Source.getFileObject()
方法的具体详情如下:
包路径:org.netbeans.modules.parsing.api.Source
类名称:Source
方法名:getFileObject
暂无
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-modelimpl
public FileBufferSnapshot2(Snapshot snapshot, long timestamp) {
super(snapshot.getSource().getFileObject());
this.snapshot = snapshot;
this.timestamp = timestamp;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby
private boolean isIndexable(Indexable indexable, Snapshot snapshot) {
String extension = snapshot.getSource().getFileObject().getExt();
if (extension.equals("rb")) { // NOI18N
return true;
}
return false;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-groovy-editor
private boolean isIndexable(Indexable indexable, Snapshot snapshot) {
String extension = snapshot.getSource().getFileObject().getExt();
if (extension.equals("groovy")) { // NOI18N
return true;
}
return false;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-groovy-editor
private TreeAnalyzer(GroovyParserResult result, IndexingSupport support, Indexable indexable) {
this.result = result;
this.file = result.getSnapshot().getSource().getFileObject();
this.support = support;
this.indexable = indexable;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
private FileElementQuery(final PHPParseResult result) {
super(QueryScope.FILE_SCOPE);
this.result = result;
this.fileObject = result.getSnapshot().getSource().getFileObject();
this.url = fileObject != null ? URLMapper.findURL(fileObject, URLMapper.INTERNAL) : null;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javascript2-model
String getUnigueNameForAnonymObject(ParserResult parserResult) {
FileObject fo = parserResult.getSnapshot().getSource().getFileObject();
if (fo != null) {
return fo.getName() + ANONYMOUS_OBJECT_NAME_START + anonymObjectCount++;
}
return ANONYMOUS_OBJECT_NAME_START + anonymObjectCount++;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
@NbBundle.Messages("MSG_FatalError=Unable to parse the file")
FatalError(GSFPHPParser.Context context) {
super(Bundle.MSG_FatalError(),
context.getSnapshot().getSource().getFileObject(),
0, context.getBaseSource().length(),
Severity.ERROR, null);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-groovy-editor
private Hint getDescriptor(Operation operation, String description, RuleContext context,
BaseDocument baseDoc, OffsetRange range) {
int DEFAULT_PRIORITY = 292;
HintFix fixToApply = new SimpleFix(operation, description, baseDoc, context);
List<HintFix> fixList = new ArrayList<>(1);
fixList.add(fixToApply);
// FIXME parsing API
Hint descriptor = new Hint(this, fixToApply.getDescription(), context.parserResult.getSnapshot().getSource().getFileObject(), range,
fixList, DEFAULT_PRIORITY);
return descriptor;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-groovy-editor
public CompleteElementHandler(CompletionContext context) {
this.context = context;
this.info = context.getParserResult();
FileObject fo = info.getSnapshot().getSource().getFileObject();
if (fo != null) {
// FIXME index is broken when invoked on start
this.index = GroovyIndex.get(QuerySupport.findRoots(fo, Collections.singleton(ClassPath.SOURCE), null, null));
} else {
this.index = null;
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby
@CheckForNull
public static BaseDocument getDocument(RubyParseResult result, boolean forceOpen) {
if (result != null) {
Source source = result.getSnapshot().getSource();
return GsfUtilities.getDocument(source.getFileObject(), forceOpen);
}
return null;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
private FileScopeImpl(PHPParseResult info, String name) {
super(
null,
name,
Union2.<String, FileObject>createSecond(info != null ? info.getSnapshot().getSource().getFileObject() : null),
new OffsetRange(0, 0),
PhpElementKind.PROGRAM,
false);
this.info = info;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
@Override
public void invoke(PHPRuleContext context, List<Hint> hints) {
this.hints = hints;
PHPParseResult phpParseResult = (PHPParseResult) context.parserResult;
baseDocument = context.doc;
if (phpParseResult.getProgram() != null) {
fileObject = phpParseResult.getSnapshot().getSource().getFileObject();
if (fileObject != null) {
checkHints(phpParseResult, fileObject);
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-html-custom
@Override
public List<CompletionItem> completeOpenTags(CompletionContext context) {
List<CompletionItem> items = new ArrayList<>();
Configuration conf = Configuration.get(context.getResult().getSnapshot().getSource().getFileObject());
for (Tag t : conf.getTags()) {
String tagName = t.getName();
if (tagName.startsWith(context.getPrefix())) {
items.add(new CustomTagCompletionItem(t, context.getCCItemStartOffset()));
}
}
return items;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
@Override
public void invoke(PHPRuleContext context, List<Hint> hints) {
PHPParseResult phpParseResult = (PHPParseResult) context.parserResult;
if (phpParseResult.getProgram() != null) {
FileObject fileObject = phpParseResult.getSnapshot().getSource().getFileObject();
if (fileObject != null) {
CheckVisitor checkVisitor = new CheckVisitor(fileObject, context.doc);
phpParseResult.getProgram().accept(checkVisitor);
hints.addAll(checkVisitor.getHints());
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
@Override
public void invoke(PHPRuleContext context, List<Hint> result) {
PHPParseResult phpParseResult = (PHPParseResult) context.parserResult;
if (phpParseResult.getProgram() != null) {
FileObject fileObject = phpParseResult.getSnapshot().getSource().getFileObject();
if (fileObject != null) {
CheckVisitor checkVisitor = new CheckVisitor(fileObject, context.doc);
phpParseResult.getProgram().accept(checkVisitor);
result.addAll(checkVisitor.getHints());
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-html-custom
public MissingRequiredAttributes(Collection<Attribute> attributes, OpenTag element, RuleContext context, OffsetRange range, boolean lineHint) {
super(lineHint ? LINE_RULE : RULE,
Bundle.missingRequiredAttributes(Utils.attributes2String(attributes)),
context.parserResult.getSnapshot().getSource().getFileObject(),
range,
getFixes(attributes, element, context),
30);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
@Override
public void invoke(PHPRuleContext context, List<Hint> result) {
PHPParseResult phpParseResult = (PHPParseResult) context.parserResult;
if (phpParseResult.getProgram() != null) {
FileObject fileObject = phpParseResult.getSnapshot().getSource().getFileObject();
if (fileObject != null) {
CheckVisitor checkVisitor = createVisitor(fileObject, context.doc);
phpParseResult.getProgram().accept(checkVisitor);
result.addAll(checkVisitor.getHints());
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
@Override
public void invoke(PHPRuleContext context, List<Hint> result) {
PHPParseResult phpParseResult = (PHPParseResult) context.parserResult;
if (phpParseResult.getProgram() != null) {
FileObject fileObject = phpParseResult.getSnapshot().getSource().getFileObject();
if (fileObject != null) {
CheckVisitor checkVisitor = createVisitor(fileObject, context.doc);
phpParseResult.getProgram().accept(checkVisitor);
result.addAll(checkVisitor.getHints());
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javascript2-model
public ModelVisitor(ParserResult parserResult, OccurrenceBuilder occurrenceBuilder) {
super();
FileObject fileObject = parserResult.getSnapshot().getSource().getFileObject();
this.modelBuilder = new ModelBuilder(JsFunctionImpl.createGlobal(
fileObject, Integer.MAX_VALUE, parserResult.getSnapshot().getMimeType()));
this.occurrenceBuilder = occurrenceBuilder;
this.parserResult = parserResult;
this.scriptName = fileObject != null ? fileObject.getName().replace('.', '_') : "";
lc = getLexicalContext();
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-html-custom
@Override
public void implement() throws Exception {
Configuration conf = Configuration.get(snapshot.getSource().getFileObject());
Tag tag = conf.getTag(elementName);
if(tag != null) {
conf.remove(tag);
conf.store();
LexerUtils.rebuildTokenHierarchy(snapshot.getSource().getDocument(true));
}
}
内容来源于网络,如有侵权,请联系作者删除!