当前位置: 首页>>代码示例>>Java>>正文


Java DataObject.getFolder方法代码示例

本文整理汇总了Java中org.openide.loaders.DataObject.getFolder方法的典型用法代码示例。如果您正苦于以下问题:Java DataObject.getFolder方法的具体用法?Java DataObject.getFolder怎么用?Java DataObject.getFolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.loaders.DataObject的用法示例。


在下文中一共展示了DataObject.getFolder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateSettings

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/**
 * Updates settings used by this generator. It should be called outside locks.
 * @param file a file where the generated content will be added
 */
public void updateSettings(FileObject file) {
    DataObject dobj = null;
    DataFolder folder = null;
    try {
        dobj = DataObject.find(file);
        folder = dobj.getFolder();
    } catch (DataObjectNotFoundException ex) {
        Exceptions.printStackTrace(ex);
    }
    if (dobj == null || folder == null) {
        return;
    }
    for (CreateFromTemplateAttributesProvider provider
            : Lookup.getDefault().lookupAll(CreateFromTemplateAttributesProvider.class)) {
        Map<String, ?> attrs = provider.attributesFor(dobj, folder, "XXX"); // NOI18N
        if (attrs == null) {
            continue;
        }
        Object aName = attrs.get("user"); // NOI18N
        if (aName != null) {
            author = aName.toString();
            break;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:JavadocGenerator.java

示例2: addSource

import org.openide.loaders.DataObject; //导入方法依赖的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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:Util.java

示例3: enable

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/** Enabled only if the current project is ProjectDataObject.
*/
@Override
public boolean enable (Node[] arr) {
    if ((arr == null) || (arr.length == 0)) return false;

    for (int i = 0; i < arr.length; i++) {
        DataObject shad = arr[i].getCookie(DataObject.class);
        //Disable when node is not shadow in Favorites folder.
        if (shad == null || shad.getFolder() != FavoritesNode.getFolder()) {
            return false;
        }
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:Actions.java

示例4: performAction

import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/**
* Removes the links.
*
* @param arr gives array of actually activated nodes.
*/
@Override
protected void performAction (Node[] arr) {
    for (int i = 0; i < arr.length; i++) {
        DataObject shad = arr[i].getCookie(DataObject.class);

        if (shad != null && shad.getFolder() == FavoritesNode.getFolder()) {
            try {
                shad.delete();
            } catch (IOException ex) {
                LOG.log(Level.WARNING, null, ex);
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:Actions.java


注:本文中的org.openide.loaders.DataObject.getFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。