Thursday, August 30, 2012

Performing compare in Eclipse with resources that are not under version control

I had an interesting problem at hand. For a particular plugin that has GEF editor every time model of the editor would get build a special '.compiledFlow' file would get generated. This file should not be managed by svn and should not be committed with the rest of the project. This was double by using Team.setAllIgnores(). However, as a by-product of this whenever I tried to compare a file that was under version control, .compiledFlow would also be considered for comparison, this is because model file and .compiledFlow file were bulked in this special virtual folder. Whenever I tried to compare my model file I would get the following error
org.tigris.subversion.javahl.ClientException: svn: '/home/akravets/dev/workspaces/runtime-trunk/test1/Flows/flow1.iwp/.compiledFlow' is not under version control at org.tigris.subversion.svnclientadapter.javahl.AbstractJhlClientAdapter.diff( at org.tigris.subversion.subclipse.ui.operations.ShowDifferencesAsUnifiedDiffOperationWC.execute( at at$ at at$ at org.eclipse.jface.operation.ModalContext$ Caused by: org.tigris.subversion.javahl.ClientException: svn: '/home/akravets/dev/workspaces/runtime-trunk/test1/Flows/flow1.iwp/.compiledFlow' is not under version control at org.tigris.subversion.javahl.JavaHLObjectFactory.throwException( at org.tmatesoft.svn.core.javahl.SVNClientImpl.throwException( at org.tmatesoft.svn.core.javahl.SVNClientImpl.diff( at org.tmatesoft.svn.core.javahl.SVNClientImpl.diff( at org.tmatesoft.svn.core.javahl.SVNClientImpl.diff( at org.tigris.subversion.svnclientadapter.javahl.AbstractJhlClientAdapter.diff( ... 6 more Caused by: org.tmatesoft.svn.core.SVNException: svn: '/home/akravets/dev/workspaces/runtime-trunk/test1/Flows/flow1.iwp/.compiledFlow' is not under version control at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error( at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error( at org.tmatesoft.svn.core.internal.wc.admin.SVNWCAccess.getVersionedEntry( at org.tmatesoft.svn.core.wc.SVNBasicClient.getRevisionNumber( at org.tmatesoft.svn.core.wc.SVNBasicClient.getRevisionNumber( at org.tmatesoft.svn.core.wc.SVNDiffClient.doDiffURLWC( at org.tmatesoft.svn.core.wc.SVNDiffClient.doDiff( at org.tmatesoft.svn.core.javahl.SVNClientImpl.diff( ... 9 more
Obviously the problem here is that .compiledFlow was not under version control. However, I don't want it to be there, and I also want to compare this file's siblings. The solution is set unversioned diff flag:
SVNDiffClient diffClient = SVNClientManager.newInstance().getDiffClient(); 

Monday, August 27, 2012

Meld wrapper script

A script to call meld with comparison of local and remote file:

# if you simply want to see what command arguments are passed by subversion,
# simply uncomment following line, and comment rest of the script:
# echo "$@"


# Configure your favorite diff program here.

# Subversion provides the paths we need as the sixth and seventh
# parameters.
LEFT=${3} # 'MINE' - was 6
RIGHT=${2} # 'THEIRS' (online) - was 7

# Call the diff command (change the following line to make sense for
# your merge program).

# Return an errorcode of 0 if no differences were detected, 1 if some were.
# Any other errorcode will be treated as fatal.

Thursday, July 26, 2012

Code & Me: Hiding UI elements in RCP

Code & Me: Hiding UI elements in RCP: External plug-ins and features give you a tremendous power to enrich your RCP applications. Somtimes you might wish to use an external featu...

Tuesday, July 24, 2012

Code & Me: Reusing Platform images

Code & Me: Reusing Platform images: The eclipse platform comes with a huge amount of ready to use images. Often when you need a nice icon for a toolbar or menu there is already...

Friday, June 29, 2012

Thursday, June 14, 2012

Cannot choose buckminster build step in Jenkins

There is a bug in buckminster plugin for Jenkins where when choosing buckminster as build step, nothing happens - drop down does not expand. This bug explains cause and solution which probably will be fixed.

Wednesday, June 6, 2012

Find exact revision at which svn branch was cut

svn log -v -r0:HEAD --stop-on-copy --limit 1

Friday, April 13, 2012

Decorating GEF figure using EditPolicy

In GMF there is a nifty DragDropEditPolicy that allows you to decorate EditPart's figure by changing background color thus indicating to the user that he is hovering over particular figure. I wanted to use this in my GEF editor, but unfortunately this policy does not exist in GEF.

To make use of this policy I made my plugin depend on import org.eclipse.gmf.runtime.diagram.ui.editpolicies and extended DragDropEditPolicy with my own

public class DesignerDragDropEditPolicty extends DragDropEditPolicy {
 private Label connectionLabel;
 private PolylineConnection relationFigure;
 private DesignerEditor editor;
 private Image image;

 public DesignerDragDropEditPolicty() {
  connectionLabel = new Label();
  image = DesignerUIPlugin.getDefault().getImageRegistry().get(ImageConstants.DROP_ICON);
 // remove icon when edit policy is done
 public void eraseTargetFeedback(Request request) {
  if(relationFigure != null){
 // add icon on filtered edit part. Remove it when another edit part is hovered over.
 public void showTargetFeedback(Request request) {
  if(request instanceof CreateRequest){
   editor = (DesignerEditor) DesignerUtil.getActiveDesignerTab();
   Point location = ((CreateRequest)request).getLocation();
   EditPart part = editor.getViewer().findObjectAt(location);

   if(part instanceof RelationEditPart){
    relationFigure = ((RelationEditPart)part).getConnection();
    relationFigure.add(connectionLabel, new MidpointLocator(relationFigure, 0));
    if(relationFigure != null){

Instead of changing background of the figure as DragDropEditPolicy does I did something different. Whenever user passes inside an EditPart, in my case it's a relation, I put an icon signifying that in this case an object can be dropped onto existing connection an be created in the middle of the relation. I could have put a label saying "Drop here", but I think icons work better than words and after you get used to seeing a particular label with words it gets annoying.

Notice that in showTargetFeedback I filter out EditPart that I am interested in, so here code can be added to add different behavior for other parts.

Wednesday, March 28, 2012

Examine Eclipse via OSGi console

  • Launch eclipse with just the osgi console (eclipse -console -noexit) 
  • Run 'ss' to figure out what hasn't been resolved 
  • 'diag [bundle #]' will give you some details on the problem

Tuesday, March 20, 2012

Adding 'Collapse All' button to a view

Start by adding extension point to plugin.xml of plugin where View lives:



Then add service code to the View's createPartControl method:

 IWorkbenchPartSite site = getSite();
        if (site != null) {
         IHandlerService handlerService = (IHandlerService) site.getService(
         if (handlerService != null) {
          CollapseAllHandler fCollapseHandler = new CollapseAllHandler(viewer);
          handlerService.activateHandler(CollapseAllHandler.COMMAND_ID ,

Blogger Syntax Highliter