GridTreeViewer's questons [message #1012677] |
Thu, 21 February 2013 21:30  |
Eclipse User |
|
|
|
Hi guys:
I am using nebula GridTreeViewer in my project,but there are three question,I can not know how to do,can anyone help me?
1,when a cell(TextCellEditor) is focused(not editor activate),I type CTRL+V,and want to paste the content to the cell,but now I only can make the editor activate through ColumnViewerEditorActivationStrategy setting,I have to type CTRL+V again to paste.is there any way to paste the content to a cell(TextCellEditor) with only one time typing CTRL+V?
2.afte inputing the value of a cell , when typing the ENTER keybord,I want to navigate to the cell of next row in the same column index,how to perfomance that?
3.I come from china,I always want to input chinese words,which combined by some keybord.when the cell(TextCellEditor) is focused(not editor activate),I can not input the chinese words,how should I resolve that problem?
that's will be appreciated if there is some snippets to indicate the questions.
thanks a lot
|
|
|
Re: GridTreeViewer's questons [message #1012802 is a reply to message #1012677] |
Fri, 22 February 2013 03:46   |
Eclipse User |
|
|
|
Those questions are not Grid specific but JFace ones ;-)
Am 22.02.13 03:30, schrieb cheng shouwu:
> Hi guys:
>
> I am using nebula GridTreeViewer in my project,but there are three
> question,I can not know how to do,can anyone help me?
>
> 1,when a cell(TextCellEditor) is focused(not editor activate),I type
> CTRL+V,and want to paste the content to the cell,but now I only can make
> the editor activate through ColumnViewerEditorActivationStrategy
> setting,I have to type CTRL+V again to paste.is there any way to paste
> the content to a cell(TextCellEditor) with only one time typing CTRL+V?
>
You have to subclass TextCellEditor and overwrite
activate(ColumnViewerEditorActivationEvent) there you can get the
activation event.
> 2.afte inputing the value of a cell , when typing the ENTER keybord,I
> want to navigate to the cell of next row in the same column index,how to
> perfomance that?
>
You'll best overload keyReleaseOccured() and there in an *asyncExec* set
new selection AND call viewer.editElement()
> 3.I come from china,I always want to input chinese words,which combined
> by some keybord.when the cell(TextCellEditor) is focused(not editor
> activate),I can not input the chinese words,how should I resolve that
> problem?
>
See above the activate() will get the original event and you can there
from get the typed char and insert it directly to the text-field.
Tom
|
|
|
|
Re: GridTreeViewer's questons [message #1014183 is a reply to message #1014092] |
Mon, 25 February 2013 05:12  |
Eclipse User |
|
|
|
hi Thomas Schindl:
1.for the first question ,i do as below,and it can work correctly
@Override
public void activate(ColumnViewerEditorActivationEvent activationEvent) {
if(((activationEvent.keyCode >=96 && activationEvent.keyCode <=122) || (activationEvent.keyCode >=30 && activationEvent.keyCode <=61)) && ((activationEvent.stateMask & SWT.CTRL) != SWT.CTRL)){
text.setText(activationEvent.character+"");
}
if(((activationEvent.stateMask & SWT.CTRL) == SWT.CTRL) && (activationEvent.keyCode == 'v')){
text.setText("");
performPaste();
}
activate();
}
2.for the second question ,i do like this ,and it work fine
protected void keyReleaseOccured(KeyEvent keyEvent) {
if (keyEvent.character == '\r') { // Return key
// Enter is handled in handleDefaultSelection.
// Do not apply the editor value in response to an Enter key event
// since this can be received from the IME when the intent is -not-
// to apply the value.
// See bug 39074 [CellEditors] [DBCS] canna input mode fires bogus event from Text Control
//
// An exception is made for Ctrl+Enter for multi-line texts, since
// a default selection event is not sent in this case.
if (text != null && !text.isDisposed()&& (text.getStyle() & SWT.MULTI) != 0) {
if ((keyEvent.stateMask & SWT.CTRL) != 0) {
super.keyReleaseOccured(keyEvent);
}
}
int i = grid.getSelectionIndex()+1;
int j = grid.getFocusCell().x;
grid.setSelection(i);
ColumnViewer gv = (ColumnViewer)grid.getData("viewer");
IStructuredSelection newSelection= (IStructuredSelection)gv.getSelection();
if (newSelection.size() ==1){
gv.editElement(newSelection.getFirstElement(), j);
Point newPt = grid.getFocusCell();
grid.setCellSelection(newPt);
}
return;
}
super.keyReleaseOccured(keyEvent);
}
3.but for the third question,I really do not know how to do
|
|
|
Powered by
FUDForum. Page generated in 0.03150 seconds