|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.editor.options; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; import org.openide.cookies.InstanceCookie; import org.openide.filesystems.FileLock; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileStateInvalidException; import org.openide.filesystems.FileSystem; import org.openide.loaders.DataFolder; import org.openide.loaders.DataObject; import org.openide.loaders.FolderInstance; import org.openide.util.TaskListener; import org.openide.util.Task; import org.openide.xml.XMLUtil; import org.w3c.dom.Document; import org.openide.loaders.DataObjectNotFoundException; import java.lang.ClassNotFoundException; import org.netbeans.editor.BaseKit; import org.openide.loaders.DataObjectExistsException; import java.lang.reflect.Field; import org.openide.filesystems.Repository; /** MIME Options Folder representation. * Folder maintains MIME specific settings. * The folder contains XML settings files like fontscolors.xml, * abbreviations.xml, macros.xml, properties.xml ... * The folder also contains multi property subFolders like Popup, Macros, Abbreviations ... * * @author Martin Roskanin * @since 08/2001 */ public class MIMEOptionFolder{ private String mime; private Map files = new HashMap(5); private BaseOptions base; private DataFolder folder; private Map mpFolderMap = new Hashtable(); private Map subFolders = new Hashtable(); /** Creates new MIMEOptionFolder */ public MIMEOptionFolder(DataFolder f, BaseOptions bean){ folder = f; base = bean; mime=BaseOptions.BASE.equals(base.getTypeName())? "text/base" : BaseKit.getKit(base.getKitClass()).getContentType(); //NOI18N if (mime == null) mime = base.getTypeName(); loadAllFiles(); } /** Creates instance of all founded and recognized XML files */ protected Object createInstance(InstanceCookie[] cookies) throws java.io.IOException, ClassNotFoundException { for (int i = 0; i < cookies.length; i++) { if ( !(MIMEProcessor.class.isAssignableFrom(cookies[i].instanceClass() ))){ continue; } MIMEProcessor mp = (MIMEProcessor) cookies[i].instanceCreate(); if (!files.containsKey(mp.instanceClass())){ synchronized(this){ files.put( mp.instanceClass(), mp.createMIMEOptionFile(base, mp) ); } } } return null; } private void loadAllFiles(){ DataObject dob[] = folder.getChildren(); for (int i=0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.