|
Lines 27-32
Link Here
|
| 27 |
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector; |
27 |
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector; |
| 28 |
import org.eclipse.mylar.tasks.core.ITaskListExternalizer; |
28 |
import org.eclipse.mylar.tasks.core.ITaskListExternalizer; |
| 29 |
import org.eclipse.mylar.tasks.core.RepositoryTemplate; |
29 |
import org.eclipse.mylar.tasks.core.RepositoryTemplate; |
|
|
30 |
import org.eclipse.mylar.tasks.ui.AbstractDuplicateDetector; |
| 30 |
import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnectorUi; |
31 |
import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnectorUi; |
| 31 |
import org.eclipse.mylar.tasks.ui.AbstractTaskRepositoryLinkProvider; |
32 |
import org.eclipse.mylar.tasks.ui.AbstractTaskRepositoryLinkProvider; |
| 32 |
import org.eclipse.mylar.tasks.ui.TasksUiPlugin; |
33 |
import org.eclipse.mylar.tasks.ui.TasksUiPlugin; |
|
Lines 53-59
Link Here
|
| 53 |
public static final String ELMNT_TMPL_URLREPOSITORY = "urlRepository"; |
54 |
public static final String ELMNT_TMPL_URLREPOSITORY = "urlRepository"; |
| 54 |
|
55 |
|
| 55 |
public static final String ELMNT_TMPL_REPOSITORYKIND = "repositoryKind"; |
56 |
public static final String ELMNT_TMPL_REPOSITORYKIND = "repositoryKind"; |
| 56 |
|
57 |
|
| 57 |
public static final String ELMNT_TMPL_CHARACTERENCODING = "characterEncoding"; |
58 |
public static final String ELMNT_TMPL_CHARACTERENCODING = "characterEncoding"; |
| 58 |
|
59 |
|
| 59 |
public static final String ELMNT_TMPL_ANONYMOUS = "anonymous"; |
60 |
public static final String ELMNT_TMPL_ANONYMOUS = "anonymous"; |
|
Lines 71-85
Link Here
|
| 71 |
public static final String ELMNT_TMPL_ADDAUTO = "addAutomatically"; |
72 |
public static final String ELMNT_TMPL_ADDAUTO = "addAutomatically"; |
| 72 |
|
73 |
|
| 73 |
public static final String ELMNT_REPOSITORY_CONNECTOR = "connectorCore"; |
74 |
public static final String ELMNT_REPOSITORY_CONNECTOR = "connectorCore"; |
| 74 |
|
75 |
|
| 75 |
public static final String ATTR_USER_MANAGED = "userManaged"; |
76 |
public static final String ATTR_USER_MANAGED = "userManaged"; |
| 76 |
|
77 |
|
| 77 |
public static final String ATTR_CUSTOM_NOTIFICATIONS = "customNotifications"; |
78 |
public static final String ATTR_CUSTOM_NOTIFICATIONS = "customNotifications"; |
| 78 |
|
79 |
|
| 79 |
public static final String ELMNT_REPOSITORY_LINK_PROVIDER = "linkProvider"; |
80 |
public static final String ELMNT_REPOSITORY_LINK_PROVIDER = "linkProvider"; |
| 80 |
|
81 |
|
| 81 |
public static final String ELMNT_REPOSITORY_UI= "connectorUi"; |
82 |
public static final String ELMNT_REPOSITORY_UI = "connectorUi"; |
| 82 |
|
83 |
|
| 83 |
public static final String ELMNT_EXTERNALIZER = "externalizer"; |
84 |
public static final String ELMNT_EXTERNALIZER = "externalizer"; |
| 84 |
|
85 |
|
| 85 |
public static final String ATTR_BRANDING_ICON = "brandingIcon"; |
86 |
public static final String ATTR_BRANDING_ICON = "brandingIcon"; |
|
Lines 101-107
Link Here
|
| 101 |
public static final String ATTR_CLASS = "class"; |
102 |
public static final String ATTR_CLASS = "class"; |
| 102 |
|
103 |
|
| 103 |
public static final String ATTR_MENU_PATH = "menuPath"; |
104 |
public static final String ATTR_MENU_PATH = "menuPath"; |
| 104 |
|
105 |
|
| 105 |
public static final String EXTENSION_EDITORS = "org.eclipse.mylar.tasks.ui.editors"; |
106 |
public static final String EXTENSION_EDITORS = "org.eclipse.mylar.tasks.ui.editors"; |
| 106 |
|
107 |
|
| 107 |
public static final String ELMNT_EDITOR_FACTORY = "editorFactory"; |
108 |
public static final String ELMNT_EDITOR_FACTORY = "editorFactory"; |
|
Lines 110-115
Link Here
|
| 110 |
|
111 |
|
| 111 |
public static final String ELMNT_HYPERLINK_DETECTOR = "hyperlinkDetector"; |
112 |
public static final String ELMNT_HYPERLINK_DETECTOR = "hyperlinkDetector"; |
| 112 |
|
113 |
|
|
|
114 |
public static final String EXTENSION_DUPLICATE_DETECTORS = "org.eclipse.mylar.tasks.ui.duplicateDetectors"; |
| 115 |
|
| 116 |
public static final String ELMNT_DUPLICATE_DETECTOR = "detector"; |
| 117 |
|
| 118 |
public static final String ATTR_NAME = "name"; |
| 119 |
|
| 120 |
public static final String ATTR_KIND = "kind"; |
| 121 |
|
| 113 |
private static boolean coreExtensionsRead = false; |
122 |
private static boolean coreExtensionsRead = false; |
| 114 |
|
123 |
|
| 115 |
public static void initStartupExtensions(TaskListWriter delegatingExternalizer) { |
124 |
public static void initStartupExtensions(TaskListWriter delegatingExternalizer) { |
|
Lines 180-186
Link Here
|
| 180 |
for (int j = 0; j < elements.length; j++) { |
189 |
for (int j = 0; j < elements.length; j++) { |
| 181 |
if (elements[j].getName().equals(ELMNT_REPOSITORY_UI)) { |
190 |
if (elements[j].getName().equals(ELMNT_REPOSITORY_UI)) { |
| 182 |
readRepositoryConnectorUi(elements[j]); |
191 |
readRepositoryConnectorUi(elements[j]); |
| 183 |
} |
192 |
} |
| 184 |
} |
193 |
} |
| 185 |
} |
194 |
} |
| 186 |
|
195 |
|
|
Lines 191-210
Link Here
|
| 191 |
for (int j = 0; j < elements.length; j++) { |
200 |
for (int j = 0; j < elements.length; j++) { |
| 192 |
if (elements[j].getName().equals(ELMNT_REPOSITORY_LINK_PROVIDER)) { |
201 |
if (elements[j].getName().equals(ELMNT_REPOSITORY_LINK_PROVIDER)) { |
| 193 |
readLinkProvider(elements[j]); |
202 |
readLinkProvider(elements[j]); |
| 194 |
} |
203 |
} |
|
|
204 |
} |
| 205 |
} |
| 206 |
|
| 207 |
IExtensionPoint duplicateDetectorsExtensionPoint = registry.getExtensionPoint(EXTENSION_DUPLICATE_DETECTORS); |
| 208 |
IExtension[] dulicateDetectorsExtensions = duplicateDetectorsExtensionPoint.getExtensions(); |
| 209 |
for (int i = 0; i < dulicateDetectorsExtensions.length; i++) { |
| 210 |
IConfigurationElement[] elements = dulicateDetectorsExtensions[i].getConfigurationElements(); |
| 211 |
for (int j = 0; j < elements.length; j++) { |
| 212 |
if (elements[j].getName().equals(ELMNT_DUPLICATE_DETECTOR)) { |
| 213 |
readDuplicateDetector(elements[j]); |
| 214 |
} |
| 195 |
} |
215 |
} |
| 196 |
} |
216 |
} |
| 197 |
|
217 |
|
|
|
218 |
} |
| 219 |
|
| 220 |
private static void readDuplicateDetector(IConfigurationElement element) { |
| 221 |
try { |
| 222 |
Object obj = element.createExecutableExtension(ATTR_CLASS); |
| 223 |
if (obj instanceof AbstractDuplicateDetector) { |
| 224 |
AbstractDuplicateDetector duplicateDetector = (AbstractDuplicateDetector) obj; |
| 225 |
duplicateDetector.setName(element.getAttribute(ATTR_NAME)); |
| 226 |
duplicateDetector.setKind(element.getAttribute(ATTR_KIND)); |
| 227 |
TasksUiPlugin.getDefault().addDuplicateDetector((AbstractDuplicateDetector) duplicateDetector); |
| 228 |
} else { |
| 229 |
MylarStatusHandler.log("Could not load duplicate detector: " + obj.getClass().getCanonicalName(), null); |
| 230 |
} |
| 231 |
} catch (CoreException e) { |
| 232 |
MylarStatusHandler.log(e, "Could not load duplicate detector extension"); |
| 233 |
} |
| 198 |
} |
234 |
} |
| 199 |
|
235 |
|
| 200 |
private static void readLinkProvider(IConfigurationElement element) { |
236 |
private static void readLinkProvider(IConfigurationElement element) { |
| 201 |
try { |
237 |
try { |
| 202 |
Object repositoryLinkProvider = element.createExecutableExtension(ATTR_CLASS); |
238 |
Object repositoryLinkProvider = element.createExecutableExtension(ATTR_CLASS); |
| 203 |
if (repositoryLinkProvider instanceof AbstractTaskRepositoryLinkProvider) { |
239 |
if (repositoryLinkProvider instanceof AbstractTaskRepositoryLinkProvider) { |
| 204 |
TasksUiPlugin.getDefault().addRepositoryLinkProvider((AbstractTaskRepositoryLinkProvider) repositoryLinkProvider); |
240 |
TasksUiPlugin.getDefault().addRepositoryLinkProvider( |
|
|
241 |
(AbstractTaskRepositoryLinkProvider) repositoryLinkProvider); |
| 205 |
} else { |
242 |
} else { |
| 206 |
MylarStatusHandler.log("Could not load repository link provider: " + repositoryLinkProvider.getClass().getCanonicalName(), |
243 |
MylarStatusHandler.log("Could not load repository link provider: " |
| 207 |
null); |
244 |
+ repositoryLinkProvider.getClass().getCanonicalName(), null); |
| 208 |
} |
245 |
} |
| 209 |
} catch (CoreException e) { |
246 |
} catch (CoreException e) { |
| 210 |
MylarStatusHandler.log(e, "Could not load repository link provider extension"); |
247 |
MylarStatusHandler.log(e, "Could not load repository link provider extension"); |
|
Lines 246-257
Link Here
|
| 246 |
if (connectorCore instanceof AbstractRepositoryConnector && type != null) { |
283 |
if (connectorCore instanceof AbstractRepositoryConnector && type != null) { |
| 247 |
AbstractRepositoryConnector repositoryConnector = (AbstractRepositoryConnector) connectorCore; |
284 |
AbstractRepositoryConnector repositoryConnector = (AbstractRepositoryConnector) connectorCore; |
| 248 |
TasksUiPlugin.getRepositoryManager().addRepositoryConnector(repositoryConnector); |
285 |
TasksUiPlugin.getRepositoryManager().addRepositoryConnector(repositoryConnector); |
| 249 |
|
286 |
|
| 250 |
String userManagedString = element.getAttribute(ATTR_USER_MANAGED); |
287 |
String userManagedString = element.getAttribute(ATTR_USER_MANAGED); |
| 251 |
if(userManagedString != null){ |
288 |
if (userManagedString != null) { |
| 252 |
boolean userManaged = Boolean.parseBoolean(userManagedString); |
289 |
boolean userManaged = Boolean.parseBoolean(userManagedString); |
| 253 |
repositoryConnector.setUserManaged(userManaged); |
290 |
repositoryConnector.setUserManaged(userManaged); |
| 254 |
} |
291 |
} |
| 255 |
} else { |
292 |
} else { |
| 256 |
MylarStatusHandler.log("could not not load connector core: " + connectorCore, null); |
293 |
MylarStatusHandler.log("could not not load connector core: " + connectorCore, null); |
| 257 |
} |
294 |
} |
|
Lines 265-285
Link Here
|
| 265 |
try { |
302 |
try { |
| 266 |
Object connectorUiObject = element.createExecutableExtension(ATTR_CLASS); |
303 |
Object connectorUiObject = element.createExecutableExtension(ATTR_CLASS); |
| 267 |
if (connectorUiObject instanceof AbstractRepositoryConnectorUi) { |
304 |
if (connectorUiObject instanceof AbstractRepositoryConnectorUi) { |
| 268 |
AbstractRepositoryConnectorUi connectorUi = (AbstractRepositoryConnectorUi)connectorUiObject; |
305 |
AbstractRepositoryConnectorUi connectorUi = (AbstractRepositoryConnectorUi) connectorUiObject; |
| 269 |
TasksUiPlugin.addRepositoryConnectorUi((AbstractRepositoryConnectorUi) connectorUi); |
306 |
TasksUiPlugin.addRepositoryConnectorUi((AbstractRepositoryConnectorUi) connectorUi); |
| 270 |
|
307 |
|
| 271 |
String customNotificationsString = element.getAttribute(ATTR_CUSTOM_NOTIFICATIONS); |
308 |
String customNotificationsString = element.getAttribute(ATTR_CUSTOM_NOTIFICATIONS); |
| 272 |
if(customNotificationsString != null){ |
309 |
if (customNotificationsString != null) { |
| 273 |
boolean customNotifications = Boolean.parseBoolean(customNotificationsString); |
310 |
boolean customNotifications = Boolean.parseBoolean(customNotificationsString); |
| 274 |
connectorUi.setCustomNotificationHandling(customNotifications); |
311 |
connectorUi.setCustomNotificationHandling(customNotifications); |
| 275 |
} |
312 |
} |
| 276 |
|
313 |
|
| 277 |
String iconPath = element.getAttribute(ATTR_BRANDING_ICON); |
314 |
String iconPath = element.getAttribute(ATTR_BRANDING_ICON); |
| 278 |
if (iconPath != null) { |
315 |
if (iconPath != null) { |
| 279 |
ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(element.getContributor() |
316 |
ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(element.getContributor() |
| 280 |
.getName(), iconPath); |
317 |
.getName(), iconPath); |
| 281 |
if (descriptor != null) { |
318 |
if (descriptor != null) { |
| 282 |
TasksUiPlugin.getDefault().addBrandingIcon(((AbstractRepositoryConnectorUi)connectorUi).getRepositoryType(), |
319 |
TasksUiPlugin.getDefault().addBrandingIcon( |
|
|
320 |
((AbstractRepositoryConnectorUi) connectorUi).getRepositoryType(), |
| 283 |
TasksUiImages.getImage(descriptor)); |
321 |
TasksUiImages.getImage(descriptor)); |
| 284 |
} |
322 |
} |
| 285 |
} |
323 |
} |
|
Lines 288-295
Link Here
|
| 288 |
ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(element.getContributor() |
326 |
ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(element.getContributor() |
| 289 |
.getName(), overlayIconPath); |
327 |
.getName(), overlayIconPath); |
| 290 |
if (descriptor != null) { |
328 |
if (descriptor != null) { |
| 291 |
TasksUiPlugin.getDefault().addOverlayIcon(((AbstractRepositoryConnectorUi)connectorUi).getRepositoryType(), |
329 |
TasksUiPlugin.getDefault().addOverlayIcon( |
| 292 |
descriptor); |
330 |
((AbstractRepositoryConnectorUi) connectorUi).getRepositoryType(), descriptor); |
| 293 |
} |
331 |
} |
| 294 |
} |
332 |
} |
| 295 |
} else { |
333 |
} else { |
|
Lines 300-306
Link Here
|
| 300 |
MylarStatusHandler.log(e, "Could not load tasklist listener extension"); |
338 |
MylarStatusHandler.log(e, "Could not load tasklist listener extension"); |
| 301 |
} |
339 |
} |
| 302 |
} |
340 |
} |
| 303 |
|
341 |
|
| 304 |
private static void readRepositoryTemplate(IConfigurationElement element) { |
342 |
private static void readRepositoryTemplate(IConfigurationElement element) { |
| 305 |
|
343 |
|
| 306 |
boolean anonymous = false; |
344 |
boolean anonymous = false; |
|
Lines 322-339
Link Here
|
| 322 |
&& TasksUiPlugin.getRepositoryManager().getRepositoryConnector(repKind) != null) { |
360 |
&& TasksUiPlugin.getRepositoryManager().getRepositoryConnector(repKind) != null) { |
| 323 |
AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager() |
361 |
AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager() |
| 324 |
.getRepositoryConnector(repKind); |
362 |
.getRepositoryConnector(repKind); |
| 325 |
RepositoryTemplate template = new RepositoryTemplate(label, serverUrl, encoding, version, newTaskUrl, taskPrefix, |
363 |
RepositoryTemplate template = new RepositoryTemplate(label, serverUrl, encoding, version, newTaskUrl, |
| 326 |
taskQueryUrl, newAccountUrl, anonymous, addAuto); |
364 |
taskPrefix, taskQueryUrl, newAccountUrl, anonymous, addAuto); |
| 327 |
connector.addTemplate(template); |
365 |
connector.addTemplate(template); |
| 328 |
|
366 |
|
| 329 |
for (IConfigurationElement configElement : element.getChildren()) { |
367 |
for (IConfigurationElement configElement : element.getChildren()) { |
| 330 |
String name = configElement.getAttribute("name"); |
368 |
String name = configElement.getAttribute("name"); |
| 331 |
String value = configElement.getAttribute("value"); |
369 |
String value = configElement.getAttribute("value"); |
| 332 |
if(name != null && !name.equals("") && value != null) { |
370 |
if (name != null && !name.equals("") && value != null) { |
| 333 |
template.addAttribute(name, value); |
371 |
template.addAttribute(name, value); |
| 334 |
} |
372 |
} |
| 335 |
} |
373 |
} |
| 336 |
|
374 |
|
| 337 |
} else { |
375 |
} else { |
| 338 |
MylarStatusHandler.log("Could not load repository template extension " + element.getName(), |
376 |
MylarStatusHandler.log("Could not load repository template extension " + element.getName(), |
| 339 |
TasksUiExtensionReader.class); |
377 |
TasksUiExtensionReader.class); |