[go: up one dir, main page]

Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » GridTreeViewer's questons(paste navigate chinese words)
GridTreeViewer's questons [message #1012677] Fri, 22 February 2013 02:30 Go to next message
cheng shouwu is currently offline cheng shouwuFriend
Messages: 12
Registered: September 2012
Junior Member
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 08:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
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 #1014092 is a reply to message #1012802] Mon, 25 February 2013 06:32 Go to previous messageGo to next message
cheng shouwu is currently offline cheng shouwuFriend
Messages: 12
Registered: September 2012
Junior Member
thank you very much, Thomas Schindl,I will try to do your suggestions.
Re: GridTreeViewer's questons [message #1014183 is a reply to message #1014092] Mon, 25 February 2013 10:12 Go to previous message
cheng shouwu is currently offline cheng shouwuFriend
Messages: 12
Registered: September 2012
Junior Member
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
Previous Topic:Grid - onMouseExit hover question
Next Topic:TreeModelViewer support for GridViewer
Goto Forum:
  


Current Time: Fri Dec 13 14:36:33 GMT 2024

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

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

Back to the top