Search in sources :

Example 1 with ProjectsData

use of jetbrains.communicator.core.vfs.ProjectsData in project intellij-plugins by JetBrains.

the class Helper method doGetProjectsData.

public static ProjectsData doGetProjectsData(final Transport transport, final User user, IDEFacade ideFacade) {
    final ProjectsData[] result = new ProjectsData[] { ProjectsData.NULL };
    if (user.isOnline()) {
        try {
            UIUtil.run(ideFacade, StringUtil.getMsg("ViewFilesCommand.title", user.getDisplayName()), new Runnable() {

                @Override
                public void run() {
                    final Semaphore semaphore = new Semaphore(1);
                    try {
                        semaphore.acquire();
                        transport.sendXmlMessage(user, new GetProjectsDataXmlMessage(result) {

                            @Override
                            public void processResponse(Element responseElement) {
                                super.processResponse(responseElement);
                                semaphore.release();
                            }
                        });
                        semaphore.tryAcquire(getWaitTimeout(), TimeUnit.MILLISECONDS);
                    } catch (InterruptedException ignored) {
                    }
                }
            });
        } catch (CanceledException ignored) {
        //
        }
    }
    return result[0];
}
Also used : CanceledException(jetbrains.communicator.ide.CanceledException) ProjectsData(jetbrains.communicator.core.vfs.ProjectsData) GetProjectsDataXmlMessage(jetbrains.communicator.core.transport.GetProjectsDataXmlMessage) Element(org.jdom.Element) Semaphore(java.util.concurrent.Semaphore)

Example 2 with ProjectsData

use of jetbrains.communicator.core.vfs.ProjectsData in project intellij-plugins by JetBrains.

the class ViewFilesTest method testTree_SortProjects.

public void testTree_SortProjects() throws Exception {
    ProjectsData projectsData = new ProjectsData();
    projectsData.setProjectFiles("aaa", new VFile[0]);
    projectsData.setProjectFiles("ccc", new VFile[0]);
    projectsData.setProjectFiles("bbb", new VFile[0]);
    myViewFilesPanel.refreshData(myUser, projectsData);
    assertTree(new String[] { "aaa", "bbb", "ccc" });
}
Also used : ProjectsData(jetbrains.communicator.core.vfs.ProjectsData)

Example 3 with ProjectsData

use of jetbrains.communicator.core.vfs.ProjectsData in project intellij-plugins by JetBrains.

the class ViewFilesTest method testTree_ProjectAndNonProjectFiles.

public void testTree_ProjectAndNonProjectFiles() throws Exception {
    ProjectsData projectsData = new ProjectsData();
    projectsData.addNonProjectFile(VFile.create("log4j.xml"));
    projectsData.setProjectFiles("ideTalk", new VFile[] { VFile.create("build.xml") });
    myViewFilesPanel.refreshData(myUser, projectsData);
    assertTree(new String[] { "ideTalk", "build.xml", ViewFilesPanel.NON_PROJECT_NODE, "log4j.xml" });
}
Also used : ProjectsData(jetbrains.communicator.core.vfs.ProjectsData)

Example 4 with ProjectsData

use of jetbrains.communicator.core.vfs.ProjectsData in project intellij-plugins by JetBrains.

the class ViewFilesTest method testHideReadOnly.

public void testHideReadOnly() throws Exception {
    myViewFilesPanel.showReadOnly(true);
    ProjectsData projectsData = new ProjectsData();
    projectsData.setProjectFiles("ideTalk", new VFile[] { VFile.create("aaa", true), VFile.create("bbb", false) });
    myViewFilesPanel.refreshData(myUser, projectsData);
    assertTree(new String[] { "ideTalk", "aaa", "bbb" });
    myViewFilesPanel.showReadOnly(false);
    assertFalse(myViewFilesPanel.isReadOnlyShown());
    assertEquals(myViewFilesPanel.isReadOnlyShown(), myOptions.isSet(ViewFilesPanel.SHOW_READ_ONLY_KEY, true));
    assertTree(new String[] { "ideTalk", "aaa" });
}
Also used : ProjectsData(jetbrains.communicator.core.vfs.ProjectsData)

Example 5 with ProjectsData

use of jetbrains.communicator.core.vfs.ProjectsData in project intellij-plugins by JetBrains.

the class ViewFilesTest method testTree_FileNotInProject.

public void testTree_FileNotInProject() throws Exception {
    ProjectsData projectsData = new ProjectsData();
    projectsData.addNonProjectFile(VFile.create("log4j.xml"));
    myViewFilesPanel.refreshData(myUser, projectsData);
    assertTree(new String[] { ViewFilesPanel.NON_PROJECT_NODE, "log4j.xml" });
}
Also used : ProjectsData(jetbrains.communicator.core.vfs.ProjectsData)

Aggregations

ProjectsData (jetbrains.communicator.core.vfs.ProjectsData)17 IDEFacade (jetbrains.communicator.ide.IDEFacade)3 MockUser (jetbrains.communicator.mock.MockUser)3 User (jetbrains.communicator.core.users.User)2 Semaphore (java.util.concurrent.Semaphore)1 GetProjectsDataXmlMessage (jetbrains.communicator.core.transport.GetProjectsDataXmlMessage)1 CanceledException (jetbrains.communicator.ide.CanceledException)1 Element (org.jdom.Element)1