- Timestamp:
- 02/11/13 15:43:54 (12 years ago)
- Location:
- trunk/modelicaml/org.openmodelica.modelicaml.view.componentstree/src/org/openmodelica/modelicaml/view/componentstree
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modelicaml/org.openmodelica.modelicaml.view.componentstree/src/org/openmodelica/modelicaml/view/componentstree/views/ComponentsTree.java
r1694 r1707 130 130 import org.openmodelica.modelicaml.common.services.StringUtls; 131 131 import org.openmodelica.modelicaml.common.utls.ResourceManager; 132 import org.openmodelica.modelicaml.common.utls.SWTResourceManager; 132 133 import org.openmodelica.modelicaml.common.validation.services.ModelicaMLMarkerSupport; 133 134 import org.openmodelica.modelicaml.gen.modelica.cg.helpers.OMCClassValidator; … … 139 140 import org.openmodelica.modelicaml.view.componentstree.Activator; 140 141 import org.openmodelica.modelicaml.view.componentstree.dialogs.DialogComponentModification; 142 import org.openmodelica.modelicaml.view.componentstree.dialogs.ElementSelectionDialog; 141 143 import org.openmodelica.modelicaml.view.componentstree.dialogs.SearchDialog; 142 144 import org.openmodelica.modelicaml.view.componentstree.dialogs.UpdateBindingsConfirmationDialog; … … 246 248 private Action actionReload; 247 249 250 public Action actionReloadAndValidate; 251 248 252 private IAction actionExpandArrays; 249 253 … … 284 288 private String markerType = Constants.MARKERTYPE_COMPONENT_MODIFICATION; 285 289 286 290 /* 291 * dialog used to select an element from the model browser 292 */ 293 private ElementSelectionDialog elementSelectionDialog; 294 295 private Action actionElementSelectedByDialog; 287 296 288 297 … … 617 626 */ 618 627 private void fillLocalToolBar(IToolBarManager manager) { 628 manager.add(actionReload); 629 manager.add(new Separator()); 619 630 manager.add(actionFind); 620 manager.add(new Separator());621 manager.add(actionReload);631 // manager.add(new Separator()); 632 // manager.add(actionReloadAndValidate); 622 633 manager.add(new Separator()); 623 634 manager.add(actionValidate); … … 710 721 actionFind.setImageDescriptor(ImageDescriptor.createFromFile(Activator.class, "/icons/find.png")); 711 722 712 713 714 723 actionReload = new Action("actionReload") { 715 724 public void run() { 725 726 727 elementSelectionDialog = new ElementSelectionDialog( 728 //PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), // don't use this because it will block the window underneath 729 new Shell(), 730 SWTResourceManager.getImage(ElementSelectionDialog.class,"/icons/selectItem.gif"), 731 "Element Selection", 732 "Select the model to be instantiated", 733 selectedClass, 734 actionElementSelectedByDialog 735 ); 736 737 elementSelectionDialog.open(); 738 } 739 }; 740 actionReload.setText("(Reload"); 741 actionReload.setToolTipText("Reload"); 742 actionReload.setImageDescriptor(ImageDescriptor.createFromFile(Activator.class, "/icons/refresh.gif")); 743 actionReload.setEnabled(true); 744 745 746 actionElementSelectedByDialog = new Action("actionElementSelectedByDialog") { 747 public void run() { 748 749 // get the selected element from the dialog and set the view selected class 750 if (elementSelectionDialog != null) { 751 EObject selectedElement = elementSelectionDialog.getSelectedElement(); 752 if (selectedElement instanceof Class) { 753 selectedClass = (Class) selectedElement; 754 755 // close the dialog 756 elementSelectionDialog.dispose(); 757 758 // re-create the tree 759 reCreateTree(); 760 } 761 } 762 } 763 }; 764 actionElementSelectedByDialog.setText("(Reload"); 765 actionElementSelectedByDialog.setToolTipText("Reload"); 766 actionElementSelectedByDialog.setImageDescriptor(ImageDescriptor.createFromFile(Activator.class, "/icons/refresh.gif")); 767 actionElementSelectedByDialog.setEnabled(true); 768 769 770 771 772 773 actionReloadAndValidate = new Action("actionReloadAndValidate") { 774 public void run() { 775 716 776 showSelection(par, sel); 717 777 … … 725 785 } 726 786 }; 727 actionReload .setText("(Re)load and validate");728 actionReload .setToolTipText("(Re)load and validate");729 actionReload .setImageDescriptor(ImageDescriptor.createFromFile(Activator.class, "/icons/refresh.gif"));730 actionReload .setEnabled(false);787 actionReloadAndValidate.setText("(Re)load and validate"); 788 actionReloadAndValidate.setToolTipText("(Re)load and validate"); 789 actionReloadAndValidate.setImageDescriptor(ImageDescriptor.createFromFile(Activator.class, "/icons/refresh.gif")); 790 actionReloadAndValidate.setEnabled(false); 731 791 732 792 actionValidateComponentModifications = new Action("actionValidateComponentModifications") { //obviously a check box style … … 2226 2286 par = sourcepart; 2227 2287 2228 Object[] expandedElements = viewer.getExpandedElements();2229 TreePath[] expandedTreePaths = viewer.getExpandedTreePaths();2288 // Object[] expandedElements = viewer.getExpandedElements(); 2289 // TreePath[] expandedTreePaths = viewer.getExpandedTreePaths(); 2230 2290 2231 2291 // build new tree … … 2240 2300 selectedClass = (Class) selectedElement; 2241 2301 2242 createTree(); 2243 } 2244 } 2302 // createTree(); 2303 } 2304 } 2305 } 2306 2307 // set new input from the selection. 2308 // viewer.setInput(getViewSite()); 2309 // 2310 // viewer.setExpandedElements(expandedElements); 2311 // viewer.setExpandedTreePaths(expandedTreePaths); 2312 2313 reCreateTree(); 2314 } 2315 2316 2317 public void reCreateTree() { 2318 2319 Object[] expandedElements = viewer.getExpandedElements(); 2320 TreePath[] expandedTreePaths = viewer.getExpandedTreePaths(); 2321 2322 if (selectedClass instanceof Class) { 2323 createTree(); 2245 2324 } 2246 2325 … … 2251 2330 viewer.setExpandedTreePaths(expandedTreePaths); 2252 2331 } 2332 2253 2333 2254 2334 /* … … 2394 2474 actionSimulate.setEnabled(true); 2395 2475 actionValidate.setEnabled(true); 2396 actionReload .setEnabled(true);2476 actionReloadAndValidate.setEnabled(true); 2397 2477 actionCollapseAll.setEnabled(true); 2398 2478 … … 2439 2519 actionSimulate.setEnabled(false); 2440 2520 actionValidate.setEnabled(false); 2441 actionReload .setEnabled(false);2521 actionReloadAndValidate.setEnabled(false); 2442 2522 actionCollapseAll.setEnabled(false); 2443 2523 }
Note: See TracChangeset
for help on using the changeset viewer.