Ignore:
Timestamp:
11/22/11 21:36:06 (13 years ago)
Author:
wschamai
Message:
  • Modelica code import enhancements and bug fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modelicaml/org.openmodelica.modelicaml.common/src/org/openmodelica/modelicaml/common/services/PapyrusServices.java

    r1060 r1130  
    1616public class PapyrusServices {
    1717
     18    public static CommonViewer getModelExplorerView(){
     19        IViewPart view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView("org.eclipse.papyrus.modelexplorer.modelexplorer");
     20
     21        ModelExplorerPageBookView modelExplorerPageBookView = null;
     22        if (view instanceof ModelExplorerPageBookView) {
     23            modelExplorerPageBookView = (ModelExplorerPageBookView)view;
     24        }
     25        CommonViewer modelExplorerView = ((ModelExplorerView) modelExplorerPageBookView.getAdapter(ModelExplorerView.class)).getCommonViewer();
     26
     27        return modelExplorerView;
     28    }
     29   
     30   
     31    public static boolean isVisiblePapyrusModelExplorerView(){
     32        IViewPart view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView("org.eclipse.papyrus.modelexplorer.modelexplorer");
     33
     34        ModelExplorerPageBookView modelExplorerPageBookView = null;
     35        if (view instanceof ModelExplorerPageBookView) {
     36            modelExplorerPageBookView = (ModelExplorerPageBookView)view;
     37        }
     38        CommonViewer modelExplorerView = ((ModelExplorerView) modelExplorerPageBookView.getAdapter(ModelExplorerView.class)).getCommonViewer();
     39        if (modelExplorerView != null) {
     40            return modelExplorerView.getControl().isVisible();
     41        }
     42       
     43        return false;
     44    }
     45   
    1846    public static void locate(Object object){
    1947        if (object instanceof EObject) {
     
    2957            items.add(modelExplorerPageBookView.findElementForEObject( modelExplorerView, (EObject)object));
    3058           
     59            // set focus
     60            modelExplorerView.getControl().setFocus();
     61
    3162            // set new selection
    3263            modelExplorerView.setSelection(new StructuredSelection(items), true);
    33         }
     64           
     65        }
    3466    }
    3567   
     
    4678            List<Object> items = new ArrayList<Object>();
    4779            items.add(modelExplorerPageBookView.findElementForEObject( modelExplorerView, (EObject)object));
     80
     81            // set focus
     82            modelExplorerView.getControl().setFocus();
    4883           
    4984            // reset the selection so that the components tree can instantiate the selected class again
Note: See TracChangeset for help on using the changeset viewer.