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

Collapse All | Expand All

(-)a/bundles/org.eclipse.releng.tools/.settings/org.eclipse.core.resources.prefs (+2 lines)
Added Link Here
1
eclipse.preferences.version=1
2
encoding//src/org/eclipse/releng/tools/pomversion/PomVersionErrorReporter.java=UTF-8
(-)a/bundles/org.eclipse.releng.tools/META-INF/MANIFEST.MF (-1 lines)
Lines 24-30 Link Here
24
 org.eclipse.ui.console,
24
 org.eclipse.ui.console,
25
 org.eclipse.jgit;bundle-version="1.3.0";resolution:=optional,
25
 org.eclipse.jgit;bundle-version="1.3.0";resolution:=optional,
26
 org.eclipse.egit.core;bundle-version="1.3.0";resolution:=optional
26
 org.eclipse.egit.core;bundle-version="1.3.0";resolution:=optional
27
Bundle-ActivationPolicy: lazy
28
Bundle-RequiredExecutionEnvironment: J2SE-1.4
27
Bundle-RequiredExecutionEnvironment: J2SE-1.4
29
Export-Package: org.eclipse.releng.tools,
28
Export-Package: org.eclipse.releng.tools,
30
 org.eclipse.releng.tools.git;x-friends:="org.eclipse.releng.tests",
29
 org.eclipse.releng.tools.git;x-friends:="org.eclipse.releng.tests",
(-)a/bundles/org.eclipse.releng.tools/plugin.properties (-1 / +15 lines)
Lines 1-5 Link Here
1
###############################################################################
1
###############################################################################
2
# Copyright (c) 2003, 2007 IBM Corporation and others.
2
# Copyright (c) 2003, 2013 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
5
# which accompanies this distribution, and is available at
Lines 16-18 Link Here
16
RelEngActionSet.description=RelEng Tool Action Set
16
RelEngActionSet.description=RelEng Tool Action Set
17
RelEngActionSet.Release=Releasing...
17
RelEngActionSet.Release=Releasing...
18
RelEngActionSet.tooltip=Release Projects
18
RelEngActionSet.tooltip=Release Projects
19
20
releaseAction.label = Re&lease...
21
releasedAction.label = Released
22
compareProjectsAction.tooltip = Compare the selected project(s) with the released versions
23
replaceProjectsAction.tooltip = Replace the selcted project(s) with the released versions
24
loadMapProjectsAction.label = Load Map Projects
25
tagMapProjectsAction.label = Tag Map Projects
26
fixCopyrightsAction.label = Fix Copyrights
27
copyrightToolPrefPage.name = Copyright Tool
28
relengMapProjectPrefPage.name = Releng Map Project Selection
29
pomPrefPage.name = POM Version Tool
30
pomVersionMarker.name = POM Version Problem
31
pomVersionMarkerCategory.name = POM Version Problems
32
action.label = Release...
(-)a/bundles/org.eclipse.releng.tools/plugin.xml (-27 / +21 lines)
Lines 14-35 Link Here
14
               value="org.eclipse.team.core.repository=org.eclipse.team.cvs.core.cvsnature">
14
               value="org.eclipse.team.core.repository=org.eclipse.team.cvs.core.cvsnature">
15
         </filter>
15
         </filter>
16
         <action
16
         <action
17
               label="Re&amp;lease..."
17
               label="%releaseAction.label"
18
               class="org.eclipse.releng.tools.TagAndReleaseAction"
18
               class="org.eclipse.releng.tools.TagAndReleaseAction"
19
               menubarPath="team.main/group2"
19
               menubarPath="team.main/group2"
20
               id="org.eclipse.releng.tools.tagAndRelease">
20
               id="org.eclipse.releng.tools.tagAndRelease">
21
			</action>
21
			</action>
22
			<action
22
			<action
23
               label="Released"
23
               label="%releasedAction.label"
24
               tooltip="Compare the selected project(s) with the released versions"
24
               tooltip="%compareProjectsAction.tooltip"
25
               class="org.eclipse.releng.tools.CompareLocalToMap"
25
               class="org.eclipse.releng.tools.CompareLocalToMap"
26
               menubarPath="compareWithMenu/compareWithGroup"
26
               menubarPath="compareWithMenu/compareWithGroup"
27
               id="org.eclipse.releng.tools.compareWithReleased">
27
               id="org.eclipse.releng.tools.compareWithReleased">
28
         </action>
28
         </action>
29
         <action
29
         <action
30
               label="Released"
30
               label="%releasedAction.label"
31
               class="org.eclipse.releng.tools.ReplaceLocalFromMap"
31
               class="org.eclipse.releng.tools.ReplaceLocalFromMap"
32
               tooltip="Replace the selcted project(s) with the released versions"
32
               tooltip="%replaceProjectsAction.tooltip"
33
               menubarPath="replaceWithMenu/replaceWithGroup"
33
               menubarPath="replaceWithMenu/replaceWithGroup"
34
               id="org.eclipse.releng.tools.replaceWithReleased">
34
               id="org.eclipse.releng.tools.replaceWithReleased">
35
         </action>
35
         </action>
Lines 39-65 Link Here
39
            objectClass="org.eclipse.ui.IWorkingSet"
39
            objectClass="org.eclipse.ui.IWorkingSet"
40
            id="org.eclipse.releng.tools.WorkingSetContributions">
40
            id="org.eclipse.releng.tools.WorkingSetContributions">
41
         <action
41
         <action
42
               label="Release..."
42
               label="%action.label"
43
               class="org.eclipse.releng.tools.TagAndReleaseAction"
43
               class="org.eclipse.releng.tools.TagAndReleaseAction"
44
               menubarPath="team.main/group2"
44
               menubarPath="team.main/group2"
45
               id="org.eclipse.releng.tools.tagAndRelease">
45
               id="org.eclipse.releng.tools.tagAndRelease">
46
			</action>
46
			</action>
47
			<action
47
			<action
48
               label="Released"
48
               label="%releasedAction.label"
49
               tooltip="Compare the selected project(s) with the released versions"
49
               tooltip="%compareProjectsAction.tooltip"
