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


Java MultiDataObject类代码示例

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


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

示例1: getEditorCookie

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
/**
 * Tries to obtain an {@code EditorCookie} representing the given file.
 * @param  fileObj  file to get an {@code EditorCookie} from
 * @return  {@code EditorCookie} representing the file, or {@code null}
 * @throws  java.io.IOException
 *          if there was some I/O error while reading the file's content
 */
private static EditorCookie getEditorCookie(FileObject fileObj) throws IOException {
    DataObject dao;
    try {
        dao = DataObject.find(fileObj);
    } catch (DataObjectNotFoundException ex) {
        return null;
    }

    if (dao instanceof MultiDataObject) {
        MultiDataObject.Entry entry = findEntryForFile((MultiDataObject) dao, fileObj);
        if ((entry != null) && (entry instanceof CookieSet.Factory)) {
            CookieSet.Factory factory = (CookieSet.Factory) entry;
            return factory.createCookie(EditorCookie.class);   //can be null
        }
    }

    return dao.getCookie(EditorCookie.class);                  //can be null
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:DiffSidebar.java

示例2: findEntryForFile

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
/**
 * Finds entry of the given {@code MultiDataObject} that corresponds to the
 * to the given {@code FileObject}.
 * @param  dataObj  {@code MultiDataObject} to search for the corresponding
 *                  entry
 * @param  fileObj  file for which the entry is to be found
 * @return  found entry, or {@code null} if not found
 */
private static MultiDataObject.Entry findEntryForFile(MultiDataObject dataObj,
                                                      FileObject fileObj) {
    MultiDataObject.Entry primaryEntry;

    primaryEntry = dataObj.getPrimaryEntry();
    if (fileObj.equals(primaryEntry.getFile())) {
        return primaryEntry;
    }

    for (MultiDataObject.Entry entry : dataObj.secondaryEntries()) {
        if (fileObj.equals(entry.getFile())) {
            return primaryEntry;
        }
    }

    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:DiffSidebar.java

示例3: getEditableCookie

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
private static EditorCookie.Observable getEditableCookie (File file) {
    EditorCookie.Observable editorCookie = null;
    if (file == null) {
        return null;
    }
    FileObject fileObj = FileUtil.toFileObject(file);
    if (fileObj != null) {
        try {
            DataObject dao = DataObject.find(fileObj);
            if (dao instanceof MultiDataObject) {
                MultiDataObject mdao = (MultiDataObject) dao;
                for (MultiDataObject.Entry entry : mdao.secondaryEntries()) {
                    if (fileObj == entry.getFile() && entry instanceof CookieSet.Factory) {
                        CookieSet.Factory factory = (CookieSet.Factory) entry;
                        EditorCookie ec = factory.createCookie(EditorCookie.class);
                        if (ec instanceof EditorCookie.Observable) {
                            editorCookie = (EditorCookie.Observable) ec;
                        }
                    }
                }
            }
            if (editorCookie == null) {
                EditorCookie cookie = dao.getCookie(EditorCookie.class);
                if (cookie instanceof EditorCookie.Observable) {
                    editorCookie = (EditorCookie.Observable) cookie;
                }
            }
        } catch (DataObjectNotFoundException ex) {
        }
    }
    return editorCookie;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:DiffStreamSource.java

示例4: createMultiObject

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
@Override
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
    if (getExtensions().isRegistered(primaryFile)) {
        return new TopDataObject(primaryFile, this);
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:EmbeddedIndexerTest.java

示例5: takeLock

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
protected FileLock takeLock () throws IOException {
    if (getDataObject() instanceof MultiDataObject) {
        return ((MultiDataObject)getDataObject()).getPrimaryEntry().takeLock();
    } else {
        return super.getDataObject ().getPrimaryFile ().lock ();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:DataEditorSupportTest.java

示例6: createMultiObject

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
protected MultiDataObject createMultiObject (FileObject primaryFile) 
throws DataObjectExistsException, IOException {
    String mimeType = primaryFile.getMIMEType ();
    if (LanguagesManager.getDefault ().createDataObjectFor (mimeType))
        return new LanguagesDataObject (primaryFile, this);
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:LanguagesDataLoader.java

示例7: createMultiObject

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
@Override
protected MultiDataObject createMultiObject(FileObject primaryFile)
    throws DataObjectExistsException, IOException {
    Language language =
        LanguageRegistry.getInstance().getLanguageByMimeType(primaryFile.getMIMEType());

    return new GsfDataObject(primaryFile, this, language);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:GsfDataLoader.java

示例8: getEditorCookie

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
/**
 * @since 1.9.1
 */
public static EditorCookie getEditorCookie(Document doc) {
    if (doc == null) {
        return null;
    }

    DataObject dataObj = (DataObject) doc.getProperty(
                                        Document.StreamDescriptionProperty);
    if (dataObj == null) {
        return null;
    }

    EditorCookie plain = null;

    if (dataObj instanceof MultiDataObject) {
        MultiDataObject multiDataObj = (MultiDataObject) dataObj;
        for (MultiDataObject.Entry entry : multiDataObj.secondaryEntries()) {
            if (entry instanceof CookieSet.Factory) {
                CookieSet.Factory factory = (CookieSet.Factory) entry;
                EditorCookie ec = factory.createCookie(EditorCookie.class);
                if (ec.getDocument() == doc) {
                    if (ec instanceof EditorCookie.Observable) {
                        return (EditorCookie.Observable) ec;
                    }

                    if (plain == null) {
                        plain = ec;
                    }
                }
            }
        }
    }

    return chooseBetterEditorCookie(getEditorCookie(dataObj, false), plain);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:DiffUtils.java

示例9: fileForDataobject

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
private FileObject fileForDataobject(Document doc, MultiDataObject dobj) {
    for (MultiDataObject.Entry entry : dobj.secondaryEntries()) {
        if (entry instanceof CookieSet.Factory) {
            CookieSet.Factory factory = (CookieSet.Factory) entry;
            EditorCookie ec = factory.createCookie(EditorCookie.class);
            Document entryDocument = ec.getDocument();
            if (entryDocument == doc) {
                return entry.getFile();
            }
        }
    }
    return dobj.getPrimaryFile();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:DiffSidebarManager.java

示例10: createPrimaryEntry

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
/** Create the primary file entry.
    * Subclasses may override {@link JavaDataLoader.JavaFileEntry} and return a new instance
    * of the overridden entry type.
    *
    * @param primaryFile primary file recognized by this loader
    * @return primary entry for that file
    */
    protected MultiDataObject.Entry createPrimaryEntry (MultiDataObject obj, FileObject primaryFile) {
        if (getExtensions().isRegistered(primaryFile)) {
//            return new JavaFileEntry (obj, primaryFile);
            return JavaDataSupport.createJavaFileEntry(obj, primaryFile);
        }
        else {
            return new FileEntry(obj, primaryFile);
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:JavaDataLoader.java

示例11: createMultiObject

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
    return new JarDataObject(primaryFile, this);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:JarDataLoader.java

示例12: createMultiObject

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
protected MultiDataObject createMultiObject(FileObject pf) throws IOException {
    return new PUDataObject(pf, this);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:PUDataLoader.java

示例13: createPrimaryEntry

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
@Override
protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile) {
    FormServices services = Lookup.getDefault().lookup(FormServices.class);
    MultiDataObject.Entry entry = services.createPrimaryEntry(obj, primaryFile);
    return entry;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:FormDataLoader.java

示例14: ViewSupport

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
/** Constructs new ViewSupport */
public ViewSupport(MultiDataObject.Entry primary) 
{
    this.primary = primary;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:HtmlDataObject.java

示例15: createSecondaryEntry

import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
/**
 * @return  <code>PropertiesFileEntry</code> for the given file
 */
protected MultiDataObject.Entry createSecondaryEntry(
        MultiDataObject obj,
        FileObject secondaryFile) {
    return new PropertiesFileEntry(obj, secondaryFile);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:PropertiesDataLoader.java


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