Skip to content

Commit 22532cc

Browse files
committed
[1534] Update ViewUsage label in Explorer View
Bug: #1534 Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
1 parent 261c356 commit 22532cc

5 files changed

Lines changed: 32 additions & 1 deletion

File tree

CHANGELOG.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ Consumers may override this by providing an implementation of `org.eclipse.syson
8383
- https://github.com/eclipse-syson/syson/issues/1432[#1432] [metamodel] Add implicit `Subclassification` or `Subsetting` when using semantic `MetadataUsage`.
8484
- https://github.com/eclipse-syson/syson/issues/1355[#1355] [tests] Add coding rules tests on all modules.
8585
- https://github.com/eclipse-syson/syson/issues/1530[#1530] [details] Move `RequirementUsage`'s _ReqId_ property from the _Advanced_ tab to the _Core_ tab of the _Details View_.
86+
- https://github.com/eclipse-syson/syson/issues/1534[#1534] [explorer] Since it is now possible to switch from a _Standard Diagram View_ to another in SysON (for example from _General View_ to _Interconnection View_), the `ViewDefinition` name in displayed in the label of the `ViewUsage` in the _Explorer View_.
87+
With this enhancement, users can now easily identify which `ViewDefinition` is used by a `ViewUsage`.
8688

8789
=== New features
8890

backend/views/syson-tree-explorer-view/src/main/java/org/eclipse/syson/tree/explorer/view/SysONExplorerTreeDescriptionProvider.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ private TreeItemLabelDescription createDefaultStyle() {
8787
.newTreeItemLabelDescription()
8888
.name("Default style")
8989
.preconditionExpression("aql:true")
90-
.children(this.getDefaultLabelFragmentDescription())
90+
.children(this.getDefaultLabelFragmentDescription(),
91+
this.getTypeFragmentDescription())
9192
.build();
9293
}
9394

@@ -97,6 +98,16 @@ private TreeItemLabelFragmentDescription getDefaultLabelFragmentDescription() {
9798
.build();
9899
}
99100

101+
private TreeItemLabelFragmentDescription getTypeFragmentDescription() {
102+
return new TreeBuilders().newTreeItemLabelFragmentDescription()
103+
.labelExpression("aql:self.getType()")
104+
.style(new ViewBuilders().newTextStyleDescription()
105+
.name("GOLD_TEXT_STYLE_NAME")
106+
.foregroundColorExpression("aql:'#ab8b01'")
107+
.build())
108+
.build();
109+
}
110+
100111
private List<TreeItemContextMenuEntry> getContextMenuEntries() {
101112
final TreeItemContextMenuEntry newObjectsFromTextMenuEntry = new TreeBuilders().newCustomTreeItemContextMenuEntry()
102113
.contributionId(NEW_OBJECTS_FROM_TEXT_MENU_ENTRY_CONTRIBUTION_ID)

backend/views/syson-tree-explorer-view/src/main/java/org/eclipse/syson/tree/explorer/view/services/ComposedSysONExplorerService.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.eclipse.sirius.components.core.api.IEditingContext;
2020
import org.eclipse.sirius.components.trees.TreeItem;
2121
import org.eclipse.sirius.web.domain.boundedcontexts.representationdata.RepresentationMetadata;
22+
import org.eclipse.syson.sysml.ViewUsage;
2223
import org.eclipse.syson.tree.explorer.view.services.api.ISysONDefaultExplorerService;
2324
import org.eclipse.syson.tree.explorer.view.services.api.ISysONExplorerService;
2425
import org.eclipse.syson.tree.explorer.view.services.api.ISysONExplorerServiceDelegate;
@@ -141,6 +142,19 @@ public List<Object> getElements(IEditingContext editingContext, List<String> act
141142
.orElseGet(() -> this.defaultExplorerService.getElements(editingContext, activeFilterIds));
142143
}
143144

145+
public String getType(Object self) {
146+
StringBuilder type = new StringBuilder();
147+
if (self instanceof ViewUsage viewUsage) {
148+
var viewDefinition = viewUsage.getViewDefinition();
149+
if (viewDefinition != null) {
150+
type.append(" [");
151+
type.append(viewDefinition.getDeclaredName());
152+
type.append("]");
153+
}
154+
}
155+
return type.toString();
156+
}
157+
144158
private Optional<ISysONExplorerServiceDelegate> getDelegate(Object object) {
145159
return this.explorerServiceDelegate.stream()
146160
.filter(delegate -> delegate.canHandle(object))
51 KB
Loading

doc/content/modules/user-manual/pages/release-notes/2025.10.0.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ metadata def Function :> SemanticMetadata {
100100
#Function action def A0; // A0 subclassify Functions
101101
```
102102
- Move `RequirementUsage`'s _ReqId_ property from the _Advanced_ tab to the _Core_ tab of the _Details View_.
103+
- Since it is now possible to switch from a _Standard Diagram View_ to another in SysON (for example from _General View_ to _Interconnection View_), the `ViewDefinition` name in displayed in the label of the `ViewUsage` in the _Explorer View_.
104+
With this enhancement, users can now easily identify which `ViewDefinition` is used by a `ViewUsage`.
105+
106+
image::view-usage-label-with-type-explorer-view.png[ViewUsage in Explorer View, width=65%,height=65%]
103107

104108
== Dependency update
105109

0 commit comments

Comments
 (0)