1 /******************************************************************************* 2 * Copyright (c) 2010 - 2013 by Timotei Dolean <timotei21@gmail.com> 3 * 4 * This program and the accompanying materials are made available 5 * under the terms of the Eclipse Public License v1.0 6 * which accompanies this distribution, and is available at 7 * http://www.eclipse.org/legal/epl-v10.html 8 *******************************************************************************/ 9 package org.wesnoth.product; 10 11 import org.eclipse.core.resources.ResourcesPlugin; 12 import org.eclipse.core.runtime.CoreException; 13 import org.eclipse.core.runtime.NullProgressMonitor; 14 import org.eclipse.ui.application.ActionBarAdvisor; 15 import org.eclipse.ui.application.IActionBarConfigurer; 16 import org.eclipse.ui.application.IWorkbenchWindowConfigurer; 17 import org.eclipse.ui.application.WorkbenchWindowAdvisor; 18 19 import org.wesnoth.Logger; 20 21 /** 22 * Workbench advisor for the UMC IDE 23 */ 24 public class WesnothWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor 25 { 26 /** 27 * Creates a new {@link WesnothWorkbenchAdvisor} 28 * 29 * @param configurer 30 * The configurer used to configure the workbench 31 */ WesnothWorkbenchWindowAdvisor( IWorkbenchWindowConfigurer configurer )32 public WesnothWorkbenchWindowAdvisor( IWorkbenchWindowConfigurer configurer ) 33 { 34 super( configurer ); 35 } 36 37 @Override createActionBarAdvisor( IActionBarConfigurer configurer )38 public ActionBarAdvisor createActionBarAdvisor( 39 IActionBarConfigurer configurer ) 40 { 41 return new WesnothActionBarAdvisor( configurer ); 42 } 43 44 @Override preWindowOpen( )45 public void preWindowOpen( ) 46 { 47 super.preWindowOpen( ); 48 IWorkbenchWindowConfigurer configurer = getWindowConfigurer( ); 49 configurer.setShowMenuBar( true ); 50 configurer.setShowProgressIndicator( true ); 51 configurer.setShowStatusLine( true ); 52 configurer.setShowPerspectiveBar( true ); 53 configurer.setShowFastViewBars( true ); 54 configurer.setShowCoolBar( true ); 55 } 56 57 @Override postWindowCreate( )58 public void postWindowCreate( ) 59 { 60 getWindowConfigurer( ).getWindow( ).getActivePage( ) 61 .hideActionSet( "org.eclipse.ui.run" ); //$NON-NLS-1$ 62 } 63 64 @Override preWindowShellClose( )65 public boolean preWindowShellClose( ) 66 { 67 try { 68 ResourcesPlugin.getWorkspace( ).save( true, 69 new NullProgressMonitor( ) ); 70 } catch( CoreException e ) { 71 Logger.getInstance( ).logException( e ); 72 } 73 return true; 74 } 75 } 76