Lines 52-58
Link Here
|
52 |
import java.io.InputStreamReader; |
52 |
import java.io.InputStreamReader; |
53 |
import java.io.OutputStream; |
53 |
import java.io.OutputStream; |
54 |
import java.io.Reader; |
54 |
import java.io.Reader; |
|
|
55 |
import java.util.HashMap; |
55 |
import java.util.HashSet; |
56 |
import java.util.HashSet; |
|
|
57 |
import java.util.Map.Entry; |
56 |
import java.util.Set; |
58 |
import java.util.Set; |
57 |
import java.util.logging.Level; |
59 |
import java.util.logging.Level; |
58 |
import java.util.logging.Logger; |
60 |
import java.util.logging.Logger; |
Lines 67-84
Link Here
|
67 |
* @author Jiri Skrivanek |
69 |
* @author Jiri Skrivanek |
68 |
*/ |
70 |
*/ |
69 |
final class CopyFiles extends Object { |
71 |
final class CopyFiles extends Object { |
70 |
|
|
|
71 |
//>>> hack for http://netbeans.org/bugzilla/show_bug.cgi?id=218976 |
72 |
private static final String CSSSP = "config/Editors/text/"; |
73 |
private static final String ORIG_CSSSP = CSSSP + "x-css"; |
74 |
private static final String TARG_CSSSP = CSSSP + "css"; |
75 |
//<<<eof |
76 |
|
72 |
|
77 |
private File sourceRoot; |
73 |
private File sourceRoot; |
78 |
private File targetRoot; |
74 |
private File targetRoot; |
79 |
private EditableProperties currentProperties; |
75 |
private EditableProperties currentProperties; |
80 |
private Set<String> includePatterns = new HashSet<String>(); |
76 |
private Set<String> includePatterns = new HashSet<String>(); |
81 |
private Set<String> excludePatterns = new HashSet<String>(); |
77 |
private Set<String> excludePatterns = new HashSet<String>(); |
|
|
78 |
private HashMap<String, String> translatePatterns = new HashMap<String, String>(); // <originalPath, newPath> |
82 |
private static final Logger LOGGER = Logger.getLogger(CopyFiles.class.getName()); |
79 |
private static final Logger LOGGER = Logger.getLogger(CopyFiles.class.getName()); |
83 |
|
80 |
|
84 |
private CopyFiles(File source, File target, File patternsFile) { |
81 |
private CopyFiles(File source, File target, File patternsFile) { |
Lines 193-201
Link Here
|
193 |
return; |
190 |
return; |
194 |
} |
191 |
} |
195 |
|
192 |
|
196 |
//>>> hack for http://netbeans.org/bugzilla/show_bug.cgi?id=218976 |
193 |
for (Entry<String, String> entry : translatePatterns.entrySet()) { |
197 |
if(relativePath.startsWith(ORIG_CSSSP)) { relativePath = TARG_CSSSP + relativePath.substring(ORIG_CSSSP.length()); } |
194 |
if (relativePath.startsWith(entry.getKey())) { |
198 |
//<<< |
195 |
String value = entry.getValue(); |
|
|
196 |
LOGGER.log(Level.INFO, "Translating old relative path: {0}", relativePath); //NOI18N |
197 |
relativePath = value + relativePath.substring(entry.getKey().length()); |
198 |
LOGGER.log(Level.INFO, " to new one: {0}", relativePath); //NOI18N |
199 |
} |
200 |
} |
199 |
|
201 |
|
200 |
File targetFile = new File(targetRoot, relativePath); |
202 |
File targetFile = new File(targetRoot, relativePath); |
201 |
LOGGER.log(Level.FINE, "Path: {0}", relativePath); //NOI18N |
203 |
LOGGER.log(Level.FINE, "Path: {0}", relativePath); //NOI18N |
Lines 299-304
Link Here
|
299 |
if (line.length() > 0) { |
301 |
if (line.length() > 0) { |
300 |
excludePatterns.addAll(parsePattern(line)); |
302 |
excludePatterns.addAll(parsePattern(line)); |
301 |
} |
303 |
} |
|
|
304 |
} else if (line.startsWith("translate ")) { //NOI18N |
305 |
line = line.substring(10); |
306 |
if (line.length() > 0) { |
307 |
String[] translations = line.split("\\|"); |
308 |
for (String translation : translations) { |
309 |
String originalPath = translation.substring(0, translation.indexOf("=>")); |
310 |
String newPath = translation.substring(translation.lastIndexOf("=>") + 2); |
311 |
if (translatePatterns.containsKey(originalPath)) { |
312 |
LOGGER.log(Level.INFO, "Translation already exists: {0}. Ignoring new translation: {1}", //NOI18N |
313 |
new Object[]{originalPath.concat("=>").concat(translatePatterns.get(originalPath)), |
314 |
originalPath.concat("=>").concat(newPath)}); |
315 |
} else { |
316 |
translatePatterns.put(originalPath, newPath); |
317 |
} |
318 |
} |
319 |
} |
302 |
} else { |
320 |
} else { |
303 |
throw new java.io.IOException("Wrong line: " + line); //NOI18N |
321 |
throw new java.io.IOException("Wrong line: " + line); //NOI18N |
304 |
} |
322 |
} |