simplification of DataProviders: single-element NAVIGATABLE_ARRAY is automatically provided by NavigatableArrayRule if NAVIGATABLE is available

This commit is contained in:
nik
2015-02-09 10:58:09 +03:00
parent f6763a4980
commit 4d9229982d
2 changed files with 3 additions and 7 deletions
@@ -57,10 +57,6 @@ public class TestsUIUtil {
if (testProxy == null) return null;
if (AbstractTestProxy.DATA_KEY.is(dataId)) return testProxy;
if (CommonDataKeys.NAVIGATABLE.is(dataId)) return getOpenFileDescriptor(testProxy, model);
if (CommonDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
final Navigatable openFileDescriptor = getOpenFileDescriptor(testProxy, model);
return openFileDescriptor != null ? new Navigatable[]{openFileDescriptor} : null;
}
if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
final Location location = testProxy.getLocation(project, properties.getScope());
if (location != null) {
@@ -190,17 +190,17 @@ public class DomModelTreeView extends Wrapper implements DataProvider, Disposabl
@Override
@Nullable
public Object getData(String dataId) {
if (DomModelTreeView.DATA_KEY.is(dataId)) {
if (DATA_KEY.is(dataId)) {
return this;
}
final SimpleNode simpleNode = getTree().getSelectedNode();
if (simpleNode instanceof AbstractDomElementNode) {
final DomElement domElement = ((AbstractDomElementNode)simpleNode).getDomElement();
if (domElement != null && domElement.isValid()) {
if (CommonDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
if (CommonDataKeys.NAVIGATABLE.is(dataId)) {
final XmlElement tag = domElement.getXmlElement();
if (tag instanceof Navigatable) {
return new Navigatable[] { (Navigatable)tag };
return tag;
}
}
}