Tuesday, September 15, 2009

Bind a key binding that is already defined

To correctly bind a key that is already defined for example by platform - F5 for refresh, the important thing is to create your own context:


name="refresh" parentId="org.eclipse.ui.contexts.window">




Once correct context is defined, it needs to be activated. For example, in view:


View.createPartControl(Composite parent) {
...
...
IContextService contextService = (IContextService) getSite().getService(IContextService.class);
contextService.activateContext("com.iwaysoftware.explorer.refresh");
}


Then the usual, command is created that is tied to a handler that extends AbstractHandler, command is tied to a binding, and the binding is in turn uses earlier created custom context.



defaultHandler="com.iwaysoftware.explorer.handler.RefreshHandler" id="com.iwaysoftware.explorer.refreshCommand"
name="Refresh">



sequence="F5" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
contextId="com.iwaysoftware.explorer.refresh" />


name="refresh" parentId="org.eclipse.ui.contexts.window">


Saturday, September 12, 2009

Kill process that is using paricular port

Find process id and kill it

ruby@t61:~/dev/ruby/demo$ sudo netstat -lpn | grep 3000
[sudo] password for ruby:
tcp 0 0 127.0.0.1:3000 0.0.0.0:* LISTEN 5358/ruby
ruby@t61:~/dev/ruby/demo$ kill -9 5358

Monday, August 31, 2009

Disabling nodes in CheckboxTreeViewer

Working on a project at work I had to use CheckboxTreeViewer, one of the requirements was that some nodes in the tree are disabled. I thought that this would be easy enough because surely CheckboxTreeViewer has some method that I can call to disable some checkboxes. It turns out it does not.

The first thing I obviously did was googled for possible solution. Unfortunately the solutions were not what I needed, so I decided to try the problem myself. Luckily there are two methods that are of help in CheckboxTreeViewer: setGrayed and setChecked, setGrayed nicely grays out checkbox so the user knows that this checkbox is disabled.

Here is the code in pastebin, since it does not render well in my template.

The disable mechanism revolves around value in model's isEnabled field. My model is roughly based on example from this article, but any model will do as long as there is variable that sets a particular model element not enabled. Screen shot on the left shows how this code works in my application.

Eclipse 3.5 has interface ICheckStateProvider that pretty much does what I wanted to do here. However, I am currently at Eclipse 3.4, so will have to wait for this once I move to 3.5.

Tuesday, June 2, 2009

Open Video takes on Adobe Flash Player

One of the proposed new features in HTML5 is "native" video player. Dailymotion.com has a demo of the player and it look pretty good.

The problem I have with Flash is...well the fact that I have to install it. With Open Video as it is called there is nothing to install, player works naively if you will. The cool thing about the player and the fact that it is basically an HTML tag is that you can you style sheets to shape the player as you wish, apply different filters on the video and array of other different things I suppose. However the most amazing thing about the player is that it is fast!

The only thing that will slow down growth of this in current browsers is Ogg Theora codec. This codec is only supported by FireFox 3.5, so if you cannot see the video it means you are not running that browser version.

Nevertheless, Open Video is very exciting news and I look forward for it to be adapter by the industry.

More information about video element can be found here.

Thursday, May 28, 2009

Set default java on Ubuntu


$JAVA_VERSION = where java is installed (/usr/lib/jvm/java-1.5.0-sun)
sudo update-java-alternative -s $JAVA_VERSION


java version "1.5.0_18"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_18-b02)
Java HotSpot(TM) Server VM (build 1.5.0_18-b02, mixed mode)

Thursday, May 21, 2009

ИскаBoo starts its life

The eBook project is in the works and enjoys its new home. Why ИскаBoo(IskaBoo) you might ask? Well it's a play on two words, Russian искать which means to search and Boo which is English Book without the 'k'. Sounds nice, don't you think?
So the first conversion I am doing is actually from LRF to PDF just because there are libraries available for the conversion: LRFTools. Yes, I wanted to implement fb2 to lrf first, but I'd like to finish UI part first so that I have extension point correct to contribute to conversion. The extension point here is this:


inputtype="lrf"
name="LRF to EPUB Converter"
outputtype="epub" providerclass="free.akravets.iskaboo.ui.coverter.lrttools.LRF2EPUBConverter">




So here a plugin that wants to contribute to conversion mechanism will implement this extension point and provide implementation of IEBookConverterProvider interface:


public interface IEBookConverterProvider {
public URL convert(URL inputDocument) throws MalformedURLException;
}


Of course this interface is not 100% set, but basic conversion from LRF to PDF almost works.

Friday, May 15, 2009

eBook Tools for Eclipse

I recently discussed available solutions for eBook conversions. Then I decide why not create Eclipse plug-in that would tackle this task as well? I chose Google Code as my source code repository - it's actually quite nice (what isn't from Google, right :) ). There is nothing major there right now - only project / import wizard and an extension point, but I am excited to start working on the real code that will make this plug-in tick. My first item on the list will be creating fb2 to epub coversion.

Blogger Syntax Highliter