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


Java DataObject.rename方法代码示例

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


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

示例1: handleRename

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
@Override
public void handleRename(Node node, String newName) {
    InstanceContent ic = new InstanceContent();
    ic.add(node);
    ExplorerContext d = new ExplorerContext();
    d.setNewName(newName);
    ic.add(d);
    Lookup l = new AbstractLookup(ic);
    DataObject dob = node.getCookie(DataObject.class);
    Action a = RefactoringActionsFactory.renameAction().createContextAwareInstance(l);
    if (Boolean.TRUE.equals(a.getValue("applicable"))) {//NOI18N
        a.actionPerformed(RefactoringActionsFactory.DEFAULT_EVENT);
    } else {
        try {
            dob.rename(newName);
        } catch (IOException ioe) {
            ErrorManager.getDefault().notify(ioe);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:RenameHandlerImpl.java

示例2: testRename

import org.openide.loaders.DataObject; //导入方法依赖的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

示例3: doRefactoringBypass

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
public void doRefactoringBypass() throws IOException {
    DataObject dob = null;
    if (byPassFolder != null) {
        dob = DataFolder.findFolder(byPassFolder);
    } else {
        dob = DataObject.find(refactoring.getRefactoringSource().lookup(FileObject.class));
    }
    dob.rename(panel.getNameValue());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:RenameMappingFileRefactoringUI.java

示例4: renameDO

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
private void renameDO(File from, File to) throws DataObjectNotFoundException, IOException {
    DataObject daoFrom = DataObject.find(FileUtil.toFileObject(from));
    daoFrom.rename(to.getName());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:FilesystemInterceptorTest.java

示例5: renameDO

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
private void renameDO(File from, File to) throws DataObjectNotFoundException, IOException {
    DataObject daoFrom = DataObject.find(FileUtil.toFileObject(from));                
    daoFrom.rename(to.getName());               
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:InteceptorTest.java

示例6: renameDO

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
private void renameDO (File from, String newName) throws DataObjectNotFoundException, IOException {
    DataObject daoFrom = DataObject.find(FileUtil.toFileObject(from));
    daoFrom.rename(newName);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:InterceptorTest.java


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