1 11 12 package org.eclipse.jface.viewers; 13 14 import java.util.EventObject ; 15 16 import org.eclipse.swt.events.KeyEvent; 17 import org.eclipse.swt.events.MouseEvent; 18 import org.eclipse.swt.events.TraverseEvent; 19 20 26 public class ColumnViewerEditorActivationEvent extends EventObject { 27 30 private static final long serialVersionUID = 1L; 31 32 35 public static final int KEY_PRESSED = 1; 36 37 40 public static final int MOUSE_CLICK_SELECTION = 2; 41 42 45 public static final int MOUSE_DOUBLE_CLICK_SELECTION = 3; 46 47 51 public static final int PROGRAMMATIC = 4; 52 53 56 public static final int TRAVERSAL = 5; 57 58 61 public EventObject sourceEvent; 62 63 66 public int time; 67 68 78 public int eventType; 79 80 83 public int keyCode; 84 85 88 public char character; 89 90 93 public int stateMask; 94 95 98 public boolean cancel = false; 99 100 107 public ColumnViewerEditorActivationEvent(ViewerCell cell) { 108 super(cell); 109 eventType = PROGRAMMATIC; 110 } 111 112 122 public ColumnViewerEditorActivationEvent(ViewerCell cell, MouseEvent event) { 123 super(cell); 124 125 if (event.count >= 2) { 126 eventType = MOUSE_DOUBLE_CLICK_SELECTION; 127 } else { 128 eventType = MOUSE_CLICK_SELECTION; 129 } 130 131 this.sourceEvent = event; 132 this.time = event.time; 133 } 134 135 141 public ColumnViewerEditorActivationEvent(ViewerCell cell, KeyEvent event) { 142 super(cell); 143 this.eventType = KEY_PRESSED; 144 this.sourceEvent = event; 145 this.time = 0; 146 this.keyCode = event.keyCode; 147 this.character = event.character; 148 this.stateMask = event.stateMask; 149 } 150 151 159 public ColumnViewerEditorActivationEvent(ViewerCell cell, TraverseEvent event) { 160 super(cell); 161 this.eventType = TRAVERSAL; 162 this.sourceEvent = event; 163 } 164 } 165 | Popular Tags |