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