blob: be20894858d054dc2fb40259da0fab8fa0de7044 (
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
|
/*******************************************************************************
* Copyright (c) 2004, 2007 Mylyn project committers 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
*******************************************************************************/
package org.eclipse.mylyn.bugzilla.deprecated;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylyn.internal.tasks.ui.deprecated.AbstractRepositoryTaskEditor;
import org.eclipse.mylyn.internal.tasks.ui.deprecated.AbstractTaskEditorFactory;
import org.eclipse.mylyn.internal.tasks.ui.deprecated.RepositoryTaskEditorInput;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.part.EditorPart;
/**
* @author Mik Kersten
* @author Rob Elves
*/
public class BugzillaTaskEditorFactory extends AbstractTaskEditorFactory {
private static final String TITLE = "Bugzilla";
@Override
public EditorPart createEditor(TaskEditor parentEditor, IEditorInput editorInput) {
AbstractRepositoryTaskEditor editor = null;
if (editorInput instanceof RepositoryTaskEditorInput) {
RepositoryTaskEditorInput taskInput = (RepositoryTaskEditorInput) editorInput;
if (taskInput.getTaskData().isNew()) {
editor = new NewBugzillaTaskEditor(parentEditor);
} else {
editor = new BugzillaTaskEditor(parentEditor);
}
} else if (editorInput instanceof TaskEditorInput) {
editor = new BugzillaTaskEditor(parentEditor);
}
return editor;
}
@Override
public IEditorInput createEditorInput(ITask task) {
if (task instanceof BugzillaTask) {
BugzillaTask bugzillaTask = (BugzillaTask) task;
final TaskRepository repository = TasksUi.getRepositoryManager().getRepository(
BugzillaCorePlugin.CONNECTOR_KIND, bugzillaTask.getRepositoryUrl());
BugzillaTaskEditorInput input = new BugzillaTaskEditorInput(repository, bugzillaTask, true);
return input;
}
return null;
}
@Override
public String getTitle() {
return TITLE;
}
@Override
public boolean canCreateEditorFor(ITask task) {
return task instanceof BugzillaTask;
}
@Override
public boolean providesOutline() {
return true;
}
@Override
public boolean canCreateEditorFor(IEditorInput input) {
if (input instanceof RepositoryTaskEditorInput) {
return BugzillaCorePlugin.CONNECTOR_KIND.equals(((RepositoryTaskEditorInput) input).getRepository()
.getConnectorKind());
}
return false;
}
}
|