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


Java EditorCookie.close方法代码示例

本文整理汇总了Java中org.openide.cookies.EditorCookie.close方法的典型用法代码示例。如果您正苦于以下问题:Java EditorCookie.close方法的具体用法?Java EditorCookie.close怎么用?Java EditorCookie.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.cookies.EditorCookie的用法示例。


在下文中一共展示了EditorCookie.close方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSaveOpenConcurrent

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
/** Tests that charset of saving document is not removed from cache by
 * concurrent openDocument() call (see #160784). */
public void testSaveOpenConcurrent() throws Exception {
    obj = DataObject.find(fileObject);
    DES sup = support();
    assertFalse("It is closed now", sup.isDocumentLoaded());
    assertNotNull("DataObject found", obj);

    Document doc = sup.openDocument();
    assertTrue("It is open now", support().isDocumentLoaded());
    doc.insertString(0, "Ahoj", null);
    EditorCookie s = (EditorCookie) sup;
    assertNotNull("Modified, so it has cookie", s);
    assertEquals(sup, s);

    Logger.getLogger(DataEditorSupport.class.getName()).setLevel(Level.FINEST);
    Logger.getLogger(DataEditorSupport.class.getName()).addHandler(new OpeningHandler(sup));
    s.saveDocument();
    
    assertLockFree(obj.getPrimaryFile());
    s.close();
    CloseCookie c = (CloseCookie) sup;
    assertNotNull("Has close", c);
    assertTrue("Close ok", c.close());
    assertLockFree(obj.getPrimaryFile());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:DataEditorSupportTest.java

示例2: postCloseCleanup

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
private void postCloseCleanup() {
    try {
        // try to close the dataobject
        DataObject d = DataObject.find(getConsoleFile());
        EditorCookie cake = d.getLookup().lookup(EditorCookie.class);
        cake.close();
        // discard the dataobject
        synchronized (this) {
            if (document == null) {
                return;
            }
            document = null;
        }
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
    }
    if (controlsIO) {
        inputOutput.closeInputOutput();
    }
    ShellRegistry.get().closed(this);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:JShellEnvironment.java

示例3: finalize

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
protected void finalize() throws Throwable {
    try {
        DataObject dobj = DataObject.find(backendCatalogFileObj);
        EditorCookie thisDocumentEditorCookie = (EditorCookie)dobj.getCookie(EditorCookie.class);
        backendCatalogSwingDocument.removeDocumentListener(this);
        thisDocumentEditorCookie.close();
    } finally {
        super.finalize();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:CatalogFileWrapperDOMImpl.java

示例4: closeTopComponents

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
private static void closeTopComponents() {
    for (TopComponent tc : new ArrayList<TopComponent>(TopComponent.getRegistry().getOpened())) {
        final EditorCookie ec = tc.getLookup().lookup(EditorCookie.class);
        if (ec != null) {
            ec.close();
        }
    }
    System.out.println("closed all ... hopefully");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:PerfWatchProjects.java

示例5: testAnnotationProviderIsCalledCorrectly

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
public void testAnnotationProviderIsCalledCorrectly() throws Exception {              
    Object o = Lookup.getDefault().lookup(AnnotationProvider.class);
    if(o == null) {
        fail("No  annotation provider found");
    }
    
    FileObject fo = fs.getRoot().createData("test", "txt");

    DataObject data = DataObject.find(fo);
    
    EditorCookie ec = data.getCookie(EditorCookie.class);
    
    ConsistencyCheckProvider.setCalled(0);
    ec.open();
    
    CloneableEditorSupport ces = (CloneableEditorSupport)ec;
    
    assertEquals("Provider called exactly once", 1,ConsistencyCheckProvider.getCalled());
    assertEquals("Consistent lookup content", data.getPrimaryFile(),ConsistencyCheckProvider.getInLkp());

    Line l1 = ces.getLineSet().getCurrent(0);
    assertEquals("Exactly one annotation attached", 1, l1.getAnnotationCount());
    
    ec.close();
    // XXX
    Line l2 = ces.getLineSet().getCurrent(0);
    assertEquals ("Lines are the same", l1, l2);
    assertEquals("Exactly one annotation attached after close", 1, l2.getAnnotationCount());

    ConsistencyCheckProvider.setCalled(0);
    ec.open();
    // XXX
    assertEquals("Provider not called during reopen", 0,ConsistencyCheckProvider.getCalled());
    assertEquals("Exactly one annotation attached after reopen", 1, ces.getLineSet().getCurrent(0).getAnnotationCount());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:AnnotationProviderTest.java

示例6: closeEditor

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
public boolean closeEditor() {
    EditorCookie cake = getConsoleFile().getLookup().lookup(EditorCookie.class);
    if (cake == null) {
        return true;
    }
    return cake.close();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:JShellEnvironment.java

示例7: closeFile

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
private void closeFile() {
    EditorCookie ec = null;
    if(dataObject!=null) ec = dataObject.getCookie(EditorCookie.class);
    if(ec != null) ec.close();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:MarkOccurrencesTest.java


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