本文整理汇总了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
}
示例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;
}
示例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;
}
示例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;
}
示例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 ();
}
}
示例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;
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
}
示例11: createMultiObject
import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
return new JarDataObject(primaryFile, this);
}
示例12: createMultiObject
import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
protected MultiDataObject createMultiObject(FileObject pf) throws IOException {
return new PUDataObject(pf, this);
}
示例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;
}
示例14: ViewSupport
import org.openide.loaders.MultiDataObject; //导入依赖的package包/类
/** Constructs new ViewSupport */
public ViewSupport(MultiDataObject.Entry primary)
{
this.primary = primary;
}
示例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);
}