1 /*
2  * Copyright (C) 2010 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.hierarchyviewer;
18 
19 import com.android.ide.eclipse.ddms.Perspective;
20 import com.android.ide.eclipse.hierarchyviewer.views.DeviceSelectorView;
21 import com.android.ide.eclipse.hierarchyviewer.views.LayoutView;
22 import com.android.ide.eclipse.hierarchyviewer.views.PropertyView;
23 import com.android.ide.eclipse.hierarchyviewer.views.TreeOverviewView;
24 import com.android.ide.eclipse.hierarchyviewer.views.TreeViewView;
25 
26 import org.eclipse.ui.IFolderLayout;
27 import org.eclipse.ui.IPageLayout;
28 import org.eclipse.ui.IPerspectiveFactory;
29 
30 public class TreeViewPerspective implements IPerspectiveFactory {
31 
32     public static final String ID = "com.android.ide.eclipse.hierarchyviewer.TreeViewPerspective"; //$NON-NLS-1$
33 
34     @Override
createInitialLayout(IPageLayout layout)35     public void createInitialLayout(IPageLayout layout) {
36         layout.setEditorAreaVisible(false);
37 
38         String editorArea = layout.getEditorArea();
39         IFolderLayout folder;
40 
41         folder = layout.createFolder("properties", IPageLayout.LEFT, 0.10f, editorArea); //$NON-NLS-1$
42         folder.addView(DeviceSelectorView.ID);
43         folder.addView(PropertyView.ID);
44 
45         folder = layout.createFolder("main", IPageLayout.RIGHT, 0.24f, "properties"); //$NON-NLS-1$ //$NON-NLS-2$
46         folder.addView(TreeViewView.ID);
47 
48         folder = layout.createFolder("panel-top", IPageLayout.RIGHT, 0.7f, "main"); //$NON-NLS-1$ //$NON-NLS-2$
49         folder.addView(TreeOverviewView.ID);
50 
51 
52         folder = layout.createFolder("panel-bottom", IPageLayout.BOTTOM, 0.5f, "panel-top"); //$NON-NLS-1$ //$NON-NLS-2$
53         folder.addView(LayoutView.ID);
54 
55         layout.addShowViewShortcut(DeviceSelectorView.ID);
56         layout.addShowViewShortcut(PropertyView.ID);
57         layout.addShowViewShortcut(TreeOverviewView.ID);
58         layout.addShowViewShortcut(LayoutView.ID);
59         layout.addShowViewShortcut(TreeViewView.ID);
60 
61         layout.addPerspectiveShortcut("org.eclipse.jdt.ui.JavaPerspective"); //$NON-NLS-1$
62         layout.addPerspectiveShortcut(PixelPerfectPespective.ID);
63         layout.addPerspectiveShortcut(Perspective.ID);
64     }
65 
66 }
67