TypeSafeDataProvider Replacement?
Wondering what the recommended replacement is for the deprecated class TypeSafeDataProvider? For example, we have this class:
class PropertiesTable extends JBTable implements TypeSafeDataProvider, CopyProvider{
Within it we implement the calcData function:
@SuppressWarnings("rawtypes")
@Override
public void calcData(DataKey key, DataSink sink) {
if (key.equals(PlatformDataKeys.COPY_PROVIDER)) {
sink.put(PlatformDataKeys.COPY_PROVIDER, this);
}
}
Without the TypeSafeDataProvider implementation our context menus don't work. I see on the comments for TypeSafeDataProvider that the DataProvider class is recommended as a replacement: https://github.com/JetBrains/intellij-community/blob/master/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/DataProvider.java. But I'm not sure how?
Please sign in to leave a comment.
Thanks Aleksey, that seems to have done it! General pattern for anyone in future:
Old code within calcData:
Replacement code within getData:
& put a default return value of null at the end of getData.