Search in sources :

Example 21 with SettingsNode

use of org.gradle.gradleplugin.foundation.settings.SettingsNode in project gradle by gradle.

the class FavoritesSerializable method serializeIn.

public static void serializeIn(SettingsNode settings, List<FavoriteTask> favorites) {
    //remove everything already there
    favorites.clear();
    SettingsNode rootElement = settings.getChildNode(ROOT_TAG);
    if (rootElement == null) {
        return;
    }
    Iterator<SettingsNode> iterator = rootElement.getChildNodes(FAVORITE_ELEMENT_TAG).iterator();
    while (iterator.hasNext()) {
        SettingsNode taskNode = iterator.next();
        String fullCommandLine = taskNode.getValueOfChild(FULL_COMMAND_LINE, null);
        if (fullCommandLine != null) {
            String displayName = taskNode.getValueOfChild(DISPLAY_NAME, fullCommandLine);
            boolean showOutput = taskNode.getValueOfChildAsBoolean(SHOW_OUTPUT, false);
            addFavoriteTask(favorites, fullCommandLine, displayName, showOutput);
        }
    }
}
Also used : SettingsNode(org.gradle.gradleplugin.foundation.settings.SettingsNode)

Example 22 with SettingsNode

use of org.gradle.gradleplugin.foundation.settings.SettingsNode in project gradle by gradle.

the class FavoritesSerializable method serializeOut.

public static void serializeOut(SettingsNode settings, List<FavoriteTask> favorites) {
    SettingsNode rootNode = settings.addChildIfNotPresent(ROOT_TAG);
    //clear out whatever may have already been there
    rootNode.removeAllChildren();
    Iterator<FavoriteTask> iterator = favorites.iterator();
    while (iterator.hasNext()) {
        FavoriteTask favoriteTask = iterator.next();
        SettingsNode taskNode = rootNode.addChild(FAVORITE_ELEMENT_TAG);
        taskNode.setValueOfChild(FULL_COMMAND_LINE, favoriteTask.getFullCommandLine());
        taskNode.setValueOfChild(DISPLAY_NAME, favoriteTask.getDisplayName());
        taskNode.setValueOfChildAsBoolean(SHOW_OUTPUT, favoriteTask.alwaysShowOutput());
    }
}
Also used : SettingsNode(org.gradle.gradleplugin.foundation.settings.SettingsNode)

Example 23 with SettingsNode

use of org.gradle.gradleplugin.foundation.settings.SettingsNode in project gradle by gradle.

the class BasicProjectAndTaskFilter method serializeInStringList.

/**
     * Reads in a list of strings as 'item' element children of parentElement.
     */
private void serializeInStringList(SettingsNode parentNode, List<String> strings) {
    Iterator<SettingsNode> iterator = parentNode.getChildNodes(ITEM).iterator();
    while (iterator.hasNext()) {
        SettingsNode itemNode = iterator.next();
        String item = itemNode.getValue();
        if (item != null) {
            strings.add(item);
        }
    }
}
Also used : SettingsNode(org.gradle.gradleplugin.foundation.settings.SettingsNode)

Example 24 with SettingsNode

use of org.gradle.gradleplugin.foundation.settings.SettingsNode in project gradle by gradle.

the class BasicProjectAndTaskFilter method serializeOutStringList.

/**
     * Writes out a list of strings as 'item' element children of parentElement.
     */
private void serializeOutStringList(SettingsNode parentNode, List<String> strings) {
    Iterator<String> iterator = strings.iterator();
    while (iterator.hasNext()) {
        String item = iterator.next();
        SettingsNode itemNode = parentNode.addChild(ITEM);
        itemNode.setValue(item);
    }
}
Also used : SettingsNode(org.gradle.gradleplugin.foundation.settings.SettingsNode)

Example 25 with SettingsNode

use of org.gradle.gradleplugin.foundation.settings.SettingsNode in project gradle by gradle.

the class BasicProjectAndTaskFilter method serializeOut.

/**
     * Call this to saves the current settings.
     *
     * @param settings where you save the settings.
     */
public void serializeOut(SettingsNode settings) {
    SettingsNode rootNode = settings.addChildIfNotPresent(BASIC_PROJECT_AND_TASK_FILTER);
    //clear out whatever may have already been there
    rootNode.removeAllChildren();
    rootNode.setValueOfChildAsBoolean(FILTER_OUT_TASKS_WITH_NO_DESCRIPTION, filterOutTasksWithNoDescription);
    SettingsNode filteredOutProjectsNode = rootNode.addChild(FILTERED_OUT_PROJECTS);
    serializeOutStringList(filteredOutProjectsNode, filteredOutProjectNames);
    SettingsNode filteredOutTasksNode = rootNode.addChild(FILTERED_OUT_TASKS);
    serializeOutStringList(filteredOutTasksNode, filteredOutTaskNames);
}
Also used : SettingsNode(org.gradle.gradleplugin.foundation.settings.SettingsNode)

Aggregations

SettingsNode (org.gradle.gradleplugin.foundation.settings.SettingsNode)35 DOM4JSettingsNode (org.gradle.gradleplugin.foundation.settings.DOM4JSettingsNode)19 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ChangeEvent (javax.swing.event.ChangeEvent)1 ChangeListener (javax.swing.event.ChangeListener)1 UncheckedIOException (org.gradle.api.UncheckedIOException)1 SettingsNodeVersion1 (org.gradle.openapi.external.ui.SettingsNodeVersion1)1