Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Disposing off the GridEditor
Disposing off the GridEditor [message #41902] Thu, 25 October 2007 10:55 Go to next message
Eclipse UserFriend
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 #41934 is a reply to message #41902] Thu, 25 October 2007 11:29 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
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 #42179 is a reply to message #41934] Fri, 26 October 2007 09:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rams1983.yahoo.com

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 #42353 is a reply to message #42179] Mon, 29 October 2007 17:07 Go to previous message
Chris Gross is currently offline Chris GrossFriend
Messages: 253
Registered: July 2009
Senior Member
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 11:29 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
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 09:41 Go to previous message
Ramya is currently offline RamyaFriend
Messages: 3
Registered: July 2009
Junior Member
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 17:07 Go to previous message
Chris Gross is currently offline Chris GrossFriend
Messages: 471
Registered: July 2009
Senior Member
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
>
Previous Topic:Focus out Event in Grid
Next Topic:Extending Grid & GridViewer
Goto Forum:
  


Current Time: Thu Mar 28 09:35:27 GMT 2024

Powered by FUDForum. Page generated in 0.02477 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top