本文整理汇总了Java中org.openide.loaders.DataFolder.getFolder方法的典型用法代码示例。如果您正苦于以下问题:Java DataFolder.getFolder方法的具体用法?Java DataFolder.getFolder怎么用?Java DataFolder.getFolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.loaders.DataFolder
的用法示例。
在下文中一共展示了DataFolder.getFolder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: topPackage
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
private @CheckForNull DataFolder topPackage() {
if (parent == null) {
return null;
}
DataFolder here = getLookup().lookup(DataFolder.class);
while (here != null) {
DataFolder there = here.getFolder();
if (there != null && there != parent) {
here = there;
} else {
break;
}
}
return here;
}
示例2: getNestedDisplayName
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
String getNestedDisplayName(DataFolder folder) {
DataFolder f = folder;
StringBuffer b = new StringBuffer();
while (f != top) {
if (b.length() > 0) {
b.insert(0, " \u2192 "); // XXX I18N? just a right-arrow
}
b.insert(0, getDisplayName(f));
f = f.getFolder();
}
return b.toString();
}
示例3: handleRename
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
@Override
public void handleRename(Node node, String newName) {
DataFolder dob = (DataFolder) node.getCookie(DataObject.class);
FileObject fo = dob.getPrimaryFile();
if (node.isLeaf()) {
//rename empty package and don't try to do any refactoring
try {
if (!RefactoringUtils.isValidPackageName(newName)) {
String msg = new MessageFormat(NbBundle.getMessage(RenameRefactoringPlugin.class,"ERR_InvalidPackage")).format(
new Object[] {newName}
);
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(
msg, NotifyDescriptor.INFORMATION_MESSAGE));
return;
}
ClassPath sourcepath = ClassPath.getClassPath(fo, ClassPath.SOURCE);
if (sourcepath == null) {
throw new IOException("no sourcepath for " + fo);
}
FileObject root = sourcepath.findOwnerRoot(fo);
if (root == null) {
throw new IOException(fo + " not in its own sourcepath " + sourcepath);
}
FileObject newFolder = FileUtil.createFolder(root, newName.replace('.','/'));
while (dob.getChildren().length == 0 && dob.isDeleteAllowed() && !dob.getPrimaryFile().equals(newFolder)) {
DataFolder parent = dob.getFolder();
dob.delete();
dob = parent;
}
} catch (IOException ioe) {
ErrorManager.getDefault().notify(ioe);
}
return;
}
InstanceContent ic = new InstanceContent();
ic.add(node);
ExplorerContext d = new ExplorerContext();
d.setNewName(newName);
ic.add(d);
final Lookup l = new AbstractLookup(ic);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
Action a = RefactoringActionsFactory.renameAction().createContextAwareInstance(l);
if (Boolean.TRUE.equals(a.getValue("applicable"))) { //NOI18N
a.actionPerformed(RefactoringActionsFactory.DEFAULT_EVENT);
}
}
});
}