update copyright
[fedora-idea.git] / xml / dom-impl / src / com / intellij / util / xml / tree / actions / BaseDomTreeAction.java
blobc59a8ec1dfdacda4f7ae4fc2e24175b4da5a7477
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.intellij.util.xml.tree.actions;
19 import com.intellij.openapi.actionSystem.AnAction;
20 import com.intellij.openapi.actionSystem.AnActionEvent;
21 import com.intellij.util.xml.tree.DomModelTreeView;
23 /**
24 * User: Sergey.Vasiliev
26 abstract public class BaseDomTreeAction extends AnAction {
27 private DomModelTreeView myTreeView;
29 protected BaseDomTreeAction() {
32 protected BaseDomTreeAction(DomModelTreeView treeView) {
33 myTreeView = treeView;
36 final public void update(AnActionEvent e) {
37 final DomModelTreeView treeView = getTreeView(e);
39 if (treeView != null) {
40 update(e, treeView);
42 else {
43 e.getPresentation().setEnabled(false);
47 protected DomModelTreeView getTreeView(AnActionEvent e) {
48 if (myTreeView != null) return myTreeView;
50 return (DomModelTreeView)e.getDataContext().getData(DomModelTreeView.DOM_MODEL_TREE_VIEW_KEY);
53 final public void actionPerformed(AnActionEvent e) {
54 final DomModelTreeView treeView = getTreeView(e);
55 if (treeView != null) {
56 actionPerformed(e, treeView);
60 public abstract void actionPerformed(AnActionEvent e, DomModelTreeView treeView);
62 public abstract void update(AnActionEvent e, DomModelTreeView treeView);