50
               class="org.eclipse.releng.tools.CompareLocalToMap"
50
               class="org.eclipse.releng.tools.CompareLocalToMap"
51
               menubarPath="compareWithMenu/compareWithGroup"
51
               menubarPath="compareWithMenu/compareWithGroup"
52
               id="org.eclipse.releng.tools.compareWithReleased">
52
               id="org.eclipse.releng.tools.compareWithReleased">
53
         </action>
53
         </action>
54
         <action
54
         <action
55
               label="Released"
55
               label="%releasedAction.label"
56
               class="org.eclipse.releng.tools.ReplaceLocalFromMap"
56
               class="org.eclipse.releng.tools.ReplaceLocalFromMap"
57
               tooltip="Replace the selcted project(s) with the released versions"
57
               tooltip="%replaceProjectsAction.tooltip"
58
               menubarPath="replaceWithMenu/replaceWithGroup"
58
               menubarPath="replaceWithMenu/replaceWithGroup"
59
               id="org.eclipse.releng.tools.replaceWithReleased">
59
               id="org.eclipse.releng.tools.replaceWithReleased">
60
         </action>
60
         </action>
61
         <action
61
         <action
62
               label="Fix Copyrights"
62
               label="%fixCopyrightsAction.label"
63
               class="org.eclipse.releng.tools.AdvancedFixCopyrightAction"
63
               class="org.eclipse.releng.tools.AdvancedFixCopyrightAction"
64
               menubarPath="additions"
64
               menubarPath="additions"
65
               enablesFor="+"
65
               enablesFor="+"
Lines 72-84 Link Here
72
            nameFilter="*.map"
72
            nameFilter="*.map"
73
            id="org.eclipse.releng.cvs.mapActions">
73
            id="org.eclipse.releng.cvs.mapActions">
74
         <action
74
         <action
75
               label="Load Map Projects"
75
               label="%loadMapProjectsAction.label"
76
               class="org.eclipse.releng.tools.LoadMap"
76
               class="org.eclipse.releng.tools.LoadMap"
77
               menubarPath="team.main/group1"
77
               menubarPath="team.main/group1"
78
               id="org.eclipse.releng.cvs.LoadMap">
78
               id="org.eclipse.releng.cvs.LoadMap">
79
         </action>
79
         </action>
80
         <action
80
         <action
81
               label="Tag Map Projects"
81
               label="%tagMapProjectsAction.label"
82
               class="org.eclipse.releng.tools.TagMap"
82
               class="org.eclipse.releng.tools.TagMap"
83
               menubarPath="team.main/group1"
83
               menubarPath="team.main/group1"
84
               id="org.eclipse.releng.cvs.TagMap">
84
               id="org.eclipse.releng.cvs.TagMap">
Lines 89-95 Link Here
89
            objectClass="org.eclipse.core.resources.IResource"
89
            objectClass="org.eclipse.core.resources.IResource"
90
            id="org.eclipse.releng.internal.tools.AdvancedCopyrightContribution">
90
            id="org.eclipse.releng.internal.tools.AdvancedCopyrightContribution">
91
         <action
91
         <action
92
               label="Fix Copyrights"
92
               label="%fixCopyrightsAction.label"
93
               class="org.eclipse.releng.tools.AdvancedFixCopyrightAction"
93
               class="org.eclipse.releng.tools.AdvancedFixCopyrightAction"
94
               menubarPath="additions"
94
               menubarPath="additions"
95
               enablesFor="+"
95
               enablesFor="+"
Lines 119-138 Link Here
119
	<!-- ********** Preference Pages ************** -->
119
	<!-- ********** Preference Pages ************** -->
120
	<extension point="org.eclipse.ui.preferencePages">
120
	<extension point="org.eclipse.ui.preferencePages">
121
      <page
121
      <page
122
            name="Copyright Tool"
122
            name="%copyrightToolPrefPage.name"
123
            class="org.eclipse.releng.tools.preferences.CopyrightPreferencePage"
123
            class="org.eclipse.releng.tools.preferences.CopyrightPreferencePage"
124
            id="org.eclipse.releng.tools.preferences.CopyrightPreferencePage">
124
            id="org.eclipse.releng.tools.preferences.CopyrightPreferencePage">
125
      </page>
125
      </page>
126
      <page
126
      <page
127
            class="org.eclipse.releng.tools.preferences.MapProjectPreferencePage"
127
            class="org.eclipse.releng.tools.preferences.MapProjectPreferencePage"
128
            id="org.eclipse.releng.tools.preferences.MapProjectPreferencePage"
128
            id="org.eclipse.releng.tools.preferences.MapProjectPreferencePage"
129
            name="Releng Map Project Selection"
129
            name="%relengMapProjectPrefPage.name"
130
            category="org.eclipse.team.ui.TeamPreferences">
130
            category="org.eclipse.team.ui.TeamPreferences">
131
      </page>
131
      </page>
132
      <page
132
      <page
133
            class="org.eclipse.releng.tools.preferences.PomVersionPreferencePage"
133
            class="org.eclipse.releng.tools.preferences.PomVersionPreferencePage"
134
            id="org.eclipse.releng.tools.preferences.PomVersionPreferencePage"
134
            id="org.eclipse.releng.tools.preferences.PomVersionPreferencePage"
135
            name="POM Version Tool">
135
            name="%pomPrefPage.name">
136
      </page>
136
      </page>
137
   </extension>
137
   </extension>
138
	
138
	
Lines 158-164 Link Here
158
       </adapter>
158
       </adapter>
159
    </factory>
159
    </factory>
160
 </extension>
160
 </extension>
161
<extension id="org.eclipse.releng.tools.pomVersionProblem" point="org.eclipse.core.resources.markers" name="POM Version Problem">
161
<extension id="pomVersionProblem" point="org.eclipse.core.resources.markers" name="%pomVersionMarker.name">
162
  <super  type="org.eclipse.core.resources.problemmarker"/>
162
  <super  type="org.eclipse.core.resources.problemmarker"/>
163
  <super type="org.eclipse.core.resources.textmarker"/>
163
  <super type="org.eclipse.core.resources.textmarker"/>
