|
Lines 29-35
Link Here
|
| 29 |
import org.eclipse.core.commands.ParameterizedCommand; |
29 |
import org.eclipse.core.commands.ParameterizedCommand; |
| 30 |
import org.eclipse.core.commands.common.NotDefinedException; |
30 |
import org.eclipse.core.commands.common.NotDefinedException; |
| 31 |
import org.eclipse.core.runtime.IConfigurationElement; |
31 |
import org.eclipse.core.runtime.IConfigurationElement; |
|
|
32 |
import org.eclipse.core.runtime.IExtensionDelta; |
| 32 |
import org.eclipse.core.runtime.IExtensionRegistry; |
33 |
import org.eclipse.core.runtime.IExtensionRegistry; |
|
|
34 |
import org.eclipse.core.runtime.IRegistryChangeEvent; |
| 35 |
import org.eclipse.core.runtime.IRegistryChangeListener; |
| 33 |
import org.eclipse.core.runtime.IStatus; |
36 |
import org.eclipse.core.runtime.IStatus; |
| 34 |
import org.eclipse.core.runtime.MultiStatus; |
37 |
import org.eclipse.core.runtime.MultiStatus; |
| 35 |
import org.eclipse.core.runtime.Platform; |
38 |
import org.eclipse.core.runtime.Platform; |
|
Lines 50-61
Link Here
|
| 50 |
import org.eclipse.jface.util.PropertyChangeEvent; |
53 |
import org.eclipse.jface.util.PropertyChangeEvent; |
| 51 |
import org.eclipse.jface.util.Util; |
54 |
import org.eclipse.jface.util.Util; |
| 52 |
import org.eclipse.swt.SWT; |
55 |
import org.eclipse.swt.SWT; |
|
|
56 |
import org.eclipse.swt.widgets.Display; |
| 53 |
import org.eclipse.ui.IMemento; |
57 |
import org.eclipse.ui.IMemento; |
| 54 |
import org.eclipse.ui.IWorkbenchPreferenceConstants; |
58 |
import org.eclipse.ui.IWorkbenchPreferenceConstants; |
| 55 |
import org.eclipse.ui.PlatformUI; |
59 |
import org.eclipse.ui.PlatformUI; |
| 56 |
import org.eclipse.ui.WorkbenchException; |
60 |
import org.eclipse.ui.WorkbenchException; |
| 57 |
import org.eclipse.ui.XMLMemento; |
61 |
import org.eclipse.ui.XMLMemento; |
| 58 |
import org.eclipse.ui.commands.ICommandService; |
62 |
import org.eclipse.ui.commands.ICommandService; |
|
|
63 |
import org.eclipse.ui.internal.IWorkbenchConstants; |
| 59 |
import org.eclipse.ui.internal.WorkbenchPlugin; |
64 |
import org.eclipse.ui.internal.WorkbenchPlugin; |
| 60 |
import org.eclipse.ui.internal.misc.Policy; |
65 |
import org.eclipse.ui.internal.misc.Policy; |
| 61 |
import org.eclipse.ui.keys.IBindingService; |
66 |
import org.eclipse.ui.keys.IBindingService; |
|
Lines 231-248
Link Here
|
| 231 |
/** |
236 |
/** |
| 232 |
* The name of the deprecated accelerator configurations extension point. |
237 |
* The name of the deprecated accelerator configurations extension point. |
| 233 |
*/ |
238 |
*/ |
| 234 |
private static final String EXTENSION_ACCELERATOR_CONFIGURATIONS = "org.eclipse.ui.acceleratorConfigurations"; //$NON-NLS-1$ |
239 |
private static final String EXTENSION_ACCELERATOR_CONFIGURATIONS = PlatformUI.PLUGIN_ID |
|
|
240 |
+ '.' + IWorkbenchConstants.PL_ACCELERATOR_CONFIGURATIONS; |
| 235 |
|
241 |
|
| 236 |
/** |
242 |
/** |
| 237 |
* The name of the bindings extension point. |
243 |
* The name of the bindings extension point. |
| 238 |
*/ |
244 |
*/ |
| 239 |
private static final String EXTENSION_BINDINGS = "org.eclipse.ui.bindings"; //$NON-NLS-1$ |
245 |
private static final String EXTENSION_BINDINGS = PlatformUI.PLUGIN_ID + '.' |
|
|
246 |
+ IWorkbenchConstants.PL_BINDINGS; |
| 240 |
|
247 |
|
| 241 |
/** |
248 |
/** |
| 242 |
* The name of the commands extension point, and the name of the key for the |
249 |
* The name of the commands extension point, and the name of the key for the |
| 243 |
* commands preferences. |
250 |
* commands preferences. |
| 244 |
*/ |
251 |
*/ |
| 245 |
private static final String EXTENSION_COMMANDS = "org.eclipse.ui.commands"; //$NON-NLS-1$ |
252 |
private static final String EXTENSION_COMMANDS = PlatformUI.PLUGIN_ID + '.' |
|
|
253 |
+ IWorkbenchConstants.PL_COMMANDS; |
| 246 |
|
254 |
|
| 247 |
/** |
255 |
/** |
| 248 |
* The index of the active scheme configuration elements in the indexed |
256 |
* The index of the active scheme configuration elements in the indexed |
|
Lines 274-288
Link Here
|
| 274 |
private static final String LEGACY_DEFAULT_SCOPE = "org.eclipse.ui.globalScope"; //$NON-NLS-1$ |
282 |
private static final String LEGACY_DEFAULT_SCOPE = "org.eclipse.ui.globalScope"; //$NON-NLS-1$ |
| 275 |
|
283 |
|
| 276 |
/** |
284 |
/** |
|
|
285 |
* Whether the preference and registry change listeners have been attached |
| 286 |
* yet. |
| 287 |
*/ |
| 288 |
private static boolean listenersAttached = false; |
| 289 |
|
| 290 |
/** |
| 277 |
* A look-up map for 2.1.x style <code>string</code> keys on a |
291 |
* A look-up map for 2.1.x style <code>string</code> keys on a |
| 278 |
* <code>keyBinding</code> element. |
292 |
* <code>keyBinding</code> element. |
| 279 |
*/ |
293 |
*/ |
| 280 |
private static final Map r2_1KeysByName = new HashMap(); |
294 |
private static final Map r2_1KeysByName = new HashMap(); |
| 281 |
|
|
|
| 282 |
/** |
| 283 |
* Whether the property change listener has been attached yet. |
| 284 |
*/ |
| 285 |
private static boolean propertyChangeListenerAttached = false; |
| 286 |
|
295 |
|
| 287 |
static { |
296 |
static { |
| 288 |
final IKeyLookup lookup = KeyLookupFactory.getDefault(); |
297 |
final IKeyLookup lookup = KeyLookupFactory.getDefault(); |
|
Lines 642-660
Link Here
|
| 642 |
commandService); |
651 |
commandService); |
| 643 |
|
652 |
|
| 644 |
/* |
653 |
/* |
| 645 |
* Add a listener so that future preference changes trigger an update of |
654 |
* Adds listener so that future preference and registry changes trigger |
| 646 |
* the binding manager automatically. |
655 |
* an update of the binding manager automatically. |
| 647 |
*/ |
656 |
*/ |
| 648 |
if (!propertyChangeListenerAttached) { |
657 |
if (!listenersAttached) { |
| 649 |
store.addPropertyChangeListener(new IPropertyChangeListener() { |
658 |
store.addPropertyChangeListener(new IPropertyChangeListener() { |
| 650 |
public void propertyChange(PropertyChangeEvent event) { |
659 |
public final void propertyChange(final PropertyChangeEvent event) { |
| 651 |
if (EXTENSION_COMMANDS.equals(event.getProperty())) { |
660 |
if (EXTENSION_COMMANDS.equals(event.getProperty())) { |
| 652 |
read(bindingManager, commandService); |
661 |
read(bindingManager, commandService); |
| 653 |
} |
662 |
} |
| 654 |
} |
663 |
} |
| 655 |
}); |
664 |
}); |
| 656 |
propertyChangeListenerAttached = true; |
665 |
|
| 657 |
} |
666 |
registry.addRegistryChangeListener(new IRegistryChangeListener() { |
|
|
667 |
public final void registryChanged( |
| 668 |
final IRegistryChangeEvent event) { |
| 669 |
final IExtensionDelta[] acceleratorConfigurationDeltas = event |
| 670 |
.getExtensionDeltas( |
| 671 |
PlatformUI.PLUGIN_ID, |
| 672 |
IWorkbenchConstants.PL_ACCELERATOR_CONFIGURATIONS); |
| 673 |
if (acceleratorConfigurationDeltas.length == 0) { |
| 674 |
final IExtensionDelta[] bindingDeltas = event |
| 675 |
.getExtensionDeltas(PlatformUI.PLUGIN_ID, |
| 676 |
IWorkbenchConstants.PL_BINDINGS); |
| 677 |
if (bindingDeltas.length == 0) { |
| 678 |
final IExtensionDelta[] commandDeltas = event |
| 679 |
.getExtensionDeltas(PlatformUI.PLUGIN_ID, |
| 680 |
IWorkbenchConstants.PL_COMMANDS); |
| 681 |
if (commandDeltas.length == 0) { |
| 682 |
return; |
| 683 |
} |
| 684 |
} |
| 685 |
} |
| 686 |
|
| 687 |
/* |
| 688 |
* At least one of the deltas is non-zero, so re-read all of |
| 689 |
* the bindings. |
| 690 |
*/ |
| 691 |
Display.getDefault().asyncExec(new Runnable() { |
| 692 |
public void run() { |
| 693 |
read(bindingManager, commandService); |
| 694 |
} |
| 695 |
}); |
| 696 |
} |
| 697 |
}, PlatformUI.PLUGIN_ID); |
| 698 |
|
| 699 |
listenersAttached = true; |
| 700 |
} |
| 658 |
} |
701 |
} |
| 659 |
|
702 |
|
| 660 |
|
703 |
|
|
Lines 778-784
Link Here
|
| 778 |
.getScheme(IBindingService.DEFAULT_DEFAULT_ACTIVE_SCHEME_ID)); |
821 |
.getScheme(IBindingService.DEFAULT_DEFAULT_ACTIVE_SCHEME_ID)); |
| 779 |
} catch (final NotDefinedException e) { |
822 |
} catch (final NotDefinedException e) { |
| 780 |
// Damn, we're fucked. |
823 |
// Damn, we're fucked. |
| 781 |
throw new Error("You cannot make something from nothing"); //$NON-NLS-1$ |
824 |
throw new Error( |
|
|
825 |
"The default default active scheme id is not defined."); //$NON-NLS-1$ |
| 782 |
} |
826 |
} |
| 783 |
} |
827 |
} |
| 784 |
|
828 |
|
|
Lines 1365-1370
Link Here
|
| 1365 |
final IConfigurationElement[] configurationElements, |
1409 |
final IConfigurationElement[] configurationElements, |
| 1366 |
final int configurationElementCount, |
1410 |
final int configurationElementCount, |
| 1367 |
final BindingManager bindingManager) { |
1411 |
final BindingManager bindingManager) { |
|
|
1412 |
// Undefine all the previous schemes. |
| 1413 |
final Scheme[] schemes = bindingManager.getDefinedSchemes(); |
| 1414 |
if (schemes != null) { |
| 1415 |
for (int i = 0; i < schemes.length; i++) { |
| 1416 |
schemes[i].undefine(); |
| 1417 |
} |
| 1418 |
} |
| 1419 |
|
| 1368 |
for (int i = 0; i < configurationElementCount; i++) { |
1420 |
for (int i = 0; i < configurationElementCount; i++) { |
| 1369 |
final IConfigurationElement configurationElement = configurationElements[i]; |
1421 |
final IConfigurationElement configurationElement = configurationElements[i]; |
| 1370 |
|
1422 |
|