Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 165581

Summary: Improve Open Correspond Task action
Product: z_Archived Reporter: Eugene Kuleshov <ekuleshov>
Component: MylynAssignee: Eugene Kuleshov <ekuleshov>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Reworked Open Correspond Task action
none
Reworked Open Correspond Task action. 2nd take
none
Updating stale patch
none
Second iteration
none
Subclipse integration for Mylar
none
mylar/context/zip
none
updating stale patch
none
Fixed an NPE
none
mylar/context/zip none

Description Eugene Kuleshov CLA 2006-11-22 20:09:55 EST
Happens on opening Corresponding Task from incoming SVN Change Set in Synchronize view for projects linked to JIRA repository.
Mik, I thought you did fixed the error handling so screwed connectors won't affect this. I also wonder why WebRepositoryConnector is called in the first place, links should be resolved to specific JIRA repository.

-- Error Log --
Date: Wed Nov 22 19:59:31 EST 2006
Message: java.lang.NullPointerException
Severity: Error
Plugin ID: org.eclipse.ui
Stack Trace:
java.lang.NullPointerException
	at org.eclipse.mylar.internal.tasks.web.WebRepositoryConnector.getRepositoryUrlFromTaskUrl(WebRepositoryConnector.java:127)
	at org.eclipse.mylar.tasks.core.TaskRepositoryManager.getConnectorForRepositoryTaskUrl(TaskRepositoryManager.java:148)
	at org.eclipse.mylar.internal.tasks.ui.TaskUiUtil.openRepositoryTask(TaskUiUtil.java:143)
	at org.eclipse.mylar.internal.team.ui.actions.OpenCorrespondingTaskAction.run(OpenCorrespondingTaskAction.java:146)
	at org.eclipse.mylar.internal.team.ui.actions.OpenCorrespondingTaskAction.run(OpenCorrespondingTaskAction.java:81)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:253)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:925)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3463)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3077)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1924)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1888)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:348)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:165)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:341)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:285)
	at org.eclipse.core.launcher.Main.run(Main.java:987)
	at org.eclipse.core.launcher.Main.main(Main.java:962)
Comment 1 Eugene Kuleshov CLA 2006-11-25 11:33:55 EST
Same error when trying to open correspond resource from svn changeset (subclipse) with linked web repository.

java.lang.NullPointerException
	at org.eclipse.mylar.internal.tasks.web.WebRepositoryConnector.getRepositoryUrlFromTaskUrl(WebRepositoryConnector.java:151)
	at org.eclipse.mylar.tasks.core.TaskRepositoryManager.getConnectorForRepositoryTaskUrl(TaskRepositoryManager.java:148)
	at org.eclipse.mylar.internal.tasks.ui.TaskUiUtil.openRepositoryTask(TaskUiUtil.java:143)
	at org.eclipse.mylar.internal.team.ui.actions.OpenCorrespondingTaskAction.run(OpenCorrespondingTaskAction.java:146)
	at org.eclipse.mylar.internal.team.ui.actions.OpenCorrespondingTaskAction.run(OpenCorrespondingTaskAction.java:81)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:253)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:925)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3463)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3077)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1924)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1888)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:348)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:165)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:341)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:285)
	at org.eclipse.core.launcher.Main.run(Main.java:987)
	at org.eclipse.core.launcher.Main.main(Main.java:962)
Comment 2 Eugene Kuleshov CLA 2006-11-26 01:31:26 EST
Created attachment 54525 [details]
Reworked Open Correspond Task action
Comment 3 Eugene Kuleshov CLA 2006-11-26 01:46:39 EST
This patch introduce massive refactoring around Open Correspond task action. Now it is working with Subclipse synchronizations and its History view. All old functionality should still work.

There is few new methods on connectors to convert urls back and forth. 

Other plugins can also register own adapters for ILinkedTaskInfo (interface probably should be moved to the core plugin) to make this action work for somewhere else. All old functionality and Subclipse stuff is adapted by LinkedTaskInfoAdapterFactory. I also hooked up svn's issue tracking info. So, repository url resolved from svn info if it is there, though there is still some space for improvement.

