@@ -0,0 +1,2202 @@
+/*%0A * Perfclispe%0A * %0A * %0A * Copyright (c) 2013 Jakub Knetl%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.perfclipse.wizards.swt.events;%0A%0Aimport org.eclipse.swt.SWT;%0Aimport org.eclipse.swt.events.KeyAdapter;%0Aimport org.eclipse.swt.events.KeyEvent;%0Aimport org.eclipse.swt.events.SelectionAdapter;%0Aimport org.eclipse.swt.events.SelectionEvent;%0Aimport org.eclipse.swt.widgets.Event;%0A%0A/**%0A * Event that maps Delete key pressed event to %7B@link SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)%7D%0A * method%0A * @author Jakub Knetl%0A *%0A */%0Apublic class DelKeyPressedSelectionAdapter extends KeyAdapter %7B%0A%0A%09private SelectionAdapter adapter;%0A%0A%09/**%0A%09 * %0A%09 */%0A%09public DelKeyPressedSelectionAdapter(SelectionAdapter adapter) %7B%0A%09%09if (adapter == null)%7B%0A%09%09%09throw new IllegalArgumentException(%22adapter is null%22);%0A%09%09%7D%0A%09%09this.adapter = adapter;%0A%09%7D%0A%0A%09/**%0A%09 * Converts del key released event to %7B@link SelectionAdapter#widgetSelected(SelectionEvent)%7D%0A%09 */%0A%09@Override%0A%09public void keyReleased(KeyEvent e) %7B%0A%09%09if (e.keyCode == SWT.DEL)%7B%0A%09%09%09SelectionEvent selEvent = new SelectionEvent(KeyEventCopy(e));%0A%09%09%09%0A%09%09%09adapter.widgetSelected(selEvent);%0A%09%09%7D%0A%09%7D%0A%0A%09/**%0A%09 * Copies necessary data from mouse event into event.%0A%09 * %0A%09 * TODO:%0A%09 * Current implementation of widgetSelected method does not use%0A%09 * the argument so it could basically be null, but it should be %0A%09 * fixed.%0A%09 * %0A%09 * @param mouseEvent event from which data will be copied%0A%09 * @return event event object representing mouse event%0A%09 */%0A%09private Event KeyEventCopy(KeyEvent e) %7B%0A%09%09Event event = new Event();%0A%09%09//TODO: copy ALL data from KeyEvent to selection event%0A%09%09event.widget = e.widget;%0A%09%09%0A%09%09return event;%0A%09%7D%0A%09%0A%09%0A%0A%7D%0A

Add Del key pressed selection adapter