|
Lines 9-17
Link Here
|
| 9 |
import org.eclipse.ui.views.properties.TextPropertyDescriptor; |
9 |
import org.eclipse.ui.views.properties.TextPropertyDescriptor; |
| 10 |
|
10 |
|
| 11 |
/** |
11 |
/** |
| 12 |
* @author maarten |
12 |
* Display various {@link AbstractTask} properties in the Eclipse Properties View.<br /> |
|
|
13 |
* See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=210639">Bug 210639</a> and |
| 14 |
* <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=208275">Bug 208275</a><br /> |
| 15 |
* |
| 16 |
* @author Maarten Meijer |
| 13 |
*/ |
17 |
*/ |
| 14 |
public class AbstractTaskPropertiesSource implements IPropertySource { |
18 |
public class AbstractTaskPropertiesSource extends AbstractMylynPropertySource implements IPropertySource { |
| 15 |
/** |
19 |
/** |
| 16 |
* |
20 |
* |
| 17 |
*/ |
21 |
*/ |
|
Lines 24-65
Link Here
|
| 24 |
private static final String OWNER = "owner"; |
28 |
private static final String OWNER = "owner"; |
| 25 |
private static final String PARENT = "parent"; |
29 |
private static final String PARENT = "parent"; |
| 26 |
private static final String SCHEDULED = "scheduled"; |
30 |
private static final String SCHEDULED = "scheduled"; |
| 27 |
private static final String SUMMARY = "summary"; |
|
|
| 28 |
|
| 29 |
private AbstractTask task; |
| 30 |
/** |
31 |
/** |
| 31 |
* @param adaptableObject |
32 |
* @param adaptableObject |
| 32 |
*/ |
33 |
*/ |
| 33 |
public AbstractTaskPropertiesSource(AbstractTask adaptableObject) { |
34 |
public AbstractTaskPropertiesSource(AbstractTask adaptableObject) { |
| 34 |
this.task = adaptableObject; |
35 |
super(adaptableObject); |
| 35 |
} |
|
|
| 36 |
|
| 37 |
public Object getEditableValue() { |
| 38 |
// TODO Auto-generated method stub |
| 39 |
return null; |
| 40 |
} |
36 |
} |
| 41 |
|
37 |
|
| 42 |
public IPropertyDescriptor[] getPropertyDescriptors() { |
38 |
public IPropertyDescriptor[] getPropertyDescriptors() { |
| 43 |
|
|
|
| 44 |
TextPropertyDescriptor summary = new TextPropertyDescriptor(SUMMARY, "Summary"); |
39 |
TextPropertyDescriptor summary = new TextPropertyDescriptor(SUMMARY, "Summary"); |
| 45 |
summary.setCategory(task.getClass().getName()); |
40 |
summary.setCategory(description); |
| 46 |
TextPropertyDescriptor owner = new TextPropertyDescriptor(OWNER, "Owner"); |
41 |
TextPropertyDescriptor owner = new TextPropertyDescriptor(OWNER, "Owner"); |
| 47 |
owner.setCategory(task.getClass().getName()); |
42 |
owner.setCategory(description); |
| 48 |
TextPropertyDescriptor scheduled = new TextPropertyDescriptor(SCHEDULED, "Scheduled for"); |
43 |
TextPropertyDescriptor scheduled = new TextPropertyDescriptor(SCHEDULED, "Scheduled for"); |
| 49 |
scheduled.setCategory(task.getClass().getName()); |
44 |
scheduled.setCategory(description); |
| 50 |
TextPropertyDescriptor parent = new TextPropertyDescriptor(PARENT, "Parent Containers"); |
45 |
TextPropertyDescriptor parent = new TextPropertyDescriptor(PARENT, "Parent Containers"); |
| 51 |
parent.setCategory(task.getClass().getName()); |
46 |
parent.setCategory(description); |
| 52 |
TextPropertyDescriptor kind = new TextPropertyDescriptor(KIND, "Connector Kind"); |
47 |
TextPropertyDescriptor kind = new TextPropertyDescriptor(KIND, "Repository Connector Kind"); |
| 53 |
kind.setCategory(task.getClass().getName()); |
48 |
kind.setCategory(description); |
| 54 |
TextPropertyDescriptor url = new TextPropertyDescriptor(URL, "Repository URL"); |
49 |
TextPropertyDescriptor url = new TextPropertyDescriptor(URL, "Repository URL"); |
| 55 |
url.setCategory(task.getClass().getName()); |
50 |
url.setCategory(description); |
| 56 |
TextPropertyDescriptor status = new TextPropertyDescriptor(STATUS, "Synchronization Status"); |
51 |
TextPropertyDescriptor status = new TextPropertyDescriptor(STATUS, "Synchronization Status"); |
| 57 |
status.setCategory(task.getClass().getName()); |
52 |
status.setCategory(description); |
| 58 |
TextPropertyDescriptor state = new TextPropertyDescriptor(STATE, "Synchronization State"); |
53 |
TextPropertyDescriptor state = new TextPropertyDescriptor(STATE, "Synchronization State"); |
| 59 |
state.setCategory(task.getClass().getName()); |
54 |
state.setCategory(description); |
| 60 |
TextPropertyDescriptor lastRead = new TextPropertyDescriptor(LAST_READ, "Last Read Timestamp"); |
55 |
TextPropertyDescriptor lastRead = new TextPropertyDescriptor(LAST_READ, "Last Read Timestamp"); |
| 61 |
lastRead.setCategory(task.getClass().getName()); |
56 |
lastRead.setCategory(description); |
| 62 |
return new IPropertyDescriptor[] { |
57 |
IPropertyDescriptor[] specific = new IPropertyDescriptor[] { |
| 63 |
summary, |
58 |
summary, |
| 64 |
owner, |
59 |
owner, |
| 65 |
scheduled, |
60 |
scheduled, |
|
Lines 70-78
Link Here
|
| 70 |
state, |
65 |
state, |
| 71 |
lastRead |
66 |
lastRead |
| 72 |
}; |
67 |
}; |
|
|
68 |
return super.appendSpecifics(specific, super.getPropertyDescriptors()); |
| 73 |
} |
69 |
} |
| 74 |
|
70 |
|
| 75 |
public Object getPropertyValue(Object id) { |
71 |
public Object getPropertyValue(Object id) { |
|
|
72 |
AbstractTask task = (AbstractTask) container; |
| 76 |
if(SUMMARY.equals(id)) { |
73 |
if(SUMMARY.equals(id)) { |
| 77 |
return task.getSummary(); |
74 |
return task.getSummary(); |
| 78 |
} else if(OWNER.equals(id)) { |
75 |
} else if(OWNER.equals(id)) { |
|
Lines 92-113
Link Here
|
| 92 |
} else if(LAST_READ.equals(id)) { |
89 |
} else if(LAST_READ.equals(id)) { |
| 93 |
return task.getLastReadTimeStamp() == null ? NULL_MSG : task.getLastReadTimeStamp().toString(); |
90 |
return task.getLastReadTimeStamp() == null ? NULL_MSG : task.getLastReadTimeStamp().toString(); |
| 94 |
} |
91 |
} |
| 95 |
return null; |
92 |
return super.getPropertyValue(id); |
| 96 |
} |
|
|
| 97 |
|
| 98 |
public boolean isPropertySet(Object id) { |
| 99 |
// TODO Auto-generated method stub |
| 100 |
return false; |
| 101 |
} |
| 102 |
|
| 103 |
public void resetPropertyValue(Object id) { |
| 104 |
// TODO Auto-generated method stub |
| 105 |
|
| 106 |
} |
| 107 |
|
| 108 |
public void setPropertyValue(Object id, Object value) { |
| 109 |
// TODO Auto-generated method stub |
| 110 |
|
| 111 |
} |
93 |
} |
| 112 |
|
94 |
|
| 113 |
} |
95 |
} |