本文整理匯總了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);
}
}
}
示例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"));
}
示例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());
}
示例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());
}
示例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());
}
示例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);
}