Community
Participate
Working Groups
I have the following usecase: I write a .textile file and want to include the java doc location for "java.lang.Runnable" by pressing M1+Space. The content assist should then provide me with the entry "JavaDoc reference" and when I select it it should transform "java.lang.Runnable" to {{{Runnable":http://www.sun.com/javadoc/....}}}. How would the content assist perform this replacement? It would try to look up the HTML file for "java/lang/Runnable.html" at Sun's server. The same would go for Eclipse classes. It would convert all "." with "/" and tries to load the website. If that was successful the content assist inserts the URL. I would like to implement that in my own plugin, and need some tips: # How do I contribute to the Mylyn WikiText content assist? The org.eclipse.mylyn.wikitext.ui.contentAssist EP only allows static assists. # How would I get access to the currently used Markup processor and as it for its Hyperlink markup so I can generate that markup at the current cursor position (and replacing the former text) I would provide a preference page where one can add JavaDoc locations and a regex when the location should match. This would also allow me to reference my own classes and their javadoc at github.
Sounds like a very cool feature. Normally to add content assist to the WikiText editor you would add something like this to your plugin.xml: bc. <extension point="org.eclipse.ui.editors.templates"> <template name="%exampleTemplate.name" contextTypeId="org.eclipse.mylyn.wikitext.ui.editor" id="org.eclipse.mylyn.wikitext.ui.examples.assist.template" description="%exampleTemplate.description"> <pattern>my pattern ${text} goes here</pattern> </template> </extension> Unfortunately this standard mechanism for adding templates does not provide a mechanism for having dynamic template patterns such as the one you describe. You might consider making a contribution to enhance the content assist mechanism to support dynamic templates. If you're interested I suggest that you start having a look in @org.eclipse.mylyn.internal.wikitext.ui.editor.assist@ in the org.eclipse.mylyn.wikitext.ui bundle. Also pay special attention to @org.eclipse.jface.text.templates.TemplateProposal@.
Created attachment 159659 [details] mylyn/context/zip
OK, I will look around how this could be accomplished. As described before I would need a way to merge dynamic content proposals with the ones currently active for the editor (provided by the contentAssist wikitext EP). Just today I wanted to add the link to a MSDN class into my textile document and the workflow should have been like this: 1. Type the Class/Function I would like to create a link to. In this example "ReadDirectoryChangesW" 2. Press M1+Space for the content assist. It should present me: "Find Link with google", "Find JavaDoc Link" 3. I select "Find Link with google" and using the Google search API it would find the first entry that google returns and change the "ReadDirectoryChangesW" text into the appropriate "link" for the current text processor. In my case it should have changed into "ReadDirectoryChangesW":http://msdn.microsoft.com/en-us/library/aa365465%28VS.85%29.aspx So first I need to find out how mylyn creates the content proposals and how to hook into that.
What I did was just implementing a template variable resolver for the "url" type. The result is visible here: http://screencast.com/t/ODY1Y2Zj It queries google using the Google search AJAX API and provides the resulting URLs. That's ok, but I would like to have something more. What I also often need is a reference to a source file on github. I just have no idea yet how to resolve that. One would have to read out the workspace projects .git informations and see if github is references there as a remote. If it is, it would compose the URL with the projects remote + the classname (replacing "." with "/").
Created attachment 159790 [details] Initial implementation
Created attachment 159791 [details] Definition of variable resolver
I also works on Eclipse classes, although some manual changes might be necessary. http://screencast.com/t/YWQ4MTFmMD
(In reply to comment #4) > What I did was just implementing a template variable resolver for the "url" > type. The result is visible here: > http://screencast.com/t/ODY1Y2Zj > > It queries google using the Google search AJAX API and provides the resulting > URLs. I just watched the screencast and it looks really cool! Nice job. It's impressive how simple it is. (In reply to comment #4) > What I also often need is a reference to a source file on github. I just have no idea yet how to resolve > that. One would have to read out the workspace projects .git informations and > see if github is references there as a remote. If it is, it would compose the > URL with the projects remote + the classname (replacing "." with "/"). You may want to consider a contribution to "EGit":http://www.eclipse.org/egit for github-related content assist.
Any thoughts how we could bring this into WikiText? Should it be a separate bundle or included into wikitext.ui?
(In reply to comment #9) > Any thoughts how we could bring this into WikiText? Should it be a separate > bundle or included into wikitext.ui? Philipp, unfortunately we cannot add to dependencies of the WikiText ui bundle. That said, your contribution would be welcomed by many, so I'd like to see if there's a way to include it. Currently there's interest in maintaining a JSON library in orbit (bug 301578 for which CQ 3603 was approved). In case you're not aware Orbit is the preferred way for Eclipse bundles to work with 3rd party libraries. If it doesn't already your contribution would have to be modified to use an approved library. I suggest that you join our "weekly conference call":http://wiki.eclipse.org/Mylyn/Meetings if you can. I'll bring up this issue and we can discuss our options.
(In reply to comment #10) > (In reply to comment #9) > > Any thoughts how we could bring this into WikiText? Should it be a separate > > bundle or included into wikitext.ui? > > Philipp, unfortunately we cannot add to dependencies of the WikiText ui bundle. > That said, your contribution would be welcomed by many, so I'd like to see if > there's a way to include it. > > Currently there's interest in maintaining a JSON library in orbit (bug 301578 > for which CQ 3603 was approved). In case you're not aware Orbit is the > preferred way for Eclipse bundles to work with 3rd party libraries. If it > doesn't already your contribution would have to be modified to use an approved > library. I am only using JSON from the Jetty utils bundle, which is Orbit approved. On Thursday I will be not available for the call. But you can bring the issue up and see what others think about the addition and possible further enhancements (like the git integration).
(In reply to comment #11) > I am only using JSON from the Jetty utils bundle, which is Orbit approved. Great to hear! > On Thursday I will be not available for the call. But you can bring the issue up > and see what others think about the addition and possible further enhancements > (like the git integration). No problem, I've put it on the agenda.
We'd like to better understand the use cases for this feature and would like to give users a chance to try it out before including it in the main WikiText distribution. The best way to facilitate this is to create a new WikiText bundle and feature in the Mylyn sandbox. That way users would be able to install it and try it out simply by adding the sandbox update site URL. There were some concerns raised about how this feature handles unrelated search results. To help with this we discussed always scoping the search to one or more websites. This could be done via workspace preferences (requiring new UI) or via extension points. If you're willing to work with us to tweak and polish this feature we'll gladly welcome your very cool contribution!
(In reply to comment #13) > We'd like to better understand the use cases for this feature and would like to > give users a chance to try it out before including it in the main WikiText > distribution. The best way to facilitate this is to create a new WikiText > bundle and feature in the Mylyn sandbox. That way users would be able to > install it and try it out simply by adding the sandbox update site URL. Sure I can provide such a bundle. > There were some concerns raised about how this feature handles unrelated search > results. To help with this we discussed always scoping the search to one or > more websites. This could be done via workspace preferences (requiring new UI) > or via extension points. Yes, we could provide a preference page for the URLs to use to fetch potential candidates. > If you're willing to work with us to tweak and polish this feature we'll gladly > welcome your very cool contribution! I would be happy to contribute. I will add the scoping and create the bundle next week and report back here.
(In reply to comment #14) > Sure I can provide such a bundle. Don't worry about creating a bundle for now. I'll set up the sandbox bundle. That way you won't have to worry about bundle naming, package naming etc. > Yes, we could provide a preference page for the URLs to use to fetch potential > candidates. > ... > I would be happy to contribute. Great! > I will add the scoping and create the bundle next week and report back here. For now you can continue evolving your code against the wikitext.ui bundle until such time as we've got the sandbox set up.
Philipp, you'll notice that we've added the Mylyn WikiText sandbox projects to CVS under tools/org.eclipse.mylyn/sandbox (see bug 304871 for details) Feel free to continue working on your patch here, preferably changing package names to match those in the @org.eclipse.mylyn.wikitext.sandbox.ui@ project.
Thanks David, I will see when I will be able to work on that.
Closed as part of backlog clean-up. Please re-open if you'd like to see this revisited, perhaps with a contribution.