|
Lines 7-12
Link Here
|
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
|
|
10 |
* Semion Chichelnitsky (semion@il.ibm.com) - bug 208564 |
| 10 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
| 11 |
package org.eclipse.core.internal.preferences; |
12 |
package org.eclipse.core.internal.preferences; |
| 12 |
|
13 |
|
|
Lines 31-36
Link Here
|
| 31 |
* strings. |
32 |
* strings. |
| 32 |
*/ |
33 |
*/ |
| 33 |
private static final long STRING_SHARING_INTERVAL = 300000; |
34 |
private static final long STRING_SHARING_INTERVAL = 300000; |
|
|
35 |
private static final String MATCH_TYPE_PREFIX = "prefix"; //$NON-NLS-1$ |
| 34 |
|
36 |
|
| 35 |
// cheat here and add "project" even though we really shouldn't know about it |
37 |
// cheat here and add "project" even though we really shouldn't know about it |
| 36 |
// because of plug-in dependencies and it being defined in the resources plug-in |
38 |
// because of plug-in dependencies and it being defined in the resources plug-in |
|
Lines 774-780
Link Here
|
| 774 |
} else { |
776 |
} else { |
| 775 |
// otherwise check to see if we have any applicable keys |
777 |
// otherwise check to see if we have any applicable keys |
| 776 |
for (int j = 0; j < entries.length; j++) { |
778 |
for (int j = 0; j < entries.length; j++) { |
| 777 |
if (entries[j] != null && child.get(entries[j].getKey(), null) != null) |
779 |
if (entries[j] == null) |
|
|
780 |
continue; |
| 781 |
if (entries[j].getMatchType() == null) { |
| 782 |
if (child.get(entries[j].getKey(), null) != null) |
| 783 |
return true; |
| 784 |
} else if (internalMatchesWithMatchType(entries[j], child.keys())) |
| 778 |
return true; |
785 |
return true; |
| 779 |
} |
786 |
} |
| 780 |
} |
787 |
} |
|
Lines 796-801
Link Here
|
| 796 |
} |
803 |
} |
| 797 |
|
804 |
|
| 798 |
/* |
805 |
/* |
|
|
806 |
* Internal method that check the matching preferences for entry with specific match type. |
| 807 |
*/ |
| 808 |
private boolean internalMatchesWithMatchType(PreferenceFilterEntry entry, String[] keys) { |
| 809 |
if (keys == null || keys.length == 0) |
| 810 |
return false; |
| 811 |
String key = entry.getKey(); |
| 812 |
String matchType = entry.getMatchType(); |
| 813 |
if (!matchType.equalsIgnoreCase(MATCH_TYPE_PREFIX)) |
| 814 |
return false; |
| 815 |
for (int i = 0; i < keys.length; i++) { |
| 816 |
if (keys[i].startsWith(key)) { |
| 817 |
return true; |
| 818 |
} |
| 819 |
} |
| 820 |
return false; |
| 821 |
} |
| 822 |
|
| 823 |
/* |
| 799 |
* Returns a boolean value indicating whether or not the given Properties |
824 |
* Returns a boolean value indicating whether or not the given Properties |
| 800 |
* object is the result of a preference export previous to Eclipse 3.0. |
825 |
* object is the result of a preference export previous to Eclipse 3.0. |
| 801 |
* |
826 |
* |
|
Lines 961-966
Link Here
|
| 961 |
String childPath = nodeFullPath.substring(treePath.length()); |
986 |
String childPath = nodeFullPath.substring(treePath.length()); |
| 962 |
childPath = EclipsePreferences.makeRelative(childPath); |
987 |
childPath = EclipsePreferences.makeRelative(childPath); |
| 963 |
if (tree.nodeExists(childPath)) { |
988 |
if (tree.nodeExists(childPath)) { |
|
|
989 |
Preferences child = tree.node(childPath); |
| 964 |
PreferenceFilterEntry[] entries; |
990 |
PreferenceFilterEntry[] entries; |
| 965 |
// protect against wrong classes since this is passed in by the user |
991 |
// protect against wrong classes since this is passed in by the user |
| 966 |
try { |
992 |
try { |
|
Lines 974-980
Link Here
|
| 974 |
ArrayList list = new ArrayList(); |
1000 |
ArrayList list = new ArrayList(); |
| 975 |
for (int j = 0; j < entries.length; j++) { |
1001 |
for (int j = 0; j < entries.length; j++) { |
| 976 |
if (entries[j] != null) |
1002 |
if (entries[j] != null) |
| 977 |
list.add(entries[j].getKey()); |
1003 |
addMatchedKeys(list, entries[j], child.keys()); |
| 978 |
} |
1004 |
} |
| 979 |
keys = (String[]) list.toArray(new String[list.size()]); |
1005 |
keys = (String[]) list.toArray(new String[list.size()]); |
| 980 |
} |
1006 |
} |
|
Lines 986-991
Link Here
|
| 986 |
return result; |
1012 |
return result; |
| 987 |
} |
1013 |
} |
| 988 |
|
1014 |
|
|
|
1015 |
/* |
| 1016 |
* Internal method that adds to the given list the matching preferences for entry with or without specific match type. |
| 1017 |
*/ |
| 1018 |
private void addMatchedKeys(ArrayList list, PreferenceFilterEntry entry, String[] keys) { |
| 1019 |
String matchType = entry.getMatchType(); |
| 1020 |
if (matchType == null) { |
| 1021 |
list.add(entry.getKey()); |
| 1022 |
return; |
| 1023 |
} |
| 1024 |
if (keys == null) |
| 1025 |
return; |
| 1026 |
String key = entry.getKey(); |
| 1027 |
for (int i = 0; i < keys.length; i++) { |
| 1028 |
if (matchType.equals(MATCH_TYPE_PREFIX) && keys[i].startsWith(key)) |
| 1029 |
list.add(keys[i]); |
| 1030 |
} |
| 1031 |
} |
| 1032 |
|
| 989 |
/** |
1033 |
/** |
| 990 |
* Compares two plugin version identifiers to see if their preferences |
1034 |
* Compares two plugin version identifiers to see if their preferences |
| 991 |
* are compatible. If they are not compatible, a warning message is |
1035 |
* are compatible. If they are not compatible, a warning message is |