-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Initial contribution of property-view extension #8655
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.
@ndoschek thank you for the contribution, I have not looked nor tested the changes thoroughly yet, but it looks very promising. I did notice a bug however where the properties
view is not properly cleared when no editors
are opened:
Thank you! That's a good point, thanks for noticing! I will look into it tomorrow or Thursday the latest. |
1124b46
to
bf82078
Compare
I noticed that widgets opened via the file navigator are not properly activated, which led to missing global selections. This caused the missing update of the property view. |
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.
The functionality works very well 👍 I believe it is a very good initial contribution to the property-view
.
I have some minor cosmetic changes at the moment, please be sure to rebase the pull-request and resolve the conficts.
@@ -94,7 +94,7 @@ export class FileNavigatorModel extends FileTreeModel { | |||
|
|||
previewNode(node: TreeNode): void { | |||
if (FileNode.is(node)) { | |||
open(this.openerService, node.uri, { mode: 'reveal', preview: true }); | |||
open(this.openerService, node.uri, { preview: true }); |
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.
Can you clarify why the change is necessary? I do not believe we should change the behavior of opening nodes in the following pull-request.
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 took a deeper look at the behaviour of the file/editor selection itself.
Depending on the preference settings, the editor can either be revealed or opened (and therefore automatically activated).
Regarding the revealed
mode (which is currently the case for the preferences Editor > Enable Preview > true
as well as Workbench > List > Open Mode > singleClick
):
If the editor is revealed, the global selection is not updated and does not contain the revealed editor, as the file node in the navigator stays the current selection. (This is also observable in the GIF from your first comment)
Therefore I would say the behaviour is technically correct as the property-view
listens to the current selection,
but I agree that it might not be very intuitive to the user.
I can think of two possible ways to go on from here:
- Stick to the behavioural change and activate editors if they are opened via
singleClick
or inpreview
to assure that the global selection is up to date. - Adapt the
EditorWidget
andEditorPreviewWidget
to set the global selection if they are revealed.
What's your opinion on this? Thanks in advance.
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 took a deeper look at the behaviour of the file/editor selection itself.
Depending on the preference settings, the editor can either be revealed or opened (and therefore automatically activated).
Regarding therevealed
mode (which is currently the case for the preferencesEditor > Enable Preview > true
as well asWorkbench > List > Open Mode > singleClick
):
If the editor is revealed, the global selection is not updated and does not contain the revealed editor, as the file node in the navigator stays the current selection. (This is also observable in the GIF from your first comment)Therefore I would say the behaviour is technically correct as the
property-view
listens to the current selection,
but I agree that it might not be very intuitive to the user.I can think of two possible ways to go on from here:
- Stick to the behavioural change and activate editors if they are opened via
singleClick
or inpreview
to assure that the global selection is up to date.
I do not believe we should modify the current activate
behavior.
- Adapt the
EditorWidget
andEditorPreviewWidget
to set the global selection if they are revealed.
This may be the correct behavior, although I'm not sure myself as I have yet to verify if there are any implications when setting the global selection in this case. Would it be possible to rely on the shell
to determine the current widget and update the property-view
then? (this may also cause issues)
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 with you and reverted the current activate
behaviour.
The combination of selection and focus is the main point to look at in my opinion. As it depends on the settings, how editors are opened, I think sticking to the global selection and focus without relying on changes regarding the ApplicationShell
might be the cleanest way for the property-view
overall.
Please see my attached screencast, where I show the differences between activated editors and 'only revealed' editor. If editors are revealed, the focus stays in the file navigator widget, until the user decides to activate an editor (or any other widget). This would mean that the property-view
would depend only on the global selection/focus behaviour and would align without adaptions if there will be changes in the future on that matter.
packages/property-view/src/browser/empty-property-view-widget-provider.tsx
Outdated
Show resolved
Hide resolved
packages/property-view/src/browser/property-view-frontend-module.ts
Outdated
Show resolved
Hide resolved
bf82078
to
4daa8e2
Compare
4daa8e2
to
67cc0b8
Compare
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.
@ndoschek the changes are very well implemented and work very well, thank you for updating the pull-request 👍 Given that the extension is currently not pulled by any other @theia
extension it should be fine to merge and update the property-view
functionality iteratively without any risk.
I did have minor comments however if you'd like to take a look:
We may want to think about implementing onActivateRequest
for the widget, since currently when it is opened a warning is logged (since the default implementation is no-op
). For such a case we can activate the first node in the property-view if you believe it is the proper behavior:
@ndoschek thank you for the contribution, I waited for others to review as well but I believe it is fine to merge since it does not affect other extensions. Would you mind resolving the conflict and I'll merge right after? |
3435406
to
e8b2279
Compare
Thank you very much @vince-fugnitto! I rebased my changes to resolve the conflicts. |
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.
LGTM, it worked for me by following the steps.
@eclipse-theia/core is anyone ok with taking in this new extension or should it be in its own repo?
I am not against having it here.
packages/property-view/src/browser/empty-property-view-widget-provider.tsx
Outdated
Show resolved
Hide resolved
@ndoschek thanks for this contribution. Since
|
e8b2279
to
281ed4a
Compare
@marcdumais-work I looked at the flowchart and can confirm that |
Let me rephrase Paul's question above: @eclipse-theia/core is anyone not ok with taking in this new extension, in this repo? If we store it here, it will be published along the other framework extensions, with minimal overhead. If it were in its own repo instead, someone would need to release it from there, separately. |
packages/property-view/src/browser/property-view-widget-provider.ts
Outdated
Show resolved
Hide resolved
packages/property-view/src/browser/resource-property-view/resource-property-data-service.ts
Outdated
Show resolved
Hide resolved
...ages/property-view/src/browser/resource-property-view/resource-property-view-tree-widget.tsx
Show resolved
Hide resolved
@ndoschek Do think it would be worthwhile to add some UI tests for it? I don't see much that could be unit-tested, but do you think anything could be tested UI-wise to catch potential regressions? (adding to the |
78cf349
to
23e7297
Compare
@marechal-p I added the |
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.
LGTM, pinging @eclipse-theia/core again because of the new extension.
23e7297
to
27b49f8
Compare
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.
@ndoschek: Just a quick note to ask that you please squash this PRs commits before eventual merge. In the meantime it's ok to add new ones on top, while making improvements and answering review comments.
dff03e2
to
0268119
Compare
0268119
to
0dbae74
Compare
@marcdumais-work All commits in this PR are squashed and rebased to latest master. |
@marcdumais-work : Was squashing the only remaining change you requested? (that has been done) |
@ndoschek Could you resolve the conflicts? |
f4f2215
to
41b7af5
Compare
@ndoschek is the CI failure something to worry about? |
@marcdumais-work I think the failures were mainly reported because the master branch on my forked repo was not up-to-date and therefore the builds failed, sorry for that! |
@marechal-p if you have no further comments, can you merge this contributions? |
and/or @vince-fugnitto |
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.
@ndoschek @JonasHelming some minor updated and it should be good to merge (I'll take care of merging after) 👍 Please be sure to squash after making the commits as well.
bf3ac59
to
573fd1e
Compare
@vince-fugnitto Thank you for your review, I addressed your comments and squashed the commit. |
@ndoschek looks like something was merged prior to the update which resulted in a conflict. Can you please rebase? |
Signed-off-by: Nina Doschek <ndoschek@eclipsesource.com>
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.
Merging! Thank you for your contribution and patience @ndoschek :)
Introduction
Many IDEs, such as the traditional Eclipse IDE, have the notion of a global, extensible property view, which shows additional information about the current selection within the IDE. Property views are heavily used in those IDEs for showing details of elements in e.g. diagram editors, complex tree editors, or the file explorer selection. Therefore, the main idea is to have a global, generic property view in the IDE, but allow specific implementations to extend the contents of the global property view with specific additional information for some type of selection.
What it does
The
@theia/property-view
extension contributes a generic, global property view based on Theia's global selection.The property view widget can be opened/toggled either via menu
View->Properties
or via shortcutShift+Alt+P
. It is located in the bottom dock area per default.The following two default content widgets are implemented in this extension:
To contribute a specific property view, it is necessary to implement a
PropertyViewDataService
which gathers the property data for a selection as well as aPropertyViewWidgetProvider
which provides a suitable content widget to display the property data for a specific selection inside the property view widget.How to test
View -> Properties
or via ShortcutShift+Alt+P
No properties available.
)Review checklist
Reminder for reviewers
Example implementation
Here is a short example of how to implement an additional property view, which displays the name and whether it is a file or directory in a simple React widget based on the selection from the file explorer (assuming there would be no
ResourcePropertyViewWidget
of course):The
FileInfoPropertyDataService
gathers the file information and delivers a custom object:The
FileInfoPropertyWidget
is a simple ReactWidget and displays the selected node and whether it is a file or directory:The
FileInfoPropertyViewWidgetProvider
is responsible to provide the correctPropertyViewContentWidget
based on the selection:In the frontend module of your application you need to bind the
FileInfoPropertyDataService
as well as theFileInfoPropertyViewWidgetProvider
as follows:Following these few steps should give the reader an idea on how to implement an own property view, consisting of a specific
PropertyViewWidgetProvider
andPropertyviewDataService
.Outlook
This PR provides the generic capabilities of a global property view that can be extended with specific additional information contributed by specific Theia extensions.
We plan to use this global property view in the context of graphical modeling tools (e.g. diagram editors). A specific use case is, for instance, the implementation of EMF Ecore support for Theia as well as other applications in the context of EMF.cloud.
In EMF.cloud we also have an extension of the property view support of this PR, that allows to dynamically generate editable property views based on JSON schema defined data. If there is interest in the community to have that as part of Theia, we are happy to open a follow-up PR that builds on this PR.
Please see below for an example of a property view (JSON-schema based in this case) in the Theia Ecore editor:
Signed-off-by: Nina Doschek ndoschek@eclipsesource.com