diff options
author | Curtis Windatt | 2013-05-15 16:59:33 +0000 |
---|---|---|
committer | Curtis Windatt | 2013-05-15 16:59:33 +0000 |
commit | a73c89af81867d0aecedc4ef22e9a9c33aa92d1b (patch) | |
tree | f3c4f027e2128caf36d7422c51af1afb7f53bf62 | |
parent | c5c8edf8a63493ed3cbb27c51267e5ea05f19bac (diff) | |
download | eclipse.pde.ui-a73c89af81867d0aecedc4ef22e9a9c33aa92d1b.tar.gz eclipse.pde.ui-a73c89af81867d0aecedc4ef22e9a9c33aa92d1b.tar.xz eclipse.pde.ui-a73c89af81867d0aecedc4ef22e9a9c33aa92d1b.zip |
Bug 403149 - Move POM version tool from PDE to Releng Tools
Change-Id: Ieb8e29a583b3275d8d72fd2b16a4b43f8251a5e4
15 files changed, 13 insertions, 394 deletions
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java index 4b5729664d..0acb5f0a1d 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java @@ -104,9 +104,6 @@ public interface ICoreConstants { /** Constant for the string <code>build.properties</code> */ public final static String BUILD_FILENAME_DESCRIPTOR = "build.properties"; //$NON-NLS-1$ - /** Constant for the string <code>build.properties</code> */ - public final static String POM_FILENAME_DESCRIPTOR = "pom.xml"; //$NON-NLS-1$ - /** * Target version of <code>3.0</code> * <p> @@ -354,7 +351,6 @@ public interface ICoreConstants { public static IPath FEATURE_PATH = new Path(FEATURE_FILENAME_DESCRIPTOR); public static IPath BUILD_PROPERTIES_PATH = new Path(BUILD_FILENAME_DESCRIPTOR); public static IPath OSGI_INF_PATH = new Path(OSGI_INF_FOLDER_NAME); - public static IPath POM_PATH = new Path(POM_FILENAME_DESCRIPTOR); // Extension point identifiers public static final String EXTENSION_POINT_SOURCE = PDECore.PLUGIN_ID + ".source"; //$NON-NLS-1$ diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java index 8800454cdb..c87a303bf5 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java @@ -237,8 +237,6 @@ public class PDECoreMessages extends NLS { public static String ManifestConsistencyChecker_buildPropertiesSubtask; - public static String ManifestConsistencyChecker_verifyingPomVersions; - public static String BuildErrorReporter_missingEntry; public static String BuildErrorReporter_missingFolder; public static String BuildErrorReporter_emptyEntry; @@ -306,8 +304,6 @@ public class PDECoreMessages extends NLS { public static String PluginParser_EclipseConverterMissingAttribute; - public static String PomErrorReporter_pomVersionMismatch; - public static String XMLTextChangeListener_editNames_addAttribute; public static String XMLTextChangeListener_editNames_addContent; public static String XMLTextChangeListener_editNames_insertNode; diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PreferenceInitializer.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PreferenceInitializer.java index 735bef00d8..02d64489e1 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PreferenceInitializer.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PreferenceInitializer.java @@ -80,8 +80,6 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer { prefs.putInt(CompilerFlags.P_MISSING_VERSION_IMP_PKG, CompilerFlags.IGNORE); prefs.putInt(CompilerFlags.P_MISSING_VERSION_REQ_BUNDLE, CompilerFlags.IGNORE); - prefs.putInt(CompilerFlags.P_MATCHING_POM_VERSION, CompilerFlags.IGNORE); - prefs.putBoolean(CompilerFlags.S_CREATE_DOCS, false); prefs.put(CompilerFlags.S_DOC_FOLDER, "doc"); //$NON-NLS-1$ prefs.putInt(CompilerFlags.S_OPEN_TAGS, CompilerFlags.WARNING); diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/CompilerFlags.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/CompilerFlags.java index 4a2665cc27..521810c34e 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/CompilerFlags.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/CompilerFlags.java @@ -66,10 +66,10 @@ public class CompilerFlags { public static final String P_MISSING_EXPORT_PKGS = "compilers.p.missing-packages"; //$NON-NLS-1$ public static final String P_DEPRECATED = "compilers.p.deprecated"; //$NON-NLS-1$ public static final String P_INTERNAL = "compilers.p.internal"; //$NON-NLS-1$ + public static final String P_MISSING_VERSION_EXP_PKG = "compilers.p.missing-version-export-package"; //$NON-NLS-1$ public static final String P_MISSING_VERSION_IMP_PKG = "compilers.p.missing-version-import-package"; //$NON-NLS-1$ public static final String P_MISSING_VERSION_REQ_BUNDLE = "compilers.p.missing-version-require-bundle"; //$NON-NLS-1$ - public static final String P_MATCHING_POM_VERSION = "compilers.p.matching-pom-version"; //$NON-NLS-1$ /** * schema preferences diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ErrorReporter.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ErrorReporter.java index 498d219eb8..2805cb83b5 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ErrorReporter.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ErrorReporter.java @@ -53,19 +53,6 @@ public abstract class ErrorReporter { return null; } - protected IMarker addMarker(String message, int lineNumber, int charStart, int charEnd, int severity, int problemID, String category) { - IMarker marker = addMarker(message, lineNumber, severity, problemID, category); - if (marker != null) { - try { - marker.setAttribute(IMarker.CHAR_START, charStart); - marker.setAttribute(IMarker.CHAR_END, charEnd); - } catch (CoreException e) { - PDECore.logException(e); - } - } - return marker; - } - protected IDocument createDocument(IFile file) { if (!file.exists()) { return null; @@ -135,14 +122,6 @@ public abstract class ErrorReporter { return null; } - public IMarker report(String message, int line, int charStart, int charEnd, int severity, int problemID, String category) { - if (severity == CompilerFlags.ERROR) - return addMarker(message, line, charStart, charEnd, IMarker.SEVERITY_ERROR, problemID, category); - else if (severity == CompilerFlags.WARNING) - return addMarker(message, line, charStart, charEnd, IMarker.SEVERITY_WARNING, problemID, category); - return null; - } - protected void report(String message, int line, String compilerFlag, String category) { report(message, line, compilerFlag, PDEMarkerFactory.NO_RESOLUTION, category); } diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker.java index 4d7ab390f3..859900bd9d 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ManifestConsistencyChecker.java @@ -27,9 +27,6 @@ public class ManifestConsistencyChecker extends IncrementalProjectBuilder { private int EXTENSIONS = 0x2; private int BUILD = 0x4; private int STRUCTURE = 0x8; - private int POM = 0x10; - - private int ALL_TYPES = MANIFEST | EXTENSIONS | BUILD | STRUCTURE | POM; private static boolean DEBUG = false; private static IProject[] EMPTY_LIST = new IProject[0]; @@ -82,10 +79,10 @@ public class ManifestConsistencyChecker extends IncrementalProjectBuilder { int type = 0; public boolean visit(IResourceDelta delta) throws CoreException { - if (delta != null && type != ALL_TYPES) { + if (delta != null && type != (MANIFEST | EXTENSIONS | BUILD | STRUCTURE)) { int kind = delta.getKind(); if (kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED) { - type = ALL_TYPES; + type = MANIFEST | EXTENSIONS | BUILD | STRUCTURE; if (DEBUG) { System.out.print("Needs to rebuild project [" + getProject().getName() + "]: "); //$NON-NLS-1$ //$NON-NLS-2$ System.out.print(delta.getResource().getProjectRelativePath().toString()); @@ -110,7 +107,7 @@ public class ManifestConsistencyChecker extends IncrementalProjectBuilder { System.out.println(" - changed"); //$NON-NLS-1$ } } else if (file.equals(PDEProject.getManifest(project))) { - type |= MANIFEST | EXTENSIONS | BUILD | POM; + type |= MANIFEST | EXTENSIONS | BUILD; if (DEBUG) { System.out.print("Needs to rebuild project [" + getProject().getName() + "]: "); //$NON-NLS-1$ //$NON-NLS-2$ System.out.print(delta.getResource().getProjectRelativePath().toString()); @@ -130,17 +127,10 @@ public class ManifestConsistencyChecker extends IncrementalProjectBuilder { System.out.print(delta.getResource().getProjectRelativePath().toString()); System.out.println(" - changed"); //$NON-NLS-1$ } - } else if (file.equals(PDEProject.getPom(project))) { - type |= POM; - if (DEBUG) { - System.out.print("Needs to check pom.xml in project [" + getProject().getName() + "]: "); //$NON-NLS-1$ //$NON-NLS-2$ - System.out.print(delta.getResource().getProjectRelativePath().toString()); - System.out.println(" - changed"); //$NON-NLS-1$ - } } } } - return type != ALL_TYPES; + return type != (MANIFEST | EXTENSIONS | BUILD | STRUCTURE); } public int getType() { @@ -178,7 +168,7 @@ public class ManifestConsistencyChecker extends IncrementalProjectBuilder { if (DEBUG) { System.out.println("Project [" + getProject().getName() + "] - full build"); //$NON-NLS-1$ //$NON-NLS-2$ } - return ALL_TYPES; + return MANIFEST | EXTENSIONS | BUILD | STRUCTURE; } // the project has been "touched" by PluginRebuilder to indicate @@ -240,9 +230,6 @@ public class ManifestConsistencyChecker extends IncrementalProjectBuilder { if ((type & BUILD) != 0) { validateBuildProperties(new SubProgressMonitor(monitor, 1)); } - if ((type & POM) != 0) { - validatePom(new SubProgressMonitor(monitor, 1)); - } } private int getWorkAmount(int type) { @@ -251,8 +238,6 @@ public class ManifestConsistencyChecker extends IncrementalProjectBuilder { ++work; if ((type & BUILD) != 0) ++work; - if ((type & POM) != 0) - ++work; return work; } @@ -330,18 +315,6 @@ public class ManifestConsistencyChecker extends IncrementalProjectBuilder { } } - private void validatePom(IProgressMonitor monitor) { - if (monitor.isCanceled()) - return; - IProject project = getProject(); - IFile file = PDEProject.getPom(project); - if (file.exists()) { - monitor.subTask(PDECoreMessages.ManifestConsistencyChecker_verifyingPomVersions); - PomErrorReporter ber = new PomErrorReporter(file); - ber.validateContent(monitor); - } - } - // Will place a marker on the project if the build.properties does not exist private void validateBuildPropertiesExists(IProject project) { IFile file = PDEProject.getBuildProperties(project); @@ -425,8 +398,6 @@ public class ManifestConsistencyChecker extends IncrementalProjectBuilder { cleanProblems(PDEProject.getFragmentXml(getProject()), IResource.DEPTH_ZERO); // clean build properties cleanProblems(PDEProject.getBuildProperties(getProject()), IResource.DEPTH_ZERO); - // clean the new POM file errors - cleanProblems(PDEProject.getPom(getProject()), IResource.DEPTH_INFINITE); localmonitor.worked(1); } finally { localmonitor.done(); diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/PDEMarkerFactory.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/PDEMarkerFactory.java index d9cf9cc782..47bfa15670 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/PDEMarkerFactory.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/PDEMarkerFactory.java @@ -80,20 +80,13 @@ public class PDEMarkerFactory { public static final int P_UNKNOWN_CLASS = 0x3003; public static final int P_USELESS_FILE = 0x3004; - // pom.xml fixes - public static final int POM_MISMATCH_VERSION = 0x4001; - - // custom marker attributes + // marker attribute keys public static final String BK_BUILD_ENTRY = "buildEntry.key"; //$NON-NLS-1$ public static final String BK_BUILD_TOKEN = "buildEntry.tokenValue"; //$NON-NLS-1$ public static final String MPK_LOCATION_PATH = "xmlTree.locationPath"; //$NON-NLS-1$ public static final String ATTR_CAN_ADD = "deprecatedAutostart.canAdd"; //$NON-NLS-1$ public static final String ATTR_HEADER = "deprecatedAutostart.header"; //$NON-NLS-1$ /** - * String attribute for the correct version that should be in the POM file - */ - public static final String POM_CORRECT_VERSION = "pom.CorrectVersion"; //$NON-NLS-1$ - /** * Boolean attribute for marker added when no newline is found at the end of a manifest. Value is * <code>true</code> if there is character content on the last line that should be * saved or <code>false</code> if the line only contains whitespace characters. diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/PomErrorReporter.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/PomErrorReporter.java deleted file mode 100644 index 2cfb598ede..0000000000 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/PomErrorReporter.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.pde.internal.core.builders; - -import java.util.Stack; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.osgi.service.resolver.BundleDescription; -import org.eclipse.osgi.util.NLS; -import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.pde.internal.core.*; -import org.osgi.framework.Version; -import org.xml.sax.*; -import org.xml.sax.helpers.DefaultHandler; - -/** - * Validates the content of the pom.xml. Currently the only check is that the - * version specified in pom.xml matches the bundle version. - * - */ -public class PomErrorReporter extends ErrorReporter { - - private static final String ELEMENT_PROJECT = "project"; //$NON-NLS-1$ - private static final String ELEMENT_VERSION = "version"; //$NON-NLS-1$ - private static final String SNAPSHOT_SUFFIX = "-SNAPSHOT"; //$NON-NLS-1$ - - private SAXParserFactory parserFactory = SAXParserFactory.newInstance(); - private int pomVersionSeverity; - - public PomErrorReporter(IFile file) { - super(file); - pomVersionSeverity = CompilerFlags.getFlag(fProject, CompilerFlags.P_MATCHING_POM_VERSION); - } - - @Override - protected void validate(IProgressMonitor monitor) { - SubMonitor subMon = SubMonitor.convert(monitor, 10); - try { - if (subMon.isCanceled()) { - return; - } - if (pomVersionSeverity == CompilerFlags.IGNORE) { - return; - } - - PluginModelManager manager = PDECore.getDefault().getModelManager(); - IPluginModelBase bundle = manager.findModel(fProject); - BundleDescription description = bundle.getBundleDescription(); - if (description != null) { - Version bundleVersion = description.getVersion(); - try { - SAXParser parser = parserFactory.newSAXParser(); - PomVersionHandler handler = new PomVersionHandler(fFile, bundleVersion); - parser.parse(fFile.getContents(), handler); - } catch (Exception e1) { - // Ignored, if there is a problem with the pom file don't create a marker - } - - } - } finally { - subMon.done(); - if (monitor != null) { - monitor.done(); - } - } - - } - - private void reportMarker(String message, int lineNumber, int charStart, int charEnd, String correctedVersion) { - IMarker marker = report(message, lineNumber, charStart, charEnd, pomVersionSeverity, PDEMarkerFactory.POM_MISMATCH_VERSION, PDEMarkerFactory.CAT_OTHER); - if (marker != null) { - try { - marker.setAttribute(PDEMarkerFactory.POM_CORRECT_VERSION, correctedVersion); - } catch (CoreException e) { - // Ignored - } - } - } - - class PomVersionHandler extends DefaultHandler { - private Version bundleVersion; - private Stack<String> elements = new Stack<String>(); - private boolean checkVersion = false; - private Locator locator; - - public PomVersionHandler(IFile file, Version bundleVersion) { - this.bundleVersion = bundleVersion; - } - - @Override - public void setDocumentLocator(Locator locator) { - this.locator = locator; - } - - @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { - if (ELEMENT_VERSION.equals(qName)) { - if (!elements.isEmpty() && ELEMENT_PROJECT.equals(elements.peek())) { - checkVersion = true; - } - } - elements.push(qName); - } - - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - elements.pop(); - } - - @Override - public void characters(char[] ch, int start, int length) throws SAXException { - if (checkVersion) { - checkVersion = false; - // Compare the versions - String versionString = new String(ch, start, length); - try { - // Remove snapshot suffix - int index = versionString.indexOf(SNAPSHOT_SUFFIX); - if (index >= 0) { - versionString = versionString.substring(0, index); - } - Version pomVersion = Version.parseVersion(versionString); - // Remove qualifiers and snapshot - Version bundleVersion2 = new Version(bundleVersion.getMajor(), bundleVersion.getMinor(), bundleVersion.getMicro()); - Version pomVersion2 = new Version(pomVersion.getMajor(), pomVersion.getMinor(), pomVersion.getMicro()); - - if (!bundleVersion2.equals(pomVersion2)) { - String correctedVersion = bundleVersion2.toString(); - if (index >= 0) { - correctedVersion = correctedVersion.concat(SNAPSHOT_SUFFIX); - } - - try { - // Need to create a document to calculate the markers charstart and charend - IDocument doc = createDocument(fFile); - int offset = doc.getLineOffset(locator.getLineNumber() - 1); // locator lines start at 1 - int charEnd = offset + locator.getColumnNumber() - 1; // returns column at end of character string, columns start at 1 - int charStart = charEnd - length; - reportMarker(NLS.bind(PDECoreMessages.PomErrorReporter_pomVersionMismatch, pomVersion2.toString(), bundleVersion2.toString()), locator.getLineNumber(), charStart, charEnd, correctedVersion); - } catch (BadLocationException e) { - PDECore.log(e); - } - } - } catch (IllegalArgumentException e) { - // Do nothing, user has a bad version - } - } - } - } -} diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties index d4677e1552..16099505c8 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties @@ -201,7 +201,6 @@ ManifestConsistencyChecker_buildDoesNotExist=build.properties does not exist ManifestConsistencyChecker_builderTaskName=Validating project ManifestConsistencyChecker_manifestDoesNotExist=META-INF/MANIFEST.MF does not exist ManifestConsistencyChecker_manifestMisspelled=Manifest file name misspelled. It must be spelled 'MANIFEST.MF' -ManifestConsistencyChecker_verifyingPomVersions=Verifying pom.xml versions SchemaElementReference_refElementMissing=No DTD available ExportWizard_badDirectory = Specified directory could not be created. @@ -233,7 +232,6 @@ PluginConverter_EclipseConverterErrorParsingPluginManifest=Error parsing plug-in PluginModelManager_0=Target Platform PluginModelManager_1=Updating plug-in dependencies PluginParser_EclipseConverterMissingAttribute=Error parsing {0} manifest. Missing attribute "{1}" in element "{2}". -PomErrorReporter_pomVersionMismatch=POM artifact version {0} does not match bundle version {1} # {0} will be a product id, this string will be the name of a p2 repository ProductExportOperation_0={0} Repository diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/project/PDEProject.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/project/PDEProject.java index 7325fd83b1..94ac435d78 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/project/PDEProject.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/project/PDEProject.java @@ -157,17 +157,6 @@ public class PDEProject { /** * Returns the resource in the specified project corresponding to its - * <code>pom.xml</code>file. - * - * @param project project - * @return <code>pom.xml</code> file that may or may not exist - */ - public static IFile getPom(IProject project) { - return getBundleRelativeFile(project, ICoreConstants.POM_PATH); - } - - /** - * Returns the resource in the specified project corresponding to its * <code>plugin.xml</code>file. * * @param project project diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java index 301280ee54..32e395ed17 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java @@ -123,8 +123,6 @@ public class PDEUIMessages extends NLS { public static String PDECompilersConfigurationBlock_usage; public static String PDECompilersConfigurationBlock_build; - public static String PDECompilersConfigurationBlock_compilers_p_mismatched_pom_version; - public static String PDEWizardNewFileCreationPage_errorMsgStartsWithDot; public static String CommandComposerPart_formTitle; @@ -2675,8 +2673,6 @@ public class PDEUIMessages extends NLS { public static String PointSelectionPage_newDepMessage; - public static String PomVersionMarkerResolution_pomVersionResolutionLabel; - public static String OrganizeManifestsWizard_title; public static String OrganizeManifestsOperation_export; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/PomVersionMarkerResolution.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/PomVersionMarkerResolution.java deleted file mode 100644 index 338e5fe874..0000000000 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/PomVersionMarkerResolution.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.pde.internal.ui.correction; - -import org.eclipse.pde.internal.ui.PDEUIMessages; - -import java.io.*; -import javax.xml.parsers.*; -import javax.xml.transform.*; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.osgi.util.NLS; -import org.eclipse.pde.internal.core.PDECore; -import org.eclipse.ui.IMarkerResolution; -import org.w3c.dom.*; -import org.xml.sax.SAXException; - -/** - * Marker resolution for when version in pom.xml does not match the plug-in version. - * Replaces the version string to one based on the version in the manifest. The corrected - * version must have been stored on the marker at creation time. - * - * @since 4.3 - * - */ -public class PomVersionMarkerResolution implements IMarkerResolution { - - private static final String ELEMENT_VERSION = "version"; //$NON-NLS-1$ - private String correctedVersion; - - /** - * New marker resolution that will offer to replace the current POM version with corrected version - * @param correctedVersion new version to insert - */ - public PomVersionMarkerResolution(String correctedVersion) { - this.correctedVersion = correctedVersion; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IMarkerResolution#getLabel() - */ - public String getLabel() { - return NLS.bind(PDEUIMessages.PomVersionMarkerResolution_pomVersionResolutionLabel, correctedVersion); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IMarkerResolution#run(org.eclipse.core.resources.IMarker) - */ - public void run(IMarker marker) { - if (correctedVersion == null || correctedVersion.trim().length() == 0) { - return; - } - IResource resource = marker.getResource(); - if (resource.exists() && resource.getType() == IResource.FILE) { - IFile file = (IFile) resource; - if (!file.isReadOnly()) { - InputStream fileInput = null; - try { - - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); - fileInput = file.getContents(); - Document doc = docBuilder.parse(fileInput); - - Node root = doc.getDocumentElement(); - NodeList list = root.getChildNodes(); - - for (int i = 0; i < list.getLength(); i++) { - Node node = list.item(i); - if (ELEMENT_VERSION.equals(node.getNodeName())) { - node.setTextContent(correctedVersion); - } - } - - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - Transformer transformer = transformerFactory.newTransformer(); - DOMSource source = new DOMSource(doc); - StreamResult result = new StreamResult(outputStream); - transformer.transform(source, result); - - IStatus status = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] {file}, null); - if (!status.isOK()) { - throw new CoreException(status); - } - - ByteArrayInputStream stream = new ByteArrayInputStream(outputStream.toByteArray()); - file.setContents(stream, true, false, null); - - } catch (ParserConfigurationException e) { - PDECore.log(e); - } catch (SAXException e) { - PDECore.log(e); - } catch (IOException e) { - PDECore.log(e); - } catch (TransformerException e) { - PDECore.log(e); - } catch (CoreException e) { - PDECore.log(e); - } finally { - if (fileInput != null) { - try { - fileInput.close(); - } catch (IOException e) { - } - } - } - - } - - } - } -} diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/ResolutionGenerator.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/ResolutionGenerator.java index 0e598837c1..978a8c6d0a 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/ResolutionGenerator.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/ResolutionGenerator.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.pde.internal.ui.correction; +import org.eclipse.ui.IMarkerResolution2; + import java.util.ArrayList; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; @@ -21,7 +23,8 @@ import org.eclipse.pde.internal.core.ICoreConstants; import org.eclipse.pde.internal.core.TargetPlatformHelper; import org.eclipse.pde.internal.core.builders.PDEMarkerFactory; import org.eclipse.pde.internal.ui.PDEUIMessages; -import org.eclipse.ui.*; +import org.eclipse.ui.IMarkerResolution; +import org.eclipse.ui.IMarkerResolutionGenerator2; import org.osgi.framework.Constants; public class ResolutionGenerator implements IMarkerResolutionGenerator2 { @@ -111,13 +114,6 @@ public class ResolutionGenerator implements IMarkerResolutionGenerator2 { return new IMarkerResolution[] {new NoLineTerminationResolution(AbstractPDEMarkerResolution.REMOVE_TYPE)}; case PDEMarkerFactory.M_R4_SYNTAX_IN_R3_BUNDLE : return new IMarkerResolution[] {new AddBundleManifestVersionResolution()}; - case PDEMarkerFactory.POM_MISMATCH_VERSION : - try { - String correctedVersion = (String) marker.getAttribute(PDEMarkerFactory.POM_CORRECT_VERSION); - return new IMarkerResolution[] {new PomVersionMarkerResolution(correctedVersion)}; - } catch (CoreException e) { - return NO_RESOLUTIONS; - } } return NO_RESOLUTIONS; } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties index 5892213f17..fecf4aa2d0 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties @@ -72,7 +72,6 @@ PDECompilersConfigurationBlock_settings_changed=Settings Changed PDECompilersConfigurationBlock_settings_changed_all=Compiler settings have changed. A full build is required for the changes to take effect.\n\nDo a full build now? PDECompilersConfigurationBlock_usage=Usage PDECompilersConfigurationBlock_build=Build -PDECompilersConfigurationBlock_compilers_p_mismatched_pom_version=Mismatched plug-in and pom.xml artifact version PDEMultiPageContentOutline_SortingAction_label = Sort PDEMultiPageContentOutline_SortingAction_tooltip = Sort PDEMultiPageContentOutline_SortingAction_description = Sorts elements in the outline @@ -1028,7 +1027,6 @@ PointSelectionPage_newDepFound=New dependencies added to plugin... PointSelectionPage_noDescAvailable=(no description available) PointSelectionPage_cannotFindTemplate=Cannot find extension for the specified template id PointSelectionPage_newDepMessage=Save changes made to plugin? (Pressing 'No' may result in your code having compilation errors). -PomVersionMarkerResolution_pomVersionResolutionLabel=Replace version in pom.xml with {0} ProductDefinitonWizardPage_productExists=Specified product already exists ProductDefinitonWizardPage_application=&Application: diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/PDECompilersConfigurationBlock.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/PDECompilersConfigurationBlock.java index 8df24a40a7..d57fa2dfdc 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/PDECompilersConfigurationBlock.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/PDECompilersConfigurationBlock.java @@ -11,8 +11,6 @@ *******************************************************************************/ package org.eclipse.pde.internal.ui.preferences; -import org.eclipse.pde.internal.ui.PDEUIMessages; - import com.ibm.icu.text.MessageFormat; import java.util.*; import java.util.List; @@ -222,7 +220,6 @@ public class PDECompilersConfigurationBlock extends ConfigurationBlock { private static final Key KEY_P_VERSION_EXP_PKG = getPDEPrefKey(CompilerFlags.P_MISSING_VERSION_EXP_PKG); private static final Key KEY_P_VERSION_IMP_PKG = getPDEPrefKey(CompilerFlags.P_MISSING_VERSION_IMP_PKG); private static final Key KEY_P_VERSION_REQ_BUNDLE = getPDEPrefKey(CompilerFlags.P_MISSING_VERSION_REQ_BUNDLE); - private static final Key KEY_P_MATCHING_POM_VERSION = getPDEPrefKey(CompilerFlags.P_MATCHING_POM_VERSION); private static final Key KEY_S_CREATE_DOCS = getPDEPrefKey(CompilerFlags.S_CREATE_DOCS); private static final Key KEY_S_DOC_FOLDER = getPDEPrefKey(CompilerFlags.S_DOC_FOLDER); @@ -230,8 +227,7 @@ public class PDECompilersConfigurationBlock extends ConfigurationBlock { private static String[] SEVERITIES = {PDEUIMessages.PDECompilersConfigurationBlock_error, PDEUIMessages.PDECompilersConfigurationBlock_warning, PDEUIMessages.PDECompilersConfigurationBlock_ignore}; - private static Key[] fgAllKeys = {KEY_F_UNRESOLVED_FEATURES, KEY_F_UNRESOLVED_PLUGINS, KEY_P_BUILD, KEY_P_BUILD_MISSING_OUTPUT, KEY_P_BUILD_SOURCE_LIBRARY, KEY_P_BUILD_OUTPUT_LIBRARY, KEY_P_BUILD_SRC_INCLUDES, KEY_P_BUILD_BIN_INCLUDES, KEY_P_BUILD_JAVA_COMPLIANCE, KEY_P_BUILD_JAVA_COMPILER, KEY_P_BUILD_ENCODINGS, KEY_P_INTERNAL, KEY_P_DEPRECATED, KEY_P_DISCOURAGED_CLASS, KEY_P_INCOMPATIBLE_ENV, KEY_P_MISSING_EXPORT_PKGS, KEY_P_NO_REQUIRED_ATT, KEY_P_NOT_EXTERNALIZED, KEY_P_UNKNOWN_ATTRIBUTE, KEY_P_UNKNOWN_CLASS, KEY_P_UNKNOWN_ELEMENT, KEY_P_UNKNOWN_IDENTIFIER, KEY_P_UNKNOWN_RESOURCE, KEY_P_UNRESOLVED_EX_POINTS, KEY_P_UNRESOLVED_IMPORTS, KEY_P_VERSION_EXP_PKG, KEY_P_VERSION_IMP_PKG, KEY_P_VERSION_REQ_BUNDLE, KEY_P_MATCHING_POM_VERSION, KEY_S_CREATE_DOCS, KEY_S_DOC_FOLDER, - KEY_S_OPEN_TAGS}; + private static Key[] fgAllKeys = {KEY_F_UNRESOLVED_FEATURES, KEY_F_UNRESOLVED_PLUGINS, KEY_P_BUILD, KEY_P_BUILD_MISSING_OUTPUT, KEY_P_BUILD_SOURCE_LIBRARY, KEY_P_BUILD_OUTPUT_LIBRARY, KEY_P_BUILD_SRC_INCLUDES, KEY_P_BUILD_BIN_INCLUDES, KEY_P_BUILD_JAVA_COMPLIANCE, KEY_P_BUILD_JAVA_COMPILER, KEY_P_BUILD_ENCODINGS, KEY_P_INTERNAL, KEY_P_DEPRECATED, KEY_P_DISCOURAGED_CLASS, KEY_P_INCOMPATIBLE_ENV, KEY_P_MISSING_EXPORT_PKGS, KEY_P_NO_REQUIRED_ATT, KEY_P_NOT_EXTERNALIZED, KEY_P_UNKNOWN_ATTRIBUTE, KEY_P_UNKNOWN_CLASS, KEY_P_UNKNOWN_ELEMENT, KEY_P_UNKNOWN_IDENTIFIER, KEY_P_UNKNOWN_RESOURCE, KEY_P_UNRESOLVED_EX_POINTS, KEY_P_UNRESOLVED_IMPORTS, KEY_P_VERSION_EXP_PKG, KEY_P_VERSION_IMP_PKG, KEY_P_VERSION_REQ_BUNDLE, KEY_S_CREATE_DOCS, KEY_S_DOC_FOLDER, KEY_S_OPEN_TAGS}; /** * Constant representing the {@link IDialogSettings} section for this block @@ -527,7 +523,7 @@ public class PDECompilersConfigurationBlock extends ConfigurationBlock { initializeComboControls(client, new String[] {PDEUIMessages.PDECompilersConfigurationBlock_1, PDEUIMessages.PDECompilersConfigurationBlock_2, PDEUIMessages.PDECompilersConfigurationBlock_0, PDEUIMessages.PDECompilersConfigurationBlock_3, PDEUIMessages.PDECompilersConfigurationBlock_4, PDEUIMessages.PDECompilersConfigurationBlock_5, PDEUIMessages.PDECompilersConfigurationBlock_6, PDEUIMessages.PDECompilersConfigurationBlock_7, PDEUIMessages.CompilersConfigurationTab_buildPropertiesErrors}, new Key[] {KEY_P_BUILD_SOURCE_LIBRARY, KEY_P_BUILD_OUTPUT_LIBRARY, KEY_P_BUILD_MISSING_OUTPUT, KEY_P_BUILD_BIN_INCLUDES, KEY_P_BUILD_SRC_INCLUDES, KEY_P_BUILD_JAVA_COMPLIANCE, KEY_P_BUILD_JAVA_COMPILER, KEY_P_BUILD_ENCODINGS, KEY_P_BUILD}, CompilerFlags.PLUGIN_FLAGS); // Versioning client = createExpansibleComposite(sbody, PDEUIMessages.PDECompilersConfigurationBlock_versioning); - initializeComboControls(client, new String[] {PDEUIMessages.compilers_p_missing_require_bundle, PDEUIMessages.compilers_p_missing_exp_pkg, PDEUIMessages.compilers_p_missing_imp_pkg, PDEUIMessages.PDECompilersConfigurationBlock_compilers_p_mismatched_pom_version}, new Key[] {KEY_P_VERSION_REQ_BUNDLE, KEY_P_VERSION_EXP_PKG, KEY_P_VERSION_IMP_PKG, KEY_P_MATCHING_POM_VERSION}, CompilerFlags.PLUGIN_FLAGS); + initializeComboControls(client, new String[] {PDEUIMessages.compilers_p_missing_require_bundle, PDEUIMessages.compilers_p_missing_exp_pkg, PDEUIMessages.compilers_p_missing_imp_pkg}, new Key[] {KEY_P_VERSION_REQ_BUNDLE, KEY_P_VERSION_EXP_PKG, KEY_P_VERSION_IMP_PKG}, CompilerFlags.PLUGIN_FLAGS); // Usage client = createExpansibleComposite(sbody, PDEUIMessages.PDECompilersConfigurationBlock_usage); initializeComboControls(client, new String[] {PDEUIMessages.compilers_p_unresolved_import, PDEUIMessages.compilers_p_unresolved_ex_points, PDEUIMessages.compilers_p_internal, PDEUIMessages.compilers_p_deprecated, PDEUIMessages.compilers_p_not_externalized_att}, new Key[] {KEY_P_UNRESOLVED_IMPORTS, KEY_P_UNRESOLVED_EX_POINTS, KEY_P_INTERNAL, KEY_P_DEPRECATED, KEY_P_NOT_EXTERNALIZED}, CompilerFlags.PLUGIN_FLAGS); |