| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2010, 2012 Ericsson |
| 3 | * |
| 4 | * All rights reserved. This program and the accompanying materials are |
| 5 | * made available under the terms of the Eclipse Public License v1.0 which |
| 6 | * accompanies this distribution, and is available at |
| 7 | * http://www.eclipse.org/legal/epl-v10.html |
| 8 | * |
| 9 | * Contributors: |
| 10 | * Francois Chouinard - Initial API and implementation |
| 11 | *******************************************************************************/ |
| 12 | |
| 13 | package org.eclipse.linuxtools.tmf.ui.views; |
| 14 | |
| 15 | import org.eclipse.linuxtools.tmf.ui.project.wizards.NewTmfProjectWizard; |
| 16 | import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramView; |
| 17 | import org.eclipse.linuxtools.tmf.ui.views.statistics.TmfStatisticsView; |
| 18 | import org.eclipse.ui.IFolderLayout; |
| 19 | import org.eclipse.ui.IPageLayout; |
| 20 | import org.eclipse.ui.IPerspectiveFactory; |
| 21 | |
| 22 | /** |
| 23 | * The tracing perspective definition. |
| 24 | * |
| 25 | * @version 1.0 |
| 26 | * @author Francois Chouinard |
| 27 | */ |
| 28 | public class TracingPerspectiveFactory implements IPerspectiveFactory { |
| 29 | |
| 30 | // ------------------------------------------------------------------------ |
| 31 | // Constants |
| 32 | // ------------------------------------------------------------------------ |
| 33 | |
| 34 | /** The Perspective ID */ |
| 35 | public static final String ID = "org.eclipse.linuxtools.tmf.ui.perspective"; //$NON-NLS-1$ |
| 36 | |
| 37 | // Standard TMF views |
| 38 | private static final String HISTOGRAM_VIEW_ID = HistogramView.ID; |
| 39 | |
| 40 | // Standard Eclipse views |
| 41 | private static final String PROJECT_VIEW_ID = IPageLayout.ID_PROJECT_EXPLORER; |
| 42 | private static final String STATISTICS_VIEW_ID = TmfStatisticsView.ID; |
| 43 | private static final String PROPERTIES_VIEW_ID = IPageLayout.ID_PROP_SHEET; |
| 44 | private static final String BOOKMARKS_VIEW_ID = IPageLayout.ID_BOOKMARKS; |
| 45 | |
| 46 | |
| 47 | // ------------------------------------------------------------------------ |
| 48 | // IPerspectiveFactory |
| 49 | // ------------------------------------------------------------------------ |
| 50 | |
| 51 | @Override |
| 52 | public void createInitialLayout(IPageLayout layout) { |
| 53 | |
| 54 | // Editor area |
| 55 | layout.setEditorAreaVisible(true); |
| 56 | |
| 57 | // Create the top left folder |
| 58 | IFolderLayout topLeftFolder = layout.createFolder( |
| 59 | "topLeftFolder", IPageLayout.LEFT, 0.15f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$ |
| 60 | topLeftFolder.addView(PROJECT_VIEW_ID); |
| 61 | |
| 62 | // Create the middle right folder |
| 63 | IFolderLayout middleRightFolder = layout.createFolder( |
| 64 | "middleRightFolder", IPageLayout.BOTTOM, 0.50f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$ |
| 65 | middleRightFolder.addView(STATISTICS_VIEW_ID); |
| 66 | |
| 67 | // Create the bottom right folder |
| 68 | IFolderLayout bottomRightFolder = layout.createFolder( |
| 69 | "bottomRightFolder", IPageLayout.BOTTOM, 0.55f, "middleRightFolder"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 70 | bottomRightFolder.addView(HISTOGRAM_VIEW_ID); |
| 71 | bottomRightFolder.addView(PROPERTIES_VIEW_ID); |
| 72 | bottomRightFolder.addView(BOOKMARKS_VIEW_ID); |
| 73 | |
| 74 | // Populate menus, etc |
| 75 | layout.addPerspectiveShortcut(ID); |
| 76 | layout.addNewWizardShortcut(NewTmfProjectWizard.ID); |
| 77 | } |
| 78 | |
| 79 | } |