Search in sources :

Example 16 with GitResourceContextualMenu

use of com.oxygenxml.git.view.staging.GitResourceContextualMenu in project oxygen-git-client-addon by oxygenxml.

the class GitViewResourceContextualMenuActionsTest method testActionsEnablingState_16.

/**
 * <p><b>Description:</b> test the enabling state of the actions
 * from the contextual menu of the unstaged resources.</p>
 * <p><b>Bug ID:</b> EXM-40615</p>
 *
 * @author sorin_carbunaru
 *
 * @throws Exception
 */
public void testActionsEnablingState_16() throws Exception {
    GitResourceContextualMenu menu = new GitResourceContextualMenu(new SelectedResourcesProvider() {

        @Override
        public List<FileStatus> getOnlySelectedLeaves() {
            return getAllSelectedResources();
        }

        @Override
        public List<FileStatus> getAllSelectedResources() {
            List<FileStatus> fileStatuses = new ArrayList<>();
            fileStatuses.add(new FileStatus(GitChangeType.UNTRACKED, "test.xml"));
            fileStatuses.add(new FileStatus(GitChangeType.MODIFIED, "test2.xml"));
            return fileStatuses;
        }
    }, gitCtrl, null, // For unstaged resources
    false, Optional.of(RepositoryState.SAFE));
    assertEquals("\n" + "Open_In_Compare [DISABLED]\n" + "Open [ENABLED]\n" + "----\n" + "Stage [ENABLED]\n" + "Resolve_Conflict [DISABLED]\n" + "  Open_In_Compare [DISABLED]\n" + "  ----\n" + "  Resolve_Using_Mine [DISABLED]\n" + "  Resolve_Using_Theirs [DISABLED]\n" + "  Mark_Resolved [DISABLED]\n" + "  ----\n" + "  Restart_Merge [DISABLED]\n" + "Discard [ENABLED]\n" + "----\n" + "Show_history [DISABLED]\n" + "Show_blame [DISABLED]", PopupMenuSerializer.serializePopupStructure(menu, true, true));
}
Also used : FileStatus(com.oxygenxml.git.service.entities.FileStatus) SelectedResourcesProvider(com.oxygenxml.git.view.staging.ChangesPanel.SelectedResourcesProvider) ArrayList(java.util.ArrayList) List(java.util.List) GitResourceContextualMenu(com.oxygenxml.git.view.staging.GitResourceContextualMenu)

Example 17 with GitResourceContextualMenu

use of com.oxygenxml.git.view.staging.GitResourceContextualMenu in project oxygen-git-client-addon by oxygenxml.

the class GitViewResourceContextualMenuActionsTest method testActionsEnablingState_12.

/**
 * <p><b>Description:</b> test the enabling state of the actions
 * from the contextual menu of the staged resources.</p>
 * <p><b>Bug ID:</b> EXM-40615</p>
 *
 * @author sorin_carbunaru
 *
 * @throws Exception
 */
public void testActionsEnablingState_12() throws Exception {
    GitResourceContextualMenu menu = new GitResourceContextualMenu(new SelectedResourcesProvider() {

        @Override
        public List<FileStatus> getOnlySelectedLeaves() {
            return getAllSelectedResources();
        }

        @Override
        public List<FileStatus> getAllSelectedResources() {
            List<FileStatus> fileStatuses = new ArrayList<>();
            fileStatuses.add(new FileStatus(GitChangeType.REMOVED, "test.xml"));
            fileStatuses.add(new FileStatus(GitChangeType.REMOVED, "test2.xml"));
            return fileStatuses;
        }
    }, gitCtrl, null, // For staged resources
    true, Optional.of(RepositoryState.SAFE));
    assertEquals("\n" + "Open_In_Compare [DISABLED]\n" + "Open [DISABLED]\n" + "----\n" + "Unstage [ENABLED]\n" + "Resolve_Conflict [DISABLED]\n" + "  Open_In_Compare [DISABLED]\n" + "  ----\n" + "  Resolve_Using_Mine [DISABLED]\n" + "  Resolve_Using_Theirs [DISABLED]\n" + "  Mark_Resolved [DISABLED]\n" + "  ----\n" + "  Restart_Merge [DISABLED]\n" + "Discard [ENABLED]", PopupMenuSerializer.serializePopupStructure(menu, true, true));
}
Also used : FileStatus(com.oxygenxml.git.service.entities.FileStatus) SelectedResourcesProvider(com.oxygenxml.git.view.staging.ChangesPanel.SelectedResourcesProvider) ArrayList(java.util.ArrayList) List(java.util.List) GitResourceContextualMenu(com.oxygenxml.git.view.staging.GitResourceContextualMenu)

