Subversion Repositories XServices

Rev

Rev 30 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
30 brianR 1
/*
2
 *   Mylyn Connector for Serena Business Mashups
3
 * 	 Copyright 2010 Brian Rosenberger (Brutex Network)
4
 *
5
 *   Licensed under the Apache License, Version 2.0 (the "License");
6
 *   you may not use this file except in compliance with the License.
7
 *   You may obtain a copy of the License at
8
 *
9
 *       http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 *   Unless required by applicable law or agreed to in writing, software
12
 *   distributed under the License is distributed on an "AS IS" BASIS,
13
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 *   See the License for the specific language governing permissions and
15
 *   limitations under the License.
16
 *
17
 *   Serena, TeamTrack and Serena Business Mashup are
18
 * 	 registered trademarks of SERENA Software Inc.
19
 */
20
package net.brutex.mylyn.sbmconnector.ui;
21
 
22
import net.brutex.mylyn.sbmconnector.SBMConnectorPlugin;
23
 
24
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
25
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
26
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory;
27
import org.eclipse.mylyn.tasks.ui.editors.BrowserFormPage;
28
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
29
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
30
import org.eclipse.swt.graphics.Image;
31
import org.eclipse.ui.forms.editor.IFormPage;
32
 
33
public class SBMTicketEditorPageFactory extends AbstractTaskEditorPageFactory {
34
 
35
	@Override
36
	public boolean canCreatePageFor(TaskEditorInput input) {
37
		if (input.getTask().getConnectorKind().equals(SBMConnectorPlugin.CONNECTOR_KIND)) {
38
			return true;
39
		}
40
		return false;
41
	}
42
 
43
	@Override
44
	public IFormPage createPage(TaskEditor parentEditor) {
45
		TaskEditorInput input = parentEditor.getTaskEditorInput();
46
		if (input.getTask().getConnectorKind().equals(SBMConnectorPlugin.CONNECTOR_KIND)) {
47
			SBMTicketEditorPage sbmeditor = new SBMTicketEditorPage(parentEditor);
48
			return sbmeditor;
49
		} else {
50
			return new BrowserFormPage(parentEditor, "Formular konnte nicht generiert werden");
51
		}
52
	}
53
 
54
	@Override
55
	public Image getPageImage() {
56
		return CommonImages.getImage(TasksUiImages.REPOSITORY_SMALL);
57
	}
58
 
59
 
60
	@Override
61
	public String getPageText() {
62
		return SBMConnectorPlugin.LABEL;
63
	}
64
 
65
	@Override
66
	public int getPriority() {
67
		// be the first
68
		return PRIORITY_TASK;
69
	}
70
 
71
 
72
}