blob: 07a4b4da3a28fe68ce78e24e79c4c2d91fc9191c (
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
/*******************************************************************************
* Copyright (c) 2004, 2009 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.tasks.ui.editors;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IPluginContribution;
import org.eclipse.ui.forms.editor.IFormPage;
/**
* @since 3.0
* @author Steffen Pingel
*/
public abstract class AbstractTaskEditorPageFactory implements IPluginContribution {
public static final int PRIORITY_ADDITIONS = 100;
public static final int PRIORITY_CONTEXT = 20;
public static final int PRIORITY_PLANNING = 10;
public static final int PRIORITY_TASK = 30;
private String id;
private String pluginId;
public abstract boolean canCreatePageFor(@NonNull TaskEditorInput input);
@NonNull
public abstract IFormPage createPage(@NonNull TaskEditor parentEditor);
@Nullable
public String[] getConflictingIds(@NonNull TaskEditorInput input) {
return null;
}
@Nullable
public String getId() {
return id;
}
// TODO EDITOR life cycle of image?
@NonNull
public abstract Image getPageImage();
@NonNull
public abstract String getPageText();
public int getPriority() {
return PRIORITY_ADDITIONS;
}
public void setId(String id) {
this.id = id;
}
/**
* {@inheritDoc}
*
* @since 3.2
*/
@Nullable
public final String getLocalId() {
return getId();
}
/**
* {@inheritDoc}
*
* @since 3.2
* @see #setPluginId(String)
*/
@Nullable
public final String getPluginId() {
return pluginId;
}
/**
* @since 3.2
* @see #getPluginId()
*/
public final void setPluginId(@Nullable String pluginId) {
this.pluginId = pluginId;
}
/**
* Clients should override to provide an image for <code>page</code>. Invokes {@link #getPageImage()} for backwards
* compatibility.
*
* @param editor
* the task editor instance
* @param page
* the page that uses the image
* @return an image
* @since 3.10
*/
@NonNull
public Image getPageImage(@NonNull TaskEditor editor, @NonNull IFormPage page) {
return getPageImage();
}
/**
* Clients should override to provide a label for <code>page</code>. Invokes {@link #getPageText()} for backwards
* compatibility.
*
* @param editor
* the task editor instance
* @param page
* the page that uses the label
* @return a label
* @since 3.10
*/
@NonNull
public String getPageText(@NonNull TaskEditor editor, @NonNull IFormPage page) {
return getPageText();
}
}
|