當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。