|
Lines 133-146
Link Here
|
| 133 |
* </p> |
133 |
* </p> |
| 134 |
* <p> |
134 |
* <p> |
| 135 |
* This preference page has four general types of methods. Create methods are |
135 |
* This preference page has four general types of methods. Create methods are |
| 136 |
* called when the page is first made visisble. They are responsible for |
136 |
* called when the page is first made visible. They are responsible for creating |
| 137 |
* creating all of the widgets, and laying them out within the preference page. |
137 |
* all of the widgets, and laying them out within the preference page. Fill |
| 138 |
* Fill methods populate the contents of the widgets that contain collections of |
138 |
* methods populate the contents of the widgets that contain collections of data |
| 139 |
* data from which items can be selected. The select methods respond to |
139 |
* from which items can be selected. The select methods respond to selection |
| 140 |
* selection events from the user, such as a button press or a table selection. |
140 |
* events from the user, such as a button press or a table selection. The update |
| 141 |
* The update methods update the contents of various widgets based on the |
141 |
* methods update the contents of various widgets based on the current state of |
| 142 |
* current state of the user interface. For example, the command name label will |
142 |
* the user interface. For example, the command name label will always try to |
| 143 |
* always try to match the current select in the binding table. |
143 |
* match the current select in the binding table. |
| 144 |
* </p> |
144 |
* </p> |
| 145 |
* |
145 |
* |
| 146 |
* @since 3.2 |
146 |
* @since 3.2 |
|
Lines 603-608
Link Here
|
| 603 |
return null; |
603 |
return null; |
| 604 |
} |
604 |
} |
| 605 |
|
605 |
|
|
|
606 |
private boolean checkConflict(Binding binding) { |
| 607 |
Collection matches = (Collection) localChangeManager |
| 608 |
.getActiveBindingsDisregardingContext().get( |
| 609 |
binding.getTriggerSequence()); |
| 610 |
if (matches != null) { |
| 611 |
Iterator i = matches.iterator(); |
| 612 |
while (i.hasNext()) { |
| 613 |
Binding b = (Binding) i.next(); |
| 614 |
if (binding != b |
| 615 |
&& b.getContextId().equals(binding.getContextId())) { |
| 616 |
return true; |
| 617 |
} |
| 618 |
} |
| 619 |
} |
| 620 |
return false; |
| 621 |
} |
| 622 |
|
| 606 |
public final String getColumnText(final Object element, |
623 |
public final String getColumnText(final Object element, |
| 607 |
final int columnIndex) { |
624 |
final int columnIndex) { |
| 608 |
final Object value = element; |
625 |
final Object value = element; |
|
Lines 617-622
Link Here
|
| 617 |
return NewKeysPreferenceMessages.Undefined_Command; |
634 |
return NewKeysPreferenceMessages.Undefined_Command; |
| 618 |
} |
635 |
} |
| 619 |
case COLUMN_TRIGGER_SEQUENCE: |
636 |
case COLUMN_TRIGGER_SEQUENCE: |
|
|
637 |
if (checkConflict(binding)) { |
| 638 |
return "*" + binding.getTriggerSequence().format(); //$NON-NLS-1$ |
| 639 |
} |
| 620 |
return binding.getTriggerSequence().format(); |
640 |
return binding.getTriggerSequence().format(); |
| 621 |
|
641 |
|
| 622 |
case COLUMN_WHEN: |
642 |
case COLUMN_WHEN: |
|
Lines 701-706
Link Here
|
| 701 |
for (int i = 1; i < COLUMN_USER; i++) { |
721 |
for (int i = 1; i < COLUMN_USER; i++) { |
| 702 |
String text = getColumnText(element, i); |
722 |
String text = getColumnText(element, i); |
| 703 |
if (text != null) { |
723 |
if (text != null) { |
|
|
724 |
buf.append(' '); |
| 704 |
buf.append(text); |
725 |
buf.append(text); |
| 705 |
} |
726 |
} |
| 706 |
} |
727 |
} |
|
Lines 1038-1046
Link Here
|
| 1038 |
|
1059 |
|
| 1039 |
// update the model |
1060 |
// update the model |
| 1040 |
bindingModel.remove(binding); |
1061 |
bindingModel.remove(binding); |
|
|
1062 |
updateConflicts(binding); |
| 1041 |
bindingAdd(binding); |
1063 |
bindingAdd(binding); |
| 1042 |
} |
1064 |
} |
| 1043 |
|
1065 |
|
|
|
1066 |
private final void updateConflicts(final Binding binding) { |
| 1067 |
Collection matches = (Collection) localChangeManager |
| 1068 |
.getActiveBindingsDisregardingContext().get( |
| 1069 |
binding.getTriggerSequence()); |
| 1070 |
if (matches != null) { |
| 1071 |
Iterator i = matches.iterator(); |
| 1072 |
while (i.hasNext()) { |
| 1073 |
Binding b = (Binding) i.next(); |
| 1074 |
if (binding != b |
| 1075 |
&& b.getContextId().equals(binding.getContextId())) { |
| 1076 |
filteredTree.getViewer().update(b, null); |
| 1077 |
} |
| 1078 |
} |
| 1079 |
} |
| 1080 |
} |
| 1081 |
|
| 1044 |
private final void bindingRestore(final KeyBinding binding) { |
1082 |
private final void bindingRestore(final KeyBinding binding) { |
| 1045 |
final ParameterizedCommand cmd = binding.getParameterizedCommand(); |
1083 |
final ParameterizedCommand cmd = binding.getParameterizedCommand(); |
| 1046 |
bindingRestore(cmd, false); |
1084 |
bindingRestore(cmd, false); |
|
Lines 1870-1875
Link Here
|
| 1870 |
// update the model |
1908 |
// update the model |
| 1871 |
bindingModel.remove(keyBinding); |
1909 |
bindingModel.remove(keyBinding); |
| 1872 |
bindingModel.add(binding); |
1910 |
bindingModel.add(binding); |
|
|
1911 |
updateConflicts(keyBinding); |
| 1912 |
updateConflicts(binding); |
| 1873 |
// end update the model |
1913 |
// end update the model |
| 1874 |
update(); |
1914 |
update(); |
| 1875 |
filteredTree.getViewer().setSelection( |
1915 |
filteredTree.getViewer().setSelection( |
|
Lines 1886-1891
Link Here
|
| 1886 |
// end update the model |
1926 |
// end update the model |
| 1887 |
bindingModel.add(binding); |
1927 |
bindingModel.add(binding); |
| 1888 |
commandModel.remove(object); |
1928 |
commandModel.remove(object); |
|
|
1929 |
updateConflicts(binding); |
| 1889 |
update(); |
1930 |
update(); |
| 1890 |
|
1931 |
|
| 1891 |
filteredTree.getViewer().setSelection( |
1932 |
filteredTree.getViewer().setSelection( |
|
Lines 2371-2376
Link Here
|
| 2371 |
// update the model |
2412 |
// update the model |
| 2372 |
bindingModel.remove(keyBinding); |
2413 |
bindingModel.remove(keyBinding); |
| 2373 |
bindingModel.add(binding); |
2414 |
bindingModel.add(binding); |
|
|
2415 |
updateConflicts(keyBinding); |
| 2416 |
updateConflicts(binding); |
| 2374 |
// end update the model |
2417 |
// end update the model |
| 2375 |
update(); |
2418 |
update(); |
| 2376 |
filteredTree.getViewer().setSelection( |
2419 |
filteredTree.getViewer().setSelection( |