blob: bf42bc9168bf4b5fccb64a8838f0cfb55586cfe5 (
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
|
/*******************************************************************************
* 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.tasks.ui.editors;
import org.eclipse.core.runtime.Assert;
/**
* @author Steffen Pingel
* @since 3.0
*/
public abstract class TaskEditorPartDescriptor {
private final String id;
private String path;
// public AbstractTaskEditorPart createPart() {
// final AbstractTaskEditorPart[] result = new AbstractTaskEditorPart[1];
// SafeRunnable.run(new ISafeRunnable() {
//
// public void handleException(Throwable exception) {
// StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
// "Unable to create instance of class \"" + getClassName() + "\" for task editor part \""
// + getId() + "\""));
// }
//
// public void run() throws Exception {
// Class<?> clazz = Class.forName(getClassName());
// result[0] = (AbstractTaskEditorPart) clazz.newInstance();
// }
//
// });
// return result[0];
// }
public TaskEditorPartDescriptor(String id) {
Assert.isNotNull(id);
this.id = id;
}
public abstract AbstractTaskEditorPart createPart();
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
TaskEditorPartDescriptor other = (TaskEditorPartDescriptor) obj;
return id.equals(other.id);
}
public String getId() {
return id;
}
public String getPath() {
return path;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id.hashCode();
return result;
}
public TaskEditorPartDescriptor setPath(String path) {
this.path = path;
return this;
}
}
|