@Override public void onClick(@Nonnull IConstant data, @Nonnull Context context) { final String text = Locator.getInstance().getEngine().getVarsRegistry().getDescription(data.getName()); if (!Strings.isEmpty(text)) { if (text == null) throw new AssertionError(); Locator.getInstance().getClipboard().setText(text); } }
@Nonnull @Override protected List<LabeledMenuItem<IConstant>> getMenuItemsOnLongClick(@Nonnull IConstant item) { final List<LabeledMenuItem<IConstant>> result = new ArrayList<LabeledMenuItem<IConstant>>(Arrays.asList(LongClickMenuItem.values())); if (item.isSystem()) { result.remove(LongClickMenuItem.edit); result.remove(LongClickMenuItem.remove); } if (Strings.isEmpty( Locator.getInstance().getEngine().getVarsRegistry().getDescription(item.getName()))) { result.remove(LongClickMenuItem.copy_description); } if (Strings.isEmpty(item.getValue())) { result.remove(LongClickMenuItem.copy_value); } return result; }