/******************************************************************************* * Copyright (c) 2015 Bruno Medeiros and other Contributors. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Bruno Medeiros - initial API and implementation *******************************************************************************/ package melnorme.lang.ide.ui; import melnorme.lang.ide.ui.dialogs.LangNewProjectWizard; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.search.ui.NewSearchUI; import org.eclipse.ui.IFolderLayout; import org.eclipse.ui.IPageLayout; import org.eclipse.ui.IPerspectiveFactory; import org.eclipse.ui.console.IConsoleConstants; import org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard; import org.eclipse.ui.wizards.newresource.BasicNewFolderResourceWizard; public class LangPerspective implements IPerspectiveFactory { public LangPerspective() { super(); } @Override public void createInitialLayout(IPageLayout layout) { addViewStructure(layout); addActionSets(layout); addShowViewShortcuts(layout); addNewWizardShortcuts(layout); addPerspectiveShotcuts(layout); } protected void addViewStructure(IPageLayout layout) { String editorArea = layout.getEditorArea(); IFolderLayout leftFolder = layout.createFolder("leftPane", IPageLayout.LEFT, 0.25f, editorArea); leftFolder.addView(IPageLayout.ID_PROJECT_EXPLORER); IFolderLayout bottomFolder = layout.createFolder("bottomPane", IPageLayout.BOTTOM, 0.75f, editorArea); bottomFolder.addView(IPageLayout.ID_PROBLEM_VIEW); bottomFolder.addView(IPageLayout.ID_TASK_LIST); bottomFolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID); bottomFolder.addView(IPageLayout.ID_PROGRESS_VIEW); bottomFolder.addView(IConsoleConstants.ID_CONSOLE_VIEW); // Create outline after bottom pane layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, 0.75f, editorArea); } protected void addShowViewShortcuts(IPageLayout layout) { layout.addShowViewShortcut(IPageLayout.ID_OUTLINE); layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW); layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST); layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID); layout.addShowViewShortcut(IPageLayout.ID_PROGRESS_VIEW); layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW); } protected void addActionSets(IPageLayout layout) { layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET); layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET); } protected void addNewWizardShortcuts(IPageLayout layout) { // Lang layout.addNewWizardShortcut(LangNewProjectWizard.WIZARD_ID); // General layout.addNewWizardShortcut(BasicNewFolderResourceWizard.WIZARD_ID); layout.addNewWizardShortcut(BasicNewFileResourceWizard.WIZARD_ID); } protected void addPerspectiveShotcuts(IPageLayout layout) { layout.addPerspectiveShortcut("org.eclipse.debug.ui.DebugPerspective"); //$NON-NLS-1$ layout.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective"); //$NON-NLS-1$ layout.addPerspectiveShortcut("org.eclipse.team.ui.TeamSynchronizingPerspective"); //$NON-NLS-1$ } }