use of org.eclipse.flux.core.Repository in project flux by eclipse.
the class SyncConnectHandler method setEnabled.
@Override
public void setEnabled(Object evaluationContext) {
Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository();
if (repository != null && evaluationContext instanceof IEvaluationContext) {
IEvaluationContext evalContext = (IEvaluationContext) evaluationContext;
Object selection = evalContext.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
if (selection instanceof ISelection) {
IProject[] selectedProjects = getSelectedProjects((ISelection) selection);
for (IProject project : selectedProjects) {
if (!repository.isConnected(project)) {
setBaseEnabled(true);
return;
}
}
}
}
setBaseEnabled(false);
}
use of org.eclipse.flux.core.Repository in project flux by eclipse.
the class SyncDisconnectHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
IProject[] selectedProjects = getSelectedProjects(selection);
// selectedProjects[0].getLocalTimeStamp();
// selectedProjects[0].getFile(".project").getLocalTimeStamp();
Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository();
if (repository != null) {
for (IProject project : selectedProjects) {
if (repository.isConnected(project)) {
repository.removeProject(project);
}
}
}
return null;
}
use of org.eclipse.flux.core.Repository in project flux by eclipse.
the class SyncDisconnectHandler method setEnabled.
@Override
public void setEnabled(Object evaluationContext) {
Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository();
if (repository != null && evaluationContext instanceof IEvaluationContext) {
IEvaluationContext evalContext = (IEvaluationContext) evaluationContext;
Object selection = evalContext.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
if (selection instanceof ISelection) {
IProject[] selectedProjects = getSelectedProjects((ISelection) selection);
for (IProject project : selectedProjects) {
if (repository.isConnected(project)) {
setBaseEnabled(true);
return;
}
}
}
}
setBaseEnabled(false);
}
use of org.eclipse.flux.core.Repository 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;
}
use of org.eclipse.flux.core.Repository in project flux by eclipse.
the class SyncConnectHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
IProject[] selectedProjects = getSelectedProjects(selection);
Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository();
if (repository != null) {
for (IProject project : selectedProjects) {
if (!repository.isConnected(project)) {
repository.addProject(project);
}
}
}
return null;
}
Aggregations