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.ui.IFolderLayout;
12 import org.eclipse.ui.IPageLayout;
13 import org.eclipse.ui.IPerspectiveFactory;
14 import org.eclipse.ui.console.IConsoleConstants;
15 
16 import org.wesnoth.views.AddonsView;
17 import org.wesnoth.views.WesnothProjectsExplorer;
18 
19 /**
20  * The WML Perspective
21  */
22 public class WMLPerspective implements IPerspectiveFactory
23 {
24     /**
25      * The ID of the {@link WMLPerspective}
26      */
27     public static final String ID_WMLPERSPECTIVE = "org.wesnoth.product.WMLPerspective";
28 
29     @Override
createInitialLayout( IPageLayout layout )30     public void createInitialLayout( IPageLayout layout )
31     {
32         // Add "show views".
33         layout.addShowViewShortcut( IPageLayout.ID_OUTLINE );
34         layout.addShowViewShortcut( IPageLayout.ID_PROBLEM_VIEW );
35         layout.addShowViewShortcut( AddonsView.ID_ADDONS_VIEW );
36         layout
37             .addShowViewShortcut( WesnothProjectsExplorer.ID_PROJECTS_EXPLORER );
38 
39         // Editors are placed for free.
40         String editorArea = layout.getEditorArea( );
41         layout.setEditorAreaVisible( true );
42 
43         // Place navigator and outline to left of editor area.
44         IFolderLayout left = layout.createFolder( "left", IPageLayout.LEFT, ( float ) 0.26, editorArea ); //$NON-NLS-1$
45         left.addView( WesnothProjectsExplorer.ID_PROJECTS_EXPLORER );
46 
47         IFolderLayout bottom = layout.createFolder( "bottom", IPageLayout.BOTTOM, 0.76f, editorArea ); //$NON-NLS-1$
48         bottom.addView( IPageLayout.ID_PROBLEM_VIEW );
49         bottom.addView( IPageLayout.ID_PROGRESS_VIEW );
50         bottom.addView( IConsoleConstants.ID_CONSOLE_VIEW );
51         bottom.addView( AddonsView.ID_ADDONS_VIEW );
52 
53         IFolderLayout right = layout.createFolder( "right", IPageLayout.RIGHT, 0.68f, editorArea ); //$NON-NLS-1$
54         right.addView( IPageLayout.ID_OUTLINE );
55 
56         layout.addPerspectiveShortcut( ID_WMLPERSPECTIVE );
57 
58         // Add "new wizards".
59         layout.addNewWizardShortcut( "org.eclipse.ui.wizards.new.folder" ); //$NON-NLS-1$
60         layout.addNewWizardShortcut( "org.eclipse.ui.wizards.new.file" ); //$NON-NLS-1$
61         layout.addNewWizardShortcut( "org.wesnoth.wizards.NewConfigFileWizard" );
62         layout.addNewWizardShortcut( "org.wesnoth.wizards.emptyProjectWizard" );
63         layout.addNewWizardShortcut( "org.wesnoth.wizards.CampaignNewWizard" );
64         layout.addNewWizardShortcut( "org.wesnoth.wizards.ScenarioNewWizard" );
65         layout.addNewWizardShortcut( "org.wesnoth.wizards.eraNewWizard" );
66         layout.addNewWizardShortcut( "org.wesnoth.wizards.factionNewWizard" );
67         layout.addNewWizardShortcut( "org.wesnoth.wizards.wizardLauncher" );
68     }
69 }
70