public TreeSet<String> getRemotePackageNames(IProgressMonitor monitor) throws InterruptedException, Exception {
TreeSet<String> packageNames = new TreeSet<String>();
// temporarily set timeout
int timeoutMillis = getProjectModel().getForceProject().getReadTimeoutMillis();
Connection connection = null;
try {
monitorCheck(monitor);
connection =
ContainerDelegate.getInstance().getFactoryLocator().getConnectionFactory()
.getConnection(getProjectModel().getForceProject());
connection.setTimeoutMillis(Constants.INTERNAL_TIMEOUT_MILLIS);
getProjectModel().setConnection(connection);
monitorCheck(monitor);
ProjectPackageList projectPackageList =
ContainerDelegate.getInstance().getServiceLocator().getProjectService().getProjectPackageFactory()
.getDevelopmentAndUnmanagedInstalledProjectPackages(connection);
String[] packageNameArray = projectPackageList.getPackageNames();
if (Utils.isNotEmpty(packageNameArray)) {
packageNames.addAll(Arrays.asList(packageNameArray));
}
} catch (InterruptedException e) {
throw e;
} catch (Exception e) {
logger.warn("Unable to get project packages for project '" + getProjectModel().getProjectName() + "': "
+ ForceExceptionUtils.getRootExceptionMessage(e));
throw e;
} finally {
// set timeout back to users desired limit
if (connection != null) {
connection.setTimeoutMillis(timeoutMillis);
}
}
return packageNames;
}