164
  <persistent value="true"/>
164
  <persistent value="true"/>
Lines 166-172 Link Here
166
 <extension
166
 <extension
167
       point="org.eclipse.ui.ide.markerSupport">
167
       point="org.eclipse.ui.ide.markerSupport">
168
    <markerTypeCategory
168
    <markerTypeCategory
169
          name="POM Version Problems">
169
          name="%pomVersionMarkerCategory.name">
170
       <markerTypeReference
170
       <markerTypeReference
171
             id="org.eclipse.releng.tools.pomVersionProblem">
171
             id="org.eclipse.releng.tools.pomVersionProblem">
172
       </markerTypeReference>
172
       </markerTypeReference>
Lines 180-193 Link Here
180
    </markerResolutionGenerator>
180
    </markerResolutionGenerator>
181
 </extension>
181
 </extension>
182
 <extension
182
 <extension
183
       id="PomVersionBuilder"
183
       point="org.eclipse.ui.startup">
184
       name="Pom Version Tool"
184
    <startup></startup>
185
       point="org.eclipse.core.resources.builders">
186
    <builder>
187
       <run
188
             class="org.eclipse.releng.tools.pomversion.PomVersionBuilder">
189
       </run>
190
    </builder>
191
 </extension>
185
 </extension>
192
186
193
</plugin>
187
</plugin>
(-)a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/RelEngPlugin.java (-2 / +43 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
2
 * Copyright (c) 2000, 2013 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 14-27 Link Here
14
import java.util.ResourceBundle;
14
import java.util.ResourceBundle;
15
15
16
import org.eclipse.core.resources.IProject;
16
import org.eclipse.core.resources.IProject;
17
import org.eclipse.core.resources.IResourceChangeEvent;
17
import org.eclipse.core.resources.IWorkspace;
18
import org.eclipse.core.resources.IWorkspace;
18
import org.eclipse.core.resources.ResourcesPlugin;
19
import org.eclipse.core.resources.ResourcesPlugin;
19
import org.eclipse.core.runtime.Assert;
20
import org.eclipse.core.runtime.Assert;
20
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.IStatus;
22
import org.eclipse.core.runtime.IStatus;
22
import org.eclipse.core.runtime.Status;
23
import org.eclipse.core.runtime.Status;
24
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
25
import org.eclipse.core.runtime.preferences.InstanceScope;
26
import org.eclipse.releng.tools.pomversion.IPomVersionConstants;
27
import org.eclipse.releng.tools.pomversion.PomVersionErrorReporter;
23
import org.eclipse.team.core.RepositoryProvider;
28
import org.eclipse.team.core.RepositoryProvider;
29
import org.eclipse.ui.IStartup;
24
import org.eclipse.ui.plugin.AbstractUIPlugin;
30
import org.eclipse.ui.plugin.AbstractUIPlugin;
31
import org.osgi.framework.BundleContext;
25
32
26
33
27
/**
34
/**
Lines 32-44 Link Here
32
 *    <li>Builder and associated project nature
39
 *    <li>Builder and associated project nature
33
 *    <li>Fix Copyright action
40
 *    <li>Fix Copyright action
34
 */
41
 */
35
public class RelEngPlugin extends AbstractUIPlugin {
42
public class RelEngPlugin extends AbstractUIPlugin implements IStartup {
36
	
43
	
37
	public static final String ID = "org.eclipse.releng.tools"; //$NON-NLS-1$
44
	public static final String ID = "org.eclipse.releng.tools"; //$NON-NLS-1$
38
	public static final String MAP_PROJECT_NAME = Messages.getString("RelEngPlugin.1"); //$NON-NLS-1$
45
	public static final String MAP_PROJECT_NAME = Messages.getString("RelEngPlugin.1"); //$NON-NLS-1$
39
	public static final String MAP_FOLDER = Messages.getString("RelEngPlugin.2"); //$NON-NLS-1$
46
	public static final String MAP_FOLDER = Messages.getString("RelEngPlugin.2"); //$NON-NLS-1$
40
	private static final String BINARY_REPOSITORY_PROVIDER_CLASS_NAME= "org.eclipse.pde.internal.core.BinaryRepositoryProvider"; //$NON-NLS-1$
47
	private static final String BINARY_REPOSITORY_PROVIDER_CLASS_NAME= "org.eclipse.pde.internal.core.BinaryRepositoryProvider"; //$NON-NLS-1$
41
48
49
	PomVersionErrorReporter fPomReporter = new PomVersionErrorReporter();
42
	
50
	
43
	//The shared instance.
51
	//The shared instance.
44
	private static RelEngPlugin plugin;
52
	private static RelEngPlugin plugin;
Lines 57-62 Link Here
57
		}
65
		}
58
	}
66
	}
59
67
68
	/* (non-Javadoc)
69
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
70
	 */
71
	public void start(BundleContext context) throws Exception {
72
		super.start(context);
73
		IEclipsePreferences node = InstanceScope.INSTANCE.getNode(ID);
74
		if(node != null) {
75
			node.addPreferenceChangeListener(fPomReporter);
76
			String severity = getPreferenceStore().getString(IPomVersionConstants.POM_VERSION_ERROR_LEVEL);
77
			if(!IPomVersionConstants.VALUE_IGNORE.equals(severity)) {
78
				ResourcesPlugin.getWorkspace().addResourceChangeListener(fPomReporter, IResourceChangeEvent.POST_BUILD);
79
			}
80
		}
81
	}
82
	
83
	/* (non-Javadoc)
84
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
85
	 */
86
	public void stop(BundleContext context) throws Exception {
87
		IEclipsePreferences node = InstanceScope.INSTANCE.getNode(ID);
88
		if(node != null) {
89
			node.removePreferenceChangeListener(fPomReporter);
90
			ResourcesPlugin.getWorkspace().removeResourceChangeListener(fPomReporter);
91
		}
92
		super.stop(context);
93
	}
94
	
60
	/**
95
	/**
61
	 * Returns the shared instance.
96
	 * Returns the shared instance.
62
	 */
97
	 */
Lines 155-160 Link Here
155
		return provider != null && !BINARY_REPOSITORY_PROVIDER_CLASS_NAME.equals(provider.getClass().getName());