I still would like to add one more method into connector API to use information about repository to parse comments. For example, for JIRA they could use project ids to build regexps for really really smart comment parsing. Current parsing it is nearly unusable.
Comment 4 Eugene Kuleshov CLA 2006-11-26 04:46:40 EST
Created attachment 54527 [details]
Reworked Open Correspond Task action. 2nd take

This should fix classloading issues when Subclipse is not avaialable. Also, added better resolution of the repository url from svn properties.
Comment 5 Mik Kersten CLA 2006-11-26 22:50:06 EST
I reviewed the patch and like the LinedTaskInfo approach.  I still need to take a closer look before applying, but before I do that could you post the signature and comment for the additional method that you want on the connector?  And yes, I think we should move ILikendTaskInfo into mylar.tasks but I can do that when reviewing the patch.

Also, since we are not covered by unit tests here could you verify that the manual tests we have listed for this pass after your refactoring: http://wiki.eclipse.org/index.php/Mylar_Testing#Team 
Comment 6 Eugene Kuleshov CLA 2006-11-26 23:09:00 EST
(In reply to comment #5)
> I reviewed the patch and like the LinedTaskInfo approach.  I still need to take
> a closer look before applying, but before I do that could you post the
> signature and comment for the additional method that you want on the connector?

It should take repository (or its url) and a text string and return LikendTaskInfo or an array/collection of those with parsing results. Default implementation can just search for any http urls, and I can look at implementing a special one for JIRA after you'll apply this patch and maybe add this method.
We can eventually see if all the code used in bugzilla edtiors to find "bug#xxx" links can be also moved into that method, though then we may need to include all positions/offsets into the LikendTaskInfo.

>  And yes, I think we should move ILikendTaskInfo into mylar.tasks but I can do
> that when reviewing the patch.

I wonder if we really need interface? Maybe it could be just LinkedTaskInfo. Then you can also move OpenCorrespondingTask action to the task ui plugin.

> Also, since we are not covered by unit tests here could you verify that the
> manual tests we have listed for this pass after your refactoring:
> http://wiki.eclipse.org/index.php/Mylar_Testing#Team 

Will do.
Comment 7 Eugene Kuleshov CLA 2006-11-27 00:00:43 EST
 (In reply to comment #5)
> Also, since we are not covered by unit tests here could you verify that the manual tests we have listed for this pass after your refactoring: http://wiki.eclipse.org/index.php/Mylar_Testing#Team 

Just tested and everything seem working fine.

By the way, when you'll be reviewing this patc, can you please check which one of the following calls is more appropriate to open a Task?

  // TaskUiUtil.openEditor(info.getTask(), false);
  TaskUiUtil.refreshAndOpenTaskListElement(info.getTask());
Comment 8 Eugene Kuleshov CLA 2006-11-27 15:53:54 EST
Here we are. Patch is stale now.
Comment 9 Mik Kersten CLA 2006-11-27 16:25:22 EST
I'm sorry about that Eugene.  I couldn't get to it because it too big a change for me to get to for RC1, and I really needed to apply Willian's patch because it changed the UI.  But this is on top of my list as soon as RC1 goes out.  If you could re-cut the patch it should no longer go stale because we are about to finalize RC1, unless there is a major bug to fix.  New dev build uploading now.
Comment 10 Eugene Kuleshov CLA 2006-11-27 16:30:03 EST
(In reply to comment #9)
> I'm sorry about that Eugene.  I couldn't get to it because it too big a change
> for me to get to for RC1

I really hoped to get this in RC1, so it would be better tested... Will cut a patch again in a minute
Comment 11 Eugene Kuleshov CLA 2006-11-27 16:38:30 EST
Created attachment 54587 [details]
Updating stale patch

Note that attachement submission is still not working for me even with the last dev build.
Comment 12 Eugene Kuleshov CLA 2006-11-27 20:00:55 EST
Mik, Rob, I can barely work on anything else with such huge patch sitting in my workspace. :-(
Comment 13 Mik Kersten CLA 2006-11-28 20:22:18 EST
Patch applied but not verified.  I moved the Subclipse stuff to org.eclipse.mylar.internal.sandbox.team.SubclipseLinkedTaskInfoWrapper, but had to comment that class out until there is a way of consuming that dependency without forcing a check-out of Subclipse.
Comment 14 Eugene Kuleshov CLA 2006-11-29 06:06:14 EST
Created attachment 54696 [details]
Second iteration

This is second iteration. I changed most (if not all) menu contributions to use adaptable class, removed all subclipse dependencies, added new connector method for repository-specific parsing comments and implemented version for jira.

Mik, Rob, I hope you can review and apply this one too. New plugin for Subclipse will be in the next attachment.
Comment 15 Eugene Kuleshov CLA 2006-11-29 06:11:11 EST
Created attachment 54697 [details]
Subclipse integration for Mylar
Comment 16 Eugene Kuleshov CLA 2006-11-29 06:12:53 EST
Created attachment 54698 [details]
mylar/context/zip
Comment 17 Eugene Kuleshov CLA 2006-11-29 16:18:18 EST
TODO move adapter factory into the extension point:

<extension point="org.eclipse.core.runtime.adapters">
  <factory class="com.xyz.MyFileAdapterFactory" 
        adaptableType="org.eclipse.core.resources.IFile">
    <adapter type="com.xyz.MyFile"/>
  </factory>
</extension>
Comment 18 Eugene Kuleshov CLA 2006-12-01 15:13:00 EST
Created attachment 54925 [details]
updating stale patch
Comment 19 Mik Kersten CLA 2006-12-03 00:23:49 EST
Patch applied.  This gets rid of our Subclispe support, so I assume that you will be making a patch to Subclipse to ensure that 1.0 supports it?  If so we will need to ensure that we let the existing users know of the update instructions.
Comment 20 Eugene Kuleshov CLA 2006-12-03 00:46:21 EST
(In reply to comment #19)
> Patch applied.  This gets rid of our Subclispe support, 

Hallelujah! That is totally awesome!

> so I assume that you will be making a patch to Subclipse to ensure 
> that 1.0 supports it?  

I already did. Have you had a chance to look at the plugin I attached here?
https://bugs.eclipse.org/bugs/attachment.cgi?id=54697

> If so we will need to ensure that we let the existing users know 
> of the update instructions.

I was wondering if we can link Sublipse update site from Mylar update site... and in the future we can continue such practice and link other 3rd party plugins integrated with mylar.
Comment 21 Eugene Kuleshov CLA 2006-12-03 16:35:14 EST
Mik, there is a showstopper issue that holds me from completing this. 

Class org.eclipse.mylar.internal.team.ILinkedTaskInfo should be made an API and maybe moved into org.eclipse.mylar.tasks.core plugin.

Here is complete list of dependencies required for new Subclipse plugin:

 org.eclipse.mylar.tasks.core,
 org.eclipse.mylar.tasks.ui,
 org.eclipse.mylar.team,

The only class used from org.eclipse.mylar.tasks.ui is the TasksUiPlugin in order to get list of all repositories to matching repository for svn url (which can be longer then repository URL) So, SubclipseLinkedTaskInfo class is calling TasksUiPlugin.getRepositoryManager().getAllRepositories().
Comment 22 Mik Kersten CLA 2006-12-04 20:58:55 EST
Yes, we should be able to link the site via the discovery site mechanism, and this is something I have always imaged we would have too.  Please open a new bug for that, hopefully we can have it working for 1.0.

I moved ILinkedTaskInfo into ..mylar.tasks.core, it doesn't belong in context.core but seems fine to have as API there.  Regarding the TasksUiPlugin, is that dependency a problem?  Note sure if we will be able to move the repository management into tasks.core quickly enough, but let me know.
Comment 23 Eugene Kuleshov CLA 2006-12-05 04:57:04 EST
Created attachment 55032 [details]
Fixed an NPE
Comment 24 Eugene Kuleshov CLA 2006-12-05 04:57:06 EST
Created attachment 55033 [details]
mylar/context/zip
Comment 25 Mik Kersten CLA 2006-12-05 15:07:52 EST
Patch applied.