-
Notifications
You must be signed in to change notification settings - Fork 114
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
Fixes #671 - Move some platform-ui undo utility classes into a core location #672
Conversation
See #671 for description |
Couldn't those be in an internal but exported with |
In theory, yes, but, I personally draw the line between what I consider to be major repositories. I can understand if platform core wanted a bundle to be xfriends with something in platform ui, but once you cross the road into JDT-land, it seems that it should be publicly available API. Basically, once a major consumer is attempting to use it, there's no point to keeping it as xfriends. It should be supported as public. |
Test Results 40 files - 2 40 suites - 2 51m 31s ⏱️ - 11m 13s For more details on these failures and errors, see this check. Results for commit 75fb0ca. ± Comparison against base commit 0613f93. ♻️ This comment has been updated with latest results. |
I'm a bit worried about the names of all that. For example having a "ProjectDescription" API when there is already |
import org.eclipse.core.runtime.CoreException; | ||
|
||
/** | ||
* IFileContentDescription is a description of a file's content. |
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.
Why not using directly IFile or IFileInfo for that?
OK, I start to understand it better that those classes are meant to get a local snapshot of a resource to store in the undo/redo stack and process later. If there are no other consumers than undo/redo, then we can probably just show |
I'm a +1 on changing package name to include an I'm generally against renaming the classes to 'Snapshots' unless there's a wider consensus that's the correct thing to do. Changing package name is one thing but changing the class name, well, I'm not sure. I'll do it if demanded, but... For JDT, the patch to migrate from use of the ui.ide.undo classes to the new core ones would be as simple as changing imports (assuming we don't change the class name, just the package). This is because our primary entry point to creating these objects is by calling For eclipse ui, I'd need to investigate more deeply to see how extensively these classes are used. I can see that |
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.
That looks good overall, just a minor comment inline that we need to address before moving forward.
* Base implementation of ResourceSnapshot that describes the common attributes | ||
* of a resource to be created. | ||
* | ||
* This class is not intended to be instantiated or used by clients. |
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.
We should maybe remove this line?
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.
This line should not be removed. The approved way of accessing these classes is by calling ResourceSnapshot.fromResource(r);
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.
So couldn't the constructors be only package-visible? And the documentation mention that the right approach to get an instance if ResourceSnapshot.fromResource()
?
6b7ace5
to
f6cf377
Compare
The test failure is also visible on master and doesn't relate to the change (ie actually tests the content of help for last I-Build, not the one that would be generated by this PR). However, I still miss the exact symptom of the problem we're trying to fix. @robstryker do you have a link to some failure somewhere? If it's the current test that we see failing here that we're trying to fix, then the solution can be simply to list the "new" bundle in https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/blob/725cacd808359189e38bda85b416ed80d03bda22/eclipse.platform.common/bundles/org.eclipse.platform.doc.isv/buildDoc.xml#L54 |
I'll be refactoring this patch to ensure that org.eclipse.ui.ide can properly consume these in an api-compatible fashion. Please hold off. |
OK, I'm converting to draft in the meantime. |
329925a
to
60cc99a
Compare
I think this comment was meant to be posted to a different issue. This issue here is not prompted by any test failures. |
I have significantly refactored the proposed patch, to add an internal package as the current ui.ide had done. This was an oversight on my part since only 1 of the classes should have been public. In order to maintain API compatibility with prior consumers of the ui.ide code, I have chosen to make use of interfaces instead of only abstract classes. This allows the existing UI code to simply wrap the core implementation and implement the same interface. This will maintain compatability with all of the existing classes and the expected return values. More of that can be discussed on an issue in the UI repository when appropriate. |
60cc99a
to
d48570d
Compare
…es into a core location Signed-off-by: Rob Stryker <stryker@redhat.com> Update copyright headers and since tags Signed-off-by: Rob Stryker <stryker@redhat.com> Rename API to use snapshot instead of description for clarity Signed-off-by: Rob Stryker <stryker@redhat.com> Missing since tag Signed-off-by: Rob Stryker <stryker@redhat.com> Reorganize newly moved classes and clean up Signed-off-by: Rob Stryker <stryker@redhat.com>
d48570d
to
1607f82
Compare
* IContainerSnapshot is a lightweight description that describes a container to | ||
* be created. | ||
* | ||
* This class is not intended to be instantiated by clients. |
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.
This line can be removed as interfaces cannot be instantiated.
However, 1 important thing to settle when introducing this interface API is whether we want to allow other implementations? If we want to restrict the implementations to the ones that are shipped here, we should add a @noimplements
tag to make PDE warn in case someone wants to implement it.
It's safer to start with as many restrictions as possible and to remove them later than the other way round, as it gives more freedom for further changes.
* IMarkerSnapshot is a lightweight snapshot of a marker for the purposes of | ||
* undoing. | ||
* | ||
* This class is not intended to be instantiated by clients. |
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.
Same as above.
* IResourceSnapshot is a lightweight snapshot that describes the common | ||
* attributes of a resource to be created. | ||
* | ||
* This class is not intended to be extended by clients. |
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.
same as above
Signed-off-by: Rob Stryker <stryker@redhat.com>
1607f82
to
75fb0ca
Compare
df661fe
into
eclipse-platform:master
* the progress monitor to be used when creating the resource | ||
* @throws CoreException if creation failed | ||
*/ | ||
public void createExistentResourceFromHandle(IResource resource, |
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.
I understand that my comment is late, but create
method usually returns an instance of something (like the method above). Do you think something like "materialize" or "actualize" could be better here @robstryker @mickaelistria ?
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.
I agree it looks like this particular thing can be improved. I'm also curious about why is this method useful when we already have createResource
. @robstryker in which case would one want to call it instead of createResource
? What about a new restoreResource
that would join both?
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.
I'm also thinking that we could maybe add generics <T extends IResource>
here and there to polish things a bit and facilitate consumption.
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.
generics are proposed in #705
No description provided.