Home | History | Annotate | Download | only in views
      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 
     17 package com.android.ide.eclipse.gltrace.views;
     18 
     19 import com.android.ide.eclipse.gltrace.editors.GLFunctionTraceViewer;
     20 import com.android.ide.eclipse.gltrace.editors.StateViewPage;
     21 
     22 import org.eclipse.ui.IWorkbenchPart;
     23 
     24 /**
     25  * The StateView shows the GL state for the current active {@link GLFunctionTraceViewer}.
     26  * It behaves like the Eclipse Outline View: Each active editor provides the GL state content
     27  * to show via a {@link StateViewPage}. This class simply acts as a stack view showing the
     28  * state corresponding to whichever editor is active.
     29  */
     30 public class StateView extends GLPageBookView {
     31     public static final String ID = "com.android.ide.eclipse.gltrace.views.State"; //$NON-NLS-1$
     32 
     33     public StateView() {
     34         super("Open (or select) a GL Trace file to view the GL State.");
     35     }
     36 
     37     @Override
     38     protected PageRec doCreatePage(IWorkbenchPart part) {
     39         if (!(part instanceof GLFunctionTraceViewer)) {
     40             return null;
     41         }
     42 
     43         GLFunctionTraceViewer viewer = (GLFunctionTraceViewer) part;
     44         StateViewPage page = viewer.getStateViewPage();
     45         initPage(page);
     46         page.createControl(getPageBook());
     47 
     48         return new PageRec(part, page);
     49     }
     50 
     51     @Override
     52     protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
     53         StateViewPage v = (StateViewPage) pageRecord.page;
     54         v.dispose();
     55         pageRecord.dispose();
     56     }
     57 }
     58