In progress: [Issue 7] ELT does not work with Eclipse 4.2
diff --git a/com.google.eclipse.cdt.core/.settings/org.eclipse.pde.api.tools.prefs b/com.google.eclipse.cdt.core/.settings/org.eclipse.pde.api.tools.prefs
index 3c9c7aa..b8a147b 100644
--- a/com.google.eclipse.cdt.core/.settings/org.eclipse.pde.api.tools.prefs
+++ b/com.google.eclipse.cdt.core/.settings/org.eclipse.pde.api.tools.prefs
@@ -1,4 +1,3 @@
-#Sun Feb 07 22:11:46 EST 2010
ANNOTATION_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Error
ANNOTATION_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
@@ -29,6 +28,9 @@
API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
CLASS_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
CLASS_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
CLASS_ELEMENT_TYPE_ADDED_INTERFACE_BOUNDS=Error
@@ -156,6 +158,7 @@
METHOD_ELEMENT_TYPE_REMOVED_INTERFACE_BOUNDS=Error
METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETERS=Error
+MISSING_EE_DESCRIPTIONS=Ignore
TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
diff --git a/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/Accelerators.java b/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/Accelerators.java
deleted file mode 100644
index 1df1bfc..0000000
--- a/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/Accelerators.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2012 Google Inc.
- *
- * All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 which accompanies this distribution, and is available at
- *
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.eclipse.tm.internal.terminal.emulator;
-
-import static org.eclipse.jface.bindings.keys.SWTKeySupport.convertKeyStrokeToAccelerator;
-
-import org.eclipse.jface.bindings.keys.KeyStroke;
-import org.eclipse.swt.SWT;
-
-/**
- * @author alruiz@google.com (Alex Ruiz)
- */
-final class Accelerators {
- static int createEditActionAccelerator(int naturalKey) {
- int modifierKeys = (SWT.COMMAND == SWT.MOD1) ? SWT.COMMAND : SWT.CONTROL | SWT.SHIFT;
- KeyStroke keyStroke = KeyStroke.getInstance(modifierKeys, naturalKey);
- return convertKeyStrokeToAccelerator(keyStroke);
- }
-
- private Accelerators() {}
-}
diff --git a/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/EditActionAccelerators.java b/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/EditActionAccelerators.java
new file mode 100644
index 0000000..9d67214
--- /dev/null
+++ b/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/EditActionAccelerators.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
+ * Public License v1.0 which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.eclipse.tm.internal.terminal.emulator;
+
+import static org.eclipse.jface.bindings.keys.SWTKeySupport.convertKeyStrokeToAccelerator;
+
+import java.util.*;
+
+import org.eclipse.jface.bindings.keys.KeyStroke;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+class EditActionAccelerators {
+ private static final Map<Integer, KeyStroke> ACCELERATORS = new HashMap<Integer, KeyStroke>();
+
+ static {
+ addActionAccelerator('C');
+ addActionAccelerator('V');
+ }
+
+ private static void addActionAccelerator(int naturalKey) {
+ int modifierKeys = (SWT.COMMAND == SWT.MOD1) ? SWT.COMMAND : SWT.CONTROL | SWT.SHIFT;
+ KeyStroke keyStroke = KeyStroke.getInstance(modifierKeys, naturalKey);
+ int accelerator = convertKeyStrokeToAccelerator(keyStroke);
+ ACCELERATORS.put(accelerator, keyStroke);
+ }
+
+ static Integer naturalKey(int accelerator) {
+ KeyStroke keyStroke = ACCELERATORS.get(accelerator);
+ if (keyStroke != null) {
+ return keyStroke.getNaturalKey();
+ }
+ return null;
+ }
+}
diff --git a/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java b/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java
index 9d7c83c..0db064f 100644
--- a/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java
+++ b/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java
@@ -34,7 +34,6 @@
package org.eclipse.tm.internal.terminal.emulator;
import static org.eclipse.jface.bindings.keys.SWTKeySupport.convertEventToUnmodifiedAccelerator;
-import static org.eclipse.tm.internal.terminal.emulator.Accelerators.createEditActionAccelerator;
import java.io.*;
import java.net.SocketException;
@@ -60,8 +59,6 @@
import org.eclipse.tm.terminal.model.*;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.contexts.*;
-import org.eclipse.ui.internal.keys.*;
-import org.eclipse.ui.internal.keys.WorkbenchKeyboard.KeyDownFilter;
import org.eclipse.ui.keys.IBindingService;
/**
@@ -78,9 +75,9 @@
{
protected final static String[] LINE_DELIMITERS = { "\n" }; //$NON-NLS-1$
- private static final int[] EDIT_ACTION_ACCELERATORS = new int[] {
- createEditActionAccelerator('C'), createEditActionAccelerator('V'), createEditActionAccelerator('A')
- };
+// private static final int[] EDIT_ACTION_ACCELERATORS = new int[] {
+// createEditActionAccelerator('C'), createEditActionAccelerator('V'), createEditActionAccelerator('A')
+// };
/**
* This field holds a reference to a TerminalText object that performs all ANSI
@@ -783,11 +780,16 @@
}
int accelerator = convertEventToUnmodifiedAccelerator(event);
- for (int editActionAccelerator : EDIT_ACTION_ACCELERATORS) {
- if (editActionAccelerator == accelerator) {
- forceCommandExecution(event);
- return;
- }
+ Integer naturalKey = EditActionAccelerators.naturalKey(accelerator);
+ if (naturalKey != null) {
+ switch (naturalKey.intValue()) {
+ case 'C':
+ copy();
+ return;
+ case 'V':
+ paste();
+ return;
+ }
}
// We set the event.doit to false to prevent any further processing of this
@@ -1008,41 +1010,6 @@
writeToTerminal(charBuffer.toString());
}
-
- private void forceCommandExecution(KeyEvent e) {
- if (!e.doit) {
- return;
- }
- IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
- // Necessary to handle copy/paste/"select all" keyboard accelerators.
- if (bindingService instanceof BindingService) {
- KeyDownFilter filter = ((BindingService) bindingService).getKeyboard().getKeyDownFilter();
- Control focusControl = e.display.getFocusControl();
- boolean enabled = filter.isEnabled();
- try {
- filter.setEnabled(true);
- filter.handleEvent(copyOf(e));
- } finally {
- if (focusControl == e.display.getFocusControl() && !enabled) {
- filter.setEnabled(enabled);
- }
- }
- }
- }
-
- private Event copyOf(KeyEvent e) {
- Event event = new Event();
- event.character = e.character;
- event.data = e.data;
- event.display = e.display;
- event.doit = e.doit;
- event.keyCode = e.keyCode;
- event.keyLocation = e.keyLocation;
- event.stateMask = e.stateMask;
- event.time = e.time;
- event.widget = e.widget;
- return event;
- }
}
@Override public void setTerminalTitle(String title) {