Java Code Examples for org.openide.loaders.DataFolder#create()

The following examples show how to use org.openide.loaders.DataFolder#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LayersBridge.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void saveKeymap (String profile, Map<ShortcutAction, Set<String>> actionToShortcuts) {
    // discard our cached copy first
    keymaps.remove(profile);
    keymapDefaults.remove(profile);
    // 1) get / create Keymaps/Profile folder
    DataFolder defaultFolder = getRootFolder(SHORTCUTS_FOLDER, null);
    DataFolder folder = getRootFolder (KEYMAPS_FOLDER, profile);
    if (folder == null) {
        folder = getRootFolder (KEYMAPS_FOLDER, null);
        try {
            folder = DataFolder.create (folder, profile);
        } catch (IOException ex) {
            ErrorManager.getDefault ().notify (ex);
            return;
        }
    }
    saveKeymap (defaultFolder, folder, actionToShortcuts);
}
 
Example 2
Source File: Services.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private DataObject storeNewServiceType(ServiceType st) {
    Class stype = st.getClass ();
    // finds direct subclass of service type
    while (stype.getSuperclass () != ServiceType.class) {
        stype = stype.getSuperclass();
    }
    
    try{
        String folder = org.openide.util.Utilities.getShortClassName(stype);

        DataFolder dfServices = findSessionFolder("Services"); // NOI18N
        DataFolder dfTarget = DataFolder.create(dfServices, folder);
        
        return InstanceDataObject.create(dfTarget, null, st, null);
    } catch (Exception ex) {
        Logger.getLogger(Services.class.getName()).log(Level.WARNING, null, ex);
        return null;
    }
}