Why is DataObject's Save action fired on build of a project

View: New views
3 Messages — Rating Filter:   Alert me  

Why is DataObject's Save action fired on build of a project

by Jan Havlíček :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I have created dataobject using this code:

FileSystem fs = FileUtil.createMemoryFileSystem();
FileObject fo = fs.getRoot().createData(timelineName, "ptl");

DataObject dataObject = DataObject.find(fo);

OpenCookie oc = dataObject.getLookup().lookup(OpenCookie.class);
if (oc != null) {
  oc.open();
}

and in constructor of the DataObject is
        this.setModified(true);
        getCookieSet().assign(SaveCookie.class, saveDB);

and nothin more.

Now when I create some project (java sample or something) and create
the DataObject using code above and try to build or compile the
project in Netbeans, the save action of the dataobject is fired.

At first I thought that primary file of the dataobject is somehow
owned by the default project, but the
FileOwnerQuery.getOwner(getPrimaryFile()); returns null.

Why does this happen and is there some way to stop this behavior?

Honza

Re: Why is DataObject's Save action fired on build of a project

by Michel Graciano :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Take a look at Tools > Options > MIscellaneous > Ant > 'Save all modified files before running Ant'. Probably it is marked.

Regards

2009/10/26 Honza Havlíček <havlicek.honza@...>
Hi,
I have created dataobject using this code:

FileSystem fs = FileUtil.createMemoryFileSystem();
FileObject fo = fs.getRoot().createData(timelineName, "ptl");

DataObject dataObject = DataObject.find(fo);

OpenCookie oc = dataObject.getLookup().lookup(OpenCookie.class);
if (oc != null) {
 oc.open();
}

and in constructor of the DataObject is
       this.setModified(true);
       getCookieSet().assign(SaveCookie.class, saveDB);

and nothin more.

Now when I create some project (java sample or something) and create
the DataObject using code above and try to build or compile the
project in Netbeans, the save action of the dataobject is fired.

At first I thought that primary file of the dataobject is somehow
owned by the default project, but the
FileOwnerQuery.getOwner(getPrimaryFile()); returns null.

Why does this happen and is there some way to stop this behavior?

Honza



--
Michel Graciano
Summa Technologies do Brasil Ltda.
http://www.michelgraciano.com
https://genesis.dev.java.net/
http://translatedfiles.netbeans.org/index_pt_BR.html
https://copypastehistory.dev.java.net/

Re: Why is DataObject's Save action fired on build of a project

by Jan Havlíček :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you, it is marked, but unmarking it doesn't exactly produce the
result I wanted.

At the time of creation of the DataObject, I don't know the final
saving place yet (it is storing primary file in memory file system).
Therefore, SaveCookie has a dialog for specifying the final location
in itself and the dialog is triggered every time ant saves all
modified files.

Is there an easy way to implement save dialog for unsaved dataobject
that would be triggered by user/in the event of exit from netbeans or
should I change the approach?

Honza


On Mon, Oct 26, 2009 at 6:40 PM, Michel Graciano
<michel.graciano@...> wrote:

> Take a look at Tools > Options > MIscellaneous > Ant > 'Save all modified
> files before running Ant'. Probably it is marked.
> Regards
>
> 2009/10/26 Honza Havlíček <havlicek.honza@...>
>>
>> Hi,
>> I have created dataobject using this code:
>>
>> FileSystem fs = FileUtil.createMemoryFileSystem();
>> FileObject fo = fs.getRoot().createData(timelineName, "ptl");
>>
>> DataObject dataObject = DataObject.find(fo);
>>
>> OpenCookie oc = dataObject.getLookup().lookup(OpenCookie.class);
>> if (oc != null) {
>>  oc.open();
>> }
>>
>> and in constructor of the DataObject is
>>        this.setModified(true);
>>        getCookieSet().assign(SaveCookie.class, saveDB);
>>
>> and nothin more.
>>
>> Now when I create some project (java sample or something) and create
>> the DataObject using code above and try to build or compile the
>> project in Netbeans, the save action of the dataobject is fired.
>>
>> At first I thought that primary file of the dataobject is somehow
>> owned by the default project, but the
>> FileOwnerQuery.getOwner(getPrimaryFile()); returns null.
>>
>> Why does this happen and is there some way to stop this behavior?
>>
>> Honza
>
>
>
> --
> Michel Graciano
> Summa Technologies do Brasil Ltda.
> http://www.michelgraciano.com
> https://genesis.dev.java.net/
> http://translatedfiles.netbeans.org/index_pt_BR.html
> https://copypastehistory.dev.java.net/
>