Development, ToolJune 17, 2005 14:47
Wordpress/Blogsome plugin for Omea Reader 2. - Simplification
There is a newer post on this plugin here in my blog!
I found some articles on the resource handling, so I made the retriving of the data which was mentioned in Wordpress/Blogsome plugin for Omea Reader post more simple . I can use context.SelectedPlainText; instead of JetBrains.Omea.OpenAPI.Core.WebBrowser.SelectedText; to retrieve the selected text of the resource. The other thing, that I can user context.SelectedResources[0].GetStringProp("Subject"); to retrieve the Title of the page. I thing I made it too complicated at first glance./// Initializes the popup and displayes it
/// </summary>
/// <param name="context">Actioncontext</param>
public void Execute( IActionContext context )
{
IResourceList list = context.SelectedResources;
if
(list.Count == 1){
//Retrieves the subject of the resource.
string popupTitle = HttpUtility.UrlEncode(list[0].GetStringProp("Subject"));
string selectedText = "";
if(context.SelectedPlainText != null)
{
//Retrieves the selected text on the currently displayed resource
selectedText = HttpUtility.UrlEncode( context.SelectedPlainText.Trim() );
}
//Retrieves the URL of the displayed resource
string currentUrl = HttpUtility.UrlEncode( list[0].GetStringProp("Link"));
//Lets show the popup window
Process.Start( String.Format("http://skorozsi.blogsome.com/wp-admin/bookmarklet.php?text={0}&popupurl={1}&popuptitle={2}",selectedText, currentUrl, popupTitle)); }
}
This is the new Update() method implementation: /// <summary>/// Enable the action only if there is a selected resource.
/// </summary>
public void Update( IActionContext context, ref ActionPresentation presentation )
{
presentation.Visible = context.SelectedResources.Count == 1;
}
Colorized by: CarlosAg.CodeColorizer



Looks like a great plugin. How do we install it?
Comment by thelawstudent.com — April 5, 2006 @ 4:30