use of org.eclipse.flux.core.DownloadProject.CompletionCallback in project flux by eclipse.
the class InitializeServiceEnvironment method initializeProject.
private void initializeProject(String projectName) {
try {
// already connected project
if (repository.isConnected(projectName))
return;
// project doesn't exist in workspace
DownloadProject downloadProject = new DownloadProject(messagingConnector, projectName, repository.getUsername());
downloadProject.run(new CompletionCallback() {
@Override
public void downloadFailed() {
}
@Override
public void downloadComplete(IProject downloadedProject) {
try {
downloadedProject.build(IncrementalProjectBuilder.FULL_BUILD, null);
} catch (CoreException e) {
e.printStackTrace();
}
repository.addProject(downloadedProject);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.eclipse.flux.core.DownloadProject.CompletionCallback in project flux by eclipse.
the class SyncDownloadHandler method execute.
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
final Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository();
final MessageConnector messagingConnector = org.eclipse.flux.core.Activator.getDefault().getMessageConnector();
if (repository == null || messagingConnector == null) {
return null;
}
final Shell shell = FluxUiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
SyncDownloadSelectionDialog selectionDialog = new SyncDownloadSelectionDialog(shell, new LabelProvider(), messagingConnector, repository.getUsername());
int result = selectionDialog.open();
if (result == Dialog.OK) {
Object[] selectedProjects = selectionDialog.getResult();
for (Object selectedProject : selectedProjects) {
if (selectedProject instanceof String) {
DownloadProject downloadProject = new DownloadProject(messagingConnector, (String) selectedProject, repository.getUsername());
downloadProject.run(new CompletionCallback() {
@Override
public void downloadFailed() {
}
@Override
public void downloadComplete(IProject project) {
repository.addProject(project);
}
});
}
}
}
return null;
}
Aggregations