Friday, April 19, 2013

Creating SWT table


                    SWT TableViewer

Below I will try to explain you as to how to create a SWT table .
1.Set the layout on the composite over which you wanna create the Table specifying width and height etc .

2. Create a table
         TableViewer tableViewer = new TableViewer(parentComposite,SWT.BORDER );

3.Set the content provider
          tableViewer.setContentProvider(new TableContentProvider())
here TableContentProvider is implemeting IStructuredContentProvider
its method : public Object[] getElements(Object inputElement)
 Returns the elements in the input, which must be either an array or a Collection
So what ever you set as Input in the table we must convert it into array of objects here .

4. Set the LabelProvider  :tableViewer.setLabelProvider(new tableLabelprovider())
         tableLabelprovider    implements ITableLabelProvider
Here we can override two methods
  public String getColumnText(Object element, int columnIndex) : Returns the label text for the given column of the given element.
 Get the model which you setting in the table as input from element and using switch case we can return the value for each column according to the column Index
this is to set the label for each field in your table

5.Add columns according to your requirement

6. If you want any kind of cellEditor eg:TextCellEditor ,CheckboxCellEditor,Dialog cellEditor ,then you have  to add CellEditors for each column . If you want your column to be editable then we can use TextCellEditor .
7. set a cellModifier to your table viewer .
here in the method canModify we have to return true if for a particular column you want it to be editable .
in the method getValue() return value from your model according to the column (property name )
in the method modify() get the value from the table that has been modified and set it to your model and save the model accordingly .
Remember to refresh your table viewer .




Monday, April 8, 2013

Creating quick fix extension for Eclipse Below i am listing the steps needed for creating quick fix extensions in eclipse . I am assuming that the problem has already been registered with eclipse 1.Create a marker type with extension point org.eclipse.core.resources.markers 2.Extend the org.eclipse.ui.ide.markerResolution extension point and create a markerresolutiongenerator . 3.add the marker type while creating the validation error in the code . 4.Create a class resolution generator implements IMarkerResolutionGenerator and register it to plugin while extending the extension point markerResolution . 5.In the function getResolutions(IMarker marker) return a new object which implements IMarkerResolution2 . 6.In the run function do the necessary work . 7.Use other methods such as getDescription() etc to make ur quick fix more informative

Wednesday, March 20, 2013

Happy Bday Dear !!

Last week was my friends birthday , one of the closest , who shares almost everything . As usual people wished him , he got gifts ,cake cutting , friends ko party bhi di .
Phir bhi kuch kami si mehsus ho rahi thi was his exact words that evening .There was something missing . Why was this different if you ask me then nothing much only that a person used to call him sharp at 12 'o clk , would fight if somebody else wished him before her .A gift not very costly but would make him very happy .Par aaj wo nahi hain uske pas . She is not there to pamper him , fight with him , tease him ...
He often ask this question to himself , why he need some one in his life .Now he have freedom ,no restrictions ,just   like khula sandh .. no one going to get angry if he sleep before 12 o clk or if  he go out with his friend(most of the times with me :) ) and stay late without calling her . No fights with his  parents over the issue of marriage . No one in the society is going to point a finger at him . If there are so many  (+)ves out of being single then why he still feel the emptiness . Why he cry when he watches  a romantic movie .Why he still wakes up in the night and check for missed calls . Why he  crave for her so much .He  doesn't have the patience to deal with a new relation but still some where in his heart he wants it . He wants it badly . May be its just the hormones playing its part . May be seeing others getting settled .He feels that he has missed something big in his life .

This word LOVE  confuses me a lot . It gives a lot of pain , a bit of happiness but still every body wants it. May be our mind is designed insanely to crave for it .
ps: I feel pity on my friend . Its his feeling and and my words .  So all people who still have their loved  ones beside you holding ur hands at every moment of ur life cherish it because it feels much more worse than what i have written .Hope i never have to through what my dearest friend went through .

Tuesday, March 5, 2013

Who's Right ?

People tend to evaluate themselves .
Every time they tend to judge themselves even though you might not be noticing .
We have this inherent habit of judging our past decisions ,what we did was right or wrong .
We want somebody to judge us . That's why most of us believe in God .
The very meaning of God is someone who's watching us from above and being impartial he/she will tell us
about the things we did were right or wrong .
We want to be judged .That's why majority of us are aesthetic  .
Confident people are 80% sure about their decisions but still 20% thinks the other way .
Now coming back to the original topic who's right ?
I have been bugged by this questions ever since i don't since when .
If everybody wants themselves to be judged so whom should i believe .
If someone tells me that my decision is wrong then on what basis should i it think as wrong or right
just that he /she gives some valid points to dismiss my points . No way .
If we take the above point then everybody who thinks that their decisions are right might be wrong
and those whom we think are wrong may be right .
Then again another thing comes to my mind as to who's Good and who's Evil .
Just that some section of society thinks that a person is evil should not be a valid basis for declaring him/her
as Evil .No way .
My blog confuses me more as i am still confused as to whats right and whats wrong .
I wrote this to clarify myself as to who's right and who's wrong .
I have concluded to myself that if others tell me that your decisions are wrong  i would say ,Better mind your own business ,I am free to make my own decisions . I will do whats seems right to me . You are no God to tell me that i am wrong or right .
I am free and i make my own decisions .
Cheers to freedom .
:-)
Sunny Shekhar

Monday, January 2, 2012

Phir teri yaad aai .
woo pyaari shamein yaad aai ...
par tu na aai .....
bas aai to teri yaadein aai ...
apne sang wo pyaare lamhe sath lai
jab main bahut khush rehta tha
meri palke dhoodhati hain bas tere chehre ko..
par use na mili tu ...
bas aai to teri yaadein aai...