GrxUIPerspectiveFactory.java
Go to the documentation of this file.
00001 package com.generalrobotix.ui.grxui;
00002 
00003 import org.eclipse.ui.IFolderLayout;
00004 import org.eclipse.ui.IPageLayout;
00005 import org.eclipse.ui.IPerspectiveFactory;
00006 import org.eclipse.ui.IWorkbench;
00007 import org.eclipse.ui.IWorkbenchPage;
00008 import org.eclipse.ui.IWorkbenchWindow;
00009 import org.eclipse.ui.PlatformUI;
00010 import org.eclipse.jface.dialogs.MessageDialog;
00011 import org.eclipse.swt.widgets.Display;
00012 import org.eclipse.swt.widgets.Shell;
00013 
00014 import com.generalrobotix.ui.util.GrxDebugUtil;
00015 import com.generalrobotix.ui.util.MessageBundle;
00016 
00017 public class GrxUIPerspectiveFactory implements IPerspectiveFactory {
00018 
00019     public static final String ID = "com.generalrobotix.ui.grxui.GrxUIPerspectiveFactory";
00020     
00021     public static final String[] views = {
00022             "com.generalrobotix.ui.view.GrxItemViewPart",
00023             "com.generalrobotix.ui.view.GrxJythonPromptViewPart",
00024             "com.generalrobotix.ui.view.GrxORBMonitorViewPart",
00025             "com.generalrobotix.ui.view.GrxProcessManagerViewPart",
00026             "com.generalrobotix.ui.view.GrxServerManagerViewPart",
00027             "com.generalrobotix.ui.view.GrxLoggerViewPart",
00028             "com.generalrobotix.ui.view.GrxGraphViewPart",
00029             "com.generalrobotix.ui.view.GrxPropertyViewPart",
00030             "com.generalrobotix.ui.view.GrxRobotStatViewPart",
00031             "com.generalrobotix.ui.view.Grx3DViewPart",
00032             "com.generalrobotix.ui.view.GrxOpenHRPViewPart",
00033             "com.generalrobotix.ui.view.GrxCollisionPairViewPart",
00034             "com.generalrobotix.ui.view.GrxControllerViewPart",
00035             "com.generalrobotix.ui.view.GrxTextEditorViewPart"};
00036 
00037     
00038     public static Shell getCurrentShell(){
00039         Shell   ret = null;
00040         IWorkbench workbench = PlatformUI.getWorkbench();
00041         if( workbench != null){
00042                 IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow();
00043                 if(activeWindow != null){
00044                         IWorkbenchPage activePage = activeWindow.getActivePage();
00045                         if(activePage != null){
00046                                 if ( activePage.getPerspective().getId().contains(GrxUIPerspectiveFactory.ID) ){
00047                         ret = activeWindow.getShell();
00048                         return ret;
00049                     }
00050                         }
00051                 }
00052             for( IWorkbenchWindow window : workbench.getWorkbenchWindows() ){
00053                 for(IWorkbenchPage page:window.getPages()){
00054                     if ( page.getPerspective().getId().contains(GrxUIPerspectiveFactory.ID) ){
00055                         ret = window.getShell();
00056                         break;
00057                     }
00058                 }
00059             }
00060         }
00061         return ret;
00062     }
00063     
00064     public GrxUIPerspectiveFactory() {
00065         System.out.println("INIT GrxUIPerspectiveFactory");
00066     }
00067 
00068     public void createInitialLayout(IPageLayout layout) {
00069         System.out.println("START GrxUIPerspectiveFactory");
00070         
00071         // エディタ領域を取得
00072         String editorArea = layout.getEditorArea();
00073 
00074         // フォルダの作成
00075         IFolderLayout top_folder = layout.createFolder("TopViews",
00076                 IPageLayout.TOP, (float) 0.11f, editorArea);
00077         IFolderLayout right_middle = layout.createFolder("RightMIDDLEViews",
00078                 IPageLayout.RIGHT, (float) 0.6f, editorArea);
00079         IFolderLayout middle = layout.createFolder("MiddleViews",
00080                 IPageLayout.BOTTOM, (float) 0.4f, editorArea);
00081         IFolderLayout top_left = layout.createFolder("TopLeftViews",
00082                 IPageLayout.LEFT, (float) 0.6f, editorArea);
00083         IFolderLayout top_right = layout.createFolder("TopRightViews",
00084                 IPageLayout.RIGHT, (float) 0.35f, "TopLeftViews");
00085 
00086         top_folder.addView("com.generalrobotix.ui.view.GrxLoggerViewPart");
00087         top_left.addView("com.generalrobotix.ui.view.GrxItemViewPart");
00088 
00089         top_right.addView("com.generalrobotix.ui.view.GrxORBMonitorViewPart");
00090         top_right
00091                 .addView("com.generalrobotix.ui.view.GrxProcessManagerViewPart");
00092         top_right
00093                 .addView("com.generalrobotix.ui.view.GrxServerManagerViewPart");
00094         //top_right.addView("com.generalrobotix.ui.view.GrxLoggerViewPart");
00095 
00096         right_middle.addView("com.generalrobotix.ui.view.GrxGraphViewPart");
00097         right_middle.addView("com.generalrobotix.ui.view.GrxPropertyViewPart");
00098         right_middle.addView("com.generalrobotix.ui.view.GrxRobotStatViewPart");
00099 
00100         middle.addView("com.generalrobotix.ui.view.Grx3DViewPart");
00101         middle.addView("com.generalrobotix.ui.view.GrxOpenHRPViewPart");
00102         middle.addView("com.generalrobotix.ui.view.GrxControllerViewPart");
00103         middle.addView("com.generalrobotix.ui.view.GrxCollisionPairViewPart");
00104         middle.addView("com.generalrobotix.ui.view.GrxTextEditorViewPart");
00105 
00106         // エディタ領域不可視
00107         layout.setEditorAreaVisible(false);
00108     }
00109 }


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sun Apr 2 2017 03:43:54