Commit | Line | Data |
---|---|---|
b6eb4dce VP |
1 | /******************************************************************************* |
2 | * Copyright (c) 2014 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 | * Vincent Perot - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.internal.tmf.pcap.ui; |
b6eb4dce | 14 | |
5db5a3a4 AM |
15 | import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull; |
16 | ||
b6eb4dce | 17 | import org.eclipse.jdt.annotation.Nullable; |
2bdf0193 AM |
18 | import org.eclipse.tracecompass.internal.tmf.pcap.ui.stream.StreamListView; |
19 | import org.eclipse.tracecompass.tmf.ui.project.wizards.NewTmfProjectWizard; | |
20 | import org.eclipse.tracecompass.tmf.ui.views.colors.ColorsView; | |
21 | import org.eclipse.tracecompass.tmf.ui.views.filter.FilterView; | |
22 | import org.eclipse.tracecompass.tmf.ui.views.histogram.HistogramView; | |
23 | import org.eclipse.tracecompass.tmf.ui.views.statistics.TmfStatisticsView; | |
b6eb4dce VP |
24 | import org.eclipse.ui.IFolderLayout; |
25 | import org.eclipse.ui.IPageLayout; | |
26 | import org.eclipse.ui.IPerspectiveFactory; | |
27 | ||
28 | /** | |
29 | * The networking perspective definition. | |
30 | * | |
31 | * @author Vincent Perot | |
32 | */ | |
33 | public class NetworkingPerspectiveFactory implements IPerspectiveFactory { | |
34 | ||
35 | // ------------------------------------------------------------------------ | |
36 | // Constants | |
37 | // ------------------------------------------------------------------------ | |
38 | ||
39 | /** The Perspective ID */ | |
40 | public static final String ID = "org.eclipse.linuxtools.tmf.pcap.ui.perspective.network"; //$NON-NLS-1$ | |
41 | ||
42 | // Views | |
5db5a3a4 AM |
43 | private static final String PROJECT_VIEW_ID = checkNotNull(IPageLayout.ID_PROJECT_EXPLORER); |
44 | private static final String PROPERTIES_VIEW_ID = checkNotNull(IPageLayout.ID_PROP_SHEET); | |
45 | private static final String BOOKMARKS_VIEW_ID = checkNotNull(IPageLayout.ID_BOOKMARKS); | |
b6eb4dce VP |
46 | private static final String FILTER_VIEW_ID = FilterView.ID; |
47 | private static final String HISTOGRAM_VIEW_ID = HistogramView.ID; | |
48 | private static final String STATISTICS_VIEW_ID = TmfStatisticsView.ID; | |
49 | private static final String COLOR_VIEW_ID = ColorsView.ID; | |
50 | private static final String STREAM_LIST_VIEW_ID = StreamListView.ID; | |
51 | ||
52 | // ------------------------------------------------------------------------ | |
53 | // IPerspectiveFactory | |
54 | // ------------------------------------------------------------------------ | |
55 | ||
56 | @Override | |
57 | public void createInitialLayout(@Nullable IPageLayout layout) { | |
58 | ||
59 | if (layout == null) { | |
60 | return; | |
61 | } | |
62 | ||
63 | // Editor area | |
64 | layout.setEditorAreaVisible(true); | |
65 | ||
66 | // Create the top left folder | |
67 | IFolderLayout topLeftFolder = layout.createFolder("topLeftFolder", IPageLayout.LEFT, 0.15f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$ | |
68 | topLeftFolder.addView(PROJECT_VIEW_ID); | |
69 | ||
70 | // Create the middle right folder | |
71 | IFolderLayout middleRightFolder = layout.createFolder("middleRightFolder", IPageLayout.BOTTOM, 0.40f, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$ | |
72 | middleRightFolder.addView(PROPERTIES_VIEW_ID); | |
73 | middleRightFolder.addView(HISTOGRAM_VIEW_ID); | |
74 | middleRightFolder.addView(STATISTICS_VIEW_ID); | |
75 | middleRightFolder.addView(COLOR_VIEW_ID); | |
76 | ||
77 | // Create the bottom right folder | |
78 | IFolderLayout bottomRightFolder = layout.createFolder("bottomRightFolder", IPageLayout.BOTTOM, 0.65f, "middleRightFolder"); //$NON-NLS-1$ //$NON-NLS-2$ | |
79 | bottomRightFolder.addView(FILTER_VIEW_ID); | |
80 | bottomRightFolder.addView(BOOKMARKS_VIEW_ID); | |
81 | bottomRightFolder.addView(STREAM_LIST_VIEW_ID); | |
82 | ||
83 | // Populate menus, etc | |
84 | layout.addPerspectiveShortcut(ID); | |
85 | layout.addNewWizardShortcut(NewTmfProjectWizard.ID); | |
86 | } | |
87 | ||
88 | } |