org.openide.loaders.MultiFileLoader Java Examples

The following examples show how to use org.openide.loaders.MultiFileLoader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LayerDataObject.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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)));
}
 
Example #2
Source File: JShellDataObject.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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())
            );
        }
    });
}
 
Example #3
Source File: XMLJ2eeDataObject.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #4
Source File: TplDataObject.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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());
}
 
Example #5
Source File: GsfDataObject.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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());
}
 
Example #6
Source File: GenericDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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));
    }
}
 
Example #7
Source File: ArrayDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
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")));
}
 
Example #8
Source File: TestNGSuiteDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #9
Source File: JavaDataLoaderBeanInfo.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public BeanInfo[] getAdditionalBeanInfo () {
    try {
        return new BeanInfo[] { Introspector.getBeanInfo (MultiFileLoader.class) };
    } catch (IntrospectionException ie) {
        Exceptions.printStackTrace(ie);
        return null;
    }
}
 
Example #10
Source File: AntProjectDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #11
Source File: JaxWsDataLoaderBeanInfo.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public BeanInfo[] getAdditionalBeanInfo () {
    try {
        return new BeanInfo[] { Introspector.getBeanInfo (MultiFileLoader.class) };
    } catch (IntrospectionException ie) {
        ErrorManager.getDefault().notify(ie);
        return null;
    }
}
 
Example #12
Source File: DDDataLoaderBeanInfo.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public BeanInfo[] getAdditionalBeanInfo () {
    try {
        return new BeanInfo[] { Introspector.getBeanInfo (MultiFileLoader.class) };
    } catch (IntrospectionException ie) {
        Logger.getLogger("global").log(Level.WARNING, null, ie);
        return null;
    }
}
 
Example #13
Source File: TLDDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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);
}
       */
   }
 
Example #14
Source File: MenuDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
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")));
}
 
Example #15
Source File: JspServletDataLoaderBeanInfo.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public BeanInfo[] getAdditionalBeanInfo () {
    try {
        return new BeanInfo[] { Introspector.getBeanInfo (MultiFileLoader.class) };
    } catch (IntrospectionException ie) {
        Exceptions.printStackTrace(ie);
        return null;
    }
}
 
Example #16
Source File: LanguagesDataLoaderBeanInfo.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public BeanInfo[] getAdditionalBeanInfo() {
    try {
        return new BeanInfo[] {Introspector.getBeanInfo(MultiFileLoader.class)};
    } catch (IntrospectionException e) {
        throw new AssertionError(e);
    }
}
 
Example #17
Source File: AttrsDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
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")));
}
 
Example #18
Source File: PropertiesDataLoaderBeanInfo.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public BeanInfo[] getAdditionalBeanInfo () {
    try {
        return new BeanInfo[] { Introspector.getBeanInfo (MultiFileLoader.class) };
    } catch (IntrospectionException ie) {
        ErrorManager.getDefault().notify(ie);
        return null;
    }
}
 
Example #19
Source File: EntityDataLoaderBeanInfo.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public BeanInfo[] getAdditionalBeanInfo() {
    try {
        return new BeanInfo[] {
            java.beans.Introspector.getBeanInfo (MultiFileLoader.class)
        };
    } catch (IntrospectionException e) {
        Exceptions.printStackTrace(e);
    }
    return super.getAdditionalBeanInfo();
}
 
Example #20
Source File: SQLDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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 );
        }
    });
}
 
Example #21
Source File: PDFDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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));
    }
}
 
Example #22
Source File: XSLDataLoaderBeanInfo.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public BeanInfo[] getAdditionalBeanInfo() {
    try {
        return new BeanInfo[] {
            java.beans.Introspector.getBeanInfo (MultiFileLoader.class)
        };
    } catch (IntrospectionException e) {
        Exceptions.printStackTrace(e);
    }
    return super.getAdditionalBeanInfo();
}
 
Example #23
Source File: IdsDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
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")));
}
 
Example #24
Source File: LayoutDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #25
Source File: UnknownValuesDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
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")));
}
 
Example #26
Source File: DimensDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
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")));
}
 
Example #27
Source File: BoolsDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
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")));
}
 
Example #28
Source File: SymbolsDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
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")));
}
 
Example #29
Source File: StylesDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
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")));
}
 
Example #30
Source File: ColorsDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
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")));
}