Hierarchy View / Quick Hierarchy Popup [message #1730852] |
Fri, 29 April 2016 09:20 |
|
Hi,
I was just about implementing a hierarchy view for my DSL when I saw
that there is a new package in Xtext 2.10:
org.eclipse.xtext.ui.editor.hierarchy
I also find the associated task
https://bugs.eclipse.org/bugs/show_bug.cgi?id=489745
which is titled "Rule Call Hierarchy" but does not provide more information.
To me it seems as if hierarchy views are quite similar to outline views.
I'm also aware that there are some fundamental differences. I would
assume the most important one is that the outline view usually is only
related to a single resource while the hierarchy view relates to many
resources. Anyway...
In the JDT for instance the outline and the hierarchy quick views
(popups) are based on the same super class: AbstractInformationControl
(with a subclass HierarchInformationControl and
JavaOutlineInformationControl).
In Xtext, there is already a QuickOutlinePopup dialog, found in package
org.eclipse.xtext.ui.editor.outline.quickoutline
There are some things that could be reused for both use cases:
- LabelProvider (it seems as if the hierarchy view requires its own DSL
specific hierarchy label provider, cf. org.eclipse.xtext.xtext.ui)
- parts of the model (of the JFace MVC)
I would assume that there are different kind of "hierarchies" typically
shown in IDEs: structural hierarchies (e.g. type hierarchy as in my
case) and control hierarchies (e.g., rule calls as in the current xtext
implementation). I would assume that the first case is closer related to
the outline view, as the elements to be shown are probably similar.
Maybe my questions are more related to the first type...
I'm wondering
- if there are any plans to also add some infrastructure to the
hierarchy package similar to outline, e.g., QuickHierarchyPopup or MWE2
fragments
- The nice thing about the outline view is that I only need to adjust
the IOutlineTreeProvider (and maybe do some additional tricks when I
want different labels or so). Is this possible with the hierarchy views
as well? (In o.e.xtext.ide and o.e.xtext.xtext.ui it seems as if a lot
of custom code has to be written or the hierarchy view, maybe because of
the different hierarchy type)
- if some hierarchy related classes in the org.eclipse.xtext.ide plugin
could be moved to org.eclipse.xtext.ui, e.g., IHierarchyNode?
Regards,
Jens
|
|
|
Re: Hierarchy View / Quick Hierarchy Popup [message #1732433 is a reply to message #1730852] |
Tue, 17 May 2016 10:14 |
Anton Kosyakov Messages: 9 Registered: March 2016 |
Junior Member |
|
|
Hi Jens,
There is a new API to build UI independent hierarchies. IHierarchyNode is not a UI component but rather data model, UI specific implementation should map them to UI components, e.g. for Eclipse, IntelliJ or Web.
Regarding to your questions:
Quote:if there are any plans to also add some infrastructure to the
hierarchy package similar to outline, e.g., QuickHierarchyPopup or MWE2
fragments
You can file bugs for missing features.
Quote:The nice thing about the outline view is that I only need to adjust
the IOutlineTreeProvider (and maybe do some additional tricks when I
want different labels or so). Is this possible with the hierarchy views
as well? (In o.e.xtext.ide and o.e.xtext.xtext.ui it seems as if a lot
of custom code has to be written or the hierarchy view, maybe because of
the different hierarchy type)
Currently we have only default implementation for the call hierarchy view that can be reused, look at arithmetic or domainmodel examples. If you need a different view you will need to implement it yourself.
What kind of hierarchy do you need?
It could be enough to override org.eclipse.xtext.ide.editor.hierarchy.DefaultCallHierarchyBuilder and reuse the default call hierarchy view.
For example you can think about "Type Hierarchy" as "Call Hierarchy" around "extend" or "implement" relationships.
Or look at domainmodel example, it provides "Associations Hierarchy" that shows how one entity can be reached from another via properties. org.eclipse.xtext.example.domainmodel.ui.editor.hierarchy.AssociationHierarchyBuilder overrides DefaultCallHierarchyBuilder:
- to accept only entities as source and target declarations
- to filter all references except reference to jvm types from properties.
BTW there is no the generic hierarchy view, since one language can provide different hierarchies, around different declarations and references.
Quote:if some hierarchy related classes in the org.eclipse.xtext.ide plugin
could be moved to org.eclipse.xtext.ui, e.g., IHierarchyNode?
As explained above IHierarchyNode is on purpose UI independent.
Regards,
Anton
Get professional support from the Xtext committers at www.typefox.io.
|
|
|
Powered by
FUDForum. Page generated in 0.02455 seconds