當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。