• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
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 package com.android.ide.eclipse.adt.internal.editors.layout;
17 
18 import com.android.ide.eclipse.adt.internal.editors.layout.gle2.LayoutCanvas;
19 
20 import org.eclipse.ui.IActionBars;
21 import org.eclipse.ui.IEditorPart;
22 import org.eclipse.ui.part.EditorActionBarContributor;
23 
24 /**
25  * Action contributor responsible for updating the global action registrations in the
26  * shared action bar for the editor instances
27  */
28 public class LayoutEditorActionContributor extends EditorActionBarContributor {
29 
LayoutEditorActionContributor()30     public LayoutEditorActionContributor() {
31         super();
32     }
33 
34     @Override
setActiveEditor(IEditorPart part)35     public void setActiveEditor(IEditorPart part) {
36         IActionBars bars = getActionBars();
37         if (part instanceof LayoutEditor) {
38             LayoutCanvas canvas = ((LayoutEditor)part).getGraphicalEditor().getCanvasControl();
39             if (canvas != null) {
40                 canvas.updateGlobalActions(bars);
41             }
42         }
43     }
44 }
45