Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 279972 | Differences between
and this patch

Collapse All | Expand All

(-)js/org/eclipse/swt/widgets/Tree.js (-17 / +39 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 Innoopract Informationssysteme GmbH.
2
 * Copyright (c) 2007, 2009 Innoopract Informationssysteme GmbH.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Innoopract Informationssysteme GmbH - initial API and implementation
9
 *     Innoopract Informationssysteme GmbH - initial API and implementation
10
 *     EclipseSource - ongoing development
10
 ******************************************************************************/
11
 ******************************************************************************/
11
12
12
/**
13
/**
Lines 57-63 Link Here
57
    this._tree.addEventListener( "contextmenu", this._onContextMenu, this );
58
    this._tree.addEventListener( "contextmenu", this._onContextMenu, this );
58
    this._tree.addEventListener( "focus", this._onFocusIn, this );
59
    this._tree.addEventListener( "focus", this._onFocusIn, this );
59
    this._tree.addEventListener( "blur", this._onFocusOut, this );    
60
    this._tree.addEventListener( "blur", this._onFocusOut, this );    
60
    this._tree.addEventListener( "appear", this._updateLayout, this );    
61
    this._tree.addEventListener( "appear", this._updateLayout, this );
62
    // [if] Prevent expand/collapse with ENTER key.
63
    this._tree.removeEventListener( "keypress", this._tree._onkeypress );
64
    this._tree.addEventListener( "keypress", this._onKeyPress, this );
61
    // TODO [rst] Find out why this is not the default appearance
65
    // TODO [rst] Find out why this is not the default appearance
62
    this._tree.setAppearance( "tree" );
66
    this._tree.setAppearance( "tree" );
63
    
67
    
Lines 107-112 Link Here
107
      this._tree.removeEventListener( "focus", this._onFocusIn, this );
111
      this._tree.removeEventListener( "focus", this._onFocusIn, this );
108
      this._tree.removeEventListener( "blur", this._onFocusOut, this );
112
      this._tree.removeEventListener( "blur", this._onFocusOut, this );
109
      this._tree.removeEventListener( "appear", this._updateLayout, this );
113
      this._tree.removeEventListener( "appear", this._updateLayout, this );
114
      this._tree.removeEventListener( "keypress", this._onKeyPress, this );
110
      this._tree.removeEventListener( "changeElement", this._onTreeElementChange, this._tree );
115
      this._tree.removeEventListener( "changeElement", this._onTreeElementChange, this._tree );
111
      this._tree.dispose();
116
      this._tree.dispose();
112
      this._tree = null;
117
      this._tree = null;
Lines 430-435 Link Here
430
    
435
    
431
    /////////////////
436
    /////////////////
432
    // Event Listener
437
    // Event Listener
438
    _onKeyPress : function( evt ) {
439
      switch( evt.getKeyIdentifier() ) {
440
          case "Enter":
441
            var item = this._tree.getManager().getLeadItem();
442
            var selection = this._getSelectionIndices();
443
            if( selection != "" ) {
444
              this._sendWidgetDefaultSelected( item );
445
            }            
446
            break;
447
          default:
448
            this._tree._onkeypress( evt );
449
        }
450
    },
451
    
452
    _sendWidgetDefaultSelected : function( item ) {
453
      if( !org_eclipse_rap_rwt_EventUtil_suspend ) {
454
        if( this._selectionListeners ) {
455
          var wm = org.eclipse.swt.WidgetManager.getInstance();
456
          var id = wm.findIdByWidget( this );
457
          var itemId = wm.findIdByWidget( item );
458
          var req = org.eclipse.swt.Request.getInstance();
459
          var eventName = "org.eclipse.swt.events.widgetDefaultSelected";
460
          req.addEvent( eventName, id );
461
          req.addParameter( eventName + ".item", itemId );
462
          req.send();
463
        }
464
      }
465
    },
433
466
434
    _onChangeSelection : function( evt ) {
467
    _onChangeSelection : function( evt ) {
435
      this._updateSelectedItemState();
468
      this._updateSelectedItemState();
Lines 445-452 Link Here
445
          //      When first visible item is selected and arrow up is pressed the root
478
          //      When first visible item is selected and arrow up is pressed the root
446
          //      item ( == this ) is selected which results in an invisible selection.
479
          //      item ( == this ) is selected which results in an invisible selection.
447
          if( item == this ) {
480
          if( item == this ) {
448
          this._tree.getFirstVisibleChildOfFolder().setSelected( true );
481
            this._tree.getFirstVisibleChildOfFolder().setSelected( true );
449
          this._tree.setSelected( false );
482
            this._tree.setSelected( false );
450
          } else {
483
          } else {
451
            if ( this._selectionListeners ) {
484
            if ( this._selectionListeners ) {
452
              this._suspendClicks();
485
              this._suspendClicks();
Lines 546-564 Link Here
546
     * Handle double click on tree item
579
     * Handle double click on tree item
547
     * called by org.eclipse.swt.widgets.TreeItem
580
     * called by org.eclipse.swt.widgets.TreeItem
548
     */
581
     */
549
    _notifyItemDblClick : function(item) {
582
    _notifyItemDblClick : function( item ) {
550
      if( !org_eclipse_rap_rwt_EventUtil_suspend ) {
583
      this._sendWidgetDefaultSelected( item );
551
        if( this._selectionListeners ) {
552
          var wm = org.eclipse.swt.WidgetManager.getInstance();
553
          var id = wm.findIdByWidget( this );
554
          var itemId = wm.findIdByWidget( item );
555
          var req = org.eclipse.swt.Request.getInstance();
556
          var eventName = "org.eclipse.swt.events.widgetDefaultSelected";
557
          req.addEvent( eventName, id );
558
          req.addParameter( eventName + ".item", itemId );
559
          req.send();
560
        }
561
      }
562
    },
584
    },
563
585
564
    /*
586
    /*
(-)src/org/eclipse/rap/demo/controls/TreeTab.java (-3 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2008 Innoopract Informationssysteme GmbH.
2
 * Copyright (c) 2002, 2009 Innoopract Informationssysteme GmbH.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Innoopract Informationssysteme GmbH - initial API and implementation
9
 *     Innoopract Informationssysteme GmbH - initial API and implementation
10
 *     EclipseSource - ongoing development
10
 ******************************************************************************/
11
 ******************************************************************************/
11
12
12
package org.eclipse.rap.demo.controls;
13
package org.eclipse.rap.demo.controls;
Lines 144-152 Link Here
144
      }
145
      }
145
146
146
      public void widgetDefaultSelected( final SelectionEvent event ) {
147
      public void widgetDefaultSelected( final SelectionEvent event ) {
147
        String title = "Double Click";
148
        String title = "Widget Default Selected";
148
        Item item = ( Item )event.item;
149
        Item item = ( Item )event.item;
149
        String message = "Double click on " + item.getText() + " received";
150
        String message = "Widget default selected on "
151
          + item.getText()
152
          + " received";
150
        MessageDialog.openInformation( getShell(), title, message );
153
        MessageDialog.openInformation( getShell(), title, message );
151
      }
154
      }
152
    } );
155
    } );

Return to bug 279972