org.eclipse.ui.PerspectiveAdapter Java Examples

The following examples show how to use org.eclipse.ui.PerspectiveAdapter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UiStartupHandler.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
    public void earlyStartup() {
        /*
         * The registration of the listener should have been done in the UI thread
         * since  PlatformUI.getWorkbench().getActiveWorkbenchWindow() returns null
         * if it is called outside of the UI thread.
         * */
         Display.getDefault().asyncExec(new Runnable() {
           /* (non-Javadoc)
           * @see java.lang.Runnable#run()
           */
           public void run() {
               SdkUtils.autoLoadSdksOnEarlyStart();
        	   UpdateManager.activateXdsUpdateContext();
        	   
        	   automaticUpdateScheduler = new AutomaticUpdateScheduler();
        	   automaticUpdateScheduler.earlyStartup();
        		
               final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
               if (workbenchWindow != null) {
                 removeActionSets(workbenchWindow, workbenchWindow.getActivePage().getPerspective());
                 workbenchWindow.addPerspectiveListener(new PerspectiveAdapter() {
                   /* (non-Javadoc)
                   * @see org.eclipse.ui.PerspectiveAdapter#perspectiveActivated(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
                   */
                   @Override
                   public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspectiveDescriptor) {
                     super.perspectiveActivated(page, perspectiveDescriptor);
//                     removeActionSets(workbenchWindow, perspectiveDescriptor);
                   }
                 });
               }
           }
         });
    }