Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 185150 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java (-8 / +71 lines)
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-1045 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
	}
1065
	
1066
	private final void updateConflicts(final Collection bindings) {
1067
		Iterator i = bindings.iterator();
1068
		while (i.hasNext()) {
1069
			final Binding b = (Binding) i.next();
1070
			if (b.getParameterizedCommand()!=null) {
1071
				updateConflicts(b);
1072
			}
1073
		}
1074
	}
1075
1076
	private final void updateConflicts(final Binding binding) {
1077
		Collection matches = (Collection) localChangeManager
1078
				.getActiveBindingsDisregardingContext().get(
1079
						binding.getTriggerSequence());
1080
		if (matches != null) {
1081
			Iterator i = matches.iterator();
1082
			while (i.hasNext()) {
1083
				Binding b = (Binding) i.next();
1084
				if (binding != b
1085
						&& b.getContextId().equals(binding.getContextId())) {
1086
					filteredTree.getViewer().update(b, null);
1087
				}
1088
			}
1089
		}
1090
	}
1043
1091
1044
	private final void bindingRestore(final KeyBinding binding) {
1092
	private final void bindingRestore(final KeyBinding binding) {
1045
		final ParameterizedCommand cmd = binding.getParameterizedCommand();
1093
		final ParameterizedCommand cmd = binding.getParameterizedCommand();
Lines 1112-1117 Link Here
1112
1160
1113
		bindingModel.addAll(addSystemAll);
1161
		bindingModel.addAll(addSystemAll);
1114
		bindingModel.removeAll(removeUser);
1162
		bindingModel.removeAll(removeUser);
1163
		updateConflicts(addSystemAll);
1164
		updateConflicts(removeUser);
1115
		if (addSystemAll.isEmpty()) {
1165
		if (addSystemAll.isEmpty()) {
1116
			commandModel.add(cmd);
1166
			commandModel.add(cmd);
1117
			filteredTree.getViewer().setSelection(new StructuredSelection(cmd),
1167
			filteredTree.getViewer().setSelection(new StructuredSelection(cmd),
Lines 1420-1425 Link Here
1420
				}
1470
				}
1421
			}
1471
			}
1422
		});
1472
		});
1473
		
1474
		final Label asterisk = new Label(leftDataArea, SWT.NONE);
1475
		asterisk.setText(NewKeysPreferenceMessages.Asterisk_Text);
1476
		gridData = new GridData();
1477
		gridData.grabExcessHorizontalSpace = true;
1478
		gridData.horizontalSpan = 2;
1479
		gridData.horizontalAlignment = SWT.FILL;
1480
		asterisk.setLayoutData(gridData);
1423
1481
1424
		// RIGHT DATA AREA
1482
		// RIGHT DATA AREA
1425
		// Creates the right data area.
1483
		// Creates the right data area.
Lines 1870-1875 Link Here
1870
						// update the model
1928
						// update the model
1871
						bindingModel.remove(keyBinding);
1929
						bindingModel.remove(keyBinding);
1872
						bindingModel.add(binding);
1930
						bindingModel.add(binding);
1931
						updateConflicts(keyBinding);
1932
						updateConflicts(binding);
1873
						// end update the model
1933
						// end update the model
1874
						update();
1934
						update();
1875
						filteredTree.getViewer().setSelection(
1935
						filteredTree.getViewer().setSelection(
Lines 1886-1891 Link Here
1886
					// end update the model
1946
					// end update the model
1887
					bindingModel.add(binding);
1947
					bindingModel.add(binding);
1888
					commandModel.remove(object);
1948
					commandModel.remove(object);
1949
					updateConflicts(binding);
1889
					update();
1950
					update();
1890
1951
1891
					filteredTree.getViewer().setSelection(
1952
					filteredTree.getViewer().setSelection(
Lines 2371-2376 Link Here
2371
						// update the model
2432
						// update the model
2372
						bindingModel.remove(keyBinding);
2433
						bindingModel.remove(keyBinding);
2373
						bindingModel.add(binding);
2434
						bindingModel.add(binding);
2435
						updateConflicts(keyBinding);
2436
						updateConflicts(binding);
2374
						// end update the model
2437
						// end update the model
2375
						update();
2438
						update();
2376
						filteredTree.getViewer().setSelection(
2439
						filteredTree.getViewer().setSelection(
(-)Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferenceMessages.java (+1 lines)
Lines 39-44 Link Here
39
	public static String TriggerSequenceColumn_Text;
39
	public static String TriggerSequenceColumn_Text;
40
	public static String WhenColumn_Text;
40
	public static String WhenColumn_Text;
41
	public static String WhenLabel_Text;
41
	public static String WhenLabel_Text;
42
	public static String Asterisk_Text;
42
	
43
	
43
	public static String GroupingCombo_Label;
44
	public static String GroupingCombo_Label;
44
	public static String GroupingCombo_Category_Text;
45
	public static String GroupingCombo_Category_Text;
(-)Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.properties (+1 lines)
Lines 25-30 Link Here
25
TriggerSequenceColumn_Text = Binding
25
TriggerSequenceColumn_Text = Binding
26
WhenLabel_Text = &When:
26
WhenLabel_Text = &When:
27
WhenColumn_Text = When
27
WhenColumn_Text = When
28
Asterisk_Text = * in the binding column denotes a key conflict
28
29
29
GroupingCombo_Label = Group By: 
30
GroupingCombo_Label = Group By: 
30
GroupingCombo_Category_Text = Category
31
GroupingCombo_Category_Text = Category

Return to bug 185150