FileProperties
with a MetaData:FileProperties
is compatible with the MetaData
. Only the keys of the MetaData
to compare must matchFileProperties
is compatible with the MetaData
. If complete
is false, only the keys of the MetaData
to compare must match. Else all the keys in the two MetaData
s must matchMetaData textFileMeta = new MetaData(); fileMeta.put("fileType", "text"); MetaData imageFileMeta = new MetaData(); fileMeta.put("fileType", "image");We have a plugin where we want to open a text editor on the selected tab. We can use the following code to allow to open the editor only if the tab contains text:
public void openEditor(FileProperties properties) { if (properties.isCompatibleWith(textFileMeta)) { ... open the text editor } }
Copyright 2006-2023 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences