本文整理汇总了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);
}