- Timestamp:
- 05/31/12 17:24:02 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modelicaml/org.openmodelica.modelicaml.simulation/src/org/openmodelica/modelicaml/simulation/testexecution/dialogs/SelectTestSimulationModelsToExecuteDialog.java
r1376 r1522 31 31 import org.eclipse.uml2.uml.Element; 32 32 import org.eclipse.uml2.uml.NamedElement; 33 import org.openmodelica.modelicaml.common.dialogs.DialogMessage;34 33 import org.openmodelica.modelicaml.common.services.ModelicaMLServices; 35 34 import org.openmodelica.modelicaml.common.utls.ResourceManager; … … 51 50 private List<TreeItem> treeItems = new ArrayList<TreeItem>(); 52 51 53 private static final int DECORATION_WARNING = 0 ;54 private static final int DECORATION_ERROR = 1 ;52 // private static final int DECORATION_WARNING = 0 ; 53 // private static final int DECORATION_ERROR = 1 ; 55 54 56 55 private final ImageDescriptor warningImageDescriptor = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING); … … 74 73 super.configureShell(newShell); 75 74 newShell.setImage(ResourceManager.getPluginImage("org.openmodelica.modelicaml.profile","resources/icons/icons16/execute.png")); 76 newShell.setText(" Test Simulation Models Selection for Execution");75 newShell.setText("Simulation Models Selection"); 77 76 } 78 77 … … 84 83 @Override 85 84 protected Control createDialogArea(Composite parent) { 86 setTitleImage(ResourceManager.getPluginImage("org.openmodelica.modelicaml.profile","resources/icons/icons16/ generateSimMopdels.png"));85 setTitleImage(ResourceManager.getPluginImage("org.openmodelica.modelicaml.profile","resources/icons/icons16/tscriptrun.gif")); 87 86 setMessage("Note: you can select all models that are in a package by selecting the package."); 88 87 // setTitle("Test Scenarios and Requirements Selection"); 89 setTitle("Select testsimulation models that should be executed.");88 setTitle("Select simulation models that should be executed."); 90 89 91 90 Composite area = (Composite) super.createDialogArea(parent); … … 100 99 // tbtmTestScenarios.setImage(ResourceManager.getPluginImage("org.eclipse.ui", "/icons/full/elcl16/close_view.gif")); 101 100 String metricPreSelected = "("+selectedTestSimulationModels.size() + ")"; 102 tbtmPreSelectedTestSimulationModels.setText("Preselected TestScenarios " + metricPreSelected);101 tbtmPreSelectedTestSimulationModels.setText("Preselected Scenarios " + metricPreSelected); 103 102 104 103 final Tree treePreSelectedTestSimulationModels = new Tree(tabFolder, SWT.CHECK); … … 298 297 } 299 298 300 // private void createRequirementTreeItem(TreeItem parentItem, Element req, Element testScenario, boolean isDiscarded){ 301 // String prefix = requirementNamePrefix; 302 // TreeItem reqItem = new TreeItem(parentItem, 0); 303 // treeItems.add(reqItem); 304 // TreeItemData reqData = new TreeItemData(); 305 // reqData.setIsRequirement(true); 306 // reqData.setRequirementElement(req); 307 // reqData.setTestSimulationModelElement(testScenario); 308 // 309 // // if this is a requirement for which not all required clients are satisfied: 310 // if (this.discardedRequirements.contains(req)) { 311 // // DO NOT preselect 312 // reqItem.setChecked(false); 313 // reqData.setIsDiscarded(true); 314 // reqItem.setImage(decorateError(ResourceManager.getPluginImage("org.openmodelica.modelicaml.profile", "resources/icons/icons16/requirement.gif"))); 315 // // propagate error to all parents 316 // propagateDecoration(reqItem, DECORATION_ERROR); 317 // } 318 // else { 319 // reqData.setIsDiscarded(false); 320 // reqItem.setImage(ResourceManager.getPluginImage("org.openmodelica.modelicaml.profile", "resources/icons/icons16/requirement.gif")); 321 // 322 // // if the discarded tree is being built then do not preselect requirements and add them to the initial map. 323 // if (!isDiscarded) { 324 // // initially add to map 325 // addToTestScenarioToRequirementsMap(testScenario, req); 326 // // preselect 327 // reqItem.setChecked(true); 299 300 // Utls ************************************************************************ 301 302 private void clearAllLists(){ 303 userSelectedTestSimulationModels.clear(); 304 treeItems.clear(); 305 } 306 307 308 // Image handling ************************************************************************ 309 310 // private void propagateDecoration(TreeItem item, int decoration){ 311 // Image image = item.getImage(); 312 // if (image != null) { 313 // if (decoration == DECORATION_ERROR) { 314 // item.setImage(decorateError(image)); 315 // } 316 // else if (decoration == DECORATION_WARNING) { 317 // item.setImage(decorateError(image)); 328 318 // } 329 319 // } 330 320 // 331 // prefix = prefix + ModelicaMLServices.getRequirementID(req) + " - "; 332 // 333 // reqItem.setText(prefix + ((NamedElement)req).getName() + " ("+((NamedElement)req.getOwner()).getQualifiedName()+")"); 334 // reqItem.setData(reqData); 335 // } 336 337 // Tree Item Description Handling ************************************************************************ 338 339 // private void openDescription(TreeItem item){ 340 // Object data = item.getData(); 341 // if (data instanceof TreeItemData) { 342 // Element testSceanrio = null; 343 // if ( ((TreeItemData)data).isTestSimulationModel) { 344 // // get the test scenario and create a description of the combination 345 // testSceanrio = ((TreeItemData)data).getTestSimulationModelElement(); 346 // } 347 // 348 // if (testSceanrio != null) { 349 // String description = createDescription(testSceanrio); 350 // DialogMessage dialog = new DialogMessage(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Test Simulation Model: Details", 351 // "Details of the selected combination of system model and test scenario:", 352 // description); 353 // dialog.open(); 354 // } 321 // if (item.getParentItem() != null) { 322 // propagateDecoration(item.getParentItem(), decoration); 355 323 // } 356 324 // } 357 //358 // private String createDescription(Element testScenario){359 // String description = "";360 // TestSimulationModelCombination tsmc = tsToTestSimulationModelCombination.get(testScenario);361 // if (tsmc != null) {362 // Element systemModel = tsmc.getSystemModel();363 // description = description +364 // lineDelimiterString +365 // "\nSystem Model: '"+((NamedElement)systemModel).getName()+"' ("+((NamedElement)systemModel).getQualifiedName()+")" +366 // getAdditionalModelsString(tsmc.getRequiredModels_systemModel(), tsmc, systemModel) +367 //368 // lineDelimiterString +369 // "\nTest Scenario: '"+((NamedElement)testScenario).getName()+"'("+((NamedElement)testScenario).getQualifiedName()+")" +370 // getAdditionalModelsString(tsmc.getRequiredModels_testScenario(), tsmc, testScenario)371 // ;372 //373 // description = description + getRequirementsString("", tsmc.getRequirements(), tsmc);374 // }375 // return description.trim();376 // }377 //378 // private static final String lineDelimiterString = "\n";379 //// "\n------------------------------------------------------------------------------ \n";380 //381 //382 // private String getAdditionalModelsString(HashSet<Element> set, TestSimulationModelCombination tsmc, Element model){383 // String string = "";384 // if (set != null && set.size() > 0) {385 // string = "\n - models required in addition: \n";386 // string = string + getAdditionalModelsStringParts(set, " ", tsmc)387 // + getUnsatisfiedClients(" ", model, tsmc);388 // }389 //390 // return string;391 // }392 //393 // private String getRequirementsString(String prefix, HashSet<Class> set, TestSimulationModelCombination tsmc){394 // String string = "";395 // HashSet<Element> tempSet = new HashSet<Element>();396 // for (Element element : set) {397 // tempSet.add(element);398 // }399 //400 // List<Element> sortedList = ModelicaMLServices.getSortedByName(tempSet);401 // for (Element requirement : sortedList) {402 // if (requirement instanceof NamedElement) {403 // string = string + lineDelimiterString;404 // string = string + prefix +"Requirement: '" + ((NamedElement)requirement).getName()405 // + "' ("+((NamedElement)requirement).getQualifiedName()+")";406 // string = string + getAdditionalModelsString(tsmc.getRequiredModels_requirements().get(requirement), tsmc, requirement) + "\n";407 // string = string + getUnsatisfiedClients(" ", requirement, tsmc);408 // }409 // }410 // return string;411 // }412 //413 // private String getAdditionalModelsStringParts(HashSet<Element> set, String prefix, TestSimulationModelCombination tsmc){414 // String string = "";415 // List<Element> sortedList = ModelicaMLServices.getSortedByName(set);416 // for (Element element : sortedList) {417 // if (element instanceof NamedElement) {418 // string = string + prefix + "- " + getAlwaysIncludeString(element, tsmc) + ((NamedElement)element).getName()419 // + " ("+((NamedElement)element).getQualifiedName()+")\n";420 // }421 // }422 // return string;423 // }424 //425 // private String getAlwaysIncludeString(Element model, TestSimulationModelCombination tsmc){426 // String string = "";427 // if (tsmc.getAlwaysInclude().contains(model)) {428 // return "(always) ";429 // }430 //431 // return string;432 // }433 //434 // private String getUnsatisfiedClients(String prefix, Element element, TestSimulationModelCombination tsmc){435 // String string = "";436 // String unsatisfiedClientsString = tsmc.getClientsDotPathAsString(tsmc.getUnsatisfiedRequiredClients(element));437 // if (!unsatisfiedClientsString.trim().equals("")) {438 // string = prefix + "- unsatisfied required clients: " + "\n";439 // string = string + prefix + " " + unsatisfiedClientsString;440 // }441 // return string;442 // }443 444 // Utls ************************************************************************445 446 private void clearAllLists(){447 userSelectedTestSimulationModels.clear();448 treeItems.clear();449 }450 451 452 // Image handling ************************************************************************453 454 private void propagateDecoration(TreeItem item, int decoration){455 Image image = item.getImage();456 if (image != null) {457 if (decoration == DECORATION_ERROR) {458 item.setImage(decorateError(image));459 }460 else if (decoration == DECORATION_WARNING) {461 item.setImage(decorateError(image));462 }463 }464 465 if (item.getParentItem() != null) {466 propagateDecoration(item.getParentItem(), decoration);467 }468 }469 325 470 326 public Image decorateWarning(Image image) { … … 475 331 return new DecorationOverlayIcon(image, errorImageDescriptor, IDecoration.BOTTOM_RIGHT).createImage(); 476 332 } 477 478 // public Image decorateDiscarded(Image image) { 479 // return new DecorationOverlayIcon(image, warningImageDescriptor, IDecoration.BOTTOM_RIGHT).createImage(); 480 // } 481 333 482 334 483 335 // Listener ************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.