1/*
2 * Copyright (C) 2012 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
17package com.android.ide.eclipse.gltrace.views;
18
19import com.android.ide.eclipse.gltrace.editors.GLFunctionTraceViewer;
20
21import org.eclipse.ui.IWorkbenchPart;
22
23/**
24 * The {@link FrameSummaryView} is a page book view with pages of type {@link FrameSummaryViewPage}.
25 */
26public class FrameSummaryView extends GLPageBookView {
27    public static final String ID = "com.android.ide.eclipse.gltrace.views.FrameBuffer"; //$NON-NLS-1$
28
29    public FrameSummaryView() {
30        super("Open a GL Trace file to view the framebuffer contents.");
31    }
32
33    @Override
34    protected PageRec doCreatePage(IWorkbenchPart part) {
35        if (!(part instanceof GLFunctionTraceViewer)) {
36            return null;
37        }
38
39        GLFunctionTraceViewer viewer = (GLFunctionTraceViewer) part;
40        FrameSummaryViewPage page = viewer.getFrameSummaryViewPage();
41        initPage(page);
42        page.createControl(getPageBook());
43
44        return new PageRec(part, page);
45    }
46
47    @Override
48    protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
49        FrameSummaryViewPage page = (FrameSummaryViewPage) pageRecord.page;
50        page.dispose();
51        pageRecord.dispose();
52    }
53}
54