本文整理汇总了Java中org.openide.loaders.MultiDataObject.Entry方法的典型用法代码示例。如果您正苦于以下问题:Java MultiDataObject.Entry方法的具体用法?Java MultiDataObject.Entry怎么用?Java MultiDataObject.Entry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.loaders.MultiDataObject
的用法示例。
在下文中一共展示了MultiDataObject.Entry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: ViewSupport
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
/** Constructs new ViewSupport */
public ViewSupport(MultiDataObject.Entry primary)
{
this.primary = primary;
}
示例3: Environment
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
/** Constructor. */
public Environment(DataObject obj, MultiDataObject.Entry entry) {
super(obj);
this.entry = entry;
}
示例4: createPrimaryEntry
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile) {
return new FE(obj, primaryFile);
}
示例5: createSecondaryEntry
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
protected MultiDataObject.Entry createSecondaryEntry(MultiDataObject obj, FileObject secondaryFile) {
return new FileEntry(obj, secondaryFile);
}
示例6: createPrimaryEntry
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile) {
return new FileEntry (obj, primaryFile);
}
示例7: createPrimaryEntry
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile) {
LOG.fine("new primary entry " + primaryFile);
return new FE(obj, primaryFile);
}
示例8: createSecondaryEntry
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
protected MultiDataObject.Entry createSecondaryEntry(MultiDataObject obj, FileObject secondaryFile) {
return new FileEntry (obj, secondaryFile);
}
示例9: createPrimaryEntry
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
@Override
protected MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile) {
primary++;
return new org.openide.loaders.FileEntry (obj, primaryFile);
}
示例10: createSecondaryEntry
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
@Override
protected MultiDataObject.Entry createSecondaryEntry(MultiDataObject obj, FileObject secondaryFile) {
return new FileEntry (obj, secondaryFile);
}
示例11: createPrimaryEntry
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
@Override
protected MultiDataObject.Entry createPrimaryEntry (MultiDataObject obj, FileObject primaryFile) {
FileEntry.Format entry = new FileEntry.Format(obj, primaryFile) {
@Override
protected java.text.Format createFormat (FileObject target, String n, String e) {
ClassPath cp = ClassPath.getClassPath(target, ClassPath.SOURCE);
String resourcePath = "";
if (cp != null) {
resourcePath = cp.getResourceName(target);
if (resourcePath == null) {
resourcePath = ""; // NOI18N
}
} else {
ErrorManager.getDefault().log(ErrorManager.WARNING, "No classpath was found for folder: "+target);
}
Map<String,String> m = new HashMap<String,String>();
m.put("NAME", n ); //NOI18N
String capitalizedName;
if (n.length() > 1) {
capitalizedName = Character.toUpperCase(n.charAt(0))+n.substring(1);
} else if (n.length() == 1) {
capitalizedName = ""+Character.toUpperCase(n.charAt(0));
} else {
capitalizedName = "";
}
m.put("CAPITALIZEDNAME", capitalizedName); //NOI18N
m.put("LOWERNAME", n.toLowerCase()); //NOI18N
m.put("UPPERNAME", n.toUpperCase()); //NOI18N
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n.length(); i++) {
char c = n.charAt(i);
if (Character.isJavaIdentifierPart(c)) {
sb.append(c);
}
}
String identifier = sb.toString();
m.put("IDENTIFIER", identifier); // NOI18N
sb.setCharAt(0, Character.toUpperCase(identifier.charAt(0)));
m.put("CAPITALIZEDIDENTIFIER", sb.toString()); // NOI18N
m.put("LOWERIDENTIFIER", identifier.toLowerCase()); //NOI18N
// Yes, this is package sans filename (target is a folder).
String packageName = resourcePath.replace('/', '.');
m.put("PACKAGE", packageName); // NOI18N
String capitalizedPkgName;
if (packageName == null || packageName.length() == 0) {
packageName = "";
capitalizedPkgName = "";
} else if (packageName.length() > 1) {
capitalizedPkgName = Character.toUpperCase(packageName.charAt(0))+packageName.substring(1);
} else {
capitalizedPkgName = ""+Character.toUpperCase(packageName.charAt(0));
}
m.put("CAPITALIZEDPACKAGE", capitalizedPkgName); // NOI18N
m.put("PACKAGE_SLASHES", resourcePath); // NOI18N
// Fully-qualified name:
if (target.isRoot ()) {
m.put ("PACKAGE_AND_NAME", n); // NOI18N
m.put ("PACKAGE_AND_NAME_SLASHES", n); // NOI18N
} else {
m.put ("PACKAGE_AND_NAME", resourcePath.replace('/', '.') + '.' + n); // NOI18N
m.put ("PACKAGE_AND_NAME_SLASHES", resourcePath + '/' + n); // NOI18N
}
m.put("DATE", DateFormat.getDateInstance(DateFormat.LONG).format(new Date())); // NOI18N
m.put("TIME", DateFormat.getTimeInstance(DateFormat.SHORT).format(new Date())); // NOI18N
MapFormat f = new MapFormat(m);
f.setLeftBrace( "__" ); //NOI18N
f.setRightBrace( "__" ); //NOI18N
f.setExactMatch(false);
return f;
}
};
return entry;
}
示例12: getLocaleSuffix
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
/**
* Returns a locale specification suffix of a given
* <code>MultiDataObject</code> entry.
* <p>
* Examples:<br />
* <pre> </pre>Bundle.properties -> ""<br />
* <pre> </pre>Bundle_en_CA.properties -> "_en_CA"
*
* @param fe <code>DataObject</code> entry, representing a single bundle
* @return locale specification suffix of a given entry;
* or an empty string if the given entry has no locale suffix
* @see #getLanguage
* @see #getCountry
* @see #getVariant
*/
public static String getLocaleSuffix(MultiDataObject.Entry fe) {
FileObject fo = fe.getFile();
String fName = fo.getName();
String baseName = getBaseName(fName);
if (fName.equals(baseName))
return "";
else
return fName.substring(baseName.length());
}
示例13: createPrimaryEntry
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
/** Creates the right primary entry for given primary file.
*
* @param primaryFile primary file recognized by this loader
* @return primary entry for that file
*/
@Override
protected MultiDataObject.Entry createPrimaryEntry (MultiDataObject obj, FileObject primaryFile) {
return new XMLDataLoader.XMLFileEntry (obj, primaryFile); //adds smart templating
}
示例14: create
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
/** Factory method to create simple CloneableEditorSupport for a given
* entry of a given DataObject. The common use inside DataObject looks like
* this:
* <pre>
* getCookieSet().add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), getCookieSet()));
* </pre>
*
* @param obj the data object
* @param entry the entry to read and write from
* @param set cookie set to add remove additional cookies (currently only {@link org.openide.cookies.SaveCookie})
* @return a subclass of DataEditorSupport that implements at least
* {@link org.openide.cookies.OpenCookie},
* {@link org.openide.cookies.EditCookie},
* {@link org.openide.cookies.EditorCookie.Observable},
* {@link org.openide.cookies.PrintCookie},
* {@link org.openide.cookies.CloseCookie}
* @since 5.2
*/
public static CloneableEditorSupport create (DataObject obj, MultiDataObject.Entry entry, org.openide.nodes.CookieSet set) {
return new SimpleES (obj, entry, set);
}
示例15: SimpleES
import org.openide.loaders.MultiDataObject; //导入方法依赖的package包/类
/** Constructor.
* @param obj data object to work on
* @param set set to add/remove save cookie from
*/
public SimpleES (DataObject obj, MultiDataObject.Entry entry, CookieSet set) {
this(obj, entry, set, null);
}