Lines 19-24
Link Here
|
19 |
import java.util.HashMap; |
19 |
import java.util.HashMap; |
20 |
import java.util.HashSet; |
20 |
import java.util.HashSet; |
21 |
import java.util.Iterator; |
21 |
import java.util.Iterator; |
|
|
22 |
import java.util.List; |
22 |
import java.util.Map; |
23 |
import java.util.Map; |
23 |
import java.util.Set; |
24 |
import java.util.Set; |
24 |
|
25 |
|
Lines 41-46
Link Here
|
41 |
import org.eclipse.jface.bindings.keys.KeySequenceText; |
42 |
import org.eclipse.jface.bindings.keys.KeySequenceText; |
42 |
import org.eclipse.jface.bindings.keys.KeyStroke; |
43 |
import org.eclipse.jface.bindings.keys.KeyStroke; |
43 |
import org.eclipse.jface.contexts.IContextIds; |
44 |
import org.eclipse.jface.contexts.IContextIds; |
|
|
45 |
import org.eclipse.jface.dialogs.Dialog; |
44 |
import org.eclipse.jface.dialogs.IDialogConstants; |
46 |
import org.eclipse.jface.dialogs.IDialogConstants; |
45 |
import org.eclipse.jface.dialogs.IDialogSettings; |
47 |
import org.eclipse.jface.dialogs.IDialogSettings; |
46 |
import org.eclipse.jface.dialogs.MessageDialog; |
48 |
import org.eclipse.jface.dialogs.MessageDialog; |
Lines 67-73
Link Here
|
67 |
import org.eclipse.jface.viewers.TreeViewer; |
69 |
import org.eclipse.jface.viewers.TreeViewer; |
68 |
import org.eclipse.jface.viewers.Viewer; |
70 |
import org.eclipse.jface.viewers.Viewer; |
69 |
import org.eclipse.jface.viewers.ViewerComparator; |
71 |
import org.eclipse.jface.viewers.ViewerComparator; |
|
|
72 |
import org.eclipse.jface.window.Window; |
70 |
import org.eclipse.swt.SWT; |
73 |
import org.eclipse.swt.SWT; |
|
|
74 |
import org.eclipse.swt.events.MouseEvent; |
75 |
import org.eclipse.swt.events.MouseListener; |
71 |
import org.eclipse.swt.events.SelectionAdapter; |
76 |
import org.eclipse.swt.events.SelectionAdapter; |
72 |
import org.eclipse.swt.events.SelectionEvent; |
77 |
import org.eclipse.swt.events.SelectionEvent; |
73 |
import org.eclipse.swt.graphics.Image; |
78 |
import org.eclipse.swt.graphics.Image; |
Lines 664-669
Link Here
|
664 |
* The path at which the icon for "groups of bindings" is located. |
669 |
* The path at which the icon for "groups of bindings" is located. |
665 |
*/ |
670 |
*/ |
666 |
private static final String ICON_GROUP_OF_BINDINGS = "$nl$/icons/full/obj16/keygroups_obj.gif"; //$NON-NLS-1$ |
671 |
private static final String ICON_GROUP_OF_BINDINGS = "$nl$/icons/full/obj16/keygroups_obj.gif"; //$NON-NLS-1$ |
|
|
672 |
|
673 |
private static final String CONTEXT_ID_ACTION_SETS="org.eclipse.ui.contexts.actionSet"; //$NON-NLS-1$ |
674 |
|
675 |
private static final String CONTEXT_ID_INTERNAL=".internal."; //$NON-NLS-1$ |
667 |
|
676 |
|
668 |
/** |
677 |
/** |
669 |
* The number of items to show in the bindings table tree. |
678 |
* The number of items to show in the bindings table tree. |
Lines 676-682
Link Here
|
676 |
*/ |
685 |
*/ |
677 |
private static final NamedHandleObjectComparator NAMED_HANDLE_OBJECT_COMPARATOR = new NamedHandleObjectComparator(); |
686 |
private static final NamedHandleObjectComparator NAMED_HANDLE_OBJECT_COMPARATOR = new NamedHandleObjectComparator(); |
678 |
|
687 |
|
679 |
private final static String TAG_DIALOG_SECTION = "org.eclipse.ui.preferences.keysPreferencePage"; //$NON-NLS-1$ |
688 |
public final static String TAG_DIALOG_SECTION = "org.eclipse.ui.preferences.keysPreferencePage"; //$NON-NLS-1$ |
680 |
|
689 |
|
681 |
private final String TAG_FIELD = "showAllField"; //$NON-NLS-1$ |
690 |
private final String TAG_FIELD = "showAllField"; //$NON-NLS-1$ |
682 |
|
691 |
|
Lines 884-890
Link Here
|
884 |
gridData.widthHint = Math.max(widthHint, advancedButton.computeSize( |
893 |
gridData.widthHint = Math.max(widthHint, advancedButton.computeSize( |
885 |
SWT.DEFAULT, SWT.DEFAULT, true).x) + 5; |
894 |
SWT.DEFAULT, SWT.DEFAULT, true).x) + 5; |
886 |
advancedButton.setLayoutData(gridData); |
895 |
advancedButton.setLayoutData(gridData); |
|
|
896 |
advancedButton.addMouseListener(new MouseListener(){ |
897 |
|
898 |
public void mouseDoubleClick(MouseEvent e) { |
899 |
// TODO Auto-generated method stub |
900 |
|
901 |
} |
902 |
|
903 |
public void mouseDown(MouseEvent e) { |
904 |
// TODO Auto-generated method stub |
905 |
|
906 |
} |
887 |
|
907 |
|
|
|
908 |
public void mouseUp(MouseEvent e) { |
909 |
// TODO Auto-generated method stub |
910 |
|
911 |
Dialog dialog=new KeysPreferenceFiltersDialog(getShell()); |
912 |
if (dialog.open() == Window.OK) { |
913 |
whenCombo.setInput(getContexts()); |
914 |
} |
915 |
}}); |
888 |
return buttonBar; |
916 |
return buttonBar; |
889 |
} |
917 |
} |
890 |
|
918 |
|
Lines 1038-1043
Link Here
|
1038 |
whenCombo.getCombo().setLayoutData(gridData); |
1066 |
whenCombo.getCombo().setLayoutData(gridData); |
1039 |
whenCombo.setLabelProvider(new NamedHandleObjectLabelProvider()); |
1067 |
whenCombo.setLabelProvider(new NamedHandleObjectLabelProvider()); |
1040 |
whenCombo.setContentProvider(new ArrayContentProvider()); |
1068 |
whenCombo.setContentProvider(new ArrayContentProvider()); |
|
|
1069 |
whenCombo.setComparator(new ViewerComparator()); |
1041 |
|
1070 |
|
1042 |
// RIGHT DATA AREA |
1071 |
// RIGHT DATA AREA |
1043 |
// Creates the right data area. |
1072 |
// Creates the right data area. |
Lines 1339-1345
Link Here
|
1339 |
setScheme(localChangeManager.getActiveScheme()); |
1368 |
setScheme(localChangeManager.getActiveScheme()); |
1340 |
|
1369 |
|
1341 |
// Update the when combo. |
1370 |
// Update the when combo. |
1342 |
whenCombo.setInput(sortByName(contextService.getDefinedContexts())); |
1371 |
whenCombo.setInput(getContexts()); |
|
|
1372 |
|
1343 |
} |
1373 |
} |
1344 |
|
1374 |
|
1345 |
/* |
1375 |
/* |
Lines 1875-1878
Link Here
|
1875 |
} |
1905 |
} |
1876 |
return settings; |
1906 |
return settings; |
1877 |
} |
1907 |
} |
|
|
1908 |
|
1909 |
protected Object[] getContexts(){ |
1910 |
|
1911 |
Context[] contexts=contextService.getDefinedContexts(); |
1912 |
List filteredContexts=new ArrayList(); |
1913 |
boolean actionSetFilterchecked; |
1914 |
boolean internalFilterChecked; |
1915 |
IDialogSettings settings=getDialogSettings(); |
1916 |
if (settings.get(KeysPreferenceFiltersDialog.TAG_FILTER_ACTION_SETS)==null){ |
1917 |
//First time TAG_FILTER_ACTION_SETS will be null so we have to set actionSetFilterchecked to true |
1918 |
actionSetFilterchecked=true; |
1919 |
}else |
1920 |
actionSetFilterchecked=settings.getBoolean(KeysPreferenceFiltersDialog.TAG_FILTER_ACTION_SETS); |
1921 |
try { |
1922 |
if (actionSetFilterchecked) { |
1923 |
for (int i = 0; i < contexts.length; i++) { |
1924 |
String parentId = contexts[i].getParentId(); |
1925 |
boolean check = false; |
1926 |
if (contexts[i].getId().equalsIgnoreCase(CONTEXT_ID_ACTION_SETS)){ |
1927 |
check=true; |
1928 |
} |
1929 |
while (parentId != null) { |
1930 |
if (parentId |
1931 |
.equalsIgnoreCase(CONTEXT_ID_ACTION_SETS)) { |
1932 |
check = true; |
1933 |
} |
1934 |
parentId = contextService.getContext(parentId) |
1935 |
.getParentId(); |
1936 |
} |
1937 |
if (!check) { |
1938 |
filteredContexts.add(contexts[i]); |
1939 |
} |
1940 |
} |
1941 |
}else{ |
1942 |
//if actionSet filter is off then filteredContexts will be null so we have to copy all the contexts to it. |
1943 |
for (int i=0; i<contexts.length;i++){ |
1944 |
filteredContexts.add(contexts[i]); |
1945 |
} |
1946 |
} |
1947 |
|
1948 |
if (settings.get(KeysPreferenceFiltersDialog.TAG_FILTER_INTERNAL) == null) { |
1949 |
//First time TAG_FILTER_INTERNAL will be null so we have to set actionSetFilterchecked to true |
1950 |
internalFilterChecked = true; |
1951 |
} else |
1952 |
internalFilterChecked = settings |
1953 |
.getBoolean(KeysPreferenceFiltersDialog.TAG_FILTER_INTERNAL); |
1954 |
|
1955 |
if (internalFilterChecked) { |
1956 |
for (int i = 0; i < filteredContexts.size(); i++) { |
1957 |
if (((Context) filteredContexts.get(i)).getId().indexOf( |
1958 |
CONTEXT_ID_INTERNAL) != -1) { |
1959 |
filteredContexts.remove(i); |
1960 |
} |
1961 |
} |
1962 |
} |
1963 |
|
1964 |
} catch (NotDefinedException e) { |
1965 |
return contexts; |
1966 |
} |
1967 |
|
1968 |
|
1969 |
return filteredContexts.toArray(); |
1970 |
} |
1878 |
} |
1971 |
} |