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

Java UniFileLoader类代码示例

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

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



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

示例1: testUnmodifiedDocumentSaveAs

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
public void testUnmodifiedDocumentSaveAs() throws IOException {
    FileUtil.createData(FileUtil.getConfigRoot(), "someFolder/someFile.obj");
    
    DataObject obj = DataObject.find(FileUtil.getConfigFile("someFolder/someFile.obj"));
    assertEquals( MyDataObject.class, obj.getClass());
    assertTrue( "we need UniFileLoader", obj.getLoader() instanceof UniFileLoader );
    
    MyEnv env = new MyEnv( obj );
    MyDataEditorSupport des = new MyDataEditorSupport( obj, env );
    
    FileObject newFolder = FileUtil.createFolder(FileUtil.getConfigRoot(), "otherFolder");
    
    des.saveAs( newFolder, "newFile.newExt" );
    
    DataObject newObj = DataObject.find(FileUtil.getConfigFile("otherFolder/newFile.newExt"));
    assertEquals( MyDataObject.class, newObj.getClass());
    MyDataObject myObj = (MyDataObject)newObj;
    
    assertEquals("the original document was closed", 1, des.closeCounter );
    assertEquals("we don't ask before closing the original document", 0, des.canCloseCounter );
    assertEquals("new document was opened", 1, myObj.openCookieCalls);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:DataEditorSupportSaveAsTest.java


示例2: testModifiedDocumentSaveAs

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
public void testModifiedDocumentSaveAs() throws IOException {
    FileUtil.createData(FileUtil.getConfigRoot(), "someFolder/someFile.obj");
    
    DataObject obj = DataObject.find(FileUtil.getConfigFile("someFolder/someFile.obj"));
    assertEquals( MyDataObject.class, obj.getClass());
    assertTrue( "we need UniFileLoader", obj.getLoader() instanceof UniFileLoader );
    
    obj.setModified( true );
    
    MyEnv env = new MyEnv( obj );
    MyDataEditorSupport des = new MyDataEditorSupport( obj, env );
    
    FileObject newFolder = FileUtil.createFolder(FileUtil.getConfigRoot(), "otherFolder");
    
    des.saveAs( newFolder, "newFile.newExt" );
    
    DataObject newObj = DataObject.find(FileUtil.getConfigFile("otherFolder/newFile.newExt"));
    assertEquals( MyDataObject.class, newObj.getClass());
    MyDataObject myObj = (MyDataObject)newObj;
    
    assertEquals("the original StyledDocument was rendered (no file copy)", 1, des.renderCounter);
    assertFalse("the original document is no longer modified", obj.isModified() );
    assertEquals("the original document was closed", 1, des.closeCounter );
    assertEquals("we don't ask before closing the original document", 0, des.canCloseCounter );
    assertTrue("new document was opened", myObj.openCookieCalls > 0);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:DataEditorSupportSaveAsTest.java


示例3: testRename

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
/** Test updating document property Document.TitleProperty when dataobject is renamed */
public void testRename () throws IOException {
    FileUtil.createData(FileUtil.getConfigRoot(), "someFolder/someFile.obj");
    
    DataObject obj = DataObject.find(FileUtil.getConfigFile("someFolder/someFile.obj"));
    assertEquals( MyDataObject.class, obj.getClass());
    assertTrue( "we need UniFileLoader", obj.getLoader() instanceof UniFileLoader );

    EditorCookie ec = obj.getCookie(EditorCookie.class);
    
    StyledDocument doc = ec.openDocument();

    String val = (String) doc.getProperty(Document.TitleProperty);
    assertTrue("Test property value", val.startsWith("someFolder/someFile.obj"));

    obj.rename("newFile");

    val = (String) doc.getProperty(Document.TitleProperty);
    assertTrue("Test property value", val.startsWith("someFolder/newFile.obj"));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:DocumentTitlePropertyTest.java


示例4: testDocumentId

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
public void testDocumentId () throws IOException {
    FileUtil.createData(FileUtil.getConfigRoot(), "someFolder/someFile.obj");
    FileUtil.createData(FileUtil.getConfigRoot(), "someFolder/someFile.txt");
    
    DataObject obj = DataObject.find(FileUtil.getConfigFile("someFolder/someFile.obj"));
    DataObject txt = DataObject.find(FileUtil.getConfigFile("someFolder/someFile.txt"));
    assertEquals( MyDataObject.class, obj.getClass());
    assertTrue( "we need UniFileLoader", obj.getLoader() instanceof UniFileLoader );

    CloneableEditorSupport ecobj = (CloneableEditorSupport) obj.getCookie(EditorCookie.class);
    CloneableEditorSupport ectxt = (CloneableEditorSupport) txt.getCookie(EditorCookie.class);
    
    if (ecobj.documentID().equals(ectxt.documentID())) {
        fail("The same ID: " + ectxt.documentID());
    }
    assertEquals("Should be full name of the fileObj", obj.getPrimaryFile().getNameExt(), ecobj.documentID());
    assertEquals("Should be full name of the txtObj", txt.getPrimaryFile().getNameExt(), ectxt.documentID());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:DocumentTitlePropertyTest.java


示例5: testMove

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
/** Test updating document property Document.TitleProperty when dataobject is moved */
public void testMove () throws IOException {
    FileUtil.createData(FileUtil.getConfigRoot(), "someFolder/someFile.obj");
    FileUtil.createFolder(FileUtil.getConfigRoot(), "newFolder");

    DataObject obj = DataObject.find(FileUtil.getConfigFile("someFolder/someFile.obj"));
    DataFolder dFolder = (DataFolder) DataObject.find(FileUtil.getConfigFile("newFolder"));

    assertEquals( MyDataObject.class, obj.getClass());
    assertTrue( "we need UniFileLoader", obj.getLoader() instanceof UniFileLoader );

    EditorCookie ec = obj.getCookie(EditorCookie.class);

    StyledDocument doc = ec.openDocument();

    String val = (String) doc.getProperty(Document.TitleProperty);
    assertTrue("Test property value", val.startsWith("someFolder/someFile.obj"));

    obj.move(dFolder);

    val = (String) doc.getProperty(Document.TitleProperty);
    assertTrue("Test property value", val.startsWith("newFolder/someFile.obj"));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:DocumentTitlePropertyTest.java


示例6: HtmlDataObject

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
/** New instance.
 * @param pf primary file object for this data object
 * @param loader the data loader creating it
 * @exception DataObjectExistsException if there was already a data object for it
 */
public HtmlDataObject(FileObject pf, UniFileLoader loader) throws DataObjectExistsException {
    super(pf, loader);
    CookieSet set = getCookieSet();
    set.add(HtmlEditorSupport.class, this);
    set.add(ViewSupport.class, this);
    set.assign(SaveAsCapable.class, new SaveAsCapable() {
        public void saveAs( FileObject folder, String fileName ) throws IOException {
            HtmlEditorSupport es = getCookie( HtmlEditorSupport.class );
            try {
                es.updateEncoding();
                es.saveAs( folder, fileName );
            } catch (UserCancelException e) {
                //ignore, just not save anything
            }
        }
    });

    set.assign(FileEncodingQueryImplementation.class, new FileEncodingQueryImpl());
            
    //add check/validate xml cookies
    InputSource in = DataObjectAdapters.inputSource(this);
    set.add(new ValidateXMLSupport(in));
    set.add(new CheckXMLSupport(in));
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:HtmlDataObject.java


示例7: getAdditionalBeanInfo

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
public BeanInfo[] getAdditionalBeanInfo() {
    try {
        return new BeanInfo[] {Introspector.getBeanInfo(UniFileLoader.class)};
    } catch (IntrospectionException ie) {
        throw new AssertionError(ie);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:JarDataLoaderBeanInfo.java


示例8: getAdditionalBeanInfo

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
@Override
public BeanInfo[] getAdditionalBeanInfo() {
    try {
        return new BeanInfo[]{Introspector.getBeanInfo(UniFileLoader.class)};
    } catch (IntrospectionException e) {
        throw new AssertionError(e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:SpringXMLConfigDataLoaderBeanInfo.java


示例9: getAdditionalBeanInfo

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
public BeanInfo[] getAdditionalBeanInfo() {
    try {
        return new BeanInfo[] {Introspector.getBeanInfo(UniFileLoader.class)};
    } catch (IntrospectionException e) {
        throw new AssertionError(e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:WhereUsedDataLoaderBeanInfo.java


示例10: testRename

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
/**
 * Test that fileChange event from FileObject.refresh in DES.Env.getTime is ignored
 * ie. no property change event from DES.Env is fired.
 */
public void testRename () throws IOException {
    counter = 0;
    FileObject folder = FileUtil.toFileObject(getWorkDir());
    FileObject fo = FileUtil.createData(folder,"someFile.obj");
    
    DataObject obj = DataObject.find(fo);
    assertEquals( MyDataObject.class, obj.getClass());
    assertTrue( "we need UniFileLoader", obj.getLoader() instanceof UniFileLoader );

    EditorCookie ec = obj.getCookie(EditorCookie.class);

    DataEditorSupport des = (DataEditorSupport) ec;
    DataEditorSupport.Env env = (DataEditorSupport.Env) des.desEnv();

    File file = FileUtil.toFile(fo);
    //Set lastModified time to future so openDocument -> getTime -> FileObject.refresh
    //will generate fileChange event. fileChange event must be ignored in DES.Env to avoid
    //firing propertyChange event.
    file.setLastModified(file.lastModified() + 1000000L);
    
    env.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            counter++;
        }
    });
    
    StyledDocument doc = ec.openDocument();

    assertEquals("Counter must be zero", 0, counter);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:PropertyChangeTest.java


示例11: getAdditionalBeanInfo

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
public BeanInfo[] getAdditionalBeanInfo () {
    try {
        return new BeanInfo[] { Introspector.getBeanInfo(UniFileLoader.class) };
    } catch (IntrospectionException ie) {
 Exceptions.printStackTrace(ie);
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:SQLDataLoaderBeanInfo.java


示例12: getAdditionalBeanInfo

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
public BeanInfo[] getAdditionalBeanInfo () {
    try {
        return new BeanInfo[] { Introspector.getBeanInfo (UniFileLoader.class) };
    } catch (IntrospectionException ie) {
 Exceptions.printStackTrace(ie);
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:HtmlLoaderBeanInfo.java


示例13: getAdditionalBeanInfo

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
/** Gets additional beaninfo. */
@Override
public BeanInfo[] getAdditionalBeanInfo () {
    try {
        return new BeanInfo[] { Introspector.getBeanInfo (UniFileLoader.class) };
    } catch (IntrospectionException ie) {
        ErrorManager.getDefault().notify(ie);
        
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:URLDataLoaderBeanInfo.java


示例14: getAdditionalBeanInfo

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
/** Gets additional bean infos. */
@Override
public BeanInfo[] getAdditionalBeanInfo() {
    try {
        return new BeanInfo[] { Introspector.getBeanInfo(UniFileLoader.class) };
    } catch (IntrospectionException ie) {
        ErrorManager.getDefault().notify(ie);
        
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:PDFDataLoaderBeanInfo.java


示例15: getAdditionalBeanInfo

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
public BeanInfo[] getAdditionalBeanInfo () {
    try {
        return new BeanInfo[] { Introspector.getBeanInfo (UniFileLoader.class) };
    } catch (IntrospectionException ie) {
 ErrorManager.getDefault().notify(ie);
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ImageDataLoaderBeanInfo.java


示例16: getAdditionalBeanInfo

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
@Override
public BeanInfo[] getAdditionalBeanInfo() {
    try {
        return new BeanInfo[] {Introspector.getBeanInfo(UniFileLoader.class)};
    } catch (IntrospectionException e) {
        throw new AssertionError(e);
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:9,代码来源:GlslGeometryShaderDataLoaderBeanInfo.java


示例17: MySQLDataObject

import org.openide.loaders.UniFileLoader; //导入依赖的package包/类
public MySQLDataObject(FileObject primaryFile, UniFileLoader loader) throws DataObjectExistsException {
    super(primaryFile, loader);
    CookieSet cookies = getCookieSet();
    cookies.remove(cookies.getCookie(OpenCookie.class));
    cookies.add(new MySQLEditorSupport(this));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:SQLEditorSupportConsoleTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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