Example 18 with GitResourceContextualMenu

use of com.oxygenxml.git.view.staging.GitResourceContextualMenu in project oxygen-git-client-addon by oxygenxml.

the class GitViewResourceContextualMenuActionsTest method testActionsEnablingState_13.

/**
 * <p><b>Description:</b> test the enabling state of the actions
 * from the contextual menu of the staged resources.</p>
 * <p><b>Bug ID:</b> EXM-40615</p>
 *
 * @author sorin_carbunaru
 *
 * @throws Exception
 */
public void testActionsEnablingState_13() throws Exception {
    GitResourceContextualMenu menu = new GitResourceContextualMenu(new SelectedResourcesProvider() {

        @Override
        public List<FileStatus> getOnlySelectedLeaves() {
            return getAllSelectedResources();
        }

        @Override
        public List<FileStatus> getAllSelectedResources() {
            List<FileStatus> fileStatuses = new ArrayList<>();
            fileStatuses.add(new FileStatus(GitChangeType.REMOVED, "test.xml"));
            fileStatuses.add(new FileStatus(GitChangeType.CHANGED, "test2.xml"));
            return fileStatuses;
        }
    }, gitCtrl, null, // For staged resources
    true, Optional.of(RepositoryState.SAFE));
    assertEquals("\n" + "Open_In_Compare [DISABLED]\n" + "Open [DISABLED]\n" + "----\n" + "Unstage [ENABLED]\n" + "Resolve_Conflict [DISABLED]\n" + "  Open_In_Compare [DISABLED]\n" + "  ----\n" + "  Resolve_Using_Mine [DISABLED]\n" + "  Resolve_Using_Theirs [DISABLED]\n" + "  Mark_Resolved [DISABLED]\n" + "  ----\n" + "  Restart_Merge [DISABLED]\n" + "Discard [ENABLED]", PopupMenuSerializer.serializePopupStructure(menu, true, true));
}
Also used : FileStatus(com.oxygenxml.git.service.entities.FileStatus) SelectedResourcesProvider(com.oxygenxml.git.view.staging.ChangesPanel.SelectedResourcesProvider) ArrayList(java.util.ArrayList) List(java.util.List) GitResourceContextualMenu(com.oxygenxml.git.view.staging.GitResourceContextualMenu)

Example 19 with GitResourceContextualMenu

use of com.oxygenxml.git.view.staging.GitResourceContextualMenu in project oxygen-git-client-addon by oxygenxml.

the class GitViewResourceContextualMenuActionsTest method testActionsEnablingState_18.

/**
 * <p><b>Description:</b> test the enabling state of the actions
 * from the contextual menu of the unstaged resources.</p>
 * <p><b>Bug ID:</b> EXM-40615</p>
 *
 * @author sorin_carbunaru
 *
 * @throws Exception
 */
