Disposing off the GridEditor [message #41902] |
Thu, 25 October 2007 06:55  |
Eclipse User |
|
|
|
Originally posted by: rams1983.yahoo.com
Hi
I am adding a GridEditor to each cell of the Grid whenever that particular
cell is clicked as in the code...
expectedPeaksGrid.addMouseListener(new MouseAdapter()
{
Text textControl;
GridItem item1;
public void mouseDown(MouseEvent r)
{
if (expectedPeaksGrid.getCellSelectionCount() != 0)
{
Point p1 = expectedPeaksGrid.getCellSelection()[0];
gridEditor = new GridEditor(expectedPeaksGrid);
textControl = new Text(expectedPeaksGrid, SWT.NONE);
textControl.setText(" ");
textControl.pack();
gridEditor.grabHorizontal = true;
gridEditor.horizontalAlignment = SWT.FILL;
gridEditor.setEditor(textControl, expectedPeaksGrid
.getItem(p1.y), p1.x);
}
}
});
Now I want this grideditor to be disposed as soon as the focus shifts from
the cell that is being edited..
Can anybody suggest how to accomplish this ..
Thanks
Ramya
|
|
|
|
|
Re: Disposing off the GridEditor [message #42353 is a reply to message #42179] |
Mon, 29 October 2007 13:07  |
Eclipse User |
|
|
|
You could set your context menu into the editor, but I would suggest the
use of GridTableViewer too.
-Chris
Ramya wrote:
> Hi Tom
>
> I am trying to show a context menu when I right click on a particular
> cell..
> But if I donot dispose off the editor immediately after editing,I am not
> getting the context menu. Instead I get the context menu of the editor.
>
> So I thought I should dispose off the cell editor after editing or may
> be deactivate the control and then when I click on the cell again , the
> control is activated..
>
> Or Is there a way I can get my Context Menu even if the editor is active..
>
> Thanks
> Ramya
>
|
|
|
Re: Disposing off the GridEditor [message #585731 is a reply to message #41902] |
Thu, 25 October 2007 07:29  |
Eclipse User |
|
|
|
Hi,
Why disposing and recreating the next time. GridViewer reuses the same
GridEditor and simply replaces the control inside it. You could take a
look how we do it there or even better simply use the GridViewer?
Tom
Ramya schrieb:
> Hi
>
> I am adding a GridEditor to each cell of the Grid whenever that
> particular cell is clicked as in the code...
>
> expectedPeaksGrid.addMouseListener(new MouseAdapter()
> {
> Text textControl;
>
> GridItem item1;
>
> public void mouseDown(MouseEvent r)
> {
> if (expectedPeaksGrid.getCellSelectionCount() != 0)
> {
> Point p1 = expectedPeaksGrid.getCellSelection()[0];
>
> gridEditor = new GridEditor(expectedPeaksGrid);
> textControl = new Text(expectedPeaksGrid, SWT.NONE);
> textControl.setText(" ");
> textControl.pack();
> gridEditor.grabHorizontal = true;
> gridEditor.horizontalAlignment = SWT.FILL;
> gridEditor.setEditor(textControl, expectedPeaksGrid
> .getItem(p1.y), p1.x);
> }
>
> }
> });
>
> Now I want this grideditor to be disposed as soon as the focus shifts
> from the cell that is being edited..
>
> Can anybody suggest how to accomplish this ..
>
> Thanks
> Ramya
>
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
|
|
|
Re: Disposing off the GridEditor [message #585852 is a reply to message #41934] |
Fri, 26 October 2007 05:41  |
Eclipse User |
|
|
|
Hi Tom
I am trying to show a context menu when I right click on a particular
cell..
But if I donot dispose off the editor immediately after editing,I am not
getting the context menu. Instead I get the context menu of the editor.
So I thought I should dispose off the cell editor after editing or may be
deactivate the control and then when I click on the cell again , the
control is activated..
Or Is there a way I can get my Context Menu even if the editor is active..
Thanks
Ramya
|
|
|
Re: Disposing off the GridEditor [message #585920 is a reply to message #42179] |
Mon, 29 October 2007 13:07  |
Eclipse User |
|
|
|
You could set your context menu into the editor, but I would suggest the
use of GridTableViewer too.
-Chris
Ramya wrote:
> Hi Tom
>
> I am trying to show a context menu when I right click on a particular
> cell..
> But if I donot dispose off the editor immediately after editing,I am not
> getting the context menu. Instead I get the context menu of the editor.
>
> So I thought I should dispose off the cell editor after editing or may
> be deactivate the control and then when I click on the cell again , the
> control is activated..
>
> Or Is there a way I can get my Context Menu even if the editor is active..
>
> Thanks
> Ramya
>
|
|
|
Powered by
FUDForum. Page generated in 0.46962 seconds