190
		return provider != null && !BINARY_REPOSITORY_PROVIDER_CLASS_NAME.equals(provider.getClass().getName());
156
	}
191
	}
157
192
193
	/* (non-Javadoc)
194
	 * @see org.eclipse.ui.IStartup#earlyStartup()
195
	 */
196
	public void earlyStartup() {
197
	}
198
158
	/**
199
	/**
159
	 * The following code is a sample of how to assign a
200
	 * The following code is a sample of how to assign a
160
	 * RelEng nature to a project.  This only ever needed
201
	 * RelEng nature to a project.  This only ever needed
(-)a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/pomversion/IPomVersionConstants.java (-2 / +2 lines)
Lines 21-27 Link Here
21
	 * The marker type id for POM version problems specified in the markers extension.
21
	 * The marker type id for POM version problems specified in the markers extension.
22
	 * Value is: <code>org.eclipse.releng.tools.pomVersionProblem</code>
22
	 * Value is: <code>org.eclipse.releng.tools.pomVersionProblem</code>
23
	 */
23
	 */
24
	public final static String PROBLEM_MARKER_TYPE = RelEngPlugin.ID + "pomVersionProblem"; //$NON-NLS-1$
24
	public final static String PROBLEM_MARKER_TYPE = RelEngPlugin.ID + ".pomVersionProblem"; //$NON-NLS-1$
25
	
25
	
26
	/**
26
	/**
27
	 * String attribute stored in the problem marker for the correct version that should be in the POM file
27
	 * String attribute stored in the problem marker for the correct version that should be in the POM file
Lines 32-38 Link Here
32
	 * Preference setting that stores the severity level for pom version problem markers.
32
	 * Preference setting that stores the severity level for pom version problem markers.
33
	 * Preference value must be a string and one of {@link #VALUE_ERROR}, {@link #VALUE_WARNING} or {@link #VALUE_IGNORE}. 
33
	 * Preference value must be a string and one of {@link #VALUE_ERROR}, {@link #VALUE_WARNING} or {@link #VALUE_IGNORE}. 
34
	 */
34
	 */
35
	public final static String POM_VERSION_ERROR_LEVEL = RelEngPlugin.ID + "invalidPomVersionErrorLevel"; //$NON-NLS-1$
35
	public final static String POM_VERSION_ERROR_LEVEL = RelEngPlugin.ID + ".invalidPomVersionErrorLevel"; //$NON-NLS-1$
36
36
37
	/**
37
	/**
38
	 * Constant representing the preference value 'ignore'.
38
	 * Constant representing the preference value 'ignore'.
(-)a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/pomversion/Messages.java (+28 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2013 IBM Corporation 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
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.releng.tools.pomversion;
12
13
import org.eclipse.osgi.util.NLS;
14
15
/**
16
 * 
17
 */
18
public class Messages extends NLS {
19
	private static final String BUNDLE_NAME = "org.eclipse.releng.tools.pomversion.messages"; //$NON-NLS-1$
20
	public static String PomVersionErrorReporter_pom_version_error_marker_message;
21
	static {
22
		// initialize resource bundle
23
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
24
	}
25
26
	private Messages() {
27
	}
28
}
(-)a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/pomversion/PomVersionBuilder.java (-139 lines)
Lines 1-139 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2013 IBM Corporation 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
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.releng.tools.pomversion;
12
13
import java.util.Map;
14
import java.util.jar.JarFile;
15
16
import org.eclipse.core.resources.IFile;
17
import org.eclipse.core.resources.IProject;
18
import org.eclipse.core.resources.IResource;
19
import org.eclipse.core.resources.IResourceDelta;
20
import org.eclipse.core.resources.IResourceDeltaVisitor;
21
import org.eclipse.core.resources.IncrementalProjectBuilder;
22
import org.eclipse.core.runtime.CoreException;
23
import org.eclipse.core.runtime.IPath;
24
import org.eclipse.core.runtime.IProgressMonitor;
25
import org.eclipse.core.runtime.Path;
26
import org.eclipse.core.runtime.SubMonitor;
27
import org.eclipse.osgi.util.NLS;
28
import org.eclipse.releng.tools.RelEngPlugin;
29
30
/**
31
 * Builder for creating POM version problems
32
 */
33
public class PomVersionBuilder extends IncrementalProjectBuilder {
34
	
35
	/**
36
	 * Project relative path to the pom.xml file
37
	 */
38
	public static final IPath POM_PATH = new Path("pom.xml"); //$NON-NLS-1$
39
40
	/**
41
	 * Project relative path to the manifest file.
42
	 */
43
	public static final IPath MANIFEST_PATH = new Path(JarFile.MANIFEST_NAME);
44
45
	/* (non-Javadoc)
46
	 * @see org.eclipse.core.resources.IncrementalProjectBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
47
	 */
48
	protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
49
		if (!getProject().isAccessible()) {
50
			return null;
51
		}
52
		
53
		if (kind == FULL_BUILD) {
54
			fullBuild(monitor);
55
		} else {
56
			IResourceDelta delta = getDelta(getProject());
57
			if (delta == null) {
58
				fullBuild(monitor);
59
			} else {
60
				incrementalBuild(delta, monitor);
61
			}
62
		}
63
		return null;
64
	}	
65
	
66
	private void incrementalBuild(IResourceDelta delta, IProgressMonitor monitor) {
67
		PomResourceDeltaVisitor visitor = new PomResourceDeltaVisitor();
68
		try {
69
			delta.accept(visitor);
70
		} catch (CoreException e) {
71
			RelEngPlugin.log(e);
72
		}
73
		if (visitor.doBuild()){
74
			fullBuild(monitor);
75
		}
76
	}
77
78
	private void fullBuild(IProgressMonitor monitor) {
79
		IProject project = getProject();
80
		SubMonitor localMonitor = SubMonitor.convert(monitor, NLS.bind("Comparing POM and plug-in version in {0}", project.getName()), 10);
81
		IFile pomFile = project.getFile(POM_PATH);
82
		IFile manifestFile = project.getFile(MANIFEST_PATH);
83
		if (pomFile.exists() && manifestFile.exists()){
84
			PomVersionErrorReporter reporter = new PomVersionErrorReporter(manifestFile, pomFile);
85
			reporter.validate(localMonitor);
86
		}
87
		localMonitor.done();
88
	}
