mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
add default method getData(DataKey) to DataContext interface
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.actionSystem;
|
||||
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -34,6 +35,7 @@ public interface DataContext {
|
||||
*
|
||||
* @param dataId the data identifier for which the value is requested.
|
||||
* @return the value, or null if no value is available in the current context for this identifier.
|
||||
* @deprecated use {@link DataContext#getData(DataKey)}
|
||||
*/
|
||||
@Nullable
|
||||
Object getData(@NonNls String dataId);
|
||||
@@ -45,4 +47,16 @@ public interface DataContext {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value corresponding to the specified data key. Some of the supported
|
||||
* data identifiers are defined in the {@link com.intellij.openapi.actionSystem.PlatformDataKeys} class.
|
||||
*
|
||||
* @param key the data key for which the value is requested.
|
||||
* @return the value, or null if no value is available in the current context for this identifier.
|
||||
*/
|
||||
@Nullable
|
||||
default <T> T getData(@NotNull DataKey<T> key) {
|
||||
return (T)getData(key.getName());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user