public void initializeActionAndTriggerJComboBox()

in src/main/java/org/apache/openwhisk/intellij/explorer/editor/ui/ActivationViewEditorForm.java [155:201]


    public void initializeActionAndTriggerJComboBox(List<WhiskActionMetaData> actions, List<WhiskTriggerMetaData> triggers) {
        /**
         * It shows the list of none, action, trigger in one JComboBox at once. The order is as follows: None ~ Actions ~ triggers
         *
         * TODO Add binding action
         */
        List<ComboBoxEntityEntry> entries = Stream.of(
                Stream.of(ComboBoxEntityEntry.NONE_COMBO_BOX_ENTITY_ENTRY),
                actions.stream().map(WhiskActionMetaData::toCombBoxEntityEntry),
                triggers.stream().map(WhiskTriggerMetaData::toCombBoxEntityEntry))
                .flatMap(a -> a)
                .collect(Collectors.toList());

        actionOrTriggerJComboBox.setModel(new ComboBoxModel<ComboBoxEntityEntry>() {
            private ComboBoxEntityEntry selected;

            @Override
            public void setSelectedItem(Object anItem) {
                this.selected = (ComboBoxEntityEntry) anItem;
            }

            @Override
            public ComboBoxEntityEntry getSelectedItem() {
                return selected;
            }

            @Override
            public int getSize() {
                return entries.size();
            }

            @Override
            public ComboBoxEntityEntry getElementAt(int index) {
                return entries.get(index);
            }

            @Override
            public void addListDataListener(ListDataListener l) {
                // nothing to do
            }

            @Override
            public void removeListDataListener(ListDataListener l) {
                // nothing to do
            }
        });
    }