org.openide.loaders.DataObjectExistsException Java Examples

The following examples show how to use org.openide.loaders.DataObjectExistsException. 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: HtmlDataObject.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** New instance.
 * @param pf primary file object for this data object
 * @param loader the data loader creating it
 * @exception DataObjectExistsException if there was already a data object for it
 */
public HtmlDataObject(FileObject pf, UniFileLoader loader) throws DataObjectExistsException {
    super(pf, loader);
    CookieSet set = getCookieSet();
    set.add(HtmlEditorSupport.class, this);
    set.add(ViewSupport.class, this);
    set.assign(SaveAsCapable.class, new SaveAsCapable() {
        public void saveAs( FileObject folder, String fileName ) throws IOException {
            HtmlEditorSupport es = getCookie( HtmlEditorSupport.class );
            try {
                es.updateEncoding();
                es.saveAs( folder, fileName );
            } catch (UserCancelException e) {
                //ignore, just not save anything
            }
        }
    });

    set.assign(FileEncodingQueryImplementation.class, new FileEncodingQueryImpl());
            
    //add check/validate xml cookies
    InputSource in = DataObjectAdapters.inputSource(this);
    set.add(new ValidateXMLSupport(in));
    set.add(new CheckXMLSupport(in));
    
}
 
Example #2
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 #3
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 #4
Source File: EmbeddedIndexerTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
    if (getExtensions().isRegistered(primaryFile)) {
        return new TopDataObject(primaryFile, this);
    }
    return null;
}
 
Example #5
Source File: JnlpDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public JnlpDataObject(FileObject pf, JnlpDataLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    registerEditor(JnlpDataLoader.REQUIRED_MIME, true);
    CookieSet cookies = getCookieSet();
    InputSource in = DataObjectAdapters.inputSource(this);
    CheckXMLSupport checkCookieImpl = new CheckXMLSupport(in);
    ValidateXMLSupport validateCookieImpl = new ValidateXMLSupport(in);
    cookies.add(checkCookieImpl);
    cookies.add(validateCookieImpl);
}
 
Example #6
Source File: ClassDataLoader.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected MultiDataObject createMultiObject(FileObject primaryFile)
        throws DataObjectExistsException, IOException {

    if (primaryFile.getExt().equals(CLASS_EXTENSION)) {
        return new ClassDataObject(primaryFile, this);
    }
    return null;
}
 
Example #7
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 #8
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 #9
Source File: LanguagesDataLoader.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected MultiDataObject createMultiObject (FileObject primaryFile) 
throws DataObjectExistsException, IOException {
    String mimeType = primaryFile.getMIMEType ();
    if (LanguagesManager.getDefault ().createDataObjectFor (mimeType))
        return new LanguagesDataObject (primaryFile, this);
    return null;
}
 
Example #10
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 #11
Source File: FormDataLoader.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Creates the right data object for given primary file.
 * It is guaranteed that the provided file is realy primary file
 * returned from the method findPrimaryFile.
 *
 * @param primaryFile the primary file
 * @return the data object for this file
 * @exception DataObjectExistsException if the primary file already has data object
 */
@Override
protected MultiDataObject createMultiObject(FileObject primaryFile)
    throws DataObjectExistsException
{
    return new FormDataObject(FileUtil.findBrother(primaryFile, FORM_EXTENSION),
                              primaryFile,
                              this);
}
 
Example #12
Source File: FormDataObject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public FormDataObject(FileObject ffo, FileObject jfo, FormDataLoader loader)
    throws DataObjectExistsException
{
    super(jfo, loader);
    formEntry = (FileEntry)registerEntry(ffo);
    getCookieSet().assign( SaveAsCapable.class, new SaveAsCapable() {
        @Override
        public void saveAs(FileObject folder, String fileName) throws IOException {
            getFormEditorSupport().saveAs( folder, fileName );
        }
    });
}
 
Example #13
Source File: IntegersDataObject.java    From NBANDROID-V2 with Apache License 2.0 5 votes vote down vote up
public IntegersDataObject(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("integers.xsd")));
}
 
Example #14
Source File: JspLoader.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected JspDataObject createJspObject(FileObject pf, final UniFileLoader l) 
    throws DataObjectExistsException {
    return new JspDataObject (pf, l);
}
 
Example #15
Source File: NpmDebugLogDataObject.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public NpmDebugLogDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    registerEditor("text/npm-log", true);
}
 
Example #16
Source File: DDDataLoader.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected final MultiDataObject createMultiObject(FileObject primaryFile, String editorMimeType)
    throws DataObjectExistsException, IOException {
        
    return new DDDataObject (primaryFile, this, editorMimeType);
}
 
Example #17
Source File: DocumentTitlePropertyTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected MultiDataObject createMultiObject (FileObject primaryFile) throws DataObjectExistsException, IOException {
    return new MyMultiFileDataObject( primaryFile, this );
}
 
Example #18
Source File: DataEditorSupportSaveAsTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected MultiDataObject createMultiObject (FileObject primaryFile) throws DataObjectExistsException, IOException {
    return new MyMultiFileDataObject( primaryFile, this );
}
 
Example #19
Source File: PayaraDescriptorDataLoader.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected MultiDataObject createMultiObject(FileObject primaryFile)
        throws DataObjectExistsException, IOException {
    return new PayaraDescriptorDataObject(primaryFile, this);
}
 
Example #20
Source File: XmlMultiViewDataObject.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Creates a new instance of XmlMultiViewDataObject */
public XmlMultiViewDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException {
    super(pf, loader);
    getCookieSet().add(XmlMultiViewEditorSupport.class, this);
    getCookieSet().assign(FileEncodingQueryImplementation.class, new Object[]{XmlFileEncodingQueryImpl.singleton()});
}
 
Example #21
Source File: DDMultiViewDataObject.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public DDMultiViewDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException {
    super(pf, loader);
    modelSynchronizer = new ModelSynchronizer(this);
}
 
Example #22
Source File: PropertiesProviderTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public TwoPartObject(TwoPartLoader l, FileObject folder) throws DataObjectExistsException {
    super(folder, l);
    getCookieSet().assign(FileEncodingQueryImplementation.class, eq);
}
 
Example #23
Source File: MyDataObject.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public MyDataObject(FileObject pf, MyDataLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    CookieSet cookies = getCookieSet();
    cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), cookies));
}
 
Example #24
Source File: DataEditorSupportMoveTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public MyDataObject(MyLoader l, FileObject folder) throws DataObjectExistsException {
    super(folder, l);
    registerEditor("text/plain", false);
}
 
Example #25
Source File: DataEditorSupportMoveTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
    return new MyDataObject(this, primaryFile);
}
 
Example #26
Source File: DDWeb25DataLoader.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
protected MultiDataObject createMultiObject(FileObject primaryFile)
        throws DataObjectExistsException, IOException {
    return createMultiObject(primaryFile, REQUIRED_MIME);
}
 
Example #27
Source File: BeansDataObject.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public BeansDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    registerEditor("text/x-beans+xml", false);
}
 
Example #28
Source File: DoFPDataObject.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public DoFPDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException {
    super(pf, loader);
}
 
Example #29
Source File: YamlDataObject.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public YamlDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    registerEditor(YamlTokenId.YAML_MIME_TYPE, true);
}
 
Example #30
Source File: GradleDataLoader.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
@Override
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
    return new GradleDataObject(primaryFile, this);
}