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.
16 package com
.intellij
.util
.xml
.ui
;
18 import com
.intellij
.openapi
.actionSystem
.*;
19 import com
.intellij
.openapi
.application
.Result
;
20 import com
.intellij
.openapi
.command
.WriteCommandAction
;
21 import com
.intellij
.openapi
.project
.Project
;
22 import com
.intellij
.util
.xml
.DomElement
;
23 import com
.intellij
.util
.xml
.DomUtil
;
24 import com
.intellij
.util
.SmartList
;
25 import org
.jetbrains
.annotations
.NotNull
;
27 import java
.util
.List
;
32 public class DomTableView
extends AbstractTableView
<DomElement
> {
33 private final List
<TypeSafeDataProvider
> myCustomDataProviders
= new SmartList
<TypeSafeDataProvider
>();
35 public DomTableView(final Project project
) {
39 public DomTableView(final Project project
, final String emptyPaneText
, final String helpID
) {
40 super(project
, emptyPaneText
, helpID
);
43 public void addCustomDataProvider(TypeSafeDataProvider provider
) {
44 myCustomDataProviders
.add(provider
);
47 public void calcData(final DataKey key
, final DataSink sink
) {
48 super.calcData(key
, sink
);
49 for (final TypeSafeDataProvider customDataProvider
: myCustomDataProviders
) {
50 customDataProvider
.calcData(key
, sink
);
55 protected final void installPopup(final DefaultActionGroup group
) {
56 installPopup(ActionPlaces
.J2EE_ATTRIBUTES_VIEW_POPUP
, group
);
59 protected void wrapValueSetting(@NotNull final DomElement domElement
, final Runnable valueSetter
) {
60 if (domElement
.isValid()) {
61 new WriteCommandAction(getProject(), DomUtil
.getFile(domElement
)) {
62 protected void run(final Result result
) throws Throwable
{