	private void runWithSelection(final Object selectedObject) {
		AbstractTask repositoryTask = null;
		if (selectedObject instanceof TaskEditor) {
			TaskEditor editor = (TaskEditor) selectedObject;
			AbstractTask task = editor.getTaskEditorInput().getTask();
			if (task != null) {
				repositoryTask = task;
			}
		} else if (selectedObject instanceof AbstractRepositoryTaskEditor) {
			AbstractRepositoryTaskEditor editor = (AbstractRepositoryTaskEditor) selectedObject;
			repositoryTask = editor.getRepositoryTask();
		}
		if (repositoryTask != null) {
			AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
					repositoryTask.getConnectorKind());
			if (connector != null) {
				TasksUiPlugin.getSynchronizationManager().synchronize(connector, repositoryTask, false,
						new JobChangeAdapter() {
							@Override
							public void done(IJobChangeEvent event) {
								PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
									public void run() {
										if (selectedObject instanceof TaskEditor) {
											TaskEditor editor = (TaskEditor) selectedObject;
											editor.refreshEditorContents();
										} else if (selectedObject instanceof AbstractRepositoryTaskEditor) {
											((AbstractRepositoryTaskEditor) selectedObject).refreshEditor();
										}
									}
								});
							}
						});
			}
		}
	}

	private void runWithSelection(final Object selectedObject) {
		AbstractTask repositoryTask = null;
		if (selectedObject instanceof TaskEditor) {
			TaskEditor editor = (TaskEditor) selectedObject;
			AbstractTask task = editor.getTaskEditorInput().getTask();
			if (task != null) {
				repositoryTask = task;
			}
		} else if (selectedObject instanceof AbstractRepositoryTaskEditor) {
			AbstractRepositoryTaskEditor editor = (AbstractRepositoryTaskEditor) selectedObject;
			repositoryTask = editor.getRepositoryTask();
		}
		if (repositoryTask != null) {
			AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
					repositoryTask.getConnectorKind());
			if (connector != null) {
				TasksUiPlugin.getSynchronizationManager().synchronize(connector, repositoryTask, true,
						new JobChangeAdapter() {
							@Override
							public void done(IJobChangeEvent event) {
								PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
									public void run() {
										if (selectedObject instanceof TaskEditor) {
											TaskEditor editor = (TaskEditor) selectedObject;
											editor.refreshEditorContents();
										} else if (selectedObject instanceof AbstractRepositoryTaskEditor) {
											((AbstractRepositoryTaskEditor) selectedObject).refreshEditor();
										}
									}
								});
							}
						});
			}
		}
	}
