Thursday, August 1, 2013

GIT: Unlink of file 'com.x.xx/a1.jar' failed. Should I try again? (y/n) y during the pull

Unlink of file 'com.x.xx/MINIFY.jar' failed. Should I try again? (y/n) y

I was getting this issue, while pulling the code from the server using below command.
>git pull origin Dev


What I observed was, I kept it opened "build.properties' file, where all my dependent build jars are specified of a plug-in and that was causing the issue.

This could mean that another program is using the file, which is preventing git to sync the repository changes with the local changes. Sometimes the file may not be actually open in eclipse but may have been opened by a process run by eclipse. In this event, try closing the file in any applications that might have used it. If that doesn't work, completely exit any applications which may have opened the file.

Tuesday, July 30, 2013

Tree expand/collapse issue in NatTable(0.9->1.0)

I was facing tree expand/collapse issue in NatTable after migrating from 0.9 to 1.0 version.  I could not even expand or collapse a tree after migration, it was disabled completely so we can’t even see the children of a tree.

This can be resolved by configuring CellPainterMouseEventMatcher with GridRegion.BODY  instead of  TreeLayer.TREE_COLUMN_CELL

If you are facing the same issue, this would be useful tip.




ToolTip information on NatTable cells


Default implementation is provided by ‘DefaultToolTip’ class from Jface, so we can override getText() method to provide tool tip information based on the specific criteria.

Example below:



import java.util.Properties;

import org.eclipse.jface.window.DefaultToolTip;
import org.eclipse.jface.window.ToolTip;
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;


public class MyXToolTip extends DefaultToolTip {

private NatTable natTable;
private XSpanningDataProvider bodyDataProvider;


public MyXToolTip (NatTable natTable, XSpanningDataProvider bodyDataProvider) {
super(natTable, ToolTip.NO_RECREATE, false);
this.natTable = natTable;
this.bodyDataProvider = bodyDataProvider;
}


protected Object getToolTipArea(Event event) {
int col = natTable.getColumnPositionByX(event.x);
int row = natTable.getRowPositionByY(event.y);

//if any specific implementation here ex: You want to display tooltip information only on first column. if(col != 0) return;

return new Point(col, row);
}

protected String getText(Event event) {
int col = natTable.getColumnPositionByX(event.x);
int row = natTable.getRowPositionByY(event.y);

ILayerCell cell = natTable.getCellByPosition(col, row);
INode rowObject = bodyDataProvider.getRowObject(cell.getRowIndex()); //my INode Object which has specific cell information
String channelName = rowObject.getName();

//If any specific implementation here, ex: mixing column and row information
return channelName;
}

protected Composite createToolTipContentArea(Event event, Composite parent) {
// This is where you could get really creative with your tooltips...
return super.createToolTipContentArea(event, parent);
}
}


Thursday, July 18, 2013

Eclipse NatTable: How do you render Checkbox, Image and Text in a single cell

Say, below is your requirement. I am showing only part of the complete dialog below.


I am talking here about first column,rending check box and windows 8 image and followed by display text.

Do the following:
Use a TextPainter, decorate it (CellPainterDecorator) with an ImagePainter, use the resulting painter as base painter of another decorator and decorate it with a CheckboxPainter


//Text painter to diplay text
TextPainter textPainter = new TextPainter() {
//Any specific implementation
};


//My image painter
 class MyImagePainter extends ImagePainter {

private MyData data = null
public MyImagePainter(MyData data) {
this.data = data; //this would be useful, what image has to displayed on call.
}

@Override
protected Image getImage(ILayerCell cell, IConfigRegistry configRegistry) {
//return specific image on data object and it's properties.
return null;
}
 }

//Cell painter decorator for image and text
CellPainterDecorator cellPainterDecorator = new CellPainterDecorator(
textPainter, //text painter
CellEdgeEnum.LEFT, //Image should left side of Text
new MyImagePainter(bodyDataProvider)); //Image Painter
 
//Wrapper for cellPainterDecorator  and checkbox
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_PAINTER,
new CellPainterWrapper(new BackgroundPainter(
new CellPainterDecorator(
cellPainterDecorator, //decorator to render image and text
CellEdgeEnum.LEFT, // check box has to be displayed left hand side of the cell.
myCheckBoxPainter)), // check box painter
10),
DisplayMode.NORMAL,
TreeLayer.TREE_COLUMN_CELL);

registerEditing(configRegistry, TreeLayer.TREE_COLUMN_CELL);


























Maintaining clear git history tree

This is what I have learned from my colleague few days back.

My general workflow with git:
Git pull origin Dev-5.0
Then I would have worked for a day or two
Now, I want to push my changes for last 2 days. But, in mean time many people in my team also would have pushed the code.
Git commit  “last 2 days commits message”
Git pull origin Dev-5.0 -> get the latest code from server again
Git push origin Dev-5.0 -> push your committed changes to the server


But, this is creating a very bad hierarchy tree in git(gitk). Like below













The problem here is, while I am committing my code I don't have the latest code from central repository. This would create a different tree hierarchy in git from my last state, and only when I push my code it will merge your local branch with the central repository. Then it will connect your local branch tree node to the central tree node.

Below is the approach which has worked out for us.

Git pull origin Dev-5.0
Then you might be working for few days
Now you want to commit your changes.
Git stash   -> stash your current changes in local repository
Git pull origin Dev-5.0   -> Get the latest changes from the central repository
Now your local repository has latest changes
Apply your stashed changes on latest changes which we have pulled from central repository.
Git stash pop -> This will apply stashed changes to current changes.
If any merge conflicts, resolve them
Git commit  “my changes”
Git push origin Dev-5.0    => This would fail, if somebody else has pushed the code in mean time after your last pull, so we need to pull the code again and proceed with the push.

This is how it looks, if we maintain the above procedure.









Tuesday, July 16, 2013

Companies which are working on Eclipse related development

Companies which are working on Eclipse Plug-in development related work.

Hyderabad:
IBM ISL -Many products they have on Eclipse- Rational rose, myEclipse, OpenStack development
Kony Labs - KonyOne IDE
Pramati - Pramati servers which are based on OSGI
Progress Software - Many products which are based on Eclipse
ModelN - Enterprise modeling tools
Xilinx Inc - Embeded/chip modeling tools/Programmable logic development
Rockwell Collins - Aircraft solutions
Oracle
..very few!!!

Bangalore:
IBM ISL
SAP Labs - BO IDT, HANA Studio, BRM/BPM Tool
Mercedes Benz Research Lab
Robert Bosch
..many more!!!