89
90
	/* (non-Javadoc)
91
	 * @see org.eclipse.core.resources.IncrementalProjectBuilder#clean(org.eclipse.core.runtime.IProgressMonitor)
92
	 */
93
	protected void clean(IProgressMonitor monitor) throws CoreException {
94
		getProject().deleteMarkers(IPomVersionConstants.PROBLEM_MARKER_TYPE, false, IResource.DEPTH_INFINITE);
95
	}
96
	
97
	private class PomResourceDeltaVisitor implements IResourceDeltaVisitor {
98
		private boolean build;
99
100
		public boolean visit(IResourceDelta delta) {
101
			build = false;
102
			if (delta != null) {
103
				int kind = delta.getKind();
104
				// A file being removed doesn't affect the pom version check (markers are already cleaned)
105
				if (kind == IResourceDelta.REMOVED) {
106
					return false;
107
				}
108
				
109
				IResource resource = delta.getResource();
110
				// by ignoring derived resources we should scale a bit better.
111
				if (resource.isDerived())
112
					return false;
113
				if (resource.getType() == IResource.FILE) {
114
					IFile file = (IFile) resource;
115
					IFile pomFile = file.getProject().getFile(POM_PATH);
116
					if (file.equals(pomFile)){
117
						build = true;
118
						return false;
119
					}
120
					IFile manifestFile = file.getProject().getFile(MANIFEST_PATH);
121
					if (file.equals(manifestFile)){
122
						build = true;
123
						return false;
124
					}
125
					return false;
126
				}
127
			}
128
			return true;
129
		}
130
131
		/**
132
		 * @return whether the delta contained a file requiring a build
133
		 */
134
		public boolean doBuild() {
135
			return build;
136
		}
137
	}
138
139
}
(-)a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/pomversion/PomVersionErrorReporter.java (-83 / +270 lines)
Lines 10-16 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.releng.tools.pomversion;
11
package org.eclipse.releng.tools.pomversion;
12
12
13
import java.io.IOException;
14
import java.util.HashMap;
13
import java.util.Stack;
15
import java.util.Stack;
16
import java.util.jar.JarFile;
17
import java.util.jar.Manifest;
14
18
15
import javax.xml.parsers.SAXParser;
19
import javax.xml.parsers.SAXParser;
16
import javax.xml.parsers.SAXParserFactory;
20
import javax.xml.parsers.SAXParserFactory;
Lines 21-37 Link Here
21
import org.eclipse.core.filebuffers.LocationKind;
25
import org.eclipse.core.filebuffers.LocationKind;
22
import org.eclipse.core.resources.IFile;
26
import org.eclipse.core.resources.IFile;
23
import org.eclipse.core.resources.IMarker;
27
import org.eclipse.core.resources.IMarker;
24
import org.eclipse.core.resources.ProjectScope;
28
import org.eclipse.core.resources.IProject;
29
import org.eclipse.core.resources.IResource;
30
import org.eclipse.core.resources.IResourceChangeEvent;
31
import org.eclipse.core.resources.IResourceChangeListener;
32
import org.eclipse.core.resources.IResourceDelta;
33
import org.eclipse.core.resources.IResourceDeltaVisitor;
34
import org.eclipse.core.resources.IWorkspaceRoot;
35
import org.eclipse.core.resources.ResourcesPlugin;
25
import org.eclipse.core.runtime.CoreException;
36
import org.eclipse.core.runtime.CoreException;
26
import org.eclipse.core.runtime.IProgressMonitor;
37
import org.eclipse.core.runtime.IPath;
27
import org.eclipse.core.runtime.Platform;
38
import org.eclipse.core.runtime.Path;
28
import org.eclipse.core.runtime.SubMonitor;
39
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
29
import org.eclipse.core.runtime.preferences.IPreferencesService;
40
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
30
import org.eclipse.core.runtime.preferences.IScopeContext;
31
import org.eclipse.jface.text.BadLocationException;
41
import org.eclipse.jface.text.BadLocationException;
32
import org.eclipse.jface.text.IDocument;
42
import org.eclipse.jface.text.IDocument;
33
import org.eclipse.osgi.util.NLS;
43
import org.eclipse.osgi.util.NLS;
34
import org.eclipse.releng.tools.RelEngPlugin;
44
import org.eclipse.releng.tools.RelEngPlugin;
45
import org.eclipse.ui.texteditor.MarkerUtilities;
35
import org.osgi.framework.Version;
46
import org.osgi.framework.Version;
36
import org.xml.sax.Attributes;
47
import org.xml.sax.Attributes;
37
import org.xml.sax.Locator;
48
import org.xml.sax.Locator;
Lines 43-129 Link Here
43
 * version specified in pom.xml matches the bundle version.
54
 * version specified in pom.xml matches the bundle version.
44
 *
55
 *
45
 */
56
 */
