GrxUIPerspectiveFactory.java
Go to the documentation of this file.
1 package com.generalrobotix.ui.grxui;
2 
3 import org.eclipse.ui.IFolderLayout;
4 import org.eclipse.ui.IPageLayout;
5 import org.eclipse.ui.IPerspectiveFactory;
6 import org.eclipse.ui.IWorkbench;
7 import org.eclipse.ui.IWorkbenchPage;
8 import org.eclipse.ui.IWorkbenchWindow;
9 import org.eclipse.ui.PlatformUI;
10 import org.eclipse.jface.dialogs.MessageDialog;
11 import org.eclipse.swt.widgets.Display;
12 import org.eclipse.swt.widgets.Shell;
13 
16 
17 public class GrxUIPerspectiveFactory implements IPerspectiveFactory {
18 
19  public static final String ID = "com.generalrobotix.ui.grxui.GrxUIPerspectiveFactory";
20 
21  public static final String[] views = {
22  "com.generalrobotix.ui.view.GrxItemViewPart",
23  "com.generalrobotix.ui.view.GrxJythonPromptViewPart",
24  "com.generalrobotix.ui.view.GrxORBMonitorViewPart",
25  "com.generalrobotix.ui.view.GrxProcessManagerViewPart",
26  "com.generalrobotix.ui.view.GrxServerManagerViewPart",
27  "com.generalrobotix.ui.view.GrxLoggerViewPart",
28  "com.generalrobotix.ui.view.GrxGraphViewPart",
29  "com.generalrobotix.ui.view.GrxPropertyViewPart",
30  "com.generalrobotix.ui.view.GrxRobotStatViewPart",
31  "com.generalrobotix.ui.view.Grx3DViewPart",
32  "com.generalrobotix.ui.view.GrxOpenHRPViewPart",
33  "com.generalrobotix.ui.view.GrxCollisionPairViewPart",
34  "com.generalrobotix.ui.view.GrxControllerViewPart",
35  "com.generalrobotix.ui.view.GrxTextEditorViewPart"};
36 
37 
38  public static Shell getCurrentShell(){
39  Shell ret = null;
40  IWorkbench workbench = PlatformUI.getWorkbench();
41  if( workbench != null){
42  IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow();
43  if(activeWindow != null){
44  IWorkbenchPage activePage = activeWindow.getActivePage();
45  if(activePage != null){
46  if ( activePage.getPerspective().getId().contains(GrxUIPerspectiveFactory.ID) ){
47  ret = activeWindow.getShell();
48  return ret;
49  }
50  }
51  }
52  for( IWorkbenchWindow window : workbench.getWorkbenchWindows() ){
53  for(IWorkbenchPage page:window.getPages()){
54  if ( page.getPerspective().getId().contains(GrxUIPerspectiveFactory.ID) ){
55  ret = window.getShell();
56  break;
57  }
58  }
59  }
60  }
61  return ret;
62  }
63 
65  System.out.println("INIT GrxUIPerspectiveFactory");
66  }
67 
68  public void createInitialLayout(IPageLayout layout) {
69  System.out.println("START GrxUIPerspectiveFactory");
70 
71  // エディタ領域を取得
72  String editorArea = layout.getEditorArea();
73 
74  // フォルダの作成
75  IFolderLayout top_folder = layout.createFolder("TopViews",
76  IPageLayout.TOP, (float) 0.11f, editorArea);
77  IFolderLayout right_middle = layout.createFolder("RightMIDDLEViews",
78  IPageLayout.RIGHT, (float) 0.6f, editorArea);
79  IFolderLayout middle = layout.createFolder("MiddleViews",
80  IPageLayout.BOTTOM, (float) 0.4f, editorArea);
81  IFolderLayout top_left = layout.createFolder("TopLeftViews",
82  IPageLayout.LEFT, (float) 0.6f, editorArea);
83  IFolderLayout top_right = layout.createFolder("TopRightViews",
84  IPageLayout.RIGHT, (float) 0.35f, "TopLeftViews");
85 
86  top_folder.addView("com.generalrobotix.ui.view.GrxLoggerViewPart");
87  top_left.addView("com.generalrobotix.ui.view.GrxItemViewPart");
88 
89  top_right.addView("com.generalrobotix.ui.view.GrxORBMonitorViewPart");
90  top_right
91  .addView("com.generalrobotix.ui.view.GrxProcessManagerViewPart");
92  top_right
93  .addView("com.generalrobotix.ui.view.GrxServerManagerViewPart");
94  //top_right.addView("com.generalrobotix.ui.view.GrxLoggerViewPart");
95 
96  right_middle.addView("com.generalrobotix.ui.view.GrxGraphViewPart");
97  right_middle.addView("com.generalrobotix.ui.view.GrxPropertyViewPart");
98  right_middle.addView("com.generalrobotix.ui.view.GrxRobotStatViewPart");
99 
100  middle.addView("com.generalrobotix.ui.view.Grx3DViewPart");
101  middle.addView("com.generalrobotix.ui.view.GrxOpenHRPViewPart");
102  middle.addView("com.generalrobotix.ui.view.GrxControllerViewPart");
103  middle.addView("com.generalrobotix.ui.view.GrxCollisionPairViewPart");
104  middle.addView("com.generalrobotix.ui.view.GrxTextEditorViewPart");
105 
106  // エディタ領域不可視
107  layout.setEditorAreaVisible(false);
108  }
109 }
#define null
our own NULL pointer
Definition: IceTypes.h:57
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
org


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:38