当前位置: 首页>>代码示例>>Java>>正文


Java CompletionDocumentation类代码示例

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


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


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