46
public class PomVersionErrorReporter {
57
public class PomVersionErrorReporter implements IResourceChangeListener, IEclipsePreferences.IPreferenceChangeListener {
47
58
48
	private static final String ELEMENT_PROJECT = "project"; //$NON-NLS-1$
59
	class PomResourceDeltaVisitor implements IResourceDeltaVisitor {
49
	private static final String ELEMENT_VERSION = "version"; //$NON-NLS-1$
50
	private static final String SNAPSHOT_SUFFIX = "-SNAPSHOT"; //$NON-NLS-1$
51
60
52
	private SAXParserFactory parserFactory = SAXParserFactory.newInstance();
61
		public boolean visit(IResourceDelta delta) {
53
	private String pomVersionSeverity;
62
			if (delta != null) {
63
				IResource resource = delta.getResource();
64
				switch(resource.getType()) {
65
					case IResource.PROJECT: {
66
						//Should we not care about non-plugin projects?
67
						IProject project = (IProject) resource;
68
						try {
69
							if(project.getDescription().hasNature("org.eclipse.pde.PluginNature")) { //$NON-NLS-1$
70
								if((delta.getFlags() & IResourceDelta.OPEN) > 0) {
71
									validate(project);
72
									return false;
73
								}
74
								return true;
75
							}
76
						}
77
						catch(CoreException ce) {
78
							RelEngPlugin.log(ce);
79
						}
80
						return false;
81
 					}
82
					case IResource.ROOT:
83
					case IResource.FOLDER: {
84
						return true;
85
					}
86
					case IResource.FILE: {
87
						switch(delta.getKind()) {
88
							case IResourceDelta.REMOVED: {
89
								//if manifest removed, clean up markers
90
								if(resource.getProjectRelativePath().equals(MANIFEST_PATH)) {
91
									//manifest content changed
92
									IProject p = resource.getProject();
93
									if(p.isAccessible()) {
94
										cleanMarkers(p);
95
									}
96
								}
97
								break;
98
							}
99
							case IResourceDelta.ADDED: {
100
								//if the POM or manifest has been added scan them
101
								if(resource.getProjectRelativePath().equals(MANIFEST_PATH) ||
102
										resource.getProjectRelativePath().equals(POM_PATH)) {
103
									validate(resource.getProject());
104
								}
105
								break;
106
							}
107
							case IResourceDelta.CHANGED: {
108
								//if the content has changed clean + scan
109
								if((delta.getFlags() & IResourceDelta.CONTENT) > 0) {
110
									if(resource.getProjectRelativePath().equals(MANIFEST_PATH) ||
111
											resource.getProjectRelativePath().equals(POM_PATH)) {
112
										validate(resource.getProject());
113
									}
114
								}
115
								break;
116
							}
117
							default: {
118
								break;
119
							}
120
						}
121
						return false;
122
					}
123
				}
124
			}				
125
			return false;
126
		}
127
	}
54
	
128
	
55
	private IFile manifestFile;
129
	/**
56
	private IFile pomFile;
130
	 * XML parsing handler to check the POM version infos
57
131
	 */
58
	public PomVersionErrorReporter(IFile manifest, IFile pom) {
59
		manifestFile = manifest;
60
		pomFile = pom;
61
	}
62
63
	protected void validate(IProgressMonitor monitor) {
64
		SubMonitor subMon = SubMonitor.convert(monitor, 10);
65
		try {
66
			if (subMon.isCanceled()) {
67
				return;
68
			}
69
			if (!manifestFile.exists() || !pomFile.exists()){
70
				return;
71
			}
72
			
73
			IPreferencesService service = Platform.getPreferencesService();
74
			pomVersionSeverity = service.getString(RelEngPlugin.ID, IPomVersionConstants.POM_VERSION_ERROR_LEVEL, IPomVersionConstants.VALUE_IGNORE, new IScopeContext[] {new ProjectScope(manifestFile.getProject())});
75
			if (pomVersionSeverity == IPomVersionConstants.VALUE_IGNORE) {
76
				return;
77
			}
78
			
79
			// Get the manifest version
80
			Version bundleVersion = Version.emptyVersion;
81
82
			// Compare it to the pom file version
83
			try {
84
				SAXParser parser = parserFactory.newSAXParser();
85
				PomVersionHandler handler = new PomVersionHandler(pomFile, bundleVersion);
86
				parser.parse(pomFile.getContents(), handler);
87
			} catch (Exception e1) {
88
				// Ignored, if there is a problem with the pom file don't create a marker
89
			}
90
91
		} finally {
92
			subMon.done();
93
			if (monitor != null) {
94
				monitor.done();
95
			}
96
		}
97
98
	}
99
100
	private void reportMarker(String message, int lineNumber, int charStart, int charEnd, String correctedVersion) {
101
		try {
102
			IMarker marker = pomFile.createMarker(IPomVersionConstants.PROBLEM_MARKER_TYPE);
103
			marker.setAttribute(IMarker.MESSAGE, message);
104
			if (pomVersionSeverity != null && pomVersionSeverity.equals(IPomVersionConstants.VALUE_WARNING)){
105
				marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
106
			} else {
107
				marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
108
			}
109
			if (lineNumber == -1)
110
				lineNumber = 1;
111
			marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
112
			marker.setAttribute(IMarker.CHAR_START, charStart);
113
			marker.setAttribute(IMarker.CHAR_END, charEnd);
114
			marker.setAttribute(IPomVersionConstants.POM_CORRECT_VERSION, correctedVersion);
115
		} catch (CoreException e){
116
			RelEngPlugin.log(e);
117
		}
118
	}
119
120
	class PomVersionHandler extends DefaultHandler {
132
	class PomVersionHandler extends DefaultHandler {
121
		private Version bundleVersion;
133
		private Version bundleVersion;
122
		private Stack elements = new Stack();
134
		private Stack elements = new Stack();
123
		private boolean checkVersion = false;
135
		private boolean checkVersion = false;
124
		private Locator locator;
136
		private Locator locator;
137
		IFile pom = null;
138
		String severity = null;
125
139
126
		public PomVersionHandler(IFile file, Version bundleVersion) {
140
		public PomVersionHandler(IFile file, Version bundleVersion, String pref) {
141
			pom = file;
142
			severity = pref;
127
			this.bundleVersion = bundleVersion;
143
			this.bundleVersion = bundleVersion;
128
		}
144
		}
129
145
Lines 149-154 Link Here
149
				checkVersion = false;
165
				checkVersion = false;
150
				// Compare the versions
166
				// Compare the versions
151
				String versionString = new String(ch, start, length);
167
				String versionString = new String(ch, start, length);
168
				String origVer = versionString;
152
				try {
169
				try {
153
					// Remove snapshot suffix
170
					// Remove snapshot suffix
154
					int index = versionString.indexOf(SNAPSHOT_SUFFIX);
171
					int index = versionString.indexOf(SNAPSHOT_SUFFIX);
Lines 168-178 Link Here
168
185
169
						try {
186
						try {
170
							// Need to create a document to calculate the markers charstart and charend
187
							// Need to create a document to calculate the markers charstart and charend
171
							IDocument doc = createDocument(pomFile);
188
							IDocument doc = createDocument(pom);
172
							int offset = doc.getLineOffset(locator.getLineNumber() - 1); // locator lines start at 1
189
							int lineOffset = doc.getLineOffset(locator.getLineNumber() - 1); // locator lines start at 1
173
							int charEnd = offset + locator.getColumnNumber() - 1; // returns column at end of character string, columns start at 1
190
							int linLength = doc.getLineLength(locator.getLineNumber() - 1);
174
							int charStart = charEnd - length;
191
							String str = doc.get(lineOffset, linLength);
175
							reportMarker(NLS.bind("POM artifact version {0} does not match bundle version {1}", pomVersion2.toString(), bundleVersion2.toString()), locator.getLineNumber(), charStart, charEnd, correctedVersion);
192
							index = str.indexOf(origVer);
193
							int charStart = lineOffset + index;
194
							int charEnd = charStart + origVer.length();
195
							reportMarker(NLS.bind(Messages.PomVersionErrorReporter_pom_version_error_marker_message, pomVersion2.toString(), bundleVersion2.toString()), 
196
									locator.getLineNumber(), 
197
									charStart, 
198
									charEnd, 
199
									correctedVersion,
200
									pom,
201
									severity);
176
						} catch (BadLocationException e) {
202
						} catch (BadLocationException e) {
177
							RelEngPlugin.log(e);
203
							RelEngPlugin.log(e);
178
						}
204
						}
Lines 184-189 Link Here
184
		}
210
		}
185
	}
211
	}
186
	
212
	
213
	/**
214
	 * Project relative path to the pom.xml file
215
	 */
216
	public static final IPath POM_PATH = new Path("pom.xml"); //$NON-NLS-1$
217
218
	/**
219
	 * Project relative path to the manifest file.
220
	 */
221
	public static final IPath MANIFEST_PATH = new Path(JarFile.MANIFEST_NAME);
222
	private static final String ELEMENT_PROJECT = "project"; //$NON-NLS-1$
223
	private static final String ELEMENT_VERSION = "version"; //$NON-NLS-1$
224
	private static final String SNAPSHOT_SUFFIX = "-SNAPSHOT"; //$NON-NLS-1$
225
226
	
227
	/**
228
	 * Clean up all markers
229
	 * 
230
	 * @param project
231
	 */
232
	void cleanMarkers(IResource resource) {
233
		try {
234
			resource.deleteMarkers(IPomVersionConstants.PROBLEM_MARKER_TYPE, false, IResource.DEPTH_INFINITE);
235
		}
236
		catch(CoreException e) {
237
			RelEngPlugin.log(e);
238
		}
239
	}
240
	
241
	/**
242
	 * Validates the version in the Manifest.MF file against the version in the <code>pom.xml</code> file
243
	 * 
244
	 * @param project
245
	 * @param severity
246
	 */
247
	public void validate(IProject project) {
248
		if(project == null || !project.isAccessible()) {
249
			return;
250
		}
251
		//clean up existing markers
252
		cleanMarkers(project);
253
		
254
		String severity = RelEngPlugin.getPlugin().getPreferenceStore().getString(IPomVersionConstants.POM_VERSION_ERROR_LEVEL);
255
		if (IPomVersionConstants.VALUE_IGNORE.equals(severity)) {
256
			return;
257
		}
258
		IFile manifest = project.getFile(MANIFEST_PATH);
259
		if(!manifest.exists()) {
260
			return;
261
		}
262
		IFile pom = project.getFile(POM_PATH);
263
		if(!pom.exists()) {
264
			return;
265
		}
266
		
267
		// Get the manifest version
268
		Version bundleVersion = Version.emptyVersion;
269
		try {
270
			Manifest mani = new Manifest(manifest.getContents());
271
			java.util.jar.Attributes attributes = mani.getMainAttributes();
272
			String ver = attributes.getValue("Bundle-Version"); //$NON-NLS-1$
273
			if(ver == null) {
274
				return;
275
			}
276
			bundleVersion = new Version(ver);
277
		} catch (IOException e) {
278
			RelEngPlugin.log(e);
279
			return;
280
		} catch (CoreException e) {
281
			RelEngPlugin.log(e);
282
			return;
283
		}
284
		// Compare it to the POM file version
285
		try {
286
			SAXParserFactory parserFactory = SAXParserFactory.newInstance();
287
			SAXParser parser = parserFactory.newSAXParser();
288
			PomVersionHandler handler = new PomVersionHandler(pom, bundleVersion, severity);
289
			parser.parse(pom.getContents(), handler);
290
		} catch (Exception e1) {
291
			// Ignored, if there is a problem with the POM file don't create a marker
292
		}
293
	}
294
295
	/**
296
	 * Creates a new POM version problem marker with the given attributes
297
	 * @param message the message for the marker
298
	 * @param lineNumber the line number of the problem
299
	 * @param charStart the starting character offset
300
	 * @param charEnd the ending character offset
301
	 * @param correctedVersion the correct version to be inserted
302
	 * @param pom the handle to the POM file
303
	 * @param severity the severity of the marker to create
304
	 */
305
	void reportMarker(String message, int lineNumber, int charStart, int charEnd, String correctedVersion, IFile pom, String severity) {
306
		try {
307
			HashMap attributes = new HashMap();
308
			attributes.put(IMarker.MESSAGE, message);
309
			if (severity.equals(IPomVersionConstants.VALUE_WARNING)){
310
				attributes.put(IMarker.SEVERITY, Integer.valueOf(IMarker.SEVERITY_WARNING));
311
			} else {
312
				attributes.put(IMarker.SEVERITY, Integer.valueOf(IMarker.SEVERITY_ERROR));
313
			}
314
			if (lineNumber == -1) {
315
				lineNumber = 1;
316
			}
317
			attributes.put(IMarker.LINE_NUMBER, Integer.valueOf(lineNumber));
318
			attributes.put(IMarker.CHAR_START, Integer.valueOf(charStart));
319
			attributes.put(IMarker.CHAR_END, Integer.valueOf(charEnd));
320
			attributes.put(IPomVersionConstants.POM_CORRECT_VERSION, correctedVersion);
321
			MarkerUtilities.createMarker(pom, attributes, IPomVersionConstants.PROBLEM_MARKER_TYPE);
322
		} catch (CoreException e){
323
			RelEngPlugin.log(e);
324
		}
325
	}
326
327
	/**
328
	 * Creates a new {@link IDocument} for the given {@link IFile}. <code>null</code>
329
	 * is returned if the {@link IFile} does not exist or the {@link ITextFileBufferManager}
330
	 * cannot be acquired or there was an exception trying to create the {@link IDocument}.
331
	 * 
332
	 * @param file
333
	 * @return a new {@link IDocument} or <code>null</code>
334
	 */
187
	protected IDocument createDocument(IFile file) {
335
	protected IDocument createDocument(IFile file) {
188
		if (!file.exists()) {
336
		if (!file.exists()) {
189
			return null;
337
			return null;
Lines 203-206 Link Here
203
		}
351
		}
204
		return null;
352
		return null;
205
	}
353
	}
354
355
	/* (non-Javadoc)
356
	 * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
357
	 */
358
	public void resourceChanged(IResourceChangeEvent event) {
359
		IResourceDelta delta = event.getDelta();
360
		if(delta != null) {
361
			final PomResourceDeltaVisitor visitor = new PomResourceDeltaVisitor();
362
			try {
363
				delta.accept(visitor);
364
			} catch (CoreException e) {
365
				RelEngPlugin.log(e);
366
			}
367
		}
368
	}
369
370
	/* (non-Javadoc)
371
	 * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
372
	 */
373
	public void preferenceChange(PreferenceChangeEvent event) {
374
		if(IPomVersionConstants.POM_VERSION_ERROR_LEVEL.equals(event.getKey())) {
375
			final String severity = (String) event.getNewValue();
376
			if(severity != null) {
377
				if(IPomVersionConstants.VALUE_IGNORE.equals(severity)) {
378
					//we turned it off
379
					ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
380
				}
381
				else if(IPomVersionConstants.VALUE_IGNORE.equals(event.getOldValue())) {
382
					// we turned it on
383
					ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_BUILD);
384
				}
385
				IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
386
				IProject[] projects = root.getProjects();
387
				for (int i = 0; i < projects.length; i++) {
388
					validate(projects[i]);
389
				}
390
			}
391
		}
392
	}
206
}
393
}
(-)a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/pomversion/messages.properties (+1 lines)
Added Link Here
1
PomVersionErrorReporter_pom_version_error_marker_message=POM artifact version {0} does not match bundle version {1}
(-)a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/preferences/Messages.java (+29 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2013 IBM Corporation 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
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.releng.tools.preferences;
12
13
import org.eclipse.osgi.util.NLS;
14
15
/**
16
 * 
17
 */
18
public class Messages extends NLS {
19
	private static final String BUNDLE_NAME = "org.eclipse.releng.tools.preferences.messages"; //$NON-NLS-1$
20
	public static String PomErrorLevelBlock_mismatched_pom_versions_pref;
21
	public static String PomVersionPreferencePage_pom_pref_message;
22
	static {
23
		// initialize resource bundle
24
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
25
	}
26
27
	private Messages() {
28
	}
29
}
(-)a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/preferences/PomErrorLevelBlock.java (-4 / +4 lines)
Lines 185-193 Link Here
185
	 * Constant representing the severity values presented in the combo boxes for each option
185
	 * Constant representing the severity values presented in the combo boxes for each option
186
	 */
186
	 */
187
	private static final String[] SEVERITIES_LABELS = {
187
	private static final String[] SEVERITIES_LABELS = {
188
		"Error",
188
		"Error", //$NON-NLS-1$
189
		"Warning",
189
		"Warning", //$NON-NLS-1$
190
		"Ignore"
190
		"Ignore" //$NON-NLS-1$
191
	};
191
	};
192
	
192
	
193
	/**
193
	/**
Lines 275-281 Link Here
275
		fMainComp.setLayout(gl);
275
		fMainComp.setLayout(gl);
276
		fMainComp.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
276
		fMainComp.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
277
		fMainComp.setFont(parent.getFont());
277
		fMainComp.setFont(parent.getFont());
278
		this.fCombo = createComboControl(fMainComp, "Mismatched plug-in and pom.xml version numbers", KEY_POM_VERSION_ERROR_LEVEL);
278
		this.fCombo = createComboControl(fMainComp, Messages.PomErrorLevelBlock_mismatched_pom_versions_pref, KEY_POM_VERSION_ERROR_LEVEL);
279
		Dialog.applyDialogFont(fMainComp);
279
		Dialog.applyDialogFont(fMainComp);
280
		return fMainComp;
280
		return fMainComp;
281
	}
281
	}
(-)a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/preferences/PomVersionPreferencePage.java (-1 / +1 lines)
Lines 51-57 Link Here
51
		GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
51
		GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
52
		gd.widthHint = 400;
52
		gd.widthHint = 400;
53
		label.setLayoutData(gd);
53
		label.setLayoutData(gd);
54
		label.setText("The POM Version tool will compare the artifact version in a pom.xml file at the root of the project to the plug-in version in the manifest. If the two versions do not match a problem marker will be created. The severity of this problem can be configured on this page.");
54
		label.setText(Messages.PomVersionPreferencePage_pom_pref_message);
55
		label.setFont(comp.getFont());
55
		label.setFont(comp.getFont());
56
		
56
		
57
		block = new PomErrorLevelBlock((IWorkbenchPreferenceContainer)getContainer());
57
		block = new PomErrorLevelBlock((IWorkbenchPreferenceContainer)getContainer());
(-)a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/preferences/messages.properties (+2 lines)
Added Link Here
1
PomErrorLevelBlock_mismatched_pom_versions_pref=&Mismatched plug-in and pom.xml version numbers
2
PomVersionPreferencePage_pom_pref_message=The POM Version tool will compare the artifact version in a pom.xml file at the root of the project to the plug-in version in the manifest. If the two versions do not match a problem marker will be created. The severity of this problem can be configured on this page.

Return to bug 408152