View | Details | Raw Unified | Return to bug 215224 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/releng/tools/messages.properties (+1 lines)
Lines 77-82 Link Here
77
CopyrightPreferencePage.6=Default year must be a positive number
77
CopyrightPreferencePage.6=Default year must be a positive number
78
CopyrightPreferencePage.7=Default revision year:
78
CopyrightPreferencePage.7=Default revision year:
79
CopyrightPreferencePage.8=Always use default revision year instead of CVS lookup
79
CopyrightPreferencePage.8=Always use default revision year instead of CVS lookup
80
CopyrightPreferencePage.9=Skip over XML files
80
BuildNotesPage.2=Update Build Notes File
81
BuildNotesPage.2=Update Build Notes File
81
BuildNotesPage.3=Build Notes File:
82
BuildNotesPage.3=Build Notes File:
82
BuildNotesPage.5=Invalid file extension.
83
BuildNotesPage.5=Invalid file extension.
(-)src/org/eclipse/releng/tools/AdvancedCopyrightComment.java (-25 / +35 lines)
Lines 26-31 Link Here
26
    public static final int UNKNOWN_COMMENT = -1;
26
    public static final int UNKNOWN_COMMENT = -1;
27
    public static final int JAVA_COMMENT = 1;
27
    public static final int JAVA_COMMENT = 1;
28
    public static final int PROPERTIES_COMMENT = 2;
28
    public static final int PROPERTIES_COMMENT = 2;
29
    public static final int XML_COMMENT = 3;
29
30
30
    private int commentStyle = 0;
31
    private int commentStyle = 0;
31
    private int creationYear = -1;
32
    private int creationYear = -1;
Lines 59-98 Link Here
59
    }
60
    }
60
61
61
    private static String getLinePrefix(int commentStyle) {
62
    private static String getLinePrefix(int commentStyle) {
62
        switch(commentStyle) {
63
        switch (commentStyle) {
63
        case JAVA_COMMENT:
64
			case JAVA_COMMENT:
64
            return " * ";  //$NON-NLS-1$
65
				return " * "; //$NON-NLS-1$
65
        case PROPERTIES_COMMENT:
66
			case PROPERTIES_COMMENT:
66
            return "# "; //$NON-NLS-1$
67
				return "# "; //$NON-NLS-1$
67
        default:
68
			case XML_COMMENT:
68
            return null;
69
				return "    "; //$NON-NLS-1$
69
        }
70
			default:
71
				return null;
72
		}
70
	}
73
	}
71
74
72
	private void writeCommentStart(PrintWriter writer) {
75
	private void writeCommentStart(PrintWriter writer) {
73
	    switch(commentStyle) {
76
	    switch (commentStyle) {
74
	    case JAVA_COMMENT:
77
			case JAVA_COMMENT:
75
			writer.println("/*******************************************************************************"); //$NON-NLS-1$
78
				writer.println("/*******************************************************************************"); //$NON-NLS-1$
76
			break;
79
				break;
77
	    case PROPERTIES_COMMENT:
80
			case PROPERTIES_COMMENT:
78
		    writer.println("###############################################################################"); //$NON-NLS-1$
81
				writer.println("###############################################################################"); //$NON-NLS-1$
79
		    break;
82
				break;
80
	    }
83
			case XML_COMMENT:
84
				writer.println("<!--"); //$NON-NLS-1$
85
				break;
86
		}
81
	}
87
	}
82
88
83
	private void writeCommentEnd(PrintWriter writer) {
89
	private void writeCommentEnd(PrintWriter writer) {
84
	    switch(commentStyle) {
90
	    switch (commentStyle) {
85
	    case JAVA_COMMENT:
91
			case JAVA_COMMENT:
86
			writer.println(" *******************************************************************************/"); //$NON-NLS-1$
92
				writer.println(" *******************************************************************************/"); //$NON-NLS-1$
87
			break;
93
				break;
88
	    case PROPERTIES_COMMENT:
94
			case PROPERTIES_COMMENT:
89
		    writer.println("###############################################################################"); //$NON-NLS-1$
95
				writer.println("###############################################################################"); //$NON-NLS-1$
90
		    break;
96
				break;
91
	    }
97
			case XML_COMMENT:
98
				writer.println(" -->"); //$NON-NLS-1$
99
				break;
100
		}
92
	}
101
	}
93
	
102
	
94
	/**
103
	/**
95
	 * Get the copyright tool preference store
104
	 * Get the copyright tool preference store
105
	 * 
96
	 * @return
106
	 * @return
97
	 */
107
	 */
98
    private static IPreferenceStore getPreferenceStore() {
108
    private static IPreferenceStore getPreferenceStore() {
Lines 181-187 Link Here
181
				// just write out the line
191
				// just write out the line
182
				if (NEW_LINE.equals(currentLine)) {
192
				if (NEW_LINE.equals(currentLine)) {
183
					// handle empty lines
193
					// handle empty lines
184
					writer.print(linePrefix + currentLine);
194
					writer.println(linePrefix);
185
				} else {
195
				} else {
186
					writer.println(linePrefix + currentLine);
196
					writer.println(linePrefix + currentLine);
187
				}
197
				}
(-)src/org/eclipse/releng/tools/AdvancedFixCopyrightAction.java (+7 lines)
Lines 312-317 Link Here
312
        	}
312
        	}
