本文整理汇总了Java中org.openide.loaders.DataFolder.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java DataFolder.getChildren方法的具体用法?Java DataFolder.getChildren怎么用?Java DataFolder.getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.loaders.DataFolder
的用法示例。
在下文中一共展示了DataFolder.getChildren方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValidCategory
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
boolean isValidCategory(Node node) {
if (classPath == null)
return true;
// check if there is some valid item in this category
// [ideally we should listen on the category for adding/removing items,
// practically we just need to hide Swing categories on some mobile platforms]
DataFolder folder = node.getCookie(DataFolder.class);
if (folder == null)
return false;
DataObject[] dobjs = folder.getChildren();
for (int i=0; i < dobjs.length; i++) {
PaletteItem item = dobjs[i].getCookie(PaletteItem.class);
if (item == null || isValidItem(item))
return true;
}
return dobjs.length == 0;
}
示例2: preparePackageDelete
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
private Problem preparePackageDelete(NonRecursiveFolder folder, RefactoringElementsBag refactoringElements) {
DataFolder dataFolder = DataFolder.findFolder(folder.getFolder());
// First; delete all files except packages
DataObject children[] = dataFolder.getChildren();
boolean empty = true;
for( int i = 0; children != null && i < children.length; i++ ) {
FileObject fileObject = children[i].getPrimaryFile();
if ( !fileObject.isFolder() ) {
refactoringElements.addFileChange(refactoring, new DeleteFile(fileObject, refactoringElements));
}
else {
empty = false;
}
}
// If empty delete itself
if ( empty ) {
refactoringElements.addFileChange(refactoring, new PackageDeleteElem(folder));
}
return null;
}
示例3: containsAcceptedDataObject
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
/**
* Indicates if folder or its subfolders contains data object
* that is supported by any internationalization factory.
*/
public static boolean containsAcceptedDataObject(DataFolder folder) {
DataObject[] children = folder.getChildren();
DataObject[] folders = new DataObject[children.length];
int i, foldersCount = 0;
for (DataObject child : children) {
if (child instanceof DataFolder) {
folders[foldersCount++] = child;
} else if (FactoryRegistry.hasFactory(child.getClass())) {
return true;
}
}
for (i = 0; i < foldersCount; i++) {
if (containsAcceptedDataObject((DataFolder) children[i])) {
return true;
}
}
return false;
}
示例4: loadActions
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
private void loadActions(List<Action> actions, DataFolder df) throws IOException, ClassNotFoundException {
DataObject[] dob = df.getChildren();
int i;
int k = dob.length;
for (i = 0; i < k; i++) {
InstanceCookie ic = dob[i].getCookie(InstanceCookie.class);
if (ic == null) {
LOG.log(Level.WARNING, "Not an action instance, or broken action: {0}", dob[i].getPrimaryFile());
continue;
}
Class clazz = ic.instanceClass();
if (JSeparator.class.isAssignableFrom(clazz)) {
actions.add(null);
} else {
actions.add((Action)ic.instanceCreate());
}
}
}
示例5: addSource
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
/** Adds source to source map (I18N wizard settings). If there is already no change is done.
* If it's added anew then it is tried to find correspondin reousrce, i.e.
* first resource from the same folder.
* @param sourceMap settings where to add teh sources
* @param source source to add */
public static void addSource(Map<DataObject,SourceData> sourceMap,
DataObject source) {
if (sourceMap.containsKey(source)) {
return;
}
DataFolder folder = source.getFolder();
if (folder == null) {
sourceMap.put(source, null);
return;
}
// try to associate Bundle file
for (DataObject child : folder.getChildren()) {
if (child instanceof PropertiesDataObject) { // PENDING
sourceMap.put(source, new SourceData(child));
return;
}
}
// No resource found in the same folder.
sourceMap.put(source, null);
}
示例6: fillWebBrowsersCombo
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
private void fillWebBrowsersCombo(List<String> list, String select) {
// PENDING need to get rid of this filtering
FileObject fo = FileUtil.getConfigFile (BROWSERS_FOLDER);
if (fo != null) {
DataFolder folder = DataFolder.findFolder (fo);
DataObject [] dobjs = folder.getChildren ();
for (int i = 0; i<dobjs.length; i++) {
// Must not be hidden and have to provide instances (we assume instance is HtmlBrowser.Factory)
if (Boolean.TRUE.equals(dobjs[i].getPrimaryFile().getAttribute(EA_HIDDEN)) ||
dobjs[i].getLookup().lookup(InstanceCookie.class) == null) {
FileObject fo2 = dobjs[i].getPrimaryFile();
String n = fo2.getName();
try {
n = fo2.getFileSystem().getDecorator().annotateName(n, dobjs[i].files());
} catch (FileStateInvalidException e) {
// Never mind.
}
list.remove(n);
}
}
}
comboBoxWebBrowser.removeAllItems ();
if (!list.isEmpty()) {
for (String tag : list) {
comboBoxWebBrowser.addItem(tag);
}
if(select != null) {
comboBoxWebBrowser.setSelectedItem(select);
}
labelWebBrowser.setEnabled(true);
comboBoxWebBrowser.setEnabled(true);
jSeparator2.setEnabled(true);
} else {
labelWebBrowser.setEnabled(false);
comboBoxWebBrowser.setEnabled(false);
jSeparator2.setEnabled(false);
}
}
示例7: buildContent
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
private void buildContent() {
String rootName = "WelcomePage/TutorialsLinks"; // NOI18N
FileObject root = FileUtil.getConfigFile( rootName );
if( null == root ) {
Logger.getLogger(Tutorials.class.getName()).log(Level.INFO,
"Start page content not found: " + "FileObject: " + rootName ); //NOI18N
return;
}
DataFolder folder = DataFolder.findFolder( root );
if( null == folder ) {
Logger.getLogger(Tutorials.class.getName()).log(Level.INFO,
"Start page content not found: " + "DataFolder: " + rootName ); //NOI18N
return;
}
DataObject[] children = folder.getChildren();
if( null == children ) {
Logger.getLogger(Tutorials.class.getName()).log(Level.INFO,
"Start page content not found: " + "DataObject: " + rootName ); //NOI18N
return;
}
for( int i=0; i<children.length; i++ ) {
row = addLink( row, children[i] );
}
WebLink link = new WebLink(BundleSupport.getLabel("AllOnlineDocs"), BundleSupport.getURL("AllOnlineDocs"), Utils.getLinkColor(), false); //NOI18N
link.setFont( link.getFont().deriveFont( Font.BOLD ) );
add( link, new GridBagConstraints(0, row++, 1, 1, 0.0, 0.0,
GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(20,0,0,0), 0, 0 ) );
add( new JLabel(), new GridBagConstraints(0, row++, 1, 1, 0.0, 1.0,
GridBagConstraints.NORTHWEST, GridBagConstraints.VERTICAL, new Insets(0,0,0,0), 0, 0 ) );
}
示例8: getFolders
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
private static void getFolders(DataFolder folder, List<DataFolder> folders) {
for (DataObject d : folder.getChildren()) {
if (d instanceof DataFolder) {
DataFolder f = (DataFolder) d;
folders.add(f);
getFolders(f, folders);
}
}
}
示例9: visit
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
private static void visit(List<DataFolder> folders, DataFolder f) {
folders.add(f);
DataObject[] kids = f.getChildren();
for (int i = 0; i < kids.length; i++) {
if (kids[i] instanceof DataFolder) {
visit(folders, (DataFolder)kids[i]);
}
}
}
示例10: warmUp
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
void warmUp (FileObject templatesFolder) {
if (templatesFolder != null) {
DataFolder df = DataFolder.findFolder (templatesFolder);
if (df != null) {
df.getChildren();
}
}
}
示例11: clearBrokenShadows
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
/**
* Removes references to nonexistent files.
* Package-private for tests.
*/
void clearBrokenShadows() throws IOException {
DataFolder f = FavoritesNode.getFolder();
DataObject [] arr = f.getChildren();
for (DataObject obj : arr) {
if (! (obj instanceof DataShadow)) {
obj.delete();
}
}
}
示例12: getTags
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
public java.lang.String[] getTags () {
ArrayList<String> list = new ArrayList<String> (6);
Lookup.Result<org.openide.awt.HtmlBrowser.Factory> r = Lookup.getDefault().lookupResult(org.openide.awt.HtmlBrowser.Factory.class);
for (Lookup.Item<org.openide.awt.HtmlBrowser.Factory> i: r.allItems()) {
list.add(i.getDisplayName());
}
// PENDING need to get rid of this filtering
FileObject fo = FileUtil.getConfigFile (BROWSER_FOLDER);
if (fo != null) {
DataFolder folder = DataFolder.findFolder (fo);
DataObject [] dobjs = folder.getChildren ();
for (int i = 0; i<dobjs.length; i++) {
// Must not be hidden and have to provide instances (we assume instance is HtmlBrowser.Factory)
if (Boolean.TRUE.equals(dobjs[i].getPrimaryFile().getAttribute(EA_HIDDEN)) ||
dobjs[i].getCookie(InstanceCookie.class) == null) {
FileObject fo2 = dobjs[i].getPrimaryFile();
String n = fo2.getName();
try {
n = fo2.getFileSystem().getDecorator().annotateName(n, dobjs[i].files());
} catch (FileStateInvalidException e) {
// Never mind.
}
list.remove(n);
}
}
}
String[] retValue = new String[list.size ()];
list.toArray (retValue);
return retValue;
}
示例13: addButton
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
/**
* Add a new toolbar button represented by the given DataObject.
*/
private boolean addButton( DataObject dobj, int dropIndex, boolean dropBefore ) throws IOException {
if( null == dobj )
return false;
//check if the dropped button (action) already exists in this toolbar
String objName = dobj.getName();
DataFolder backingFolder = getBackingFolder(currentToolbar);
DataObject[] children = backingFolder.getChildren();
for( int i=0; i<children.length; i++ ) {
//TODO is comparing DataObject names ok?
if( objName.equals( children[i].getName() ) ) {
//user dropped to toolbat a new button that already exists in this toolbar
//just move the existing button to a new position
return moveButton( children[i], dropIndex, dropBefore );
}
}
DataObject objUnderCursor = getDataObjectUnderDropCursor( dropIndex-1, dropBefore );
DataShadow shadow = DataShadow.create( backingFolder, dobj );
// use some fake position, so getChildren don't complain
shadow.getPrimaryFile().setAttribute("position", 100001); // NOI18N
//find the added object
DataObject newObj = null;
children = backingFolder.getChildren();
for( int i=0; i<children.length; i++ ) {
if( objName.equals( children[i].getName() ) ) {
newObj = children[i];
break;
}
}
if( null != newObj )
reorderButtons( newObj, objUnderCursor ); //put the button to its proper position
return true;
}
示例14: removeNotify
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
@Override
public void removeNotify() {
super.removeNotify();
ToolbarPool pool = ToolbarPool.getDefault();
final ToolbarConfiguration tc = ToolbarConfiguration.findConfiguration( pool.getConfiguration() );
if( null != tc ) {
tc.setToolbarButtonDragAndDropAllowed( false );
}
//remove empty toolbars
DataFolder folder = pool.getFolder();
DataObject[] children = folder.getChildren();
for( int i=0; i<children.length; i++ ) {
final DataFolder subFolder = children[i].getCookie( DataFolder.class );
if( null != subFolder && subFolder.getChildren().length == 0 ) {
SwingUtilities.invokeLater( new Runnable() {
@Override
public void run() {
try {
subFolder.delete();
ToolbarPool.getDefault().waitFinished();
if( null != tc ) {
tc.removeEmptyRows();
tc.save();
}
}
catch (IOException e) {
LOG.log(Level.WARNING, null, e);
}
}
});
}
}
}
示例15: getFavoriteRoots
import org.openide.loaders.DataFolder; //导入方法依赖的package包/类
/**
* Returns list of current root file objects in Favorites.
* @return
*/
public synchronized List<FileObject> getFavoriteRoots() {
DataFolder f = FavoritesNode.getFolder();
DataObject [] arr = f.getChildren();
List<FileObject> ret = new ArrayList<FileObject>(arr.length);
for (DataObject obj : arr) {
if (obj instanceof DataShadow) {
ret.add(((DataShadow) obj).getOriginal().getPrimaryFile());
}
}
return ret;
}