• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CompletionDocumentation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.netbeans.spi.editor.completion.CompletionDocumentation的典型用法代码示例。如果您正苦于以下问题:Java CompletionDocumentation类的具体用法?Java CompletionDocumentation怎么用?Java CompletionDocumentation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CompletionDocumentation类属于org.netbeans.spi.editor.completion包,在下文中一共展示了CompletionDocumentation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: show

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
protected void show(CompletionDocumentation doc, int anchorOffset) {
   JTextComponent editorComponent = getEditorComponent();
   if (editorComponent == null) {
return;
   }

          if (!isVisible()) { // documentation already visible
              setContentComponent(new DocumentationScrollPane(editorComponent));
          }
          
          getDocumentationScrollPane().setData(doc);
          
          if (!isVisible()) { // do not check for size as it should remain the same
              // Set anchoring only if not displayed yet because completion
              // may have overriden the anchoring
              setAnchorOffset(anchorOffset);
              getLayout().updateLayout(this);
          } // otherwise leave present doc displayed
      }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:CompletionLayout.java


示例2: setDocumentation

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
private synchronized void setDocumentation(CompletionDocumentation doc) {
    currentDocumentation = doc;
    if (currentDocumentation != null) {
        String text = currentDocumentation.getText();
        URL url = currentDocumentation.getURL();
        if (text != null){
            Document document = view.getDocument();
            document.putProperty(Document.StreamDescriptionProperty, null);
            if (url!=null){
                // fix of issue #58658
                if (document instanceof HTMLDocument){
                    ((HTMLDocument)document).setBase(url);
                }
            }
            view.setContent(text, url != null ? url.getRef() : null);
        } else if (url != null){
            try{
                view.setPage(url);
            }catch(IOException ioe){
                StatusDisplayer.getDefault().setStatusText(ioe.toString());
            }
        }
        bShowWeb.setEnabled(url != null);
        bGoToSource.setEnabled(currentDocumentation.getGotoSourceAction() != null);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:DocumentationScrollPane.java


示例3: hyperlinkUpdate

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e != null && HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
        final String desc = e.getDescription();
        if (desc != null) {
            RP.post(new Runnable() {
                public @Override void run() {
                    CompletionDocumentation cd = currentDocumentation;
                    if (cd != null) {
                        final CompletionDocumentation doc = cd.resolveLink(desc);
                        if (doc != null) {
                            EventQueue.invokeLater(new Runnable() {
                                public @Override void run() {
                                    setData(doc);
                                }
                            });
                        }
                    }
                }
            });
        }                    
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:DocumentationScrollPane.java


示例4: createDocResourceResultSet

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
private CompletionDocumentation createDocResourceResultSet(MockUrlGrammarResult r) throws Exception {
    if (r == null) {
        r = new MockUrlGrammarResult();
        r.setContentURL(createResourceName("res/docResource.html"));
        r.setExternal(true);
    }
    
    ElementResultItem item = new ElementResultItem(0, r);
    CompletionTask task = item.doCreateDocumentationTask(r);
    CompletionResultSet rs = resultSetFor(task, CompletionProvider.DOCUMENTATION_QUERY_TYPE);
    task.query(rs);

    assertTrue(rs.isFinished());
    
    return rsImpl.getDocumentation();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ElementResultItemDocumentationTest.java


示例5: testInternalUrlDocumentation

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
/**
 * Checks documentation bundled in a JAR - not openable by external browser.
 * Need a resource within a JAR
 * 
 * @throws Exception 
 */
public void testInternalUrlDocumentation() throws Exception {
    URL res = EncodingUtil.class.getResource("/org/netbeans/modules/xml/core/resources/Bundle.properties");
    MockUrlGrammarResult test = new MockUrlGrammarResult();
    test.setContentURL(res);
    test.setExternal(false);
    
    CompletionDocumentation doc = createDocResourceResultSet(test);
    assertNull(doc.getURL());
    assertTrue(doc.getText().contains("OpenIDE-Module-Name=XML Core"));
    
    // check that relative links still resolve to internal doc
    CompletionDocumentation  internal = doc.resolveLink("mf-layer.xml");
    assertNotNull("Relative links must be resolvable", internal);
    assertNull("Relative links cannot be opened in extbrowser", doc.getURL());
    assertTrue("Content must be accessible", 
            internal.getText().contains("org-netbeans-modules-xml-dtd-grammar-DTDGrammarQueryProvider.instance"));
    
    // check that absolute links resolve to external doc
    CompletionDocumentation  external = doc.resolveLink("http://www.netbeans.org");
    assertNotNull("Absolute links must be resolvable", external);
    assertEquals("Absolute links must have URL", external.getURL(), new URL("http://www.netbeans.org"));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:ElementResultItemDocumentationTest.java


示例6: testFileDocumentation

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
/**
 * Checks that file-based documentation reverts to external as soon as possible
 * @throws Exception 
 */
public void testFileDocumentation() throws Exception {
    URL res = EncodingUtil.class.getResource("/org/netbeans/modules/xml/core/resources/Bundle.properties");
    MockUrlGrammarResult test = new MockUrlGrammarResult();
    test.setContentURL(res);
    test.setExternal(false);

    CompletionDocumentation doc = createDocResourceResultSet(test);
    assertNull(doc.getURL());
    assertTrue("Invalid content", doc.getText().contains("OpenIDE-Module-Name=XML Core"));
    
    // check that resolve of file-based URL turns the doc to external:

    URL url = createResourceName("res/docResource.html");
    CompletionDocumentation  file = doc.resolveLink(url.toString());
    assertNotNull(file);
    assertEquals("URL must be openable in browser", url, file.getURL());
    assertTrue("Invalid content of the linked doc", file.getText().contains("This is an URL resource with <a href="));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:ElementResultItemDocumentationTest.java


示例7: createDocumentationTask

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
@Override
public CompletionTask createDocumentationTask() {
    return new AsyncCompletionTask(new AsyncCompletionQuery() {
        @Override
        protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
            CompletionDocumentation docItem = SpringXMLConfigCompletionDoc.createBeanRefDoc(beanId,
                    beanNames, beanClass, beanLocFile, goToBeanAction);
            resultSet.setDocumentation(docItem);
            resultSet.finish();
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:SpringXMLConfigCompletionItem.java


示例8: setDocumentation

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
public synchronized void setDocumentation(CompletionDocumentation documentation) {
    checkNotFinished();
    if (!active || queryType != CompletionProvider.DOCUMENTATION_QUERY_TYPE) {
        return;
    }
    this.documentation = documentation;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:CompletionResultSetImpl.java


示例9: addToHistory

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
private synchronized void addToHistory(CompletionDocumentation doc) {
    int histSize = history.size();
    for (int i = currentHistoryIndex + 1; i < histSize; i++){
        history.remove(history.size() - 1);
    }
    history.add(doc);
    currentHistoryIndex = history.size() - 1;
    if (currentHistoryIndex > 0)
        bBack.setEnabled(true);
    bForward.setEnabled(false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:DocumentationScrollPane.java


示例10: openInExternalBrowser

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
private void openInExternalBrowser(){
    CompletionDocumentation cd = currentDocumentation;
    if (cd != null) {
        URL url = cd.getURL();
        if (url != null)
            HtmlBrowser.URLDisplayer.getDefault().showURL(url);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DocumentationScrollPane.java


示例11: goToSource

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
private void goToSource() {
    CompletionDocumentation cd = currentDocumentation;
    if (cd != null) {
        Action action = cd.getGotoSourceAction();
        if (action != null)
            action.actionPerformed(new ActionEvent(cd, 0, null));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DocumentationScrollPane.java


示例12: createDocumentationTask

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
@Override
public CompletionTask createDocumentationTask() {
    return new AsyncCompletionTask(new AsyncCompletionQuery() {

        @Override
        protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
            if (docText != null) {
                CompletionDocumentation documentation = HibernateCompletionDocumentation.getAttribValueDoc(docText);
                resultSet.setDocumentation(documentation);
            }
            resultSet.finish();
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:HibernateCompletionItem.java


示例13: resolveLink

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
@Override
public CompletionDocumentation resolveLink(String link) {
    try {
        DescriptionSource target = src.resolveLink(link);
        if (target != null) {
            return new ExtDocum(target, null);
        }
        
        URL base = src.getContentURL();
        if (base == null) {
            // sorry, cannot resolve.
            return null;
        }
        
        URL targetURL = new URL(base, link);
        
        // leave the VM as soon as possible. This hack uses URLMappers
        // to find out whether URL (converted to FO and back) can be
        // represented outside the VM
        boolean external = true;
        FileObject f = URLMapper.findFileObject(targetURL);
        if (f != null) {
            external = URLMapper.findURL(f, URLMapper.EXTERNAL) != null;
        }
        return new URLDocum(targetURL, external);
    } catch (MalformedURLException ex) {
        Exceptions.printStackTrace(ex);
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:XMLResultItem.java


示例14: testCustomContent

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
/**
 * Checks that custom contents overrides the one supplied by XMLResultItem
 * 
 * @throws Exception 
 */
public void testCustomContent() throws Exception {
    URL res = EncodingUtil.class.getResource("/org/netbeans/modules/xml/core/resources/Bundle.properties");
    MockUrlGrammarResult test = new MockUrlGrammarResult();
    test.setContentURL(res);
    test.setExternal(false);
    test.setDescription(PLAIN_DESCRIPTION_TEXT);
    
    CompletionDocumentation doc = createDocResourceResultSet(test);
    assertNull(doc.getURL());
    assertEquals("Invalid content", PLAIN_DESCRIPTION_TEXT, doc.getText());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ElementResultItemDocumentationTest.java


示例15: testResolveRelativeLinks

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
/**
 * Checks that relative and .. link resolution works OK.
 * 
 * @throws Exception 
 */
public void testResolveRelativeLinks() throws Exception {
    CompletionDocumentation doc = createDocResourceResultSet(null);
            
    assertEquals(createResourceName("res/docResource.html"), doc.getURL());
    
    CompletionDocumentation linked = doc.resolveLink("relativeLink1.html");
    assertNotNull(linked);
    assertEquals("Relative link must be resolved", createResourceName("res/relativeLink1.html"), linked.getURL());
    
    linked = doc.resolveLink("../parentDoc.html");
    assertNotNull(linked);
    assertEquals("Link to resource in parent folder must be resolved", createResourceName("parentDoc.html"), linked.getURL());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ElementResultItemDocumentationTest.java


示例16: testNetworkUrlDocumentation

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
/**
 * Checks that DS returning 'external' provides URL and resolves links, although
 * no custom resolver is given
 * 
 * @throws Exception 
 */
public void testNetworkUrlDocumentation() throws Exception {
    MockUrlGrammarResult test = new MockUrlGrammarResult();
    test.setExternal(true);
    test.setContentURL(new URL("http://www.netbeans.org"));
    
    CompletionDocumentation doc = createDocResourceResultSet(test);
    assertEquals("External documentation must have URL", new URL("http://www.netbeans.org"), doc.getURL());
    
    CompletionDocumentation resolved = doc.resolveLink("index.html");
    assertEquals("Resolved external link must have URL", new URL("http://www.netbeans.org/index.html"), resolved.getURL());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ElementResultItemDocumentationTest.java


示例17: testNoContentUrl

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
/**
 * Checks that without content URL, no item is produced
 * @throws Exception 
 */
public void testNoContentUrl() throws Exception {
    MockUrlGrammarResult res = new MockUrlGrammarResult();
    CompletionDocumentation doc = createDocResourceResultSet(res);
    
    assertNull(doc);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ElementResultItemDocumentationTest.java


示例18: getDocForBuiltin

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
private static CompletionDocumentation getDocForBuiltin(String builtin) {
    if (builtinGroups == null) {
        initBuiltins();
    }
    builtin = builtin.replaceAll("[A-Z]", "_$0").toLowerCase(); // camelCase to underscore_case
    String page = builtinGroups.get(builtin);
    if (!docCache2.containsKey(builtin)) {
        docCache2.put(builtin, new BuiltinDocumentation(page));
    }
    return docCache2.get(builtin);
}
 
开发者ID:rostanek,项目名称:freemarker-support-for-netbeans,代码行数:12,代码来源:FTLCompletionItem.java


示例19: resolveLink

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
@Override
public CompletionDocumentation resolveLink(String string) {
    if (!string.startsWith("#")) {
        if (string.startsWith("ref_directive_")) {
            return FTLCompletionItem.getDocForDirective(string.substring(14, string.lastIndexOf(".")));
        }
        try {
            return new FTLCompletionDocumentation(new URL("http://freemarker.org/docs/" + string));
        } catch (MalformedURLException ex) {
            //Exceptions.printStackTrace(ex);
        }
    }
    return null;
}
 
开发者ID:rostanek,项目名称:freemarker-support-for-netbeans,代码行数:15,代码来源:FTLCompletionItem.java


示例20: resolveLink

import org.netbeans.spi.editor.completion.CompletionDocumentation; //导入依赖的package包/类
@Override
public CompletionDocumentation resolveLink(String link) {
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:PersistenceCompletionDocumentation.java



注:本文中的org.netbeans.spi.editor.completion.CompletionDocumentation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IDPSSODescriptor类代码示例发布时间:2022-05-22
下一篇:
Java RequestHandler类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap