Java源码示例:org.openide.loaders.MultiFileLoader
示例1
public JShellDataObject(FileObject fo, MultiFileLoader loader) throws DataObjectExistsException {
super(fo, loader);
CookieSet cks = getCookieSet();
cks.add(new Class[] {
OpenCookie.class,
EditorCookie.Observable.class,
CloseCookie.class,
LineCookie.class,
SimpleES.class,
}, new CookieSet.Factory() {
private CloneableEditorSupport supp;
public <T extends Node.Cookie> T createCookie(Class<T> klass) {
if (supp != null) {
return klass.cast(supp);
}
return klass.cast(
/*
supp = DataEditorSupport.create(JShellDataObject.this,
getPrimaryEntry(), getCookieSet(),
() -> createPane())
);*/
supp = new SimpleES(JShellDataObject.this, getPrimaryEntry())
);
}
});
}
示例2
public LayerDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
final CookieSet cookies = getCookieSet();
final Lookup baseLookup = cookies.getLookup();
lkp = new ProxyLookup(baseLookup) {
final AtomicBoolean checked = new AtomicBoolean();
protected @Override void beforeLookup(Template<?> template) {
if (template.getType() == LayerHandle.class && checked.compareAndSet(false, true)) {
FileObject xml = getPrimaryFile();
Project p = FileOwnerQuery.getOwner(xml);
if (p != null) {
setLookups(baseLookup, Lookups.singleton(new LayerHandle(p, xml)));
}
}
}
};
registerEditor("text/x-netbeans-layer+xml", true);
cookies.add(new ValidateXMLSupport(DataObjectAdapters.inputSource(this)));
}
示例3
public XMLJ2eeDataObject(FileObject pf, MultiFileLoader loader)
throws org.openide.loaders.DataObjectExistsException {
super(pf,loader);
CookieSet cs = getCookieSet();
cs.add(XMLJ2eeEditorSupport.class, this);
cs.add(EditCookie.class, this);
cs.add(EditorCookie.class, this);
cs.add(LineCookie.class, this);
cs.add(PrintCookie.class, this);
cs.add(CloseCookie.class, this);
// added CheckXMLCookie
InputSource in = DataObjectAdapters.inputSource(this);
CheckXMLCookie checkCookie = new CheckXMLSupport(in);
cs.add(checkCookie);
}
示例4
public TplDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
CookieSet set = getCookieSet();
set.add(TplEditorSupport.class, this);
set.assign(SaveAsCapable.class, new SaveAsCapable() {
@Override
public void saveAs(FileObject folder, String fileName) throws IOException {
TplEditorSupport es = getLookup().lookup(TplEditorSupport.class);
try {
es.updateEncoding();
es.saveAs(folder, fileName);
} catch (UserCancelException e) {
//ignore, just not save anything
}
}
});
set.assign(FileEncodingQueryImplementation.class, new FileEncodingQueryImpl());
}
示例5
public GsfDataObject(FileObject pf, MultiFileLoader loader, Language language) throws DataObjectExistsException {
super(pf, loader);
// If the user creates a file with a filename where we can't figure out the language
// (e.g. the PHP New File wizard doesn't enforce a file extension, so if you create
// a file named "pie.class" (issue 124044) the data loader doesn't know which language
// to associate this with since it isn't a GSF file extension or mimetype). However
// during template creation we know the language anyway so we can use it. On subsequent
// IDE restarts the file won't be recognized so the user will have to rename or
// add a new file extension to file type mapping.
if (language == null) {
language = templateLanguage;
}
this.language = language;
getCookieSet().add(new Class[]{
GenericEditorSupport.class, // NOI18N
SaveAsCapable.class, Openable.class, EditorCookie.Observable.class,
PrintCookie.class, CloseCookie.class, Editable.class, LineCookie.class,
DataEditorSupport.class, CloneableEditorSupport.class,
CloneableOpenSupport.class
}, new EditorSupportFactory());
}
示例6
public AttrsDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
final CookieSet cookies = getCookieSet();
registerEditor(SETTINGS_MIME_TYPE, false);
cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
cookies.add(new ResourceXsdValidateXMLSupport(DataObjectAdapters.inputSource(this), AndroidStyleable.class.getResource("attrs.xsd")));
}
示例7
public ArrayDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
final CookieSet cookies = getCookieSet();
registerEditor(SETTINGS_MIME_TYPE, false);
cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
cookies.add(new ResourceXsdValidateXMLSupport(DataObjectAdapters.inputSource(this), AndroidStyleable.class.getResource("array.xsd")));
}
示例8
public TestNGSuiteDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
CookieSet cookies = getCookieSet();
cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
cookies.add(new ValidateXMLSupport(DataObjectAdapters.inputSource(this)));
registerEditor(MIME_TYPE, true);
}
示例9
public BeanInfo[] getAdditionalBeanInfo () {
try {
return new BeanInfo[] { Introspector.getBeanInfo (MultiFileLoader.class) };
} catch (IntrospectionException ie) {
Exceptions.printStackTrace(ie);
return null;
}
}
示例10
public AntProjectDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
CookieSet cookies = getCookieSet();
cookies.add (new AntProjectDataEditor (this));
FileObject prim = getPrimaryFile ();
AntProjectCookie proj = new AntProjectSupport (prim);
cookies.add (proj);
if (proj.getFile () != null) {
cookies.add (new AntActionInstance (proj));
}
cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
addPropertyChangeListener (this);
}
示例11
@Override
public BeanInfo[] getAdditionalBeanInfo () {
try {
return new BeanInfo[] { Introspector.getBeanInfo (MultiFileLoader.class) };
} catch (IntrospectionException ie) {
ErrorManager.getDefault().notify(ie);
return null;
}
}
示例12
public BeanInfo[] getAdditionalBeanInfo () {
try {
return new BeanInfo[] { Introspector.getBeanInfo (MultiFileLoader.class) };
} catch (IntrospectionException ie) {
Logger.getLogger("global").log(Level.WARNING, null, ie);
return null;
}
}
示例13
public TLDDataObject (final FileObject obj, final MultiFileLoader loader)
throws DataObjectExistsException, IOException {
super (obj, loader);
getCookieSet().add(TLDEditorSupport.class, this);
// Creates Check XML and Validate XML context actions
InputSource in = DataObjectAdapters.inputSource(this);
CheckXMLCookie checkCookie = new CheckXMLSupport(in);
getCookieSet().add(checkCookie);
ValidateXMLCookie validateCookie = new ValidateXMLSupport(in);
getCookieSet().add(validateCookie);
getCookieSet().assign(FileEncodingQueryImplementation.class, XmlFileEncodingQueryImpl.singleton());
if (debug) System.out.println("====> TLDDataObject(FileObject, loader):constructor()"); // NOI18N
//
// Sometimes the FileObject is not valid. This most usually
// occurs when the tag library exists in a source controlled
// filesystem such as a CVS or Teamware filesystem, has been
// checked in and then deleted. The source control system
// reports the existence of the FileObject, but the filesystem
// does not. In this case we throw an IOException, and the
// data object does not get built.
//
/*
if (!isValid(obj)) {
MessageFormat msgFormat =
new MessageFormat(resbundle.getString("TLDDataObject_FileDoesntExist")); // NOI18N
Object[] arg0 = new Object[] {getPrimaryFile().getName()};
// PENDING: somehow we seem to be doing nothing here.
//String msg = msgFormat.format(arg0);
//System.out.println(msg);
//throw new IOException(msg);
}
*/
}
示例14
public MenuDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
final CookieSet cookies = getCookieSet();
registerEditor(SETTINGS_MIME_TYPE, false);
cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
cookies.add(new ResourceXsdValidateXMLSupport(DataObjectAdapters.inputSource(this), AndroidStyleable.class.getResource("menu.xsd")));
}
示例15
@Override
public BeanInfo[] getAdditionalBeanInfo () {
try {
return new BeanInfo[] { Introspector.getBeanInfo (MultiFileLoader.class) };
} catch (IntrospectionException ie) {
Exceptions.printStackTrace(ie);
return null;
}
}
示例16
public BeanInfo[] getAdditionalBeanInfo() {
try {
return new BeanInfo[] {Introspector.getBeanInfo(MultiFileLoader.class)};
} catch (IntrospectionException e) {
throw new AssertionError(e);
}
}
示例17
public GenericDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
this.mimeType = FileUtil.getMIMEType(pf);
registerEditor(mimeType, false);
synchronized (REGISTRY) {
REGISTRY.add(new WeakReference<>(this));
}
}
示例18
public BeanInfo[] getAdditionalBeanInfo () {
try {
return new BeanInfo[] { Introspector.getBeanInfo (MultiFileLoader.class) };
} catch (IntrospectionException ie) {
ErrorManager.getDefault().notify(ie);
return null;
}
}
示例19
public BeanInfo[] getAdditionalBeanInfo() {
try {
return new BeanInfo[] {
java.beans.Introspector.getBeanInfo (MultiFileLoader.class)
};
} catch (IntrospectionException e) {
Exceptions.printStackTrace(e);
}
return super.getAdditionalBeanInfo();
}
示例20
public SQLDataObject(FileObject primaryFile, MultiFileLoader loader) throws DataObjectExistsException {
super(primaryFile, loader);
CookieSet cookies = getCookieSet();
final SQLEditorSupport sqlEditorSupport = new SQLEditorSupport(this);
cookies.add(sqlEditorSupport);
cookies.assign( SaveAsCapable.class, new SaveAsCapable() {
@Override
public void saveAs(FileObject folder, String fileName) throws IOException {
sqlEditorSupport.saveAs( folder, fileName );
}
});
}
示例21
public PDFDataObject(FileObject pf, MultiFileLoader loader)
throws DataObjectExistsException {
super(pf, loader);
CookieSet cookies = getCookieSet();
// [PENDING] try also Java-implemented reader
File f = FileUtil.toFile(pf);
if (f != null) {
cookies.add(new PDFOpenSupport(this));
}
}
示例22
public BeanInfo[] getAdditionalBeanInfo() {
try {
return new BeanInfo[] {
java.beans.Introspector.getBeanInfo (MultiFileLoader.class)
};
} catch (IntrospectionException e) {
Exceptions.printStackTrace(e);
}
return super.getAdditionalBeanInfo();
}
示例23
public IdsDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
final CookieSet cookies = getCookieSet();
registerEditor(SETTINGS_MIME_TYPE, false);
cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
cookies.add(new ResourceXsdValidateXMLSupport(DataObjectAdapters.inputSource(this), AndroidStyleable.class.getResource("ids.xsd")));
}
示例24
public LayoutDataObject(FileObject fo, MultiFileLoader loader) throws DataObjectExistsException {
super(fo, loader);
final CookieSet cookies = getCookieSet();
cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
cookies.add(new ValidateXMLSupport(DataObjectAdapters.inputSource(this)));
registerEditor(LAYOUT_MIME_TYPE, true);
}
示例25
public UnknownValuesDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
final CookieSet cookies = getCookieSet();
registerEditor(SETTINGS_MIME_TYPE, false);
cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
cookies.add(new ResourceXsdValidateXMLSupport(DataObjectAdapters.inputSource(this), AndroidStyleable.class.getResource("all.xsd")));
}
示例26
public DimensDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
final CookieSet cookies = getCookieSet();
registerEditor(SETTINGS_MIME_TYPE, false);
cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
cookies.add(new ResourceXsdValidateXMLSupport(DataObjectAdapters.inputSource(this), AndroidStyleable.class.getResource("dimens.xsd")));
}
示例27
public BoolsDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
final CookieSet cookies = getCookieSet();
registerEditor(SETTINGS_MIME_TYPE, false);
cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
cookies.add(new ResourceXsdValidateXMLSupport(DataObjectAdapters.inputSource(this), AndroidStyleable.class.getResource("bools.xsd")));
}
示例28
public SymbolsDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
final CookieSet cookies = getCookieSet();
registerEditor(SETTINGS_MIME_TYPE, false);
cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
cookies.add(new ResourceXsdValidateXMLSupport(DataObjectAdapters.inputSource(this), AndroidStyleable.class.getResource("symbols.xsd")));
}
示例29
public StylesDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
final CookieSet cookies = getCookieSet();
registerEditor(SETTINGS_MIME_TYPE, false);
cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
cookies.add(new ResourceXsdValidateXMLSupport(DataObjectAdapters.inputSource(this), AndroidStyleable.class.getResource("styles.xsd")));
}
示例30
public ColorsDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
final CookieSet cookies = getCookieSet();
registerEditor(SETTINGS_MIME_TYPE, false);
cookies.add(new CheckXMLSupport(DataObjectAdapters.inputSource(this)));
cookies.add(new ResourceXsdValidateXMLSupport(DataObjectAdapters.inputSource(this), AndroidStyleable.class.getResource("colors.xsd")));
}