本文整理汇总了Java中org.netbeans.modules.csl.api.StructureItem类的典型用法代码示例。如果您正苦于以下问题:Java StructureItem类的具体用法?Java StructureItem怎么用?Java StructureItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StructureItem类属于org.netbeans.modules.csl.api包,在下文中一共展示了StructureItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findCachedStructure
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
public static List<? extends StructureItem> findCachedStructure(Snapshot s, Parser.Result r) {
if (!(r instanceof ParserResult)) {
return null;
}
Reference<ResultStructure> previousRef;
previousRef = lastResults.get(s);
if (previousRef == null) {
return null;
}
ResultStructure cached = previousRef.get();
if (cached == null || cached.result != r) {
// remove from cache:
lastResults.remove(s);
return null;
}
return cached.structure;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ElementScanningTask.java
示例2: selectNode
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
private void selectNode(Document doc, StructureItem structureRoot, long id, int caret) {
StructureItemNode root = new StructureItemNode(structureRoot);
StructureItemNode toSelect = root;
OUTER: while (requestId.get() == id) {
for (Node n : toSelect.getChildren().getNodes(true)) {
StructureItemNode sin = (StructureItemNode) n;
if (sin.item.getPosition() <= caret && caret <= sin.item.getEndPosition()) {
toSelect = sin;
// see #223480, mimetype nodes look ugly in the breadcrumb bar
if (toSelect.item instanceof ElementScanningTask.MimetypeRootNode) {
root = sin;
}
continue OUTER;
}
}
break;
}
if (requestId.get() == id) {
BreadcrumbsController.setBreadcrumbs(doc, root, toSelect);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:BreadCrumbsTask.java
示例3: StructureItemNode
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
public StructureItemNode(final StructureItem item) {
super(Children.create(new ChildFactory<StructureItem>() {
@Override protected boolean createKeys(List<StructureItem> toPopulate) {
toPopulate.addAll(item.getNestedItems());
return true;
}
@Override
protected Node createNodeForKey(StructureItem key) {
return new StructureItemNode(key);
}
}, false), Lookups.fixed(new OpenCookie() {
@Override public void open() {
ElementHandle elementHandle = item.getElementHandle();
FileObject file = elementHandle != null ? elementHandle.getFileObject() : null;
if (file != null) {
UiUtils.open(file, (int) item.getPosition());
}
}
}));
this.item = item;
setDisplayName(item.getName());
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:BreadCrumbsTask.java
示例4: findLogicalRanges
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
@Override
public List<OffsetRange> findLogicalRanges(ParserResult info, int caretOffset) {
YamlParserResult result = (YamlParserResult) info;
if (result == null) {
return Collections.emptyList();
}
List<? extends StructureItem> items = result.getItems();
if (items.isEmpty()) {
return Collections.emptyList();
}
List<OffsetRange> ranges = new ArrayList<OffsetRange>();
for (StructureItem item : items) {
addRanges(ranges, caretOffset, item);
}
Collections.reverse(ranges);
Document doc = info.getSnapshot().getSource().getDocument(false);
if (doc != null) {
ranges.add(new OffsetRange(0, doc.getLength()));
}
return ranges;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:YamlKeystrokeHandler.java
示例5: addBlocks
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
private void addBlocks(YamlParserResult result, BaseDocument doc, CharSequence text, List<OffsetRange> codeblocks, StructureItem item) throws BadLocationException {
int docLength = doc == null ? text.length() : doc.getLength();
int begin = Math.min((int) item.getPosition(), docLength);
int end = Math.min((int) item.getEndPosition(), docLength);
int firstRowEnd = doc == null ? GsfUtilities.getRowEnd(text, begin) : Utilities.getRowEnd(doc, begin);
int lastRowEnd = doc == null ? GsfUtilities.getRowEnd(text, end) : Utilities.getRowEnd(doc, end);
if (begin < end && firstRowEnd != lastRowEnd) {
codeblocks.add(new OffsetRange(firstRowEnd, end));
} else {
return;
}
for (StructureItem child : item.getNestedItems()) {
int childBegin = (int) child.getPosition();
int childEnd = (int) child.getEndPosition();
if (childBegin >= begin && childEnd <= end) {
addBlocks(result, doc, text, codeblocks, child);
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:YamlScanner.java
示例6: getStructureItemsNodeVisitor
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
@Override
public <T extends List<StructureItem>> NodeVisitor<T> getStructureItemsNodeVisitor(final FeatureContext context, final T result) {
final List<StructureItem> items = new ArrayList<>();
return new NodeVisitor<T>() {
private void addItem(StructureItem si) {
if (items.isEmpty()) {
result.add(new TopLevelStructureItem.Namespaces(items));
}
items.add(si);
}
@Override
public boolean visit(Node node) {
if (node.type() == NodeType.namespace) {
addItem(new NamespaceStructureItem(context.getFileObject(), node));
}
return false;
}
};
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:NamespacesModule.java
示例7: visitPropertyValue
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
@Override
public Void visitPropertyValue(EditorConfigParser.PropertyValueContext ctx) {
propertyValue = ctx.getText();
if (propertyKey != null && !propertyKey.isEmpty() && propertyValue != null) {
properties.add(new EditorConfigPropertyStructureItem(propertyKey, propertyValue, propertyStart, propertyEnd));
}
propertyKey = null;
propertyValue = null;
propertyStart = 0;
propertyEnd = 0;
if (childCount == currentChildCount) {
if (sectionName != null) {
ArrayList<StructureItem> children = new ArrayList<>(properties);
sections.add(new EditorConfigSectionStructureItem(sectionName, sectionStart, sectionEnd, children));
}
sectionName = null;
sectionStart = 0;
sectionEnd = 0;
properties.clear();
currentChildCount = 0;
}
return super.visitPropertyValue(ctx);
}
开发者ID:junichi11,项目名称:netbeans-editorconfig-editor,代码行数:25,代码来源:EditorConfigStructureScanner.java
示例8: visitPropertyValue
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
@Override
public Void visitPropertyValue(EditorConfigParser.PropertyValueContext ctx) {
propertyValue = ctx.getText();
if (propertyKey != null && !propertyKey.isEmpty() && propertyValue != null) {
properties.add(new EditorConfigPropertyStructureItem(propertyKey, propertyValue, propertyStart, propertyEnd));
}
propertyKey = null;
propertyValue = null;
propertyStart = 0;
propertyEnd = 0;
if (childCount == currentChildCount) {
if (sectionName != null) {
ArrayList<StructureItem> children = new ArrayList<>(properties);
sections.add(new EditorConfigSectionStructureItem(sectionName, sectionStart, sectionEnd, children));
}
sectionName = null;
sectionStart = 0;
sectionEnd = 0;
properties.clear();
currentChildCount = 0;
}
return super.visitPropertyValue(ctx);
}
开发者ID:welovecoding,项目名称:editorconfig-netbeans,代码行数:25,代码来源:EditorConfigStructureScanner.java
示例9: ElementNode
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
/** Creates a new instance of TreeNode */
public ElementNode( StructureItem description, ClassMemberPanelUI ui, FileObject fileObject) {
super(description.isLeaf() ? Children.LEAF: new ElementChildren(description, ui, fileObject), Lookups.fixed(fileObject));
this.description = description;
setDisplayName( description.getName() );
this.ui = ui;
this.fileObject = fileObject;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ElementNode.java
示例10: refreshRecursively
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
private void refreshRecursively(Collection<ElementNode> toDo, final Collection<Node> toExpand) {
for (ElementNode elnod : toDo) {
final Children ch = elnod.getChildren();
if ( ch instanceof ElementChildren ) {
((ElementChildren)ch).resetKeys((List<StructureItem>)elnod.description.getNestedItems(), elnod.ui.getFilters());
Collection<ElementNode> children = (Collection<ElementNode>)(List)Arrays.asList((Node[])ch.getNodes());
toExpand.addAll(children);
refreshRecursively(children, toExpand);
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ElementNode.java
示例11: addNotify
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
@Override
protected void addNotify() {
super.addNotify();
if (parent != null) {
resetKeys((List<StructureItem>)parent.getNestedItems(), ui.getFilters());
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ElementNode.java
示例12: compare
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
public int compare(StructureItem d1, StructureItem d2) {
if ( alpha ) {
if ( k2i(d1.getKind()) != k2i(d2.getKind()) ) {
return k2i(d1.getKind()) - k2i(d2.getKind());
}
return d1.getSortText().compareTo(d2.getSortText());
}
else {
return d1.getPosition() == d2.getPosition() ? 0 : d1.getPosition() < d2.getPosition() ? -1 : 1;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ElementNode.java
示例13: MimetypeRootNode
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
private MimetypeRootNode(Language lang, List<? extends StructureItem> items, MimePath mimePath) {
this.language = lang;
this.items = new ArrayList<StructureItem>(items);
Collections.sort(items, Description.POSITION_COMPARATOR);
this.from = items.size() > 0 ? items.get(0).getPosition() : 0;
this.to = items.size() > 0 ? items.get(items.size() - 1).getEndPosition() : 0;
this.mimePath = mimePath;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ElementScanningTask.java
示例14: getTask
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
public org.netbeans.modules.csl.navigation.ElementScanningTask getTask() {
return new ElementScanningTask() {
public @Override int getPriority() {
return 20000;
}
public @Override Class<? extends Scheduler> getSchedulerClass() {
return CSLNavigatorScheduler.class;
}
@Override public void run(final ParserResult result, final SchedulerEvent event) {
runWithCancelService(new Runnable() {
@Override
public void run() {
resume();
StructureItem root = computeStructureRoot(result.getSnapshot().getSource());
FileObject file = result.getSnapshot().getSource().getFileObject();
if (root != null && file != null) {
Document doc = result.getSnapshot().getSource().getDocument(false);
BaseDocument bd = doc instanceof BaseDocument ? (BaseDocument)doc : null;
refresh(root, file, bd);
}
}
});
}
};
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:ClassMemberPanelUI.java
示例15: isExpandedByDefault
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
boolean isExpandedByDefault(Node node) {
if (node instanceof ElementNode) {
StructureItem item = ((ElementNode) node).getDescription();
if (item instanceof StructureItem.CollapsedDefault && ((StructureItem.CollapsedDefault) item).isCollapsedByDefault()) {
return false;
}
}
return true;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ClassMemberPanelUI.java
示例16: run
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
@Override
public void run(final ParserResult result, final SchedulerEvent event) {
runWithCancelService(new Runnable() {
@Override
public void run() {
resume();
final long id = requestId.incrementAndGet();
final Document doc = result.getSnapshot().getSource().getDocument(false);
if (doc == null || !BreadcrumbsController.areBreadCrumsEnabled(doc)) return ;
final int caret;
if (event instanceof CursorMovedSchedulerEvent) {
caret = ((CursorMovedSchedulerEvent) event).getCaretOffset();
} else {
//XXX: outside AWT!
JTextComponent c = EditorRegistry.focusedComponent();
if (c != null && c.getDocument() == doc)
caret = c.getCaretPosition();
else
caret = (-1);
}
if (caret == (-1)) return ;
final StructureItem structureRoot = computeStructureRoot(result.getSnapshot().getSource());
if (structureRoot == null) return ;
WORKER.post(new Runnable() {
@Override public void run() {
selectNode(doc, structureRoot, id, caret);
}
});
}
});
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:BreadCrumbsTask.java
示例17: annotateStructure
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
private String annotateStructure(List<? extends StructureItem> structure, HtmlFormatter formatter,
boolean includePositions) {
StringBuilder sb = new StringBuilder();
annotateStructureItem(0, sb, structure, formatter, includePositions);
return sb.toString();
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:CslTestBase.java
示例18: addRanges
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
private void addRanges(List<OffsetRange> ranges, int caretOffset, StructureItem item) {
int start = (int) item.getPosition();
int end = (int) item.getEndPosition();
if (caretOffset >= start && caretOffset <= end) {
ranges.add(new OffsetRange(start, end));
for (StructureItem child : item.getNestedItems()) {
addRanges(ranges, caretOffset, child);
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:YamlKeystrokeHandler.java
示例19: getItems
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
public synchronized List<? extends StructureItem> getItems() {
if (items == null) {
items = new YamlScanner().scanStructure(this);
}
return items;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:YamlParserResult.java
示例20: scan
import org.netbeans.modules.csl.api.StructureItem; //导入依赖的package包/类
@Override
public List<? extends StructureItem> scan(ParserResult info) {
YamlParserResult result = (YamlParserResult) info;
if (result != null) {
return result.getItems();
}
return Collections.emptyList();
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:YamlScanner.java
注:本文中的org.netbeans.modules.csl.api.StructureItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论