Commit | Line | Data |
---|---|---|
a7780cc8 FC |
1 | /******************************************************************************* |
2 | * Copyright (c) 2012 Ericsson | |
27f3a03d | 3 | * |
a7780cc8 FC |
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 | |
27f3a03d | 8 | * |
a7780cc8 FC |
9 | * Contributors: |
10 | * Francois Chouinard - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
04835162 | 13 | package org.eclipse.linuxtools.internal.lttng2.kernel.ui.views; |
a7780cc8 | 14 | |
04835162 PT |
15 | import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.controlflow.ControlFlowView; |
16 | import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources.ResourcesView; | |
17 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.ControlView; | |
a7780cc8 | 18 | import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramView; |
17dec5cc | 19 | import org.eclipse.linuxtools.tmf.ui.views.statistics.TmfStatisticsView; |
a7780cc8 FC |
20 | import org.eclipse.ui.IFolderLayout; |
21 | import org.eclipse.ui.IPageLayout; | |
22 | import org.eclipse.ui.IPerspectiveFactory; | |
23 | ||
24 | /** | |
a7780cc8 FC |
25 | * The default LTTng perspective. |
26 | */ | |
27 | public class PerspectiveFactory implements IPerspectiveFactory { | |
28 | ||
27f3a03d | 29 | /** Perspective ID */ |
a7780cc8 FC |
30 | public static final String ID = "org.eclipse.linuxtools.lttng2.ui.perspective"; //$NON-NLS-1$ |
31 | ||
32 | // LTTng views | |
a7780cc8 | 33 | private static final String HISTOGRAM_VIEW_ID = HistogramView.ID; |
04835162 PT |
34 | private static final String CONTROL_VIEW_ID = ControlView.ID; |
35 | private static final String CONTROLFLOW_VIEW_ID = ControlFlowView.ID; | |
36 | private static final String RESOURCES_VIEW_ID = ResourcesView.ID; | |
17dec5cc | 37 | private static final String STATISTICS_VIEW_ID = TmfStatisticsView.ID; |
a7780cc8 FC |
38 | |
39 | // Standard Eclipse views | |
40 | private static final String PROJECT_VIEW_ID = IPageLayout.ID_PROJECT_EXPLORER; | |
41 | private static final String PROPERTIES_VIEW_ID = IPageLayout.ID_PROP_SHEET; | |
42 | private static final String BOOKMARKS_VIEW_ID = IPageLayout.ID_BOOKMARKS; | |
43 | ||
44 | /* | |
45 | * (non-Javadoc) | |
27f3a03d | 46 | * |
a7780cc8 FC |
47 | * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout) |
48 | */ | |
49 | @Override | |
50 | public void createInitialLayout(IPageLayout layout) { | |
51 | ||
faa38350 | 52 | layout.setEditorAreaVisible(true); |
a7780cc8 FC |
53 | |
54 | addFastViews(layout); | |
55 | addViewShortcuts(layout); | |
56 | addPerspectiveShortcuts(layout); | |
57 | ||
58 | // Create the top left folder | |
59 | IFolderLayout topLeftFolder = layout.createFolder( | |
60 | "topLeftFolder", IPageLayout.LEFT, 0.15f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$ | |
61 | topLeftFolder.addView(PROJECT_VIEW_ID); | |
17dec5cc FC |
62 | |
63 | // Create the bottom left folder | |
64 | IFolderLayout bottomLeftFolder = layout.createFolder( | |
96f4eb18 | 65 | "bottomLeftFolder", IPageLayout.BOTTOM, 0.70f, "topLeftFolder"); //$NON-NLS-1$ //$NON-NLS-2$ |
17dec5cc | 66 | bottomLeftFolder.addView(CONTROL_VIEW_ID); |
a7780cc8 | 67 | |
04835162 PT |
68 | // Create the top right folder |
69 | IFolderLayout topRightFolder = layout.createFolder( | |
70 | "topRightFolder", IPageLayout.TOP, 0.40f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$ | |
71 | topRightFolder.addView(CONTROLFLOW_VIEW_ID); | |
72 | topRightFolder.addView(RESOURCES_VIEW_ID); | |
c5beb08d | 73 | topRightFolder.addView(STATISTICS_VIEW_ID); |
a7780cc8 | 74 | |
a7780cc8 FC |
75 | // Create the bottom right folder |
76 | IFolderLayout bottomRightFolder = layout.createFolder( | |
faa38350 | 77 | "bottomRightFolder", IPageLayout.BOTTOM, 0.50f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$ |
a7780cc8 FC |
78 | bottomRightFolder.addView(HISTOGRAM_VIEW_ID); |
79 | bottomRightFolder.addView(PROPERTIES_VIEW_ID); | |
80 | bottomRightFolder.addView(BOOKMARKS_VIEW_ID); | |
81 | } | |
82 | ||
83 | /** | |
84 | * Add fast views to the perspective | |
27f3a03d | 85 | * |
a7780cc8 FC |
86 | * @param layout |
87 | */ | |
88 | private void addFastViews(IPageLayout layout) { | |
a7780cc8 FC |
89 | } |
90 | ||
91 | /** | |
92 | * Add view shortcuts to the perspective | |
27f3a03d | 93 | * |
a7780cc8 FC |
94 | * @param layout |
95 | */ | |
96 | private void addViewShortcuts(IPageLayout layout) { | |
a7780cc8 FC |
97 | } |
98 | ||
99 | /** | |
100 | * Add perspective shortcuts to the perspective | |
27f3a03d | 101 | * |
a7780cc8 FC |
102 | * @param layout |
103 | */ | |
104 | private void addPerspectiveShortcuts(IPageLayout layout) { | |
a7780cc8 FC |
105 | } |
106 | ||
107 | } |