blob: 44bab3c926a1302e0d9ab41f69fa9c0a71acbc21 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/*******************************************************************************
* Copyright (c) 2011 Frank Becker and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Frank Becker - initial API and implementation
*******************************************************************************/
package org.eclipse.mylyn.internal.tasks.core.sync;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.sync.TaskJob;
public class UpdateRepositoryConfigurationJob extends TaskJob {
AbstractRepositoryConnector connector;
TaskRepository repository;
private IStatus error;
public UpdateRepositoryConfigurationJob(String name, TaskRepository repository,
AbstractRepositoryConnector connector) {
super(name);
this.connector = connector;
this.repository = repository;
}
@Override
public IStatus getStatus() {
return error;
}
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask(Messages.UpdateRepositoryConfigurationJob_Receiving_configuration, 100);
try {
try {
connector.updateRepositoryConfiguration(repository, subMonitorFor(monitor, 100));
} catch (CoreException e) {
error = e.getStatus();
}
} finally {
monitor.done();
}
return Status.OK_STATUS;
}
@Override
public boolean belongsTo(Object family) {
return family == repository;
}
}
|