public void testActionsEnablingState_18() throws Exception {
    GitResourceContextualMenu menu = new GitResourceContextualMenu(new SelectedResourcesProvider() {

        @Override
        public List<FileStatus> getOnlySelectedLeaves() {
            return getAllSelectedResources();
        }

        @Override
        public List<FileStatus> getAllSelectedResources() {
            List<FileStatus> fileStatuses = new ArrayList<>();
            fileStatuses.add(new FileStatus(GitChangeType.MODIFIED, "test.xml"));
            fileStatuses.add(new FileStatus(GitChangeType.MODIFIED, "test2.xml"));
            return fileStatuses;
        }
    }, gitCtrl, null, // For unstaged resources
    false, Optional.of(RepositoryState.SAFE));
    assertEquals("\n" + "Open_In_Compare [DISABLED]\n" + "Open [ENABLED]\n" + "----\n" + "Stage [ENABLED]\n" + "Resolve_Conflict [DISABLED]\n" + "  Open_In_Compare [DISABLED]\n" + "  ----\n" + "  Resolve_Using_Mine [DISABLED]\n" + "  Resolve_Using_Theirs [DISABLED]\n" + "  Mark_Resolved [DISABLED]\n" + "  ----\n" + "  Restart_Merge [DISABLED]\n" + "Discard [ENABLED]\n" + "----\n" + "Show_history [DISABLED]\n" + "Show_blame [DISABLED]", PopupMenuSerializer.serializePopupStructure(menu, true, true));
}
Also used : FileStatus(com.oxygenxml.git.service.entities.FileStatus) SelectedResourcesProvider(com.oxygenxml.git.view.staging.ChangesPanel.SelectedResourcesProvider) ArrayList(java.util.ArrayList) List(java.util.List) GitResourceContextualMenu(com.oxygenxml.git.view.staging.GitResourceContextualMenu)

Example 20 with GitResourceContextualMenu

use of com.oxygenxml.git.view.staging.GitResourceContextualMenu in project oxygen-git-client-addon by oxygenxml.

the class GitViewResourceContextualMenuActionsTest method testActionsEnablingState_10.

/**
 * <p><b>Description:</b> test the enabling state of the actions
 * from the contextual menu of the unstaged resources.</p>
 * <p><b>Bug ID:</b> EXM-40615</p>
 *
 * @author sorin_carbunaru
 *
 * @throws Exception
 */
public void testActionsEnablingState_10() throws Exception {
    GitResourceContextualMenu menu = new GitResourceContextualMenu(new SelectedResourcesProvider() {

        @Override
        public List<FileStatus> getOnlySelectedLeaves() {
            return getAllSelectedResources();
        }

        @Override
        public List<FileStatus> getAllSelectedResources() {
            List<FileStatus> fileStatuses = new ArrayList<>();
            fileStatuses.add(new FileStatus(GitChangeType.MISSING, "test.xml"));
            fileStatuses.add(new FileStatus(GitChangeType.UNTRACKED, "test2.xml"));
            return fileStatuses;
        }
    }, gitCtrl, null, // For unstaged resources
    false, Optional.of(RepositoryState.SAFE));
    assertEquals("\n" + "Open_In_Compare [DISABLED]\n" + "Open [DISABLED]\n" + "----\n" + "Stage [ENABLED]\n" + "Resolve_Conflict [DISABLED]\n" + "  Open_In_Compare [DISABLED]\n" + "  ----\n" + "  Resolve_Using_Mine [DISABLED]\n" + "  Resolve_Using_Theirs [DISABLED]\n" + "  Mark_Resolved [DISABLED]\n" + "  ----\n" + "  Restart_Merge [DISABLED]\n" + "Discard [ENABLED]\n" + "----\n" + "Show_history [DISABLED]\n" + "Show_blame [DISABLED]", PopupMenuSerializer.serializePopupStructure(menu, true, true));
}
Also used : FileStatus(com.oxygenxml.git.service.entities.FileStatus) SelectedResourcesProvider(com.oxygenxml.git.view.staging.ChangesPanel.SelectedResourcesProvider) ArrayList(java.util.ArrayList) List(java.util.List) GitResourceContextualMenu(com.oxygenxml.git.view.staging.GitResourceContextualMenu)

Aggregations

SelectedResourcesProvider (com.oxygenxml.git.view.staging.ChangesPanel.SelectedResourcesProvider)21 GitResourceContextualMenu (com.oxygenxml.git.view.staging.GitResourceContextualMenu)21 ArrayList (java.util.ArrayList)21 List (java.util.List)21 FileStatus (com.oxygenxml.git.service.entities.FileStatus)20 Repository (org.eclipse.jgit.lib.Repository)4