313
        	fileType = AdvancedCopyrightComment.PROPERTIES_COMMENT;
313
        	fileType = AdvancedCopyrightComment.PROPERTIES_COMMENT;
314
            aSourceFile = new PropertiesFile(file);
314
            aSourceFile = new PropertiesFile(file);
315
        } else if (extension.equals("xml")) { //$NON-NLS-1$
316
        	// if stop processing if ignoring xml files
317
        	if (RelEngPlugin.getDefault().getPreferenceStore().getBoolean(RelEngCopyrightConstants.IGNORE_XML_KEY)) {
318
        		return;
319
        	}
320
        	fileType = AdvancedCopyrightComment.XML_COMMENT;
321
            aSourceFile = new XmlFile(file);
315
        } else
322
        } else
316
            return;
323
            return;
317
324
(-)src/org/eclipse/releng/tools/preferences/RelEngCopyrightConstants.java (+1 lines)
Lines 22-25 Link Here
22
//	public final static String FIX_UP_EXISTING_KEY = "org.eclipse.releng.tools.fixUpExisting"; //$NON-NLS-1$
22
//	public final static String FIX_UP_EXISTING_KEY = "org.eclipse.releng.tools.fixUpExisting"; //$NON-NLS-1$
23
	public final static String REPLACE_ALL_EXISTING_KEY = "org.eclipse.releng.tools.replaceAllExisting"; //$NON-NLS-1$
23
	public final static String REPLACE_ALL_EXISTING_KEY = "org.eclipse.releng.tools.replaceAllExisting"; //$NON-NLS-1$
24
	public final static String IGNORE_PROPERTIES_KEY = "org.eclipse.releng.tools.ignoreProperties"; //$NON-NLS-1$
24
	public final static String IGNORE_PROPERTIES_KEY = "org.eclipse.releng.tools.ignoreProperties"; //$NON-NLS-1$
25
	public final static String IGNORE_XML_KEY = "org.eclipse.releng.tools.ignoreXml"; //$NON-NLS-1$
25
}
26
}
(-)src/org/eclipse/releng/tools/preferences/RelEngPreferenceInitializer.java (+1 lines)
Lines 34-39 Link Here
34
//        store.setDefault(RelEngCopyrightConstants.FIX_UP_EXISTING_KEY, false);
34
//        store.setDefault(RelEngCopyrightConstants.FIX_UP_EXISTING_KEY, false);
35
        store.setDefault(RelEngCopyrightConstants.REPLACE_ALL_EXISTING_KEY, false);
35
        store.setDefault(RelEngCopyrightConstants.REPLACE_ALL_EXISTING_KEY, false);
36
        store.setDefault(RelEngCopyrightConstants.IGNORE_PROPERTIES_KEY, false);
36
        store.setDefault(RelEngCopyrightConstants.IGNORE_PROPERTIES_KEY, false);
37
        store.setDefault(RelEngCopyrightConstants.IGNORE_XML_KEY, false);
37
	}
38
	}
38
39
39
}
40
}
(-)src/org/eclipse/releng/tools/preferences/CopyrightPreferencePage.java (-1 / +12 lines)
Lines 52-57 Link Here
52
	// disable fix up existing copyright till it works better
52
	// disable fix up existing copyright till it works better
53
//	private Button fFixExisting;
53
//	private Button fFixExisting;
54
	private Button fIgnoreProperties;
54
	private Button fIgnoreProperties;
55
	private Button fIgnoreXml;
55
	
56
	
56
	/* (non-Javadoc)
57
	/* (non-Javadoc)
57
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
58
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
Lines 125-130 Link Here
125
		data.horizontalSpan = 2;
126
		data.horizontalSpan = 2;
126
		fIgnoreProperties.setLayoutData(data);
127
		fIgnoreProperties.setLayoutData(data);
127
		
128
		
129
		// ignore xml files
130
		fIgnoreXml = new Button(fComposite, SWT.CHECK);
131
		fIgnoreXml.setText(Messages.getString("CopyrightPreferencePage.9")); //$NON-NLS-1$
132
		data = new GridData();
133
		data.horizontalSpan = 2;
134
		fIgnoreXml.setLayoutData(data);
135
128
		KeyListener listener1 = new KeyAdapter() {
136
		KeyListener listener1 = new KeyAdapter() {
129
			/* (non-Javadoc)
137
			/* (non-Javadoc)
130
			 * @see org.eclipse.swt.events.KeyAdapter#keyReleased(org.eclipse.swt.events.KeyEvent)
138
			 * @see org.eclipse.swt.events.KeyAdapter#keyReleased(org.eclipse.swt.events.KeyEvent)
Lines 240-246 Link Here
240
		fReplaceAllExisting.setSelection(store.getBoolean(RelEngCopyrightConstants.REPLACE_ALL_EXISTING_KEY));
248
		fReplaceAllExisting.setSelection(store.getBoolean(RelEngCopyrightConstants.REPLACE_ALL_EXISTING_KEY));
241
		// disable fix up existing copyright till it works better
249
		// disable fix up existing copyright till it works better
242
//		handleReplaceAllEnabled(fReplaceAllExisting.getSelection(), store.getBoolean(RelEngCopyrightConstants.FIX_UP_EXISTING_KEY));
250
//		handleReplaceAllEnabled(fReplaceAllExisting.getSelection(), store.getBoolean(RelEngCopyrightConstants.FIX_UP_EXISTING_KEY));
243
		fIgnoreProperties.setSelection(store.getBoolean(RelEngCopyrightConstants.IGNORE_PROPERTIES_KEY));		
251
		fIgnoreProperties.setSelection(store.getBoolean(RelEngCopyrightConstants.IGNORE_PROPERTIES_KEY));
252
		fIgnoreXml.setSelection(store.getBoolean(RelEngCopyrightConstants.IGNORE_XML_KEY));
244
	}
253
	}
245
	
254
	
246
	/**
255
	/**
Lines 312-317 Link Here
312
		// disable fix up existing copyright till it works better
321
		// disable fix up existing copyright till it works better
313
//		handleReplaceAllEnabled(fReplaceAllExisting.getSelection(), getPreferenceStore().getDefaultBoolean(RelEngCopyrightConstants.FIX_UP_EXISTING_KEY));
322
//		handleReplaceAllEnabled(fReplaceAllExisting.getSelection(), getPreferenceStore().getDefaultBoolean(RelEngCopyrightConstants.FIX_UP_EXISTING_KEY));
314
		fIgnoreProperties.setSelection(getPreferenceStore().getDefaultBoolean(RelEngCopyrightConstants.IGNORE_PROPERTIES_KEY));
323
		fIgnoreProperties.setSelection(getPreferenceStore().getDefaultBoolean(RelEngCopyrightConstants.IGNORE_PROPERTIES_KEY));
324
		fIgnoreXml.setSelection(getPreferenceStore().getDefaultBoolean(RelEngCopyrightConstants.IGNORE_XML_KEY));
315
		
325
		
316
		super.performDefaults();
326
		super.performDefaults();
317
	}
327
	}
Lines 330-335 Link Here
330
		// disable fix up existing copyright till it works better
340
		// disable fix up existing copyright till it works better
331
//		store.setValue(RelEngCopyrightConstants.FIX_UP_EXISTING_KEY, fFixExisting.getSelection());
341
//		store.setValue(RelEngCopyrightConstants.FIX_UP_EXISTING_KEY, fFixExisting.getSelection());
332
		store.setValue(RelEngCopyrightConstants.IGNORE_PROPERTIES_KEY, fIgnoreProperties.getSelection());
342
		store.setValue(RelEngCopyrightConstants.IGNORE_PROPERTIES_KEY, fIgnoreProperties.getSelection());
343
		store.setValue(RelEngCopyrightConstants.IGNORE_XML_KEY, fIgnoreXml.getSelection());
333
		
344
		
334
		RelEngPlugin.getDefault().savePluginPreferences();
345
		RelEngPlugin.getDefault().savePluginPreferences();
335
		
346
		
(-)plugin.xml (-2 / +3 lines)
Lines 89-96 Link Here
89
         </action>
89
         </action>
90
      </objectContribution>
90
      </objectContribution>
91
      <objectContribution
91
      <objectContribution
92
            objectClass="org.eclipse.core.resources.IResource"
92
            adaptable="true"
93
            id="org.eclipse.releng.internal.tools.AdvancedCopyrightContribution">
93
            id="org.eclipse.releng.internal.tools.AdvancedCopyrightContribution"
94
            objectClass="org.eclipse.core.resources.IResource">
94
         <action
95
         <action
95
               label="Advanced Fix Copyrights"
96
               label="Advanced Fix Copyrights"
96
               class="org.eclipse.releng.tools.AdvancedFixCopyrightAction"
97
               class="org.eclipse.releng.tools.AdvancedFixCopyrightAction"
(-)src/org/eclipse/releng/tools/XmlFile.java (+46 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 Gunnar Wagenknecht and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Gunnar Wagenknecht - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.releng.tools;
12
13
import org.eclipse.core.resources.IFile;
14
15
/**
16
 * XML File
17
 */
18
public class XmlFile extends SourceFile {
19
20
	/**
21
	 * Creates a new instance
22
	 * @param file
23
	 */
24
	public XmlFile(IFile file) {
25
		super(file);
26
	}
27
28
	/*
29
	 * (non-Javadoc)
30
	 * 
31
	 * @see Test.popup.actions.SourceFile#getCommentStart()
32
	 */
33
	public String getCommentStart() {
34
		return "<!--";
35
	}
36
37
	/*
38
	 * (non-Javadoc)
39
	 * 
40
	 * @see Test.popup.actions.SourceFile#getCommentEnd()
41
	 */
42
	public String getCommentEnd() {
43
		return "-->";
44
	}
45
46
}

Return to bug 215224