- Timestamp:
- 06/28/11 21:31:22 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modelicaml/org.openmodelica.modelicaml.view.componentstree/src/org/openmodelica/modelicaml/view/componentstree/display/ViewLabelProvider.java
r855 r860 52 52 import org.eclipse.ui.ISharedImages; 53 53 import org.eclipse.ui.PlatformUI; 54 import org.eclipse.uml2.uml.Element; 54 55 import org.eclipse.uml2.uml.Port; 56 import org.eclipse.uml2.uml.PrimitiveType; 55 57 import org.eclipse.uml2.uml.Property; 56 58 import org.eclipse.uml2.uml.Region; … … 381 383 public boolean hasErrors(TreeParent treeParent) { 382 384 HashSet<TreeObject> list = new HashSet<TreeObject>(); 383 list.addAll(findNextInvalidItem(treeParent ));385 list.addAll(findNextInvalidItem(treeParent, false)); 384 386 if (list.size() > 0 ) { 385 387 // for (TreeObject treeObject : list) { … … 392 394 393 395 394 private HashSet<TreeObject> findNextInvalidItem(TreeParent treeParent ){396 private HashSet<TreeObject> findNextInvalidItem(TreeParent treeParent, boolean parentIsInput){ 395 397 HashSet<TreeObject> list = new HashSet<TreeObject>(); 398 boolean parentIsAnInput = false; 396 399 397 // if property has no type 400 // if property has no type -> indicate error 398 401 if (treeParent.getUmlElement() instanceof Property && treeParent.getComponentType() == null) { 399 402 list.add(treeParent); 403 404 // stop searching here 400 405 return list; 406 } 407 408 Element umlElement = treeParent.getUmlElement(); 409 410 // if one of the parents is input 411 if ( parentIsInput ) { 412 if (umlElement != null ) { 413 // if it is a primitive type -> indicate an error 414 if ( ((Property)umlElement).getType() instanceof PrimitiveType 415 && (treeParent.getDeclaration() == null && treeParent.getFinalModificationRightHand() == null)) { 416 list.add(treeParent); 417 } 418 } 401 419 } 402 420 403 421 // if property is input and has no declaration and no binding equation exists for it in its first level component modification 404 422 if (treeParent.isInput() && treeParent.getDeclaration() == null && treeParent.getFinalModificationRightHand() == null) { 405 // TODO: check if the item is a component of a port that has causality input ... 406 if (treeParent.getUmlElement() != null && !(treeParent.getUmlElement() instanceof Port)) { 407 list.add(treeParent); 408 } 409 return list; 410 } 411 423 424 if (umlElement != null ) { 425 426 // check if the item is a component of a port that has causality input ... 427 if (umlElement instanceof Property && !(umlElement instanceof Port) ) { 428 429 // if it is a primitive type -> indicate an error 430 if ( ((Property)umlElement).getType() instanceof PrimitiveType) { 431 list.add(treeParent); 432 433 // stop here 434 return list; 435 } 436 // not of primitive type -> remember that this parent was an input in order to check its children 437 else { 438 439 // System.err.println(treeParent.getDotPath() + " parentIsInput: " + parentIsInput); 440 parentIsAnInput = true; 441 } 442 } 443 } 444 // // stop here 445 // return list; 446 } 447 448 // go on with search ... 412 449 TreeObject[] children = treeParent.getChildren(); 413 450 for (int i = 0; i < children.length; i++) { 414 451 if (children[i] instanceof TreeParent) { 415 list.addAll(findNextInvalidItem( (TreeParent)children[i] ));452 list.addAll(findNextInvalidItem( (TreeParent)children[i] , parentIsAnInput)); 416 453 } 417 454 }
Note: See TracChangeset
for help on using the changeset viewer.