Home | History | Annotate | Download | only in views
      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.views;
     18 
     19 import com.android.hierarchyviewerlib.actions.RefreshPixelPerfectTreeAction;
     20 import com.android.hierarchyviewerlib.ui.PixelPerfectTree;
     21 
     22 import org.eclipse.jface.action.IMenuManager;
     23 import org.eclipse.jface.action.IToolBarManager;
     24 import org.eclipse.swt.layout.FillLayout;
     25 import org.eclipse.swt.widgets.Composite;
     26 import org.eclipse.ui.IActionBars;
     27 import org.eclipse.ui.part.ViewPart;
     28 
     29 public class PixelPerfectTreeView extends ViewPart {
     30 
     31     public static final String ID =
     32             "com.android.ide.eclipse.hierarchyviewer.views.PixelPerfectTreeView"; //$NON-NLS-1$
     33 
     34     private PixelPerfectTree mPixelPerfectTree;
     35 
     36     @Override
     37     public void createPartControl(Composite parent) {
     38         parent.setLayout(new FillLayout());
     39         mPixelPerfectTree = new PixelPerfectTree(parent);
     40 
     41         placeActions();
     42     }
     43 
     44     private void placeActions() {
     45         IActionBars actionBars = getViewSite().getActionBars();
     46 
     47         IMenuManager mm = actionBars.getMenuManager();
     48         mm.removeAll();
     49         mm.add(RefreshPixelPerfectTreeAction.getAction());
     50 
     51         IToolBarManager tm = actionBars.getToolBarManager();
     52         tm.removeAll();
     53         tm.add(RefreshPixelPerfectTreeAction.getAction());
     54     }
     55 
     56     @Override
     57     public void setFocus() {
     58         mPixelPerfectTree.setFocus();
     59     }
     60 
     61 }
     62