Package org.gradle.gradleplugin.foundation.favorites

Examples of org.gradle.gradleplugin.foundation.favorites.FavoriteTask


    public void testMoveUp() {
        FavoritesEditor editor = new FavoritesEditor();

        Assert.assertTrue(editor.getFavoriteTasks().isEmpty());

        FavoriteTask mySubProject1CompleFavorite = editor.addFavorite(mySubProject1Comple, false);
        FavoriteTask mySubProject1LibFavorite = editor.addFavorite(mySubProject1Lib, false);
        FavoriteTask mySubProject1DocFavorite = editor.addFavorite(mySubProject1Doc, false);
        FavoriteTask mySubSubProjectCompileFavorite = editor.addFavorite(mySubSubProjectCompile, false);
        FavoriteTask mySubSubProjectLibFavorite = editor.addFavorite(mySubSubProjectLib, false);
        FavoriteTask mySubSubProjectDocFavorite = editor.addFavorite(mySubSubProjectDoc, false);

        List<FavoriteTask> favoritesToMove = new ArrayList<FavoriteTask>();

        favoritesToMove.add(mySubProject1LibFavorite);
        favoritesToMove.add(mySubSubProjectCompileFavorite);
View Full Code Here


    public void testMoveDown() {
        FavoritesEditor editor = new FavoritesEditor();

        Assert.assertTrue(editor.getFavoriteTasks().isEmpty());

        FavoriteTask mySubProject1CompleFavorite = editor.addFavorite(mySubProject1Comple, false);
        FavoriteTask mySubProject1LibFavorite = editor.addFavorite(mySubProject1Lib, false);
        FavoriteTask mySubProject1DocFavorite = editor.addFavorite(mySubProject1Doc, false);
        FavoriteTask mySubSubProjectCompileFavorite = editor.addFavorite(mySubSubProjectCompile, false);
        FavoriteTask mySubSubProjectLibFavorite = editor.addFavorite(mySubSubProjectLib, false);
        FavoriteTask mySubSubProjectDocFavorite = editor.addFavorite(mySubSubProjectDoc, false);

        List<FavoriteTask> favoritesToMove = new ArrayList<FavoriteTask>();

        favoritesToMove.add(mySubProject1CompleFavorite);
        favoritesToMove.add(mySubProject1DocFavorite);
View Full Code Here

        return convertFavoriteTask( favoritesEditor.addFavorite(fullCommandLine, displayName, alwaysShowOutput ) );
    }

    public String editFavorite(FavoriteTaskVersion1 favoriteTaskVersion1, final String newFullCommandLine, final String newDisplayName, final boolean newAlwaysShowOutput) {
        final StringHolder stringHolder = new StringHolder();
        FavoriteTask favoriteTask = getFavoriteTask( favoriteTaskVersion1 );
        favoritesEditor.editFavorite(favoriteTask, new FavoritesEditor.EditFavoriteInteraction() {
            public boolean editFavorite(FavoritesEditor.EditibleFavoriteTask favoriteTask) {
                favoriteTask.fullCommandLine = newFullCommandLine;
                favoriteTask.displayName = newDisplayName;
                favoriteTask.alwaysShowOutput = newAlwaysShowOutput;
View Full Code Here

    public List<FavoriteTaskVersion1> getFavoriteTasks() {
        List<FavoriteTaskVersion1> returnedTasks = new ArrayList<FavoriteTaskVersion1>();
        Iterator<FavoriteTask> taskIterator = favoritesEditor.getFavoriteTasks().iterator();
        while (taskIterator.hasNext()) {
            FavoriteTask favoriteTask = taskIterator.next();
            returnedTasks.add( new FavoriteTaskWrapper( favoriteTask ) );
        }
        return returnedTasks;
    }
View Full Code Here

    public FavoriteTaskVersion1 getFavorite(TaskVersion1 task) {
        return convertFavoriteTask( favoritesEditor.getFavorite( task.getFullTaskName() ) );
    }

    public FavoriteTaskVersion1 promptUserToAddFavorite(Window parent) {
        FavoriteTask favoriteTask = favoritesEditor.addFavorite( new SwingEditFavoriteInteraction( parent, "Add Favorite", true ) );
        return convertFavoriteTask( favoriteTask );
    }
View Full Code Here

        FavoriteTask favoriteTask = favoritesEditor.addFavorite( new SwingEditFavoriteInteraction( parent, "Add Favorite", true ) );
        return convertFavoriteTask( favoriteTask );
    }

    public boolean promptUserToEditFavorite(Window parent, FavoriteTaskVersion1 favorite) {
        FavoriteTask favoriteTask = getFavoriteTask(favorite);
        return favoritesEditor.editFavorite( favoriteTask, new SwingEditFavoriteInteraction( parent, "Edit Favorite", true ) );
    }
View Full Code Here

    private void populate() {
        model.clear();

        Iterator<FavoriteTask> taskIterator = favoritesEditor.getFavoriteTasks().iterator();
        while (taskIterator.hasNext()) {
            FavoriteTask favoriteTask = taskIterator.next();
            model.addElement(favoriteTask);
        }
    }
View Full Code Here

    private void addTask() {
        favoritesEditor.addFavorite(new SwingEditFavoriteInteraction(SwingUtilities.getWindowAncestor(mainPanel), "Add Favorite", true ));
    }

    private void editTask() {
        FavoriteTask selectedFavoriteTask = getFirstSelectedFavoriteTask();
       //if the user has kept these two in synch, we'll continue to keep them in synch.
        boolean synchronizeDisplayNameWithCommand = selectedFavoriteTask.getDisplayName().equals( selectedFavoriteTask.getFullCommandLine() );
        favoritesEditor.editFavorite(selectedFavoriteTask, new SwingEditFavoriteInteraction(SwingUtilities.getWindowAncestor(mainPanel), "Edit Favorite", synchronizeDisplayNameWithCommand ));
    }
View Full Code Here

    public Request addExecutionRequestToQueue(List<FavoriteTask> favorites) {
        if( favorites.isEmpty() ) {
            return null;
        }

        FavoriteTask firstFavoriteTask = favorites.get( 0 );
        String displayName;
        String fullCommandLine;
        boolean alwaysShowOutput = firstFavoriteTask.alwaysShowOutput();

        if( favorites.size() == 1 )
        {
            displayName = firstFavoriteTask.getDisplayName();
            fullCommandLine = firstFavoriteTask.getFullCommandLine();
        }
        else
        {
            displayName = "Multiple (" + firstFavoriteTask.getDisplayName() + ", ... )";
            fullCommandLine = FavoritesEditor.combineFavoriteCommandLines(favorites);
        }

        return addExecutionRequestToQueue( fullCommandLine, displayName, alwaysShowOutput );
    }
View Full Code Here

        FavoritesEditor originalEditor = new FavoritesEditor();

        Assert.assertTrue(originalEditor.getFavoriteTasks().isEmpty());

        //add two tasks
        FavoriteTask favoriteTask1 = originalEditor.addFavorite(mySubProject1Comple, true);
        FavoriteTask favoriteTask2 = originalEditor.addFavorite(mySubSubProjectLib, false);

        //now change the display name so its not the same as the full name, just so know each field is working.
        originalEditor.editFavorite(favoriteTask1, new FavoritesEditor.EditFavoriteInteraction() {
            public boolean editFavorite(FavoritesEditor.EditibleFavoriteTask favoriteTask) {
                favoriteTask.displayName = "favorite 1";
                return true;
            }

            public void reportError(String error) {
                throw new AssertionFailedError("Unexpected error");
            }
        });

        //make sure they were added properly
        FavoriteTask originalFavoriteTask1 = originalEditor.getFavoriteTasks().get(0);
        assertFavorite(originalFavoriteTask1, "mysubproject1:compile", "favorite 1", true);

        FavoriteTask originalFavoriteTask2 = originalEditor.getFavoriteTasks().get(1);
        assertFavorite(originalFavoriteTask2, "mysubproject1:mysubsubproject:lib", "mysubproject1:mysubsubproject:lib",
                false);

        File file = tempDir.createFile("fred.favorite-tasks");
        originalEditor.exportToFile(new TestUtility.TestExportInteraction(file,
                true)); //confirm overwrite because the above function actually creates the file.

        FavoritesEditor newEditor = new FavoritesEditor();
        newEditor.importFromFile(new TestUtility.TestImportInteraction(file));

        //make sure they're the same
        FavoriteTask readInFavoriteTask1 = originalEditor.getFavoriteTasks().get(0);
        assertFavorite(readInFavoriteTask1, originalFavoriteTask1);

        FavoriteTask readInFavoriteTask2 = originalEditor.getFavoriteTasks().get(1);
        assertFavorite(readInFavoriteTask2, originalFavoriteTask2);
    }
View Full Code Here

TOP

Related Classes of org.gradle.gradleplugin.foundation.favorites.FavoriteTask

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.