Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 224370 | Differences between
and this patch

Collapse All | Expand All

(-)a/css.editor/src/org/netbeans/modules/css/resources/layer.xml (+4 lines)
 Lines 164-169    Link Here 
164
            </folder>
164
            </folder>
165
        </folder>
165
        </folder>
166
    </folder>
166
    </folder>
167
168
    <folder name="OptionsExport">
169
	<attr name="translate" stringvalue="config/Editors/text/x-css=>config/Editors/text/css"/>
170
    </folder>
167
    
171
    
168
    <folder name="Templates">
172
    <folder name="Templates">
169
        <folder name="Other">
173
        <folder name="Other">
(-)a/nbbuild/antsrc/org/netbeans/nbbuild/LayerOptionsImport.java (-2 / +7 lines)
 Lines 146-152    Link Here 
146
                        log(origin);
146
                        log(origin);
147
                    }
147
                    }
148
                    for (String name : name2value.keySet()) {
148
                    for (String name : name2value.keySet()) {
149
                        if (name.matches("(in|ex)clude")) {
149
                        if (name.matches("(in|ex)clude") || name.equals("translate")) {
150
                            String value = name2value.get(name);
150
                            String value = name2value.get(name);
151
                            if (value != null && value.length() > 0) {
151
                            if (value != null && value.length() > 0) {
152
                                String line = String.format("%s %s", name, value);
152
                                String line = String.format("%s %s", name, value);
 Lines 198-206    Link Here 
198
                    String n = attributes.getValue("name");
198
                    String n = attributes.getValue("name");
199
                    prefix += n;
199
                    prefix += n;
200
                    register(prefix);
200
                    register(prefix);
201
                } else if (qName.equals("attr") && attributes.getValue("name").matches("(in|ex)clude")) {
201
                } else if (qName.equals("attr") && (attributes.getValue("name").matches("(in|ex)clude")
202
			|| attributes.getValue("name").equals("translate"))) {
202
                    String attrName = attributes.getValue("name");
203
                    String attrName = attributes.getValue("name");
203
                    String attrValue = attributes.getValue("stringvalue");
204
                    String attrValue = attributes.getValue("stringvalue");
205
		    if(attrName.equals("translate")) {
206
			prefix = "OptionsExport/".concat(cnb);
207
			register(prefix);
208
		    }
204
                    Map<String, String> name2value = attributesMap.get(prefix);
209
                    Map<String, String> name2value = attributesMap.get(prefix);
205
                    if (name2value == null) {
210
                    if (name2value == null) {
206
                        name2value = new HashMap<String, String>();
211
                        name2value = new HashMap<String, String>();
(-)a/o.n.upgrader/src/org/netbeans/upgrade/CopyFiles.java (-9 / +27 lines)
 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
            }

Return to bug 224370
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo