| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 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.internal.lttng2.ui.views; |
| 14 | |
| 15 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.ControlView; |
| 16 | import org.eclipse.linuxtools.tmf.ui.views.events.TmfEventsView; |
| 17 | import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramView; |
| 18 | import org.eclipse.ui.IFolderLayout; |
| 19 | import org.eclipse.ui.IPageLayout; |
| 20 | import org.eclipse.ui.IPerspectiveFactory; |
| 21 | |
| 22 | /** |
| 23 | * <b><u>PerspectiveFactory</u></b> |
| 24 | * <p> |
| 25 | * The default LTTng perspective. |
| 26 | */ |
| 27 | public class PerspectiveFactory implements IPerspectiveFactory { |
| 28 | |
| 29 | // Perspective ID |
| 30 | public static final String ID = "org.eclipse.linuxtools.lttng2.ui.perspective"; //$NON-NLS-1$ |
| 31 | |
| 32 | // LTTng views |
| 33 | private static final String EVENTS_VIEW_ID = TmfEventsView.ID; |
| 34 | private static final String HISTOGRAM_VIEW_ID = HistogramView.ID; |
| 35 | private static final String CONTROL_VIEW_ID = ControlView.ID; |
| 36 | |
| 37 | // Standard Eclipse views |
| 38 | private static final String PROJECT_VIEW_ID = IPageLayout.ID_PROJECT_EXPLORER; |
| 39 | private static final String PROPERTIES_VIEW_ID = IPageLayout.ID_PROP_SHEET; |
| 40 | private static final String BOOKMARKS_VIEW_ID = IPageLayout.ID_BOOKMARKS; |
| 41 | |
| 42 | /* |
| 43 | * (non-Javadoc) |
| 44 | * |
| 45 | * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout) |
| 46 | */ |
| 47 | @Override |
| 48 | public void createInitialLayout(IPageLayout layout) { |
| 49 | |
| 50 | layout.setEditorAreaVisible(false); |
| 51 | |
| 52 | addFastViews(layout); |
| 53 | addViewShortcuts(layout); |
| 54 | addPerspectiveShortcuts(layout); |
| 55 | |
| 56 | // Create the top left folder |
| 57 | IFolderLayout topLeftFolder = layout.createFolder( |
| 58 | "topLeftFolder", IPageLayout.LEFT, 0.15f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$ |
| 59 | topLeftFolder.addView(PROJECT_VIEW_ID); |
| 60 | topLeftFolder.addView(CONTROL_VIEW_ID); |
| 61 | |
| 62 | // // Create the top right folder |
| 63 | // IFolderLayout topRightFolder = layout.createFolder( |
| 64 | // "topRightFolder", IPageLayout.TOP, 0.40f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$ |
| 65 | |
| 66 | // Create the middle right folder |
| 67 | IFolderLayout middleRightFolder = layout.createFolder( |
| 68 | "middleRightFolder", IPageLayout.BOTTOM, 0.40f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$ |
| 69 | middleRightFolder.addView(EVENTS_VIEW_ID); |
| 70 | |
| 71 | // Create the bottom right folder |
| 72 | IFolderLayout bottomRightFolder = layout.createFolder( |
| 73 | "bottomRightFolder", IPageLayout.BOTTOM, 0.50f, "middleRightFolder"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 74 | bottomRightFolder.addView(HISTOGRAM_VIEW_ID); |
| 75 | bottomRightFolder.addView(PROPERTIES_VIEW_ID); |
| 76 | bottomRightFolder.addView(BOOKMARKS_VIEW_ID); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Add fast views to the perspective |
| 81 | * |
| 82 | * @param layout |
| 83 | */ |
| 84 | private void addFastViews(IPageLayout layout) { |
| 85 | // TODO Auto-generated method stub |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Add view shortcuts to the perspective |
| 90 | * |
| 91 | * @param layout |
| 92 | */ |
| 93 | private void addViewShortcuts(IPageLayout layout) { |
| 94 | // TODO Auto-generated method stub |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Add perspective shortcuts to the perspective |
| 99 | * |
| 100 | * @param layout |
| 101 | */ |
| 102 | private void addPerspectiveShortcuts(IPageLayout layout) { |
| 103 | // TODO Auto-generated method stub |
| 104 | } |
| 105 | |
| 106 | } |