New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RHBA-415: After rename, designer is not marked as dirty more #275
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karreiro Presumably the issue was that the lock was not released when an asset was renamed? I'll review a bit more when I understand the issue.
@mantis Precisely, Mike, that's the issue. The lock was not being released, and the editor was never marked as locked again. There are two essential scenarios to cover: The GDT Editor scenario:
Any other editor scenario (let's pick the DRL Editor):
|
final ObservablePath path = mock(ObservablePath.class); | ||
final PlaceRequest placeRequest = mock(PlaceRequest.class); | ||
final String version = "version"; | ||
final Callback<VersionRecord> callback = (v) -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might have been more readable to simply use a mock Callback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Fixed.
private void updateLockInfo(@Observes LockInfo lockInfo) { | ||
if (lockTarget != null && lockInfo.getFile().equals(lockTarget.getPath())) { | ||
void updateLockInfo(final @Observes LockInfo lockInfo) { | ||
if (getLockTarget() != null && lockInfo.getFile().toURI().equals(lockTarget.getPath().toURI())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You make a point of using toURI()
on the paths here; but.....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manstis Here we can have a PathImpl
being compared to an ObservablePath
(that's what we're avoiding), and......
@@ -309,6 +321,12 @@ void onSaveInProgress(@Observes SaveInProgressEvent evt) { | |||
} | |||
} | |||
|
|||
void onRenameInProgress(@Observes RenameInProgressEvent event) { | |||
if (getLockTarget() != null && event.getPath().equals(lockTarget.getPath())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... here you're OK using Path
equality? (not URI, like your change above). Is this OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...here, we always have an ObservablePath
being compared to another ObservablePath
.
I added a comment to make this less confusing.
Thanks for the comment :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No comments to code, however I have question. Please follow my steps:
- Pick some asset type, lets say plain drl
- Create new asset of this type
- do some changes (put some text)
- click on rename, select save and rename, confirm
- do some additional changes
- again save the drl file
- Check offered versions
- Here is the question, is it expected that there are tracked versions just from the point of renaming? Shouldn't be there also versions before renaming? This is just question because not sure how it should work, please let me know.
@jomarko Good point. I'm not sure either. IMHO, the versions should be tracked right after every IO operation and not be lost. Since it's not a regression, I think that this is not a blocker to this PR (but maybe we could raise a JIRA for that), see: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for comparing with state on master, discussed issue filed RHBA-732
See https://issues.jboss.org/browse/RHBA-415
Before:
After:
Part of an ensemble: