ApplicationWorkbenchAdvisor.java
Go to the documentation of this file.
00001 package com.generalrobotix.ui.grxui;
00002 
00003 import org.eclipse.ui.IWorkbench;
00004 import org.eclipse.ui.PlatformUI;
00005 import org.eclipse.ui.application.IWorkbenchConfigurer;
00006 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
00007 import org.eclipse.ui.application.WorkbenchAdvisor;
00008 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
00009 
00010 public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
00011 
00012         private static final String PERSPECTIVE_ID = "com.generalrobotix.ui.grxui.GrxUIPerspectiveFactory";
00013 
00014         public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
00015                         IWorkbenchWindowConfigurer configurer) {
00016                 return new ApplicationWorkbenchWindowAdvisor(configurer);
00017         }
00018 
00019         public String getInitialWindowPerspectiveId() {
00020                 return PERSPECTIVE_ID;
00021         }
00022 
00023         public void initialize(IWorkbenchConfigurer configurer) {
00024         configurer.setSaveAndRestore(true);
00025     }
00026         
00027         public void preStartup(){
00028                 //window が開く前に実行される //
00029         
00030                 Activator activator = Activator.getDefault();
00031                 IWorkbench workbench = PlatformUI.getWorkbench();
00032         workbench.addWorkbenchListener(activator);
00033 
00034         try{
00035             activator.tryLockFile();
00036         } catch (Exception ex) {
00037             activator.breakStart( ex, null );
00038         }
00039                 if(activator.getImageRegistry() == null)
00040                         try {
00041                                 activator.registryImage();
00042                         } catch (Exception e) {
00043                                 e.printStackTrace();
00044                         }
00045                 if(activator.getFontRegistry() == null)
00046                         activator.registryFont();
00047                 if(activator.getColorRegistry() == null)
00048                         activator.registryColor();
00049         activator.startGrxUI();
00050         }
00051 
00052         public void postStartup(){
00053                 Activator.getDefault().checkServer();
00054                 Activator.getDefault().loadInitialProject();
00055         }
00056 }


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:52