From 65b3daef7ead6b85f02865bf4b1f98772d6806cc Mon Sep 17 00:00:00 2001 From: Axel RICHARD Date: Fri, 19 Sep 2025 15:55:59 +0200 Subject: [PATCH 1/5] [enh] Implement ViewUsage#getViewDefinition Signed-off-by: Axel RICHARD --- .../org/eclipse/syson/sysml/impl/ViewUsageImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/ViewUsageImpl.java b/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/ViewUsageImpl.java index 95dbc5dca..27a326965 100644 --- a/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/ViewUsageImpl.java +++ b/backend/metamodel/syson-sysml-metamodel/src/main/java/org/eclipse/syson/sysml/impl/ViewUsageImpl.java @@ -152,13 +152,14 @@ public ViewDefinition getViewDefinition() { /** * * - * @generated + * @generated NOT */ public ViewDefinition basicGetViewDefinition() { - // TODO: implement this method to return the 'View Definition' reference - // -> do not perform proxy resolution - // Ensure that you remove @generated or mark it @generated NOT - return null; + return this.getType().stream() + .filter(ViewDefinition.class::isInstance) + .map(ViewDefinition.class::cast) + .findFirst() + .orElse(null); } /** From f49e452017735bdcc18fb7cf3ca42b3d57c9044b Mon Sep 17 00:00:00 2001 From: Axel RICHARD Date: Fri, 19 Sep 2025 15:57:53 +0200 Subject: [PATCH 2/5] [fix] Remove useless diagramContext in UtilService#getViewDefinitionKind Signed-off-by: Axel RICHARD --- .../main/java/org/eclipse/syson/services/UtilService.java | 7 ++----- .../diagram/common/view/services/ViewNodeService.java | 2 +- .../diagram/common/view/services/ViewToolService.java | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/backend/services/syson-services/src/main/java/org/eclipse/syson/services/UtilService.java b/backend/services/syson-services/src/main/java/org/eclipse/syson/services/UtilService.java index dde791594..cfdfeebb4 100644 --- a/backend/services/syson-services/src/main/java/org/eclipse/syson/services/UtilService.java +++ b/backend/services/syson-services/src/main/java/org/eclipse/syson/services/UtilService.java @@ -976,13 +976,10 @@ public Element getViewUsageOwner(Element element) { * @param editingContext * the {@link IEditingContext} of the element. It corresponds to a variable accessible from the variable * manager. - * @param diagramContext - * the {@link IDiagramContext} of the element. It corresponds to a variable accessible from the variable - * manager. * @return true if the given {@link Element} displayed in the given {@link IDiagramContext} is of the given * {@link ViewDefinition}, false otherwise. */ - public ViewDefinitionKind getViewDefinitionKind(Element element, List ancestors, IEditingContext editingContext, IDiagramContext diagramContext) { + public ViewDefinitionKind getViewDefinitionKind(Element element, List ancestors, IEditingContext editingContext) { ViewDefinitionKind kind = ViewDefinitionKind.GENERAL_VIEW; if (element instanceof ViewUsage viewUsage) { var types = viewUsage.getType(); @@ -995,7 +992,7 @@ public ViewDefinitionKind getViewDefinitionKind(Element element, List an var viewUsageContainingElement = ancestors.stream().filter(ViewUsage.class::isInstance).map(ViewUsage.class::cast).findFirst(); if (viewUsageContainingElement.isPresent()) { ViewUsage viewUsage = viewUsageContainingElement.get(); - kind = this.getViewDefinitionKind(viewUsage, List.of(), editingContext, diagramContext); + kind = this.getViewDefinitionKind(viewUsage, List.of(), editingContext); } } return kind; diff --git a/backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/services/ViewNodeService.java b/backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/services/ViewNodeService.java index 325ace6f9..47de90afd 100644 --- a/backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/services/ViewNodeService.java +++ b/backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/services/ViewNodeService.java @@ -140,7 +140,7 @@ public List getExposedElements(Element element, Element parent, EClass elementsToExpose.addAll(filteredExposedElements); // if it is not a General View, we don't want to display nested nodes as tree (i.e. sibling nodes + // composition edges), if it an ActionFlow view, we only want to display Action Nodes as root nodes, ... - var viewDefKind = this.utilService.getViewDefinitionKind(viewUsage, ancestors, editingContext, diagramContext); + var viewDefKind = this.utilService.getViewDefinitionKind(viewUsage, ancestors, editingContext); for (Element filteredExposedElement : filteredExposedElements) { boolean canBeDisplayed = new ViewFilterSwitch(viewDefKind, exposedElements, parent).doSwitch(filteredExposedElement); if (!canBeDisplayed) { diff --git a/backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/services/ViewToolService.java b/backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/services/ViewToolService.java index e000406d5..9350bafda 100644 --- a/backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/services/ViewToolService.java +++ b/backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/services/ViewToolService.java @@ -328,7 +328,7 @@ public Element dropElementFromDiagram(Element droppedElement, Node droppedNode, * @return true if the tool should be available, false otherwise. */ public boolean toolShouldBeAvailable(Element element, IEditingContext editingContext, DiagramContext diagramContext, EClass newElementType) { - ViewDefinitionKind viewDefinitionKind = this.utilService.getViewDefinitionKind(element, List.of(), editingContext, diagramContext); + ViewDefinitionKind viewDefinitionKind = this.utilService.getViewDefinitionKind(element, List.of(), editingContext); var elt = this.utilService.getViewUsageOwner(element); return switch (viewDefinitionKind) { From 261c356ebebfa2413e4a20bab7389aa93a9275dc Mon Sep 17 00:00:00 2001 From: Axel RICHARD Date: Fri, 19 Sep 2025 15:59:22 +0200 Subject: [PATCH 3/5] [fix] Align syson-tree-explorer-view settings to other modules Signed-off-by: Axel RICHARD --- .../org.eclipse.core.resources.prefs | 1 + .../.settings/org.eclipse.core.runtime.prefs | 3 + .../.settings/org.eclipse.jdt.core.prefs | 111 ++++++++++++- .../.settings/org.eclipse.jdt.ui.prefs | 154 +++++++++++++++++- .../.settings/org.eclipse.m2e.core.prefs | 2 +- .../org.springframework.ide.eclipse.prefs | 2 + 6 files changed, 266 insertions(+), 7 deletions(-) create mode 100644 backend/views/syson-tree-explorer-view/.settings/org.eclipse.core.runtime.prefs create mode 100644 backend/views/syson-tree-explorer-view/.settings/org.springframework.ide.eclipse.prefs diff --git a/backend/views/syson-tree-explorer-view/.settings/org.eclipse.core.resources.prefs b/backend/views/syson-tree-explorer-view/.settings/org.eclipse.core.resources.prefs index 839d647ee..29abf9995 100644 --- a/backend/views/syson-tree-explorer-view/.settings/org.eclipse.core.resources.prefs +++ b/backend/views/syson-tree-explorer-view/.settings/org.eclipse.core.resources.prefs @@ -2,4 +2,5 @@ eclipse.preferences.version=1 encoding//src/main/java=UTF-8 encoding//src/main/resources=UTF-8 encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 encoding/=UTF-8 diff --git a/backend/views/syson-tree-explorer-view/.settings/org.eclipse.core.runtime.prefs b/backend/views/syson-tree-explorer-view/.settings/org.eclipse.core.runtime.prefs new file mode 100644 index 000000000..a287fefdb --- /dev/null +++ b/backend/views/syson-tree-explorer-view/.settings/org.eclipse.core.runtime.prefs @@ -0,0 +1,3 @@ +#Mon Sep 24 15:04:19 CEST 2007 +eclipse.preferences.version=1 +line.separator=\n diff --git a/backend/views/syson-tree-explorer-view/.settings/org.eclipse.jdt.core.prefs b/backend/views/syson-tree-explorer-view/.settings/org.eclipse.jdt.core.prefs index ddb620c4a..c71ec9c98 100644 --- a/backend/views/syson-tree-explorer-view/.settings/org.eclipse.jdt.core.prefs +++ b/backend/views/syson-tree-explorer-view/.settings/org.eclipse.jdt.core.prefs @@ -1,13 +1,120 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.processAnnotations=disabled org.eclipse.jdt.core.compiler.release=enabled org.eclipse.jdt.core.compiler.source=17 +org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns=false org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line=false @@ -85,6 +192,7 @@ org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line @@ -340,6 +448,7 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_line_comments=false org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_wrapped_lines=false org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_if_empty diff --git a/backend/views/syson-tree-explorer-view/.settings/org.eclipse.jdt.ui.prefs b/backend/views/syson-tree-explorer-view/.settings/org.eclipse.jdt.ui.prefs index 3550682dd..67bdf35bc 100644 --- a/backend/views/syson-tree-explorer-view/.settings/org.eclipse.jdt.ui.prefs +++ b/backend/views/syson-tree-explorer-view/.settings/org.eclipse.jdt.ui.prefs @@ -27,7 +27,7 @@ cleanup.convert_functional_interfaces=false cleanup.convert_to_enhanced_for_loop=false cleanup.convert_to_enhanced_for_loop_if_loop_var_used=true cleanup.convert_to_switch_expressions=false -cleanup.correct_indentation=true +cleanup.correct_indentation=false cleanup.do_while_rather_than_while=true cleanup.double_negation=false cleanup.else_if=false @@ -44,11 +44,11 @@ cleanup.instanceof_keyword=false cleanup.invert_equals=false cleanup.join=false cleanup.lazy_logical_operator=false -cleanup.make_local_variable_final=true +cleanup.make_local_variable_final=false cleanup.make_parameters_final=false cleanup.make_private_fields_final=true cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=false +cleanup.make_variable_declarations_final=true cleanup.map_cloning=false cleanup.merge_conditional_blocks=false cleanup.multi_catch=false @@ -125,7 +125,7 @@ cleanup.unlooped_while=false cleanup.unreachable_block=false cleanup.use_anonymous_class_creation=false cleanup.use_autoboxing=false -cleanup.use_blocks=false +cleanup.use_blocks=true cleanup.use_blocks_only_for_return_and_throw=false cleanup.use_directly_map_method=false cleanup.use_lambda=true @@ -143,6 +143,7 @@ cleanup.valueof_rather_than_instantiation=false cleanup_profile=_SysON cleanup_settings_version=2 eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_SysON formatter_settings_version=23 org.eclipse.jdt.ui.ignorelowercasenames=true @@ -150,4 +151,147 @@ org.eclipse.jdt.ui.importorder=com;fr;java;javax;org; org.eclipse.jdt.ui.javadoc=true org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates=