Bug 129949 - [api] Permit modifications of guarded JavaSource
[api] Permit modifications of guarded JavaSource
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: Source
6.x
All All
: P2 (vote)
: 6.x
Assigned To: Jan Pokorsky
issues@java
: API, API_REVIEW_FAST
Depends on:
Blocks: 128981
  Show dependency treegraph
 
Reported: 2008-03-12 18:54 UTC by Jan Pokorsky
Modified: 2008-03-15 19:49 UTC (History)
4 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
proposed changes (9.44 KB, patch)
2008-03-12 19:54 UTC, Jan Pokorsky
Details | Diff
proposed changes ver. 2 (11.12 KB, text/plain)
2008-03-14 12:04 UTC, Jan Pokorsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Pokorsky 2008-03-12 18:54:03 UTC
It would be useful to allow ModificationResult to write changes into guarded sections of a document in case the API
client is aware of what he does.

My usecase is the BeanInfo refactoring. When I implement GuardedBlockHandler I can decide according to
ModificationResult.Difference if proposed changes are valid and in such case I could permit to write them to the document.

So what I propose is to add 2 methods to ModificationResult.Difference
 public boolean isGuarded();
 public void guards(boolean b);

The default behavior would remain the same. Modifications of guarded sections are forbidden by default.
Comment 1 Jan Pokorsky 2008-03-12 19:54:07 UTC
Created attachment 58267 [details]
proposed changes
Comment 2 Jan Pokorsky 2008-03-12 20:00:11 UTC
I would like to ask for review of this simple change. TM will be 6.1
Comment 3 Tomas Zezula 2008-03-14 10:50:44 UTC
Missing @since and increase module version otherwise OK.
Comment 4 Dusan Balek 2008-03-14 11:11:42 UTC
Consider using of more descriptive method names - otherwise it is OK for me.
Comment 5 Jan Lahoda 2008-03-14 11:16:26 UTC
-the method names seem not very intuitive to me - would be nice if we could improve them (maybe forceWrite/isForceWrite?).
-implementation note: I would prefer use of NbDocument.runAtomic(AsUser) instead of BaseDocument.runAtomic(AsUser)
-please make sure that module(s) that will use these new methods depend on the new version of java.source (in order to
prevent problems with AU).
Comment 6 Jan Pokorsky 2008-03-14 11:35:30 UTC
TZ: sure, @since has lost while I was hg queuing. apichanges.xml is already there.

DB, JL01: I wanted names to be short. In case of making names really descriptive I would propose
setCommitToGuards(boolean allow)/isCommitToGuards()

JL02: There already was casting to BaseDocument. But I am fine to use NbDocument.

Thanks for comments.

Comment 7 Tomas Zezula 2008-03-14 11:46:43 UTC
setCommitToGuards(boolean allow) is good.

Comment 8 Jan Pokorsky 2008-03-14 12:04:40 UTC
Created attachment 58381 [details]
proposed changes ver. 2
Comment 9 Jan Pokorsky 2008-03-14 12:06:22 UTC
I have updated the patch. If no more objections occur I will push this tomorrow.
Comment 10 Jan Pokorsky 2008-03-15 19:48:37 UTC
I am going to integrate.
Comment 11 Jan Pokorsky 2008-03-15 19:49:29 UTC
integrated as http://hg.netbeans.org/main/rev/8274af13b6ae


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo