Skip to main content
summaryrefslogtreecommitdiffstats
blob: fd6c3f12a16f562658d7e2c3c9b6192aaf47d081 (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
/*******************************************************************************
 * Copyright (c) 2004, 2008 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.tasks.ui.editors;

import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;

/**
 * An outline page for a {@link TaskEditor}.
 * 
 * @author Steffen Pingel
 */
public class TaskEditorOutlinePage extends ContentOutlinePage {

	private TaskEditorOutlineModel model;

	private TaskRepository taskRepository;

	private TreeViewer viewer;

	public TaskEditorOutlinePage() {
	}

	public void setInput(TaskRepository taskRepository, TaskEditorOutlineNode rootNode) {
		this.taskRepository = taskRepository;
		if (rootNode != null) {
			this.model = new TaskEditorOutlineModel(rootNode);
		} else {
			this.model = null;
		}
		if (viewer != null) {
			viewer.setInput(this.model);
			viewer.expandAll();
			viewer.refresh(true);
		}
	}

	@Override
	public void createControl(Composite parent) {
		super.createControl(parent);
		viewer = getTreeViewer();
		viewer.setContentProvider(new TaskEditorOutlineContentProvider());
		viewer.setLabelProvider(new TaskEditorOutlineNodeLabelProvider());
		viewer.setInput(model);
		viewer.expandAll();
	}

}

Back to the top