Changeset 539 for trunk/quest-ui-core/src
- Timestamp:
- 08/15/12 12:20:43 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/plugin/jfc/JFCReplayIDCalculator.java
r538 r539 6 6 import java.util.List; 7 7 import java.util.Map; 8 import java.util.regex.Matcher; 9 import java.util.regex.Pattern; 8 10 9 11 import de.ugoe.cs.quest.plugin.jfc.eventcore.JFCEvent; … … 135 137 * Guitar has a special way to deal with window titles when 136 138 * calculating unique widget IDs. This method mimics Guitar's 137 * behavior (compare compareguitar source code: edu.umd.cs.guitar.139 * behavior (compare guitar source code: edu.umd.cs.guitar. 138 140 * model.JFCDefaultIDGeneratorSimple). 139 141 * @param title 140 142 * @return 141 143 */ 142 144 143 145 private String getFuzzyTitle(String title){ 144 return ".*FreeMind.*"; 145 } 146 final List<String> PATTERNS = 147 Arrays.asList("Rachota .*", 148 "OmegaT-.*", 149 "Buddi.*", 150 "Open:.*", 151 "JabRef.*", 152 "GanttProject.*", 153 ".*Pauker.*", 154 ".*FreeMind.*", 155 ".* - ArgoUML.*", 156 "Save Project .*"); 157 158 159 for (String sPattern : PATTERNS) { 160 if (matchRegex(title, sPattern)) { 161 return sPattern; 162 } 163 } 164 165 return title; 166 } 167 168 /** 169 * Determine if the input string matches the input regex pattern. 170 * This method mimics Guitars behavior. 171 * Attempt to match the pattern 'sPattern' with the string 'sInputString'. 172 173 * @param sInputString Input string to match with pattern 174 * @param sPattern Regex pattern to match with string 175 * @return True if match, false otherwise 176 */ 177 private static boolean 178 matchRegex(String sInputString, 179 String sPattern) 180 { 181 Pattern pattern; 182 Matcher matcher; 183 184 pattern = Pattern.compile(sPattern); 185 matcher = pattern.matcher(sInputString); 186 if (matcher.matches()) { 187 return true; 188 } 189 190 return false; 191 } 192 193 /** 194 * Extracts the index from a component string 195 * @param targetPart String that represents the component 196 * @return Index of the component 197 */ 146 198 147 199 private Integer getIndex(String targetPart){ … … 150 202 if (index.equals("-1")) 151 203 throw new AssertionError("Index should only be -1 for components" + 152 "that have no parent s.");204 "that have no parent."); 153 205 154 206 return Integer.parseInt(index);
Note: See TracChangeset
for help on using the changeset viewer.