Example usage for org.springframework.ide.eclipse.boot.wizard HierarchicalMultiSelectionFieldModel getCurrentSelection

List of usage examples for org.springframework.ide.eclipse.boot.wizard HierarchicalMultiSelectionFieldModel getCurrentSelection

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.wizard HierarchicalMultiSelectionFieldModel getCurrentSelection.

Prototype

public List<T> getCurrentSelection() 

Source Link

Usage

From source file:org.springframework.ide.eclipse.boot.wizard.DefaultDependencies.java

/**
 * Stores currently selection dependencies as default dependencies 
 * //from  ww  w  . j  a v a  2 s  . com
 * @param model dependency selection model
 * @return <code>true</code> if dependencies were stored, i.e. currently stored are different from the current ones. 
 */
public boolean save(HierarchicalMultiSelectionFieldModel<Dependency> model) {
    Set<String> ids = getDependciesIdSet();
    String[] currentSelection = model.getCurrentSelection().stream().map(Dependency::getId)
            .toArray(String[]::new);
    if (ids.size() == currentSelection.length && ids.containsAll(Arrays.asList(currentSelection))) {
        // Nothing to store no changes detected
        return false;
    } else {
        // Store dependencies ids as current selection has differences from currently stored dependencies
        put(PREF_DEFAULT_DEPENDENCIES, String.join(DEPENDECIES_DELIMITER, currentSelection));
        return true;
    }
}