Search in sources :

Example 1 with GetProjectsDataXmlMessage

use of jetbrains.communicator.core.transport.GetProjectsDataXmlMessage 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)

Aggregations

Semaphore (java.util.concurrent.Semaphore)1 GetProjectsDataXmlMessage (jetbrains.communicator.core.transport.GetProjectsDataXmlMessage)1 ProjectsData (jetbrains.communicator.core.vfs.ProjectsData)1 CanceledException (jetbrains.communicator.ide.CanceledException)1 Element (org.jdom.Element)1