Perspective.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.viewer.framework;
00002 
00003 import org.eclipse.swt.SWT;
00004 import org.eclipse.ui.IFolderLayout;
00005 import org.eclipse.ui.IPageLayout;
00006 import org.eclipse.ui.IPerspectiveFactory;
00007 
00008 import edu.rice.cs.hpc.filter.view.FilterView;
00009 import edu.rice.cs.hpc.viewer.scope.bottomup.CallerScopeView;
00010 import edu.rice.cs.hpc.viewer.scope.flat.FlatScopeView;
00011 import edu.rice.cs.hpc.viewer.scope.topdown.ScopeView;
00012 import edu.rice.cs.hpc.viewer.window.ViewerWindow;
00013 
00014 
00015 /*****
00016  * 
00017  * Default perspective for the viewer
00018  *
00019  */
00020 public class Perspective implements IPerspectiveFactory {
00021     
00022     final private static String FOLDER_ID = "metricViews";
00023     
00024     // we have to use IFoderLayout instead of IPlaceFolderLayout since its states will be stored. 
00025     private IFolderLayout[] objLayout = new IFolderLayout[ViewerWindow.maxDbNum];
00026 
00027     public void createInitialLayout(IPageLayout layout) {
00028         // get the main area
00029         String editorArea = layout.getEditorArea();
00030         layout.setEditorAreaVisible(true);
00031         layout.setFixed(false);
00032         
00033         // configure the view layout, create a separate partition (layout folder) for each of the databases that can be opened
00034         // this will group the views for each database so they can be treated as a one thing (minimize, restore, resizing, relocating)
00035         for (int i=0 ; i<ViewerWindow.maxDbNum ; i++) {
00036             if (i==0) {
00037                 objLayout[i] = layout.createFolder(FOLDER_ID + i, IPageLayout.BOTTOM, 0.6f, editorArea);
00038             } else {
00039                 objLayout[i] = layout.createFolder(FOLDER_ID + i, IPageLayout.RIGHT, 0.3f, "metricViews"+ (i-1));
00040             }
00041             objLayout[i].addView(ScopeView.ID + ":" + i);
00042             objLayout[i].addView(CallerScopeView.ID + ":" + i);
00043             objLayout[i].addView(FlatScopeView.ID + ":" + i);
00044         }
00045         layout.addView(FilterView.ID, SWT.RIGHT, .5f, editorArea);
00046     }
00047     
00048     // This method allows an external package to add views to the layout folders created above.
00049     // It is not needed by any code in the Rice viewer but Bull's viewer extensions will need something like 
00050     // this and it is general enough that it could also be used by other organizations wishing to extend the 
00051     // features offered in the standard Rice viewer.
00052     public void createInitialLayout(IPageLayout layout, String baseViewId) {
00053         for (int i=0 ; i<ViewerWindow.maxDbNum ; i++) {
00054             objLayout[i].addPlaceholder(baseViewId +  ":" + i);
00055         }
00056     }
00057 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1