1 /*
2  * Copyright (C) 2007 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.ide.eclipse.ddms;
18 
19 import com.android.ide.eclipse.ddms.views.AllocTrackerView;
20 import com.android.ide.eclipse.ddms.views.DeviceView;
21 import com.android.ide.eclipse.ddms.views.EmulatorControlView;
22 import com.android.ide.eclipse.ddms.views.FileExplorerView;
23 import com.android.ide.eclipse.ddms.views.HeapView;
24 import com.android.ide.eclipse.ddms.views.LogCatView;
25 import com.android.ide.eclipse.ddms.views.NetworkStatisticsView;
26 import com.android.ide.eclipse.ddms.views.SysInfoView;
27 import com.android.ide.eclipse.ddms.views.ThreadView;
28 
29 import org.eclipse.ui.IFolderLayout;
30 import org.eclipse.ui.IPageLayout;
31 import org.eclipse.ui.IPerspectiveFactory;
32 
33 public class Perspective implements IPerspectiveFactory {
34 
35     public static String ID = "com.android.ide.eclipse.ddms.Perspective"; //$NON-NLS-1$
36 
37     @Override
createInitialLayout(IPageLayout layout)38     public void createInitialLayout(IPageLayout layout) {
39         // create a default layout that looks like the stand alone DDMS.
40 
41         // no editor window
42         layout.setEditorAreaVisible(false);
43 
44         String editorArea = layout.getEditorArea();
45         IFolderLayout folder;
46 
47         folder = layout.createFolder("logcat", IPageLayout.BOTTOM, 0.8f, //$NON-NLS-1$
48                 editorArea);
49         folder.addPlaceholder(LogCatView.ID + ":*"); //$NON-NLS-1$
50         folder.addView(LogCatView.ID);
51 
52         folder = layout.createFolder("devices", IPageLayout.LEFT, 0.3f, //$NON-NLS-1$
53                 editorArea);
54         folder.addPlaceholder(DeviceView.ID + ":*"); //$NON-NLS-1$
55         folder.addView(DeviceView.ID);
56 
57         folder = layout.createFolder("ddms-detail", IPageLayout.RIGHT, 0.5f, //$NON-NLS-1$
58                 editorArea);
59         folder.addPlaceholder(ThreadView.ID + ":*"); //$NON-NLS-1$
60         folder.addView(ThreadView.ID);
61         folder.addView(HeapView.ID);
62         folder.addView(AllocTrackerView.ID);
63         folder.addView(NetworkStatisticsView.ID);
64         folder.addView(FileExplorerView.ID);
65         folder.addView(EmulatorControlView.ID);
66         folder.addView(SysInfoView.ID);
67 
68         layout.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective"); //$NON-NLS-1$
69         layout.addPerspectiveShortcut("org.eclipse.debug.ui.DebugPerspective"); //$NON-NLS-1$
70         layout.addPerspectiveShortcut("org.eclipse.jdt.ui.JavaPerspective"); //$NON-NLS-1$
71 
72         layout.addShowViewShortcut(DeviceView.ID);
73         layout.addShowViewShortcut(FileExplorerView.ID);
74         layout.addShowViewShortcut(HeapView.ID);
75         layout.addShowViewShortcut(AllocTrackerView.ID);
76         layout.addShowViewShortcut(LogCatView.ID);
77         layout.addShowViewShortcut(ThreadView.ID);
78         layout.addShowViewShortcut(NetworkStatisticsView.ID);
79         layout.addShowViewShortcut(SysInfoView.ID);
80 
81         layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
82         layout.addShowViewShortcut(IPageLayout.ID_BOOKMARKS);
83         layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
84         layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
85         layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
86         layout.addShowViewShortcut(IPageLayout.ID_PROGRESS_VIEW);
87         layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
88     }
89 }
90