本文整理汇总了Java中org.netbeans.modules.csl.api.ElementHandle类的典型用法代码示例。如果您正苦于以下问题:Java ElementHandle类的具体用法?Java ElementHandle怎么用?Java ElementHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ElementHandle类属于org.netbeans.modules.csl.api包,在下文中一共展示了ElementHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: StructureItemNode
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的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());
}
示例2: getListCellRendererComponent
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof AlternativeLocation) {
AlternativeLocation desc = (AlternativeLocation) value;
ElementHandle e = desc.getElement();
ImageIcon icon = Icons.getElementIcon(e.getKind(), e.getModifiers());
setIcon(icon);
GsfHtmlFormatter formatter = new GsfHtmlFormatter();
String s = desc.getDisplayHtml(formatter);
setText("<html>"+s);
}
return c;
}
示例3: document
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
@Override
public String document(ParserResult info, ElementHandle element) {
FileObject fileObject = info.getSnapshot().getSource().getFileObject();
HelpResolver resolver = CssModuleSupport.getHelpResolver();
if (resolver != null) {
if (element instanceof CssPropertyElement) {
CssPropertyElement e = (CssPropertyElement) element;
PropertyDefinition property = e.getPropertyDescriptor();
return resolver.getHelp(fileObject, property);
} else if (element instanceof ElementHandle.UrlHandle) {
try {
return URLRetriever.getURLContentAndCache(new URL(element.getName()));
} catch (MalformedURLException e) {
assert false;
}
}
}
return null;
}
示例4: document
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
@Override
public String document(ParserResult result, ElementHandle handle)
{
String doc = null;
switch (docType)
{
case POD:
doc = FanIndexer.getPodDoc(handle.getName());
break;
case TYPE:
doc = ((FanBasicElementHandle) handle).getDoc();
break;
case SLOT:
doc = ((FanBasicElementHandle) handle).getDoc();
break;
}
return doc;
}
示例5: documentElement
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
@Override
public Documentation documentElement(
@NonNull final ParserResult info,
@NonNull final ElementHandle element,
@NonNull final Callable<Boolean> cancel) {
switch (element.getKind()) {
case KEYWORD:
return Optional.ofNullable(Command.forHandle(element))
.map((cmd) -> cmd.getDocumentation(cancel))
.orElse(null);
case OTHER:
try {
final URL url = ((DocHandle)element).getURI().toURL();
final Future<String> becomesContent = DocDownloader.download(url, cancel);
String content = null;
while (cancel.call() != Boolean.TRUE) {
try {
content = becomesContent.get(250, TimeUnit.MILLISECONDS);
break;
} catch (TimeoutException timeout) {
//retry
}
}
return content == null ?
null :
DocDownloader.parseSection(content, url);
} catch (Exception e) {
return null;
}
default:
return null;
}
}
示例6: actionPerformed
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
public void actionPerformed (ActionEvent ev) {
if (fileObject != null && elementHandle == null) {
UiUtils.open(fileObject, (int)start);
return;
}
ElementHandle handle = elementHandle;
FileObject primaryFile = DataLoadersBridge.getDefault().getPrimaryFile(fileObject);
if ((primaryFile != null) && (handle != null)) {
Source js = Source.create(primaryFile);
if (js != null) {
UiUtils.open(js, handle);
}
}
}
示例7: createDocumentationTask
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
@Override
public CompletionTask createDocumentationTask() {
final ElementHandle element = item.getElement();
if (element != null) {
return GsfCompletionProvider.createDocTask(element,info);
}
return null;
}
示例8: createDocTask
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
static CompletionTask createDocTask(ElementHandle element, ParserResult info) { // TODO - use ComObjectHandle ??
JavaCompletionQuery query = new JavaCompletionQuery(DOCUMENTATION_QUERY_TYPE, -1);
query.element = element;
//return new AsyncCompletionTask(query, Registry.getMostActiveComponent());
return new AsyncCompletionTask(query, EditorRegistry.lastFocusedComponent());
}
示例9: resolveLink
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
@Override
public ElementHandle resolveLink(String link, ElementHandle elementHandle) {
if (elementHandle instanceof CssPropertyElement) {
CssPropertyElement e = (CssPropertyElement) elementHandle;
PropertyDefinition property = e.getPropertyDescriptor();
HelpResolver helpResolver = CssModuleSupport.getHelpResolver();
if (helpResolver != null) {
URL url = helpResolver.resolveLink(elementHandle.getFileObject(), property, link);
if (url != null) {
return new UrlHandle(url.toExternalForm());
}
}
}
return null;
}
示例10: signatureEquals
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
@Override
public boolean signatureEquals(ElementHandle handle) {
if (!(handle instanceof HtmlElementHandle)) {
return false;
}
HtmlElementHandle htmlHandle = (HtmlElementHandle)handle;
return htmlHandle.elementPath.equals(elementPath);
}
示例11: getElement
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
@Override
public ElementHandle getElement() {
if (!this.description.isEmpty()) {
return new ApexElementHandle(this.name, this.description, this.elementKind);
}
return null;
}
示例12: signatureEquals
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
@Override
public boolean signatureEquals(ElementHandle elementHandle) {
if (elementHandle instanceof EditorConfigElementHandle) {
return name.equals(((EditorConfigElementHandle) elementHandle).name);
}
return false;
}
示例13: signatureEquals
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
@Override
public boolean signatureEquals(ElementHandle eh) {
if (!(eh instanceof SSTemplateElementHandle)) {
return false;
}
if (eh.getName().equals(this.getName())) {
return true;
}
return false;
}
示例14: signatureEquals
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
@Override
public boolean signatureEquals(ElementHandle elementHandle) {
if (elementHandle instanceof EditorConfigElementHandle) {
return name.equals(((EditorConfigElementHandle) elementHandle).name);
}
return false;
}
示例15: resolveLink
import org.netbeans.modules.csl.api.ElementHandle; //导入依赖的package包/类
@Override
public ElementHandle resolveLink(String link, ElementHandle handle)
{
//TODO: resolve links
/*System.out.println("Resolve link: "+link);
link="sys.File";
return new ElementHandle.UrlHandle(link);*/
return null;
}