blob: bc552422a51ff72565835a47495f0aacf08d0357 (
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/*********************************************************************
* Copyright (c) 2011, 2015 Tasktop Technologies 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:
* Tasktop Technologies - initial API and implementation
*********************************************************************/
package org.eclipse.mylyn.internal.reviews.ui;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.reviews.internal.core.TaskReviewsMappingsStore;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.progress.UIJob;
import org.osgi.framework.BundleContext;
/**
* @author Steffen Pingel
*/
@SuppressWarnings("restriction")
public class ReviewsUiPlugin extends AbstractUIPlugin {
public static final String PLUGIN_ID = "org.eclipse.mylyn.reviews.ui"; //$NON-NLS-1$
private static ReviewsUiPlugin plugin;
private ActiveReviewManager reviewManager;
private TaskReviewsMappingsStore taskReviewsMappingStore;
public ReviewsUiPlugin() {
}
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
reviewManager = new ActiveReviewManager();
//We need to schedule initialization otherwise TasksUiPlugin hasn't finished initialization.
UIJob job = new UIJob(Messages.ReviewsUiPlugin_Updating_task_review_mapping) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
taskReviewsMappingStore = new TaskReviewsMappingsStore(TasksUiPlugin.getTaskList(),
TasksUiPlugin.getRepositoryManager());
TaskReviewsMappingsStore.setInstance(taskReviewsMappingStore);
TasksUiPlugin.getTaskList().addChangeListener(taskReviewsMappingStore);
Job job = new Job(Messages.ReviewsUiPlugin_Updating_task_review_mapping) {
@Override
protected IStatus run(IProgressMonitor monitor) {
taskReviewsMappingStore.readFromTaskList();
return Status.OK_STATUS;
}
};
job.setSystem(true);
job.setUser(false);
job.schedule();
return Status.OK_STATUS;
}
};
job.schedule();
}
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
public static ReviewsUiPlugin getDefault() {
return plugin;
}
public ActiveReviewManager getReviewManager() {
return reviewManager;
}
public TaskReviewsMappingsStore getTaskReviewsMappingStore() {
return taskReviewsMappingStore;
}
}
|