Java Code Examples for org.openide.loaders.DataObjectExistsException

The following examples show how to use org.openide.loaders.DataObjectExistsException. These examples are extracted from open source projects. 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 Project: netbeans   Source File: TplDataObject.java    License: 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 2
Source Project: netbeans   Source File: HtmlDataObject.java    License: 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 3
Source Project: NBANDROID-V2   Source File: IntegersDataObject.java    License: 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 4
Source Project: netbeans   Source File: FormDataObject.java    License: 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 5
Source Project: netbeans   Source File: FormDataLoader.java    License: 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 6
Source Project: netbeans   Source File: JnlpDataObject.java    License: 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 7
Source Project: netbeans   Source File: ClassDataLoader.java    License: 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 8
Source Project: NBANDROID-V2   Source File: AttrsDataObject.java    License: 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 Project: NBANDROID-V2   Source File: MenuDataObject.java    License: 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 10
Source Project: netbeans   Source File: GenericDataObject.java    License: 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 11
Source Project: netbeans   Source File: LanguagesDataLoader.java    License: 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 12
Source Project: netbeans   Source File: EmbeddedIndexerTest.java    License: 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 13
Source Project: NBANDROID-V2   Source File: UnknownValuesDataObject.java    License: 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 14
Source Project: netbeans   Source File: ScriptingCreateFromTemplateTest.java    License: Apache License 2.0 4 votes vote down vote up
public SimpleObject(SimpleLoader l, FileObject fo) throws DataObjectExistsException {
    super(fo, l);
}
 
Example 15
Source Project: netbeans   Source File: TplDataLoader.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected MultiDataObject createMultiObject(final FileObject primaryFile)
throws DataObjectExistsException, IOException {
    return new TplDataObject(primaryFile, this);
}
 
Example 16
Source Project: netbeans   Source File: DDWeb30DataLoader.java    License: 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 17
Source Project: netbeans   Source File: JarDataObject.java    License: Apache License 2.0 4 votes vote down vote up
public JarDataObject(FileObject pf, JarDataLoader loader) throws DataObjectExistsException {
    super(pf, loader);
}
 
Example 18
Source Project: netbeans   Source File: JarDataLoader.java    License: Apache License 2.0 4 votes vote down vote up
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
    return new JarDataObject(primaryFile, this);
}
 
Example 19
Source Project: netbeans   Source File: HintDataObject.java    License: Apache License 2.0 4 votes vote down vote up
public HintDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    CookieSet cookies = getCookieSet();
    cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), cookies));
}
 
Example 20
Source Project: netbeans   Source File: DeclarativeHintsTestDataObject.java    License: Apache License 2.0 4 votes vote down vote up
public DeclarativeHintsTestDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    CookieSet cookies = getCookieSet();
    cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), cookies));
}
 
Example 21
Source Project: netbeans   Source File: ScriptingCreateFromTemplateTest.java    License: Apache License 2.0 4 votes vote down vote up
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
    return new SimpleObject(this, primaryFile);
}
 
Example 22
Source Project: netbeans   Source File: LanguagesDataObject.java    License: Apache License 2.0 4 votes vote down vote up
public LanguagesDataObject(FileObject pf, LanguagesDataLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    CookieSet cookies = getCookieSet();
    cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), cookies));
}
 
Example 23
Source Project: netbeans   Source File: SpringXMLConfigDataLoader.java    License: Apache License 2.0 4 votes vote down vote up
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
    return new SpringXMLConfigDataObject(primaryFile, this);
}
 
Example 24
Source Project: netbeans   Source File: PackageLockJsonDataObject.java    License: Apache License 2.0 4 votes vote down vote up
public PackageLockJsonDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
    super(pf, loader);
    registerEditor("text/package-lock+x-json", true);
}
 
Example 25
Source Project: netbeans   Source File: ObjectListRendererTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
    return new MDO(primaryFile, this);
}
 
Example 26
Source Project: netbeans   Source File: WhereUsedDataLoader.java    License: Apache License 2.0 4 votes vote down vote up
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
    return new WhereUsedDataObject(primaryFile, this);
}
 
Example 27
Source Project: netbeans   Source File: DiffDataObject.java    License: Apache License 2.0 4 votes vote down vote up
public DiffDataObject (FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
    super (pf, loader);
    CookieSet cookies = getCookieSet ();
    cookies.add ((Node.Cookie) DataEditorSupport.create (this, getPrimaryEntry (), cookies));
}
 
Example 28
Source Project: netbeans   Source File: JShellLoader.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
    return new JShellDataObject(primaryFile, this);
}
 
Example 29
Source Project: netbeans   Source File: ClientDataObject.java    License: Apache License 2.0 4 votes vote down vote up
/** Creates a new instance of ClientDataObject */
public ClientDataObject(FileObject pf, ClientDataLoader loader) throws DataObjectExistsException {
    super(pf, loader);
    init(pf,loader);
}
 
Example 30
Source Project: netbeans   Source File: SQLDataLoader.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
    return new SQLDataObject(primaryFile, this);
}