Browse Source

added check, so only decalaration or type variable, event and operation
causes warnings, added useage of events and variables to "Declaration"
model #107

bohl 10 years ago
parent
commit
da73202a60

+ 6 - 2
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextJavaValidator.java

@@ -279,7 +279,7 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 		}
 		List<ElementReferenceExpression> allUsedElementReferences = EcoreUtil2.getAllContentsOfType(sct,
 				ElementReferenceExpression.class);
-		
+
 		if (sct.getSpecification() != null) {
 			for (Declaration internalDeclaration : internalScopeDeclarations) {
 				boolean internalDeclarationUsed = false;
@@ -310,7 +310,11 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 					}
 				}
 				if (!internalDeclarationUsed) {
-					warning(INTERNAL_DECLARATION_UNUSED, internalDeclaration, null, -1);
+
+					if (internalDeclaration instanceof VariableDefinition
+							|| internalDeclaration instanceof EventDefinition
+							|| internalDeclaration instanceof OperationDefinition)
+						warning(INTERNAL_DECLARATION_UNUSED, internalDeclaration, null, -1);
 				}
 			}
 		}

File diff suppressed because it is too large
+ 162 - 72
test-plugins/org.yakindu.sct.test.models/testmodels/SCTUnit